WebPortal_TongZhou/02.UI/script/xheditor-1.1.11/serverscript/php/ubb2html.php
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
/*!
* ubb2html support for php
* @requires xhEditor
*
* @author Yanis.Wang<yanis.wang@gmail.com>
* @site http://xheditor.com/
* @licence LGPL(http://www.opensource.org/licenses/lgpl-license.php)
*
* @Version: 0.9.10 (build 110801)
*/
function ubb2html($sUBB)
{
$sHtml=$sUBB;
global $emotPath,$cnum,$arrcode,$bUbb2htmlFunctionInit;$cnum=0;$arrcode=array();
$emotPath='../xheditor_emot/';//表情根路径
if(!$bUbb2htmlFunctionInit){
function saveCodeArea($match)
{
global $cnum,$arrcode;
$cnum++;$arrcode[$cnum]=$match[0];
return "[\tubbcodeplace_".$cnum."\t]";
}}
$sHtml=preg_replace_callback('/\[code\s*(?:=\s*((?:(?!")[\s\S])+?)(?:"[\s\S]*?)?)?\]([\s\S]*?)\[\/code\]/i','saveCodeArea',$sHtml);
$sHtml=preg_replace("/&/",'&',$sHtml);
$sHtml=preg_replace("/</",'<',$sHtml);
$sHtml=preg_replace("/>/",'>',$sHtml);
$sHtml=preg_replace("/\r?\n/",'<br />',$sHtml);
$sHtml=preg_replace("/\[(\/?)(b|u|i|s|sup|sub)\]/i",'<$1$2>',$sHtml);
$sHtml=preg_replace('/\[color\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/i','<span style="color:$1;">',$sHtml);
if(!$bUbb2htmlFunctionInit){
function getSizeName($match)
{
$arrSize=array('10px','13px','16px','18px','24px','32px','48px');
if(preg_match("/^\d+$/",$match[1]))$match[1]=$arrSize[$match[1]-1];
return '<span style="font-size:'.$match[1].';">';
}}
$sHtml=preg_replace_callback('/\[size\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/i','getSizeName',$sHtml);
$sHtml=preg_replace('/\[font\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/i','<span style="font-family:$1;">',$sHtml);
$sHtml=preg_replace('/\[back\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/i','<span style="background-color:$1;">',$sHtml);
$sHtml=preg_replace("/\[\/(color|size|font|back)\]/i",'</span>',$sHtml);
for($i=0;$i<3;$i++)$sHtml=preg_replace('/\[align\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\](((?!\[align(?:\s+[^\]]+)?\])[\s\S])*?)\[\/align\]/','<p align="$1">$2</p>',$sHtml);
$sHtml=preg_replace('/\[img\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/img\]/i','<img src="$1" alt="" />',$sHtml);
if(!$bUbb2htmlFunctionInit){
function getImg($match)
{
$alt=$match[1];$p1=$match[2];$p2=$match[3];$p3=$match[4];$src=$match[5];
$a=$p3?$p3:(!is_numeric($p1)?$p1:'');
return '<img src="'.$src.'" alt="'.$alt.'"'.(is_numeric($p1)?' width="'.$p1.'"':'').(is_numeric($p2)?' height="'.$p2.'"':'').($a?' align="'.$a.'"':'').' />';
}}
$sHtml=preg_replace_callback('/\[img\s*=([^,\]]*)(?:\s*,\s*(\d*%?)\s*,\s*(\d*%?)\s*)?(?:,?\s*(\w+))?\s*\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*)?\s*\[\/img\]/i','getImg',$sHtml);
if(!$bUbb2htmlFunctionInit){
function getEmot($match)
{
global $emotPath;
后面还有 73 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。