MyBB Community Forums

Full Version: Easy MyCode
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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:
[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
thanks Yumi Smile
Neat. Thanks for the share Smile
Excellent idea! Thank you
wow, Thats pretty easy now for making MyCodes to every one,
Good and Great Job Zinga Burga
Keep it up
Thank you, for helping with security.