|
- function convert($message)
- {
- $message =str_replace(array('[u]','[/u]','[b]','[/b]','[i]','[/i]','[list]','[li]','[/li]','[/list]','[sub]', '[/sub]','[sup]','[/sup]','[strike]','[/strike]','[blockquote]','[/blockquote]','[hr]','[/backcolor]', '[/color]','[/font]','[/size]','[/align]'), array('<u>','</u>','<b>','</b>','<i>','</i>','<ul style="margin:0 0 0 15px">','<li>', '</li>','</ul>','<sub>','</sub>','<sup>','</sup>','<strike>','</strike>','<blockquote>','</blockquote>', '<hr />','</span>','</span>','</span>','</font>','</div>'), $message);
- $searcharray = array(
- "/\[list=([aA1]?)\](.+?)\[\/list\]/is",
- "/\[payto\](.+?)\[\/payto\]/is",
- "/\[font=([^\[\(&]+?)\]/is",
- "/\[color=([#0-9a-z]{1,10})\]/is",
- "/\[backcolor=([#0-9a-z]{1,10})\]/is",
- "/\[email=([^\[]*)\]([^\[]*)\[\/email\]/is",
- "/\[email\]([^\[]*)\[\/email\]/is",
- "/\[size=(\d+)\]/is",
- "/\[align=(left|center|right|justify)\]/is",
- "/\[glow=(\d+)\,([0-9a-zA-Z]+?)\,(\d+)\](.+?)\[\/glow\]/is",
- "/\[img\](.+?)\[\/img\]/is",
- "/\[url=(https?|ftp|gopher|news|telnet|mms|rtsp|thunder)([^\[\s]+?)\](.+?)\[\/url\]/is",
- "/\[url\]www\.([^\[]+?)\[\/url\]/is",
- "/\[url\](https?|ftp|gopher|news|telnet|mms|rtsp|thunder)([^\[]+?)\[\/url\]/is",
- "/\[fly\]([^\[]*)\[\/fly\]/is",
- "/\[move\]([^\[]*)\[\/move\]/is",
- "/\[post\](.+?)\[\/post\]/is",
- "/\[hide=(.+?)\](.+?)\[\/hide\]/is",
- "/\[sell=(.+?)\](.+?)\[\/sell\]/is",
- "/\[quote\](.+?)\[\/quote\]/is",
- "/\[flash=(\d+?)\,(\d+?)(\,(0|1))?\](.+?)\[\/flash\]/is",
- "/\[table(=(\d{1,3}(%|px)?))?\](.*?)\[\/table\]/is",
- "/\[wmv=[01]{1}\](.+?)\[\/wmv\]/is",
- "/\[wmv(?:=[0-9]{1,3}\,[0-9]{1,3}\,[01]{1})?\](.+?)\[\/wmv\]/is",
- "/\[rm(?:=[0-9]{1,3}\,[0-9]{1,3}\,[01]{1})\](.+?)\[\/rm\]/is",
- "/\[iframe\](.+?)\[\/iframe\]/is",
- "/\[code\](.+?)\[\/code\]/is"
- );
- return preg_replace($searcharray,'',$message);
- }
仅供参考,调用函数convert($content);
|