Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function bbcode_format($str){
- // Parse BB code
- $simple_search = array(
- '/\[b\](.*?)\[\/b\]/is',
- '/\[i\](.*?)\[\/i\]/is',
- '/\[u\](.*?)\[\/u\]/is',
- '/\[s\](.*?)\[\/s\]/is',
- '/\[quote\](.*?)\[\/quote\]/is',
- '/\[link\=(.*?)\](.*?)\[\/link\]/is',
- '/\[url\=(.*?)\](.*?)\[\/url\]/is',
- '/\[color\=(.*?)\](.*?)\[\/color\]/is',
- '/\[size=small\](.*?)\[\/size\]/is',
- '/\[size=large\](.*?)\[\/size\]/is',
- '/\[code\](.*?)\[\/code\]/is',
- '/\[habbo\=(.*?)\](.*?)\[\/habbo\]/is',
- '/\[room\=(.*?)\](.*?)\[\/room\]/is',
- '/\[group\=(.*?)\](.*?)\[\/group\]/is',
- '/\[img\](.*?)\[\/img\]/is',
- '/\[spoil\](.*?)\[\/spoil\]/is',
- '/\[yt\](.*?)\[\/yt\]/is'
- );
- $simple_replace = array(
- '<strong>$1</strong>',
- '<em>$1</em>',
- '<u>$1</u>',
- '<s>$1</s>',
- "<div class='bbcode-quote'>$1</div>",
- "<a href='$1' target='_blank'>$2</a>",
- "<a href='$1' target='_blank'>$2</a>",
- "<font color='$1'>$2</font>",
- "<font size='1'>$1</font>",
- "<font size='3'>$1</font>",
- '<pre>$1</pre>',
- "<a href='./user_profile.php?id=$1'>$2</a>",
- "<a onclick=\"roomForward(this, '$1', 'private'); return false;\" target=\"client\" href=\"./client.php?forwardId=2&roomId=$1\">$2</a>",
- "<a href='./group_profile.php?id=$1'>$2</a>",
- '<a href="$1" data-lightbox="$1"><img src="$1"/></a>',
- "<span style=\"background: none repeat scroll 0% 0% rgb(189, 202, 210); color: rgb(189, 202, 210);\" onmouseover=\"this.style.background='#5b7289'\" onmouseout=\"this.style.background='#bdcad2'\">$1</span>",
- '<center><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="520" height="315" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/$1&hl=fr_FR&fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="520" height="315" src="http://www.youtube.com/v/$1&hl=fr_FR&fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></center>');
- $str = preg_replace ($simple_search, $simple_replace, $str);
- return $str;
- }
- function bbcode_restore($str){
- // Parse BB code
- $simple_search = array(
- '/\[b\](.*?)\[\/b\]/is',
- '/\[i\](.*?)\[\/i\]/is',
- '/\[u\](.*?)\[\/u\]/is',
- '/\[s\](.*?)\[\/s\]/is',
- '/\[quote\](.*?)\[\/quote\]/is',
- '/\[link\=(.*?)\](.*?)\[\/link\]/is',
- '/\[url\=(.*?)\](.*?)\[\/url\]/is',
- '/\[color\=(.*?)\](.*?)\[\/color\]/is',
- '/\[size=small\](.*?)\[\/size\]/is',
- '/\[size=large\](.*?)\[\/size\]/is',
- '/\[code\](.*?)\[\/code\]/is',
- '/\[habbo\=(.*?)\](.*?)\[\/habbo\]/is',
- '/\[room\=(.*?)\](.*?)\[\/room\]/is',
- '/\[group\=(.*?)\](.*?)\[\/group\]/is',
- '/\[img\](.*?)\[\/img\]/is',
- '/\[yt\](.*?)\[\/yt\]/is'
- );
- $simple_replace = array(
- '<strong>$1</strong>',
- '<em>$1</em>',
- '<u>$1</u>',
- '<s>$1</s>',
- "<div class='bbcode-quote'>$1</div>",
- "<a href='$1'>$2</a>",
- "<a href='$1'>$2</a>",
- "<font color='$1'>$2</font>",
- "<font size='1'>$1</font>",
- "<font size='3'>$1</font>",
- '<pre>$1</pre>',
- "<a href='./user_profile.php?id=$1'>$2</a>",
- "<a onclick=\"roomForward(this, '$1', 'private'); return false;\" target=\"client\" href=\"./client.php?forwardId=2&roomId=$1\">$2</a>",
- "<a href='./group_profile.php?id=$1'>$2</a>",
- '<a href="$1" data-lightbox="$1"><img src="$1"/></a>',
- '<center><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="520" height="315" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/$1&hl=fr_FR&fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="520" height="315" src="http://www.youtube.com/v/$1&hl=fr_FR&fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></center>');
- $str = preg_replace ($simple_replace, $simple_search, $str);
- return $str;
- }
Advertisement
Add Comment
Please, Sign In to add comment