代理人门户 http://person.xy178.com﹥复制收藏 代理人门户已经全部开通登陆和注册服务,您有问题请到这里反馈! 管理门店 | 超级门户 | 帮助
  悟道,茫茫宇宙我追逐那烟花般的灿烂
进入管理> 
户主:求道者
·发送消息 ·加为好友
·加入收藏 ·推荐好友
我的博客分类
Freebsd
mysql
php
股票
apache
ubb
我的最新博文
FreeBSD 下換 IP 不用 Reboot
Refreshh
君生我未生,我生君已老
新建快速启动栏里的"显示桌面…
IE不显示JS了,所有的JS脚本…
转换ubb代码的一个函数
Apache 中 KeepAlive 配置的…
修改FreeBSD的系统时间
Mysql 4.1语言问题的完美解决…
教你编写高质量、高性能的My…
用MySQL内建复制功能来优化可…
MySQL优化简明指南
 
最新评论
Adobe Acrobat 7 MAC - $59.…
Hola.! Feliz ano nuevo.!
男人都喜欢吃到碗里看到锅里?
reertre
首先你连类型也没有确定,这…
我准备做一个网站,你说做什么…
好了,今天的理财123就说到这…
 
博客
转换ubb代码的一个函数 [2007-05-18 01:14:59]

在CSDN的论坛上一个朋友发的,转到这里以便用的时候直接copy和modify,省得自己写了。

 

function ubb2html($content)
{
global $article;
//是否自动识别
if ($article['isparseurl'] == "1")
{
$content = parseurl($content);
}
//自动识别结束

$content = eregi_replace(quotemeta("[b]"),quotemeta("<b>"),$content);
$content = eregi_replace(quotemeta("[/b]"),quotemeta("</b>"),$content);
$content = eregi_replace(quotemeta("[i]"),quotemeta("<i>"),$content);
$content = eregi_replace(quotemeta("[/i]"),quotemeta("</i>"),$content);
$content = eregi_replace(quotemeta("[u]"),quotemeta("<u>"),$content);
$content = eregi_replace(quotemeta("[/u]"),quotemeta("</u>"),$content);
$content = eregi_replace(quotemeta("[center]"),quotemeta("<center>"),$content);
$content = eregi_replace(quotemeta("[/center]"),quotemeta("</center>"),$content);

$content = eregi_replace(quotemeta("[quote]"),quotemeta("<table width="96%" border="0" cellspacing="3" cellpadding="0" style=word-break:break-all align="center"><tr><td><b>引用:</b></td></tr><tr><td><hr width="100%" noshade></td></tr><tr><td class="content"><font color="#0000FF">"),$content);
$content = eregi_replace(quotemeta("[/quote]"),quotemeta("</font></td></tr><tr><td><hr width="100%" noshade></td></tr></table>"),$content);

$content = eregi_replace(quotemeta("[code]"),quotemeta("<table width="96%" border="0" cellspacing="3" cellpadding="0" style=word-break:break-all align="center"><tr><td><b>代码:</b></td></tr><tr><td><hr width="100%" noshade></td></tr><tr><td class="code"><font color="#0000FF">"),$content);
$content = eregi_replace(quotemeta("[/code]"),quotemeta("</font></td></tr><tr><td><hr width="100%" noshade></td></tr></table>"),$content);

$content = eregi_replace("\[images\]([^\[]*)\[/images\]","<a href="\1" target="_blank"><img src="\1" border=0 onload="javascript:if(this.width>screen.width-333)this.width=screen.width-333" title="用新窗口浏览原始图片"></a>",$content);
 
$content = eregi_replace("\[url\]www.([^\[]*)\[/url\]", "<a href="http://www.\1" target=_blank>www.\1</a>",$content);
$content = eregi_replace("\[url\]([^\[]*)\[/url\]","<a href="\1" target=_blank>\1</a>",$content);
$content = eregi_replace("\[url=([^\[]*)\]([^\[]*)\[/url\]","<a href="\1" target=_blank>\2</a>",$content);
$content = eregi_replace("\[email\]([^\[]*)\[/email\]", "<a href="mailto:\1">\1</a>",$content);

//$content = preg_replace( '/javascript/i', 'java script', $content);
return $content;
}

本文章被推荐到了0个圈子 评论:(0) 推荐:(0) 点击:(348)
评论列表
发表评论
称  呼:
主    页:
评  论:
 
成功保险网超级门户v1.0beta powered by XY178.COM