Closed guldmann closed 9 years ago
Here are some suggestion for bbcode
$search = array( '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[s\](.*?)\[\/s\]/is', '/\[img\](https?.*?)\[\/img\]/is', '/\[url\](https?.*?)\[\/url\]/is', '/\[url=(https?.*?)\](.*?)\[\/url\]/is', '/\[quote\](.*?)\[\/quote\]/is', '/\[code\](.*?)\[\/code\]/is', '/\[quote=(.*?)\](.*?)\[\/quote\]/is', '/\[size=(\d+)\](.*?)\[\/size\]/is', '/\[center\](.*?)\[\/center\]/is', '/\[color=([#a-z0-9]+)\](.*?)\[\/color\]/is', '/\[email\](.*?)\[\/email\]/is' ); $replace = array( '<strong>$1</strong>', '<em>$1</em>', '<u>$1</u>', '<del>$1</del>', '<img src="$1" />', '<a href="$1">$1</a>', '<a href="$1">$2</a>', '<blockquote>$1</blockquote>', '<p><pre>$1</pre></p>', '$1 wrote: <blockquote><p>$2</p></blockquote>', '<span style="font-size:$1px">$2</span>', '<div style="text-align:center;">$1</div>', '<span style="color:$1;">$2</span>', '<a href="mailto:$1">$1</a>' ); return preg_replace($search, $replace, $text);
Thanx. I'l add it for implementation in CTextFilters predecessor, https://github.com/mosbth/ctextfilter/issues/2, feel free to make a pull request on it, or wait until I'll put in in there.
Here are some suggestion for bbcode