MyCodes: Style, Div, Span & ID links
#1
I have a lot of customer MyCode on my site, and I thought I'd consolidate it into a post and share with other RP sites! I find most of them very useful Smile
I find the top three - Style, Div and Span - very important for creating custom BBCode templates that prevent the need for using HTML, while maintaining an RP staple!


TITLE: Style
DESCRIPTION: MyCode style tags to contain CSS
REGULAR EXPRESSION:
\[style\](.*?)\[/style\]
REPLACEMENT:
<style type="text/css">$1</style>
CODE: [style]CSS goes here, including things such as @import url('https://fonts.googleapis.com/css?family=Vibur');[/style]
CREDIT: I didn't write this one, but I find it very necessary. I don't recall who wrote it, I found it on here on the MyBB community forms, I think.

TITLE: Div
DESCRIPTION: Div code for Mybb
REGULAR EXPRESSION:
\[div (.*?)="(.*?)"\](.*?)\[/div\]
REPLACEMENT:
<div $1="$2">$3</div>
CODE: [div]and[/div], [div style=]and[/div] [div class=]and[/div]
*ADVANCED TAB: - It's very important to click the ADVANCE tab and select YES for NESTABLE

TITLE: Span
DESCRIPTION: Span code for Mybb
REGULAR EXPRESSION:
\[span (.*?)="(.*?)"\](.*?)\[/span\]
REPLACEMENT:
<span $1="$2">$3</span>
CODE: [span]and[/span], [span style=]and[/span] [span class=]and[/span]
*ADVANCED TAB: - It's very important to click the ADVANCE tab and select YES for NESTABLE

TITLE: ID QUICK LINK
DESCRIPTION: Quickly link to a profile via ID
REGULAR EXPRESSION:
\[id=(.*?)\](.*?)\[/id\]
REPLACEMENT:
<a href="SITEURL/member.php?action=profile&uid=$1">$2</a>
CODE: [ID=#]Link Here[/ID]


** I use YourCode plugin, so I'm not sure if the default MyCode has the option for nesting codes.
[Image: BloodTies.png]

[Image: Pern.png]
Reply
#2
These codes are dangerous and expose your site to security risks!

Style: you allow users to supply any CSS! This allows them to @include pages on other sites allowing hackers to obtain information about the current session and your visitors' browsers. Also, an HTML style tag should be in the header, not body.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)