中文截取 modifier.cn_truncate.php
复制代码 代码如下:
function smarty_modifier_cn_truncate($string, $strlen = 20, $etc = '...',
$keep_first_style = false)
{
$strlen = $strlen*2;
$string = trim($string);
if ( strlen($string) <= $strlen ) {
return $string;
}
$str = strip_tags($string);
$j = 0;
for($i=0;$i<$strlen;$i++) {
if(ord(substr($str,$i,1))>0xa0) $j++;
}
if($j%2!=0) $strlen++;
$rstr=substr($str,0,$strlen);
if (strlen($str)>$strlen ) {$rstr .= $etc;}
if ( $keep_first_style == true && ereg('^<(.*)>$',$string) ) {
if ( strlen($str) <= $strlen ) {
return $string;
}
$start_pos = strpos($string,substr($str,0,4));
$end_pos = strpos($string,substr($str,-4));
$end_pos = $end_pos+4;
$rstr = substr($string,0,$start_pos) . $rstr . substr($string,$end_pos,strlen($string));
}
return $rstr;
}
modifier.ubb.php
复制代码 代码如下:
<?php
function smarty_modifier_ubb($str) {
$ubbs['quote'][0] = '/\[quote\](.*?)\[\/quote\]/s';
$ubbs['quote'][1] = '<blockquote>引用:<hr size=1>\1<hr size=1></blockquote>';
$ubbs['b'][0] = '/\[b\](.*?)\[\/b\]/s';
$ubbs['b'][1] = '<b>\1</b>';
$ubbs['i'][0] = '/\[i\](.*?)\[\/i\]/s';
$ubbs['i'][1] = '<i>\1</i>';
$ubbs['u'][0] = '/\[u\](.*?)\[\/u\]/s';
$ubbs['u'][1] = '<u>\1</u>';
$ubbs['li'][0] = '/\[li\](.*?)\[\/li\]/s';
$ubbs['li'][1] = '<li>\1</li>';
$ubbs['img'][0] = '/\[img\](.*?)\[\/img\]/s';
$ubbs['img'][1] = '<img border="0" src="/UploadFiles/2021-04-02/\1">$ubbs['img2'][0] = '/\[img=([^,]+),([^\]]+)\](.*?)\[\/img\]/s';
$ubbs['img2'][1] = '<img border="0" width="\1" height="\2" src="/UploadFiles/2021-04-02/\3">$ubbs['url'][0] = '/\[url\](.*?)\[\/url\]/s';
$ubbs['url'][1] = '<a href="\1" target="_blank">\1</a>';
$ubbs['url2'][0] = '/\[url=([^\]]+)\](.*?)\[\/url\]/s';
$ubbs['url2'][1] = '<a href="\1" target="_blank">\2</a>';
$ubbs['email'][0] = '/\[email=([^\]]+)\](.*?)\[\/email\]/s';
$ubbs['email'][1] = '<a href="mailto:\2">\2</a>';
$ubbs['qq'][0] = '/\[qq\]([0-9]{5,10})\[\/qq\]/s';
$ubbs['qq'][1] = '<a target="new" href="tencent://message/?uin=\1&Site=www.52515.net&Menu=yes"><img border="0" src="/UploadFiles/2021-04-02/pa?p=1:\1:\1">$ubbs['color'][0] = '/\[color=([^\]]+)\](.*?)\[\/color\]/s';
$ubbs['color'][1] = '<font color="\1">\2';
$ubbs['font'][0] = '/\[font=([^\]]+)\](.*?)\[\/font\]/s';
$ubbs['font'][1] = '<font face="\1">\2';
$ubbs['size'][0] = '/\[size=([0-9]+)\](.*?)\[\/size\]/s';
$ubbs['size'][1] = '<font size="\1" style="line-height:\1em;">\2';
$ubbs['sizept'][0] = '/\[size=([0-9,pt]+)\](.*?)\[\/size\]/s';
$ubbs['sizept'][1] = '<font style="font-size:\1">\2';
$ubbs['align'][0] = '/\[align=([^\]]+)\](.*?)\[\/align\]/s';
$ubbs['align'][1] = '<div align="\1">\2';
$ubbs['media'][0] = '/\[media\](.*?)\[\/media\]/s';
$ubbs['media'][1] = '<embed src="/UploadFiles/2021-04-02/\1">$ubbs['list'][0] = '/\[list\](.*?)\[\/list\]/s';
$ubbs['list'][1] = '<ul>\1</ul>';
$ubbs['list2'][0] = '/\[list=([0-9]+)\](.*?)\[\/list\]/s';
$ubbs['list2'][1] = '<ol>\2</ol>';
$ubbs['indent'][0] = '/\[indent\](.*?)\[\/indent\]/s';
$ubbs['indent'][1] = '<div style="text-indent: 20px;">\1';
$ubbs['table'][0] = '/\[table([=,0-9,%]*)\](.*?)\[\/table\]/s';
$ubbs['table'][1] = '<table style="border:#0099FF 1px dotted;border-right-width:0px; border-top-width:0px;">\2';
$ubbs['tr'][0] = '/\[tr\](.*?)\[\/tr\]/s';
$ubbs['tr'][1] = '<tr>\1';
$ubbs['td'][0] = '/\[td\](.*?)\[\/td\]/s';
$ubbs['td'][1] = '<td style="border:#0099FF 1px dotted; border-left-width:0px; border-bottom-width:0px;"> \1';
$ubbs['td2'][0] = '/\[td([^(\]|\[)]+)\](.*?)\[\/td\]/s';
$ubbs['td2'][1] = '<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[1],$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);
}
复制代码 代码如下:
function smarty_modifier_cn_truncate($string, $strlen = 20, $etc = '...',
$keep_first_style = false)
{
$strlen = $strlen*2;
$string = trim($string);
if ( strlen($string) <= $strlen ) {
return $string;
}
$str = strip_tags($string);
$j = 0;
for($i=0;$i<$strlen;$i++) {
if(ord(substr($str,$i,1))>0xa0) $j++;
}
if($j%2!=0) $strlen++;
$rstr=substr($str,0,$strlen);
if (strlen($str)>$strlen ) {$rstr .= $etc;}
if ( $keep_first_style == true && ereg('^<(.*)>$',$string) ) {
if ( strlen($str) <= $strlen ) {
return $string;
}
$start_pos = strpos($string,substr($str,0,4));
$end_pos = strpos($string,substr($str,-4));
$end_pos = $end_pos+4;
$rstr = substr($string,0,$start_pos) . $rstr . substr($string,$end_pos,strlen($string));
}
return $rstr;
}
modifier.ubb.php
复制代码 代码如下:
<?php
function smarty_modifier_ubb($str) {
$ubbs['quote'][0] = '/\[quote\](.*?)\[\/quote\]/s';
$ubbs['quote'][1] = '<blockquote>引用:<hr size=1>\1<hr size=1></blockquote>';
$ubbs['b'][0] = '/\[b\](.*?)\[\/b\]/s';
$ubbs['b'][1] = '<b>\1</b>';
$ubbs['i'][0] = '/\[i\](.*?)\[\/i\]/s';
$ubbs['i'][1] = '<i>\1</i>';
$ubbs['u'][0] = '/\[u\](.*?)\[\/u\]/s';
$ubbs['u'][1] = '<u>\1</u>';
$ubbs['li'][0] = '/\[li\](.*?)\[\/li\]/s';
$ubbs['li'][1] = '<li>\1</li>';
$ubbs['img'][0] = '/\[img\](.*?)\[\/img\]/s';
$ubbs['img'][1] = '<img border="0" src="/UploadFiles/2021-04-02/\1">$ubbs['img2'][0] = '/\[img=([^,]+),([^\]]+)\](.*?)\[\/img\]/s';
$ubbs['img2'][1] = '<img border="0" width="\1" height="\2" src="/UploadFiles/2021-04-02/\3">$ubbs['url'][0] = '/\[url\](.*?)\[\/url\]/s';
$ubbs['url'][1] = '<a href="\1" target="_blank">\1</a>';
$ubbs['url2'][0] = '/\[url=([^\]]+)\](.*?)\[\/url\]/s';
$ubbs['url2'][1] = '<a href="\1" target="_blank">\2</a>';
$ubbs['email'][0] = '/\[email=([^\]]+)\](.*?)\[\/email\]/s';
$ubbs['email'][1] = '<a href="mailto:\2">\2</a>';
$ubbs['qq'][0] = '/\[qq\]([0-9]{5,10})\[\/qq\]/s';
$ubbs['qq'][1] = '<a target="new" href="tencent://message/?uin=\1&Site=www.52515.net&Menu=yes"><img border="0" src="/UploadFiles/2021-04-02/pa?p=1:\1:\1">$ubbs['color'][0] = '/\[color=([^\]]+)\](.*?)\[\/color\]/s';
$ubbs['color'][1] = '<font color="\1">\2';
$ubbs['font'][0] = '/\[font=([^\]]+)\](.*?)\[\/font\]/s';
$ubbs['font'][1] = '<font face="\1">\2';
$ubbs['size'][0] = '/\[size=([0-9]+)\](.*?)\[\/size\]/s';
$ubbs['size'][1] = '<font size="\1" style="line-height:\1em;">\2';
$ubbs['sizept'][0] = '/\[size=([0-9,pt]+)\](.*?)\[\/size\]/s';
$ubbs['sizept'][1] = '<font style="font-size:\1">\2';
$ubbs['align'][0] = '/\[align=([^\]]+)\](.*?)\[\/align\]/s';
$ubbs['align'][1] = '<div align="\1">\2';
$ubbs['media'][0] = '/\[media\](.*?)\[\/media\]/s';
$ubbs['media'][1] = '<embed src="/UploadFiles/2021-04-02/\1">$ubbs['list'][0] = '/\[list\](.*?)\[\/list\]/s';
$ubbs['list'][1] = '<ul>\1</ul>';
$ubbs['list2'][0] = '/\[list=([0-9]+)\](.*?)\[\/list\]/s';
$ubbs['list2'][1] = '<ol>\2</ol>';
$ubbs['indent'][0] = '/\[indent\](.*?)\[\/indent\]/s';
$ubbs['indent'][1] = '<div style="text-indent: 20px;">\1';
$ubbs['table'][0] = '/\[table([=,0-9,%]*)\](.*?)\[\/table\]/s';
$ubbs['table'][1] = '<table style="border:#0099FF 1px dotted;border-right-width:0px; border-top-width:0px;">\2';
$ubbs['tr'][0] = '/\[tr\](.*?)\[\/tr\]/s';
$ubbs['tr'][1] = '<tr>\1';
$ubbs['td'][0] = '/\[td\](.*?)\[\/td\]/s';
$ubbs['td'][1] = '<td style="border:#0099FF 1px dotted; border-left-width:0px; border-bottom-width:0px;"> \1';
$ubbs['td2'][0] = '/\[td([^(\]|\[)]+)\](.*?)\[\/td\]/s';
$ubbs['td2'][1] = '<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[1],$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);
}
华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com
暂无评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?
更新日志
2024年11月19日
2024年11月19日
- 好薇2024《兵哥哥》1:124K黄金母盘[WAV+CUE]
- 胡歌.2006-珍惜(EP)【步升大风】【FLAC分轨】
- 洪荣宏.2014-拼乎自己看【华特】【WAV+CUE】
- 伊能静.1999-从脆弱到勇敢1987-1996精选2CD【华纳】【WAV+CUE】
- 刘亮鹭《汽车DJ玩主》[WAV+CUE][1.1G]
- 张杰《最接近天堂的地方》天娱传媒[WAV+CUE][1.1G]
- 群星《2022年度发烧天碟》无损黑胶碟 2CD[WAV+CUE][1.4G]
- 罗文1983-罗文甄妮-射雕英雄传(纯银AMCD)[WAV+CUE]
- 群星《亚洲故事香港纯弦》雨果UPMAGCD2024[低速原抓WAV+CUE]
- 群星《经典咏流传》限量1:1母盘直刻[低速原抓WAV+CUE]
- 庾澄庆1993《老实情歌》福茂唱片[WAV+CUE][1G]
- 许巍《在别处》美卡首版[WAV+CUE][1G]
- 林子祥《单手拍掌》华纳香港版[WAV+CUE][1G]
- 郑秀文.1997-我们的主题曲【华纳】【WAV+CUE】
- 群星.2001-生命因爱动听电影原创音乐AVCD【MEDIA】【WAV+CUE】