embed>'';
$ubbs[''list''][0] = ''/\[list\](.*?)\[\/list\]/s'';
$ubbs[''list''] = ''<ul>\1</ul>'';
$ubbs[''list2''][0] = ''/\[list=([0-9]+)\](.*?)\[\/list\]/s'';
$ubbs[''list2''] = ''<ol>\2</ol>'';
$ubbs[''indent''][0] = ''/\[indent\](.*?)\[\/indent\]/s'';
$ubbs[''indent''] = ''<div style="text-indent: 20px;">\1'';
$ubbs[''table''][0] = ''/\[table([=,0-9,%]*)\](.*?)\[\/table\]/s'';
$ubbs[''table''] = ''<table style="border:#0099FF 1px dotted;border-right-width:0px; border-top-width:0px;">\2'';
$ubbs[''tr''][0] = ''/\[tr\](.*?)\[\/tr\]/s'';
$ubbs[''tr''] = ''<tr>\1'';
$ubbs[''td''][0] = ''/\[td\](.*?)\[\/td\]/s'';
$ubbs[''td''] = ''<td style="border:#0099FF 1px dotted; border-left-width:0px; border-bottom-width:0px;"> \1'';
$ubbs[''td2''][0] = ''/\[td([^(\]|\[)]+)\](.*?)\[\/td\]/s'';
$ubbs[''td2''] = ''<td style="border:#0099FF 1px dotted; border-left-width:0px; border-bottom-width:0px;"> \2'';
$str = str_replace(''[*]'',''<li>'',$str);
foreach ($ubbs as $ubb){
$str = ubb_replace($ubb[0],$ubb,$str);
}
return $str;
}
function ubb_replace($pattern,$replacement,$str){
do {
$str_ret = $str;
$str = preg_replace($pattern,$replacement,$str);
}while($str);
return $str_ret;
}
?>
编码 modifier.unescape.php
复制代码 代码如下:
function smarty_modifier_unescape($str)
{
$str = rawurldecode($str);
preg_match_all("/(?:%u.{4})|[^%]+/",$str,$r);
$ar = $r[0];
foreach($ar as $k=>$v) {
if(substr($v,0,2) == "%u" && strlen($v) == 6)
$ar[$k] = iconv("UCS-2","GB2312",@pack("H4",substr($v,-4)));
}
return join("",$ar);
}