首页 > 资讯列表 > 编程/数据库 >> PHP

php Ubb代码编辑器函数代码

PHP 2014-12-16 04:51:04 转载来源: 网络整理/侵权必删

本文是一个php Ubb代码编辑器函数代码,感兴趣的同学参考下. <?php /* php Ubb代码编辑器 */ function get_ubb($ubb){ $ubb=preg_replace("/([B])(

本文是一个php Ubb代码编辑器函数代码,感兴趣的同学参考下.


<?php
/*
php Ubb代码编辑器
*/
function get_ubb($ubb){
$ubb=preg_replace("/([B])(.*)([/B])/","<B>2</B>" ,$ubb);//替换B粗体字
$ubb=preg_replace("/([I])(.*)([/I])/","<I>2</I>" ,$ubb);
$ubb=preg_replace("/([U])(.*)([/U])/","<U>2</U>" ,$ubb);
$ubb=preg_replace("/([LEF])(.*)([/LEF])/","<div align=left>2</div>" ,$ubb);
$ubb=preg_replace("/([MID ])(.*)([/MID ])/","<div align=center>2</div>" ,$ubb);
$ubb=preg_replace("/([RIG])(.*)([/RIG])/","<div align=right>2</div>" ,$ubb);
$ubb=preg_replace("/([LINK])(.*)([/LINK])/","<a href=2>2</a>",$ubb);
$ubb=preg_replace("/([Email])(.*)([/Email])/","<a href=mailto:2>2</a>",$ubb);
$ubb=preg_replace("/([IMAGE])(.*)([/IMAGE])/","<img src=2>",$ubb);
$ubb=preg_replace("/([FLASH])(.*)([/FLASH])/","<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=400 height=400><PARAM NAME=movie VALUE="2"><PARAM NAME=quality VALUE=high><embed src="2" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=400 height=400 ></embed></OBJECT>" ,$ubb);
$ubb=preg_replace("/([MUSIC])(.*)([/MUSIC])/","<embed src=2 autostart=false loop=3>" ,$ubb);
$ubb=preg_replace("/([PHOTO name=)([0-9]*)(])/","<img src=Ubb_img/biaoqing/2.gif >" ,$ubb);
$ubb=preg_replace("/([FONT=)(.{1,10})(])(.*)([/FONT])/","<div style=font:2>4</div>" ,$ubb);
$ubb=preg_replace("/([FONT-SIZE=)([0-9]*)(])(.*)([/FONT-SIZE])/","<div style=font-size:2px>4</div>" ,$ubb);
$ubb=preg_replace("/([FONT-COLOR=)(.{1,10})(])(.*)([/FONT-COLOR])/","<div style=color:2>4</div>" ,$ubb);
//$ubb=preg_replace("/([])(.*)([/])/","" ,$ubb);
return $ubb;
}
$str=get_ubb($_POST['cont']);
$str="<div style=font:宋体>[FONT=黑体]asdasd</div><div style=font:Georgia>asdasdas[/FONT]</div>";
echo get_ubb($str);
?>

标签: 代码 php Ubb 编辑器 函数


声明:本文内容来源自网络,文字、图片等素材版权属于原作者,平台转载素材出于传递更多信息,文章内容仅供参考与学习,切勿作为商业目的使用。如果侵害了您的合法权益,请您及时与我们联系,我们会在第一时间进行处理!我们尊重版权,也致力于保护版权,站搜网感谢您的分享!

站长搜索

http://www.adminso.com

Copyright @ 2007~2024 All Rights Reserved.

Powered By 站长搜索

打开手机扫描上面的二维码打开手机版


使用手机软件扫描微信二维码

关注我们可获取更多热点资讯

站长搜索目录系统技术支持