Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Easy MyCode
#1
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
Reply
#2
thanks Yumi Smile
Reply
#3
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
Reply
#4
Excellent idea! Thank you
[Image: logo.png]
Reply
#5
wow, Thats pretty easy now for making MyCodes to every one,
Good and Great Job Zinga Burga
Keep it up
Reply
#6
Thank you, for helping with security.
#
MyBB is the best forum software! Exclamation

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)