2009-06-08, 11:03 AM
I've seen quite a few custom MyCodes posted around recently which seem to excessively use the "(.*?)" pattern. This pattern allows virtually anything to be placed inside and can be rather dangerous if not used properly.
So here's a simple plugin which should make writing _safe_ custom MyCodes easier.
Basically, this removes the need to understand regular expressions when adding custom MyCodes in the AdminCP. You just enter in what you want and place the predefined wildcards where you want them (note, this only affects the "Regular Expression" field. Example expression:
Replacement format is unaffected - in other words, you just use $<num> where <num> refers to the wildcard number, eg, for the above:
Note that you can still enter regular expressions (read the description given when adding/editing MyCodes for this and all the available wildcards).
This plugin basically replaces (somewhat) the way MyBB handles custom MyCodes. When activating/deactivating, the plugin will convert existing MyCodes into the proper formats automatically. (note, converting from regexes the new format is difficult so the plugin will often just keep it in regex format (the code will still work); also this means that deactivating then reactivating the plugin can cause your codes to be converted to regexes)
Download
So here's a simple plugin which should make writing _safe_ custom MyCodes easier.
Basically, this removes the need to understand regular expressions when adding custom MyCodes in the AdminCP. You just enter in what you want and place the predefined wildcards where you want them (note, this only affects the "Regular Expression" field. Example expression:
[background={COLOR}]{ANYTHING}[/background]
Replacement format is unaffected - in other words, you just use $<num> where <num> refers to the wildcard number, eg, for the above:
<span style="background-color: $1">$2</span>
Note that you can still enter regular expressions (read the description given when adding/editing MyCodes for this and all the available wildcards).
This plugin basically replaces (somewhat) the way MyBB handles custom MyCodes. When activating/deactivating, the plugin will convert existing MyCodes into the proper formats automatically. (note, converting from regexes the new format is difficult so the plugin will often just keep it in regex format (the code will still work); also this means that deactivating then reactivating the plugin can cause your codes to be converted to regexes)
Download