Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Easy MyCode
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:
<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)

thanks Yumi Smile
Neat. Thanks for the share Smile
[Image: sig.gif]

Contact me in private only if you need paid help with mybb-related issues. Otherwise, please don''t, unless I invite you to. Thanks Smile
Excellent idea! Thank you
[Image: logo.png]
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.
MyBB is the best forum software! Exclamation


Forum Jump:

Users browsing this thread: 1 Guest(s)