PHP 过滤 论坛 UBB代码
2011-11-28 11:39
176 查看
class Day{ function ubb($Text) { /// UBB代码转换 //$Text=htmlspecialchars($Text); //$Text=ereg_replace("\r\n","<br>",$Text); $Text=ereg_replace("\[br\]","<br />",$Text); $Text=nl2br($Text); $Text=stripslashes($Text); $Text=preg_replace("/\\t/is"," ",$Text); $Text=preg_replace("/\[url\](http:\/\/.+?)\[\/url\]/is","<a href=\"\\1\" target=\"new\"><u>\\1</u></a>",$Text); $Text=preg_replace("/\[url\](.+?)\[\/url\]/is","<a href=\"http://\\1\" target=\"new\"><u>\\1</u></a>",$Text); $Text=preg_replace("/\[url=(http:\/\/.+?)\](.+?)\[\/url\]/is","<a href=\"\\1\" target=\"new\"><u>\\2</u></a>",$Text); $Text=preg_replace("/\[url=(.+?)\](.+?)\[\/url\]/is","<a href=\"http://\\1\" target=\"new\"><u>\\2</u></a>",$Text); $Text=preg_replace("/\[color=(.+?)\](.+?)\[\/color\]/is","<font color=\"\\1\">\\2</font>",$Text); $Text=preg_replace("/\[font=(.+?)\](.+?)\[\/font\]/is","<font face=\"\\1\">\\2</font>",$Text); $Text=preg_replace("/\[email=(.+?)\](.+?)\[\/email\]/is","<a href=\"mailto:\\1\"><u>\\2</u></a>",$Text); $Text=preg_replace("/\[email\](.+?)\[\/email\]/is","<a href=\"mailto:\\1\"><u>\\1</u></a>",$Text); $Text=preg_replace("/\[i\](.+?)\[\/i\]/is","<i>\\1</i>",$Text); $Text=preg_replace("/\[u\](.+?)\[\/u\]/is","<u>\\1</u>",$Text); $Text=preg_replace("/\[b\](.+?)\[\/b\]/is","<b>\\1</b>",$Text); $Text=preg_replace("/\[fly\](.+?)\[\/fly\]/is","<marquee width=\"98%\" behavior=\"alternate\" scrollamount=\"3\">\\1</marquee>",$Text); $Text=preg_replace("/\[move\](.+?)\[\/move\]/is","<marquee width=\"98%\" scrollamount=\"3\">\\1</marquee>",$Text); $Text=preg_replace("/\[shadow=([#0-9a-z]{1,10})\,([0-9]{1,3})\,([0-9]{1,2})\](.+?)\[\/shadow\]/is","<table width=\"*\"><tr><td style=\"filter:shadow(color=\\1, direction=\\2 ,strength=\\3)\">\\4</td></tr></table>",$Text); return $Text; } }
相关文章推荐
- php下过滤html代码的函数 提高程序安全性
- php过滤表单提交的html等危险代码
- php 对输入信息的进行安全过滤的函数代码
- php练手代码之微型论坛设计
- php 过滤英文标点符号及过滤中文标点符号代码
- php通用防注入和XSS攻击全局过滤代码
- php中使用array_filter()函数过滤空数组的实现代码
- PHP 检查或过滤IP地址的代码
- php下获取Discuz论坛登录用户名、用户组、用户ID等信息的实现代码
- php下过滤HTML代码的函数
- 通用的PHP防注入漏洞攻击的过滤函数代码
- php下获取Discuz论坛登录用户名、用户组、用户ID等信息的实现代码
- PHP技巧:php过滤危险html代码
- PHP 中检查或过滤IP地址的实现代码
- php 论坛采集程序 模拟登陆,抓取页面 实现代码
- 用java实现论坛ubb的代码
- php 对输入信息的进行安全过滤的函数代码
- 比较好用的PHP防注入漏洞过滤函数代码
- 改进:论坛UBB代码自动插入方式
- PHP 文件系统管理函数与 preg_replace() 函数过滤代码