MyBB Community Forums

Full Version: Font Awesome MyCode
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
1. Include this in your headerinclude template:
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css"> 

And you have it installed. Smile


Then, you'll want to create this MyCode:

Regular Expression:
\[icon\]([a-z-]+?)\[/icon\]

Replacement:
<i class="fa fa-$1"></i>

And now your users will be able to use them easily, like this:

[icon]facebook[/icon]

They work just like text so they'll match with all your themes. Smile
What this will do? seems lagy
Let your users use icons from the Font Awesome set.
Not very laggy at all, and yes, as Seabody said your users can use icons from Font Awesome.
(2012-09-22, 02:31 PM)Xbat Wrote: [ -> ]What this will do? seems lagy

Laggy..?
Updated for newer versions of Font Awesome.
Can someone show me a screenshot of what the font looks like please?
It's an icon font, the MyCode lets people use them in their posts: https://fortawesome.github.io/Font-Awesome/icons/
This MyCode is vulnerable to injection of malicious code...

[icon]exclamation-triangle"><script>alert("Evil code goes here...");</script><i class="fa fa-exclamation-triangle[/icon]
Produces:
<i class="fa fa-exclamation-triangle"><script>alert("Evil code goes here...");</script><i class="fa fa-exclamation-triangle"></i>

I suggest you make the search:
\[icon=([a-z-]+?)\]
Meaning that the following:
[icon=smile-o]
Will be replaced with:
<i class="fa fa-smile-o"></i>
Most MyCodes shared are vulnerable because of the lazy use of "(.*?)".
Pages: 1 2 3