haidong 发表于 2010-2-24 13:43:29

PHP操作ubb代码类

<OL><LI><CODE><FONT face=新宋体>&lt;?PHP</FONT></CODE><LI><CODE><FONT face=新宋体>//ubbcode类</FONT></CODE><LI><CODE><FONT face=新宋体>class ubbcode</FONT></CODE><LI><CODE><FONT face=新宋体>{</FONT></CODE><LI><CODE><FONT face=新宋体>    var $nest;// 递归深度,for debug</FONT></CODE><LI><CODE><FONT face=新宋体>    //可处理标签及处理函数表</FONT></CODE><LI><CODE><FONT face=新宋体>    var $tags = array(</FONT></CODE><LI><CODE><FONT face=新宋体>      'url' =&gt; '$this-&gt;url',</FONT></CODE><LI><CODE><FONT face=新宋体>      'email' =&gt; '$this-&gt;email',</FONT></CODE><LI><CODE><FONT face=新宋体>      'mail' =&gt; '$this-&gt;email',// 为了容错,和等效</FONT></CODE><LI><CODE><FONT face=新宋体>      'img' =&gt; '$this-&gt;img',</FONT></CODE><LI><CODE><FONT face=新宋体>      'b' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'i' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'u' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'tt' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      's' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'strike' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'h1' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'h2' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'h3' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'h4' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'h5' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'h6' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'sup' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'sub' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'em' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'strong' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'code' =&gt; '$this-&gt;simple',    </FONT></CODE><LI><CODE><FONT face=新宋体>      'small' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'big' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'blink' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'fly' =&gt; '$this-&gt;fly',</FONT></CODE><LI><CODE><FONT face=新宋体>      'move' =&gt; '$this-&gt;move',</FONT></CODE><LI><CODE><FONT face=新宋体>      'glow' =&gt; '$this-&gt;CSSStyle',</FONT></CODE><LI><CODE><FONT face=新宋体>      'shadow' =&gt; '$this-&gt;CSSStyle',</FONT></CODE><LI><CODE><FONT face=新宋体>      'blur' =&gt; '$this-&gt;CSSStyle',</FONT></CODE><LI><CODE><FONT face=新宋体>      'wave' =&gt; '$this-&gt;CSSStyle',</FONT></CODE><LI><CODE><FONT face=新宋体>      'sub' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'sup' =&gt; '$this-&gt;simple',</FONT></CODE><LI><CODE><FONT face=新宋体>      'size' =&gt; '$this-&gt;size',</FONT></CODE><LI><CODE><FONT face=新宋体>      'face' =&gt; '$this-&gt;face',</FONT></CODE><LI><CODE><FONT face=新宋体>      'font' =&gt; '$this-&gt;face',// 为了容错,和等效</FONT></CODE><LI><CODE><FONT face=新宋体>      'color' =&gt; '$this-&gt;color',</FONT></CODE><LI><CODE><FONT face=新宋体>      'html' =&gt; '$this-&gt;html',</FONT></CODE><LI><CODE><FONT face=新宋体>      'quote' =&gt; '$this-&gt;quote',</FONT></CODE><LI><CODE><FONT face=新宋体>      'swf' =&gt; '$this-&gt;swf',</FONT></CODE><LI><CODE><FONT face=新宋体>      'upload' =&gt; '$this-&gt;upload'</FONT></CODE><LI><CODE><FONT face=新宋体>      );</FONT></CODE><LI><CODE><FONT face=新宋体>    function ubbcode()</FONT></CODE><LI><CODE><FONT face=新宋体>    {</FONT></CODE><LI><CODE><FONT face=新宋体>      $this-&gt;$nest= 0;</FONT></CODE><LI><CODE><FONT face=新宋体>      $this-&gt;$sLastModified= <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("%s", <A href="http://www.php.net/manual/zh/function.date"><U><FONT color=#0000ff>date</FONT></U></A>("Y-m-j H:i", <A href="http://www.php.net/manual/zh/function.getlastmod"><U><FONT color=#0000ff>getlastmod</FONT></U></A>()));</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><LI><CODE><FONT face=新宋体>    /***********************************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    *对使用者输入的 E-Mail 作简单的检查,</FONT></CODE><LI><CODE><FONT face=新宋体>    *检查使用者的 E-Mail 字串是否有 @ 字元,</FONT></CODE><LI><CODE><FONT face=新宋体>    *在 @ 字元前有英文字母或数字,在之后有数节字串,</FONT></CODE><LI><CODE><FONT face=新宋体>    *最后的小数点后只能有二个或三个英文字母。</FONT></CODE><LI><CODE><FONT face=新宋体>    *super@mail.wilson.gs 就可以通过检查,super@mail.wilson 就不能通过检查</FONT></CODE><LI><CODE><FONT face=新宋体>    ************************************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function emailcheck($str) </FONT></CODE><LI><CODE><FONT face=新宋体>    {</FONT></CODE><LI><CODE><FONT face=新宋体>      if (<A href="http://www.php.net/manual/zh/function.eregi"><U><FONT color=#0000ff>eregi</FONT></U></A>("^+@(+\.)+{2,3}$", $str)) </FONT></CODE><LI><CODE><FONT face=新宋体>      return true;</FONT></CODE><LI><CODE><FONT face=新宋体>      else</FONT></CODE><LI><CODE><FONT face=新宋体>      return false;</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    /***********************************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    *对使用者输入的 URL 作简单的检查,</FONT></CODE><LI><CODE><FONT face=新宋体>    *目前只能简单判断,不能自动检查fpt,finger等</FONT></CODE><LI><CODE><FONT face=新宋体>    ************************************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function checkURL($str) </FONT></CODE><LI><CODE><FONT face=新宋体>    {</FONT></CODE><LI><CODE><FONT face=新宋体>      $bValidURL= true;</FONT></CODE><LI><CODE><FONT face=新宋体>      if (<A href="http://www.php.net/manual/zh/function.eregi"><U><FONT color=#0000ff>eregi</FONT></U></A>("(+([\.]+)+)", $str, $er_arr)) </FONT></CODE><LI><CODE><FONT face=新宋体>      {    </FONT></CODE><LI><CODE><FONT face=新宋体>/*</FONT></CODE><LI><CODE><FONT face=新宋体>printf ("0. %s &lt;br/&gt;\n", $er_arr);</FONT></CODE><LI><CODE><FONT face=新宋体>printf ("1. %s &lt;br/&gt;\n", $er_arr);</FONT></CODE><LI><CODE><FONT face=新宋体>printf ("2. %s &lt;br/&gt;\n", $er_arr);</FONT></CODE><LI><CODE><FONT face=新宋体>printf ("3. %s &lt;br/&gt;\n", $er_arr);</FONT></CODE><LI><CODE><FONT face=新宋体>printf ("4. %s &lt;br/&gt;\n", $er_arr);</FONT></CODE><LI><CODE><FONT face=新宋体>*/</FONT></CODE><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><CODE><FONT face=新宋体>      else</FONT></CODE><LI><CODE><FONT face=新宋体>         $bValidURL= false;</FONT></CODE><LI><CODE><FONT face=新宋体>      return $bValidURL;</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    /***********************************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    *对使用者输入的 图片URL 作简单的检查,</FONT></CODE><LI><CODE><FONT face=新宋体>    *目前只能简单判断结尾是否为图片文件</FONT></CODE><LI><CODE><FONT face=新宋体>    *不支持由CGI动态生成的图片,比如计数器这类的</FONT></CODE><LI><CODE><FONT face=新宋体>    ************************************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function checkImgURL($str) </FONT></CODE><LI><CODE><FONT face=新宋体>    {</FONT></CODE><LI><CODE><FONT face=新宋体>      if ($this-&gt;checkURL($str)) {</FONT></CODE><LI><CODE><FONT face=新宋体>      if(<A href="http://www.php.net/manual/zh/function.eregi"><U><FONT color=#0000ff>eregi</FONT></U></A>("\.(jpeg|jpg|gif|bmp|png|pcx|tiff|tga|lwf)$", $str)) </FONT></CODE><LI><CODE><FONT face=新宋体>          return true;</FONT></CODE><LI><CODE><FONT face=新宋体>      else</FONT></CODE><LI><CODE><FONT face=新宋体>          return false;</FONT></CODE><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><CODE><FONT face=新宋体>      else</FONT></CODE><LI><CODE><FONT face=新宋体>      return false;</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    /***********************************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    *自动补全URL部分,主要是协议前缀,</FONT></CODE><LI><CODE><FONT face=新宋体>    *默认是htpp://,支持https://;ftp://;finger://;gopher://等</FONT></CODE><LI><CODE><FONT face=新宋体>    *函数并不对URL的合法性作检查</FONT></CODE><LI><CODE><FONT face=新宋体>    ************************************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function formatURL($str) </FONT></CODE><LI><CODE><FONT face=新宋体>    {</FONT></CODE><LI><CODE><FONT face=新宋体>      if (!<A href="http://www.php.net/manual/zh/function.eregi"><U><FONT color=#0000ff>eregi</FONT></U></A>("^(ftp|http|https|mms|gopher|finger|bbs|telnet):(\/\/|\\\\)", $str))</FONT></CODE><LI><CODE><FONT face=新宋体>      $str= 'http://'.$str;</FONT></CODE><LI><CODE><FONT face=新宋体>      return $str;</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    //对$str进行UBB编码解析</FONT></CODE><LI><CODE><FONT face=新宋体>    function parse($str)</FONT></CODE><LI><CODE><FONT face=新宋体>    {</FONT></CODE><LI><CODE><FONT face=新宋体>      $nest ++;</FONT></CODE><LI><CODE><FONT face=新宋体>      $parse = ''.($str);</FONT></CODE><LI><CODE><FONT face=新宋体>      $ret = '';</FONT></CODE><LI><CODE><FONT face=新宋体>      while(true){</FONT></CODE><LI><CODE><FONT face=新宋体>            //查找 或者 , 但不包括</FONT></CODE><LI><CODE><FONT face=新宋体>            $eregi_ret=<A href="http://www.php.net/manual/zh/function.eregi"><U><FONT color=#0000ff>eregi</FONT></U></A>("\[({0,7})(=+)?\]", $parse, $eregi_arr); </FONT></CODE><LI><CODE><FONT face=新宋体>            if(!$eregi_ret)</FONT></CODE><LI><CODE><FONT face=新宋体>            {</FONT></CODE><LI><CODE><FONT face=新宋体>                $ret .= $parse;</FONT></CODE><LI><CODE><FONT face=新宋体>                break; //如果没有,返回</FONT></CODE><LI><CODE><FONT face=新宋体>            }</FONT></CODE><LI><CODE><FONT face=新宋体>/*for Debug</FONT></CODE><LI><CODE><FONT face=新宋体>            else </FONT></CODE><LI><CODE><FONT face=新宋体>            {</FONT></CODE><LI><CODE><FONT face=新宋体>            printf ("$. %s&lt;br/&gt;", $eregi_ret);</FONT></CODE><LI><CODE><FONT face=新宋体>            printf ("0. %s&lt;br/&gt;", $eregi_arr);</FONT></CODE><LI><CODE><FONT face=新宋体>            printf ("1. %s&lt;br/&gt;", $eregi_arr);</FONT></CODE><LI><CODE><FONT face=新宋体>            printf ("2. %s&lt;br/&gt;", $eregi_arr);</FONT></CODE><LI><CODE><FONT face=新宋体>            printf ("3. %s&lt;br/&gt;", $eregi_arr);</FONT></CODE><LI><CODE><FONT face=新宋体>            }</FONT></CODE><LI><CODE><FONT face=新宋体>*/</FONT></CODE><LI><LI><CODE><FONT face=新宋体>            $pos = @<A href="http://www.php.net/manual/zh/function.strpos"><U><FONT color=#0000ff>strpos</FONT></U></A>($parse, $eregi_arr);// 起始位置</FONT></CODE><LI><CODE><FONT face=新宋体>            $tag_start= $eregi_arr;</FONT></CODE><LI><CODE><FONT face=新宋体>            $tag= <A href="http://www.php.net/manual/zh/function.strtolower"><U><FONT color=#0000ff>strtolower</FONT></U></A>($eregi_arr);</FONT></CODE><LI><CODE><FONT face=新宋体>            $tag_param= $eregi_arr;</FONT></CODE><LI><CODE><FONT face=新宋体>            $parse2 = <A href="http://www.php.net/manual/zh/function.substr"><U><FONT color=#0000ff>substr</FONT></U></A>($parse, 0, $pos);//标记之前</FONT></CODE><LI><CODE><FONT face=新宋体>            $parse = <A href="http://www.php.net/manual/zh/function.substr"><U><FONT color=#0000ff>substr</FONT></U></A>($parse, $pos + $eregi_ret);//标记之后</FONT></CODE><LI><CODE><FONT face=新宋体>            if(!isset($this-&gt;tags[$tag]))</FONT></CODE><LI><CODE><FONT face=新宋体>            {</FONT></CODE><LI><CODE><FONT face=新宋体>                $ret .= $parse2.'['.$tag_start.']';</FONT></CODE><LI><CODE><FONT face=新宋体>                continue;    //如果是不支持的标记</FONT></CODE><LI><CODE><FONT face=新宋体>            }</FONT></CODE><LI><CODE><FONT face=新宋体>            //查找对应的结束标记</FONT></CODE><LI><CODE><FONT face=新宋体>            $eregi_ret=<A href="http://www.php.net/manual/zh/function.eregi"><U><FONT color=#0000ff>eregi</FONT></U></A>("\[(/".$tag.")\]", $parse, $eregi_arr);</FONT></CODE><LI><CODE><FONT face=新宋体>            if(!$eregi_ret)</FONT></CODE><LI><CODE><FONT face=新宋体>            {</FONT></CODE><LI><CODE><FONT face=新宋体>                $ret .= $parse2.'['.$tag_start.$tag_param.']';</FONT></CODE><LI><CODE><FONT face=新宋体>                continue;//没有对应该的结束标记</FONT></CODE><LI><CODE><FONT face=新宋体>            }</FONT></CODE><LI><CODE><FONT face=新宋体>            $pos= <A href="http://www.php.net/manual/zh/function.strpos"><U><FONT color=#0000ff>strpos</FONT></U></A>($parse, $eregi_arr);</FONT></CODE><LI><CODE><FONT face=新宋体>            $value= <A href="http://www.php.net/manual/zh/function.substr"><U><FONT color=#0000ff>substr</FONT></U></A>($parse, 0, $pos);   //起止标记之间的内容</FONT></CODE><LI><CODE><FONT face=新宋体>            $tag_end= $eregi_arr;</FONT></CODE><LI><CODE><FONT face=新宋体>            $parse= <A href="http://www.php.net/manual/zh/function.substr"><U><FONT color=#0000ff>substr</FONT></U></A>($parse, $pos + $eregi_ret);//结束标记之后的内容</FONT></CODE><LI><CODE><FONT face=新宋体>            // 允许嵌套标记,递归分析</FONT></CODE><LI><CODE><FONT face=新宋体>            if (!(($tag == 'code') or ($tag=="url") or ($tag=="email") or ($tag=="img"))){</FONT></CODE><LI><CODE><FONT face=新宋体>                $value= $this-&gt;parse($value);</FONT></CODE><LI><CODE><FONT face=新宋体>            }</FONT></CODE><LI><CODE><FONT face=新宋体>            $ret.= $parse2;</FONT></CODE><LI><CODE><FONT face=新宋体>            $parseFun= <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>('$ret .= %s($tag_start, $tag_param, $tag_end, $value);', $this-&gt;tags[$tag]); </FONT></CODE><LI><CODE><FONT face=新宋体>            eval($parseFun);</FONT></CODE><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><CODE><FONT face=新宋体>      $nest --;</FONT></CODE><LI><CODE><FONT face=新宋体>      return $ret;</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>/*****************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    * 简单替换,类似变为&lt;b&gt;</FONT></CODE><LI><CODE><FONT face=新宋体>    * 标签内容不便,只是替代括号为&lt;&gt;</FONT></CODE><LI><CODE><FONT face=新宋体>    *****************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function simple($start, $para, $end, $value){</FONT></CODE><LI><CODE><FONT face=新宋体>      if (<A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($para) &gt; 0) </FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s%s]%s[%s]", $start, $para, $value, $end);</FONT></CODE><LI><CODE><FONT face=新宋体>      else</FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("&lt;%s&gt;%s&lt;%s&gt;", $start, $value, $end);</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    /*****************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    * 如下认为合法可以没有“http://”;ftp一定要自己加“ftp://”</FONT></CODE><LI><CODE><FONT face=新宋体>    * 93611</FONT></CODE><LI><CODE><FONT face=新宋体>    * </FONT></CODE><LI><CODE><FONT face=新宋体>    * http://www.fogsun.com</FONT></CODE><LI><CODE><FONT face=新宋体>    *****************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function url($start, $para, $end, $value){</FONT></CODE><LI><CODE><FONT face=新宋体>      $sA= $value;</FONT></CODE><LI><CODE><FONT face=新宋体>      $sURL= <A href="http://www.php.net/manual/zh/function.substr"><U><FONT color=#0000ff>substr</FONT></U></A>(<A href="http://www.php.net/manual/zh/function.trim"><U><FONT color=#0000ff>trim</FONT></U></A>($para), 1);</FONT></CODE><LI><CODE><FONT face=新宋体>      if (<A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($sURL) &gt; 0) </FONT></CODE><LI><CODE><FONT face=新宋体>      {</FONT></CODE><LI><CODE><FONT face=新宋体>          if (<A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($value) == 0) </FONT></CODE><LI><CODE><FONT face=新宋体>            $sA= $sURL;</FONT></CODE><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><CODE><FONT face=新宋体>      else </FONT></CODE><LI><CODE><FONT face=新宋体>      {</FONT></CODE><LI><CODE><FONT face=新宋体>          $sURL= <A href="http://www.php.net/manual/zh/function.trim"><U><FONT color=#0000ff>trim</FONT></U></A>($value);</FONT></CODE><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><CODE><FONT face=新宋体>      $sURL= $this-&gt;formatURL($sURL);</FONT></CODE><LI><CODE><FONT face=新宋体>      if($this-&gt;checkURL($sURL)) </FONT></CODE><LI><CODE><FONT face=新宋体>          return "&lt;a href=\"$sURL\" class=\"small\" target=_blank&gt;$sA&lt;/a&gt;";</FONT></CODE><LI><CODE><FONT face=新宋体>      else {</FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s%s]%s[%s]", $start, $para, $value, $end);</FONT></CODE><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    /*****************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    * 如下认为合法可以没有“mailto:”头;</FONT></CODE><LI><CODE><FONT face=新宋体>    * pazee</FONT></CODE><LI><CODE><FONT face=新宋体>    * </FONT></CODE><LI><CODE><FONT face=新宋体>    * pazee@21cn.com</FONT></CODE><LI><CODE><FONT face=新宋体>    *****************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function email($start, $para, $end, $value){</FONT></CODE><LI><CODE><FONT face=新宋体>      $sA= $value;</FONT></CODE><LI><CODE><FONT face=新宋体>      $sURL= <A href="http://www.php.net/manual/zh/function.substr"><U><FONT color=#0000ff>substr</FONT></U></A>(<A href="http://www.php.net/manual/zh/function.trim"><U><FONT color=#0000ff>trim</FONT></U></A>($para), 1);</FONT></CODE><LI><CODE><FONT face=新宋体>      if (<A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($sURL) &gt; 0) </FONT></CODE><LI><CODE><FONT face=新宋体>      {</FONT></CODE><LI><CODE><FONT face=新宋体>          if (<A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($value) == 0) </FONT></CODE><LI><CODE><FONT face=新宋体>            $sA= $sURL;</FONT></CODE><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><CODE><FONT face=新宋体>      else </FONT></CODE><LI><CODE><FONT face=新宋体>      {</FONT></CODE><LI><CODE><FONT face=新宋体>          $sURL= <A href="http://www.php.net/manual/zh/function.trim"><U><FONT color=#0000ff>trim</FONT></U></A>($value);</FONT></CODE><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><CODE><FONT face=新宋体>      //if (strtolower(substr($sURL, 0, 7)) != "mailto:")</FONT></CODE><LI><CODE><FONT face=新宋体>          $sURL= "mail.php?email=". $sURL;</FONT></CODE><LI><CODE><FONT face=新宋体>      if($this-&gt;emailcheck(<A href="http://www.php.net/manual/zh/function.substr"><U><FONT color=#0000ff>substr</FONT></U></A>($sURL, 15))) </FONT></CODE><LI><CODE><FONT face=新宋体>          return "&lt;a href=\"$sURL\" class=\"small\" target=_blank&gt;$sA&lt;/a&gt;";</FONT></CODE><LI><CODE><FONT face=新宋体>      else</FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s%s]%s[%s]", $start, $para, $value, $end);</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    /*****************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    * 显示图片;如下用法认为合法</FONT></CODE><LI><CODE><FONT face=新宋体>    * </FONT></CODE><LI><CODE><FONT face=新宋体>    * www.21cn.com/title.jpg</FONT></CODE><LI><CODE><FONT face=新宋体>    *****************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function img($start, $para, $end, $value){</FONT></CODE><LI><CODE><FONT face=新宋体>      $sURL= <A href="http://www.php.net/manual/zh/function.substr"><U><FONT color=#0000ff>substr</FONT></U></A>(<A href="http://www.php.net/manual/zh/function.trim"><U><FONT color=#0000ff>trim</FONT></U></A>($para), 1);</FONT></CODE><LI><CODE><FONT face=新宋体>      if (<A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($sURL) &lt;= 0) </FONT></CODE><LI><CODE><FONT face=新宋体>          $sURL= <A href="http://www.php.net/manual/zh/function.trim"><U><FONT color=#0000ff>trim</FONT></U></A>($value);</FONT></CODE><LI><CODE><FONT face=新宋体>      //$sURL= $this-&gt;formatURL($sURL);</FONT></CODE><LI><CODE><FONT face=新宋体>      if ($this-&gt;checkImgURL($sURL))</FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("&lt;a href=\"%s\" target=\"_blank\"&gt;&lt;img src=\"%s\" border=0 alt=\"从新窗口中浏览\"&gt;&lt;/img&gt;&lt;/a&gt;", $sURL,$sURL);</FONT></CODE><LI><CODE><FONT face=新宋体>      else</FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s%s]%s[%s]", $start, $para, $value, $end);</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    /*****************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    * 字符串从右向左循环移动 </FONT></CODE><LI><CODE><FONT face=新宋体>    * 无参数</FONT></CODE><LI><CODE><FONT face=新宋体>    * 等效与html的&lt;marquee&gt;</FONT></CODE><LI><CODE><FONT face=新宋体>    *****************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function fly($start, $para, $end, $value){</FONT></CODE><LI><CODE><FONT face=新宋体>      if (<A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($para)&gt;0) // 有参数</FONT></CODE><LI><CODE><FONT face=新宋体>      return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s%s]%s[%s]", $start, $para, $value, $end);</FONT></CODE><LI><CODE><FONT face=新宋体>      else</FONT></CODE><LI><CODE><FONT face=新宋体>      return '&lt;marquee behavior=alternate scrolldelay=100&gt;'.$value.'&lt;/marquee&gt;';</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    /*****************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    * 字符串来回移动 </FONT></CODE><LI><CODE><FONT face=新宋体>    * 无参数</FONT></CODE><LI><CODE><FONT face=新宋体>    * 等效与html的&lt;marquee&gt;</FONT></CODE><LI><CODE><FONT face=新宋体>    *****************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function move($start, $para, $end, $value) {</FONT></CODE><LI><CODE><FONT face=新宋体>      if (<A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($para)&gt;0) // 有参数</FONT></CODE><LI><CODE><FONT face=新宋体>      return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s%s]%s[%s]", $start, $para, $value, $end);</FONT></CODE><LI><CODE><FONT face=新宋体>      else</FONT></CODE><LI><CODE><FONT face=新宋体>      return '&lt;marqueescrolldelay=100&gt;'.$value.'&lt;/marquee&gt;';</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    /*****************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    * 字符晕光效果包括 glow、shadow和blur</FONT></CODE><LI><CODE><FONT face=新宋体>    * 字符晕光效果或者</FONT></CODE><LI><CODE><FONT face=新宋体>    * 3个参数允许缺省</FONT></CODE><LI><CODE><FONT face=新宋体>    * 实现文字阴影特效,</FONT></CODE><LI><CODE><FONT face=新宋体>    * glow, shadow,blur 属性依次为颜色、宽度和边界大小</FONT></CODE><LI><CODE><FONT face=新宋体>    * wave 属性依次为变形频率、宽度和边界大小</FONT></CODE><LI><CODE><FONT face=新宋体>    *****************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function CSSStyle(&amp;$start, &amp;$para, &amp;$end, &amp;$value){</FONT></CODE><LI><CODE><FONT face=新宋体>      $rets= <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s%s]%s[%s]", $start, $para, $value, $end);</FONT></CODE><LI><CODE><FONT face=新宋体>      if (<A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($para)==0) </FONT></CODE><LI><CODE><FONT face=新宋体>      {</FONT></CODE><LI><CODE><FONT face=新宋体>          $para="=,,";</FONT></CODE><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><CODE><FONT face=新宋体>      if (<A href="http://www.php.net/manual/zh/function.eregi"><U><FONT color=#0000ff>eregi</FONT></U></A>("^=([#]?[[:xdigit:]]{6}|*),(*),(*)", $para, $er_arr))</FONT></CODE><LI><CODE><FONT face=新宋体>      {</FONT></CODE><LI><CODE><FONT face=新宋体>          $color=($er_arr != "") ? $er_arr : red;   // Default Color</FONT></CODE><LI><CODE><FONT face=新宋体>          $width=($er_arr != "") ? $er_arr : 400;   // Default Width</FONT></CODE><LI><CODE><FONT face=新宋体>          $border= ($er_arr != "") ? $er_arr : 5;   // Default Border</FONT></CODE><LI><CODE><FONT face=新宋体>          switch ($start) </FONT></CODE><LI><CODE><FONT face=新宋体>          {</FONT></CODE><LI><CODE><FONT face=新宋体>            case "glow":</FONT></CODE><LI><CODE><FONT face=新宋体>            case "shadow":</FONT></CODE><LI><CODE><FONT face=新宋体>            $rets= <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("&lt;font style=\"FILTER: %s(Color =%s,Strength=%s); width:%s\"&gt;%s&lt;/font&gt;", $start, $color, $border, $width, $value);</FONT></CODE><LI><CODE><FONT face=新宋体>            break;</FONT></CODE><LI><CODE><FONT face=新宋体>            case "blur";</FONT></CODE><LI><CODE><FONT face=新宋体>            $rets= <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("&lt;font style=\"FILTER: %s(Strength=%s);color:%s; width:%s\"&gt;%s&lt;/font&gt;", $start, $border, $color, $width, $value);</FONT></CODE><LI><CODE><FONT face=新宋体>            break;</FONT></CODE><LI><CODE><FONT face=新宋体>            case "wave":</FONT></CODE><LI><CODE><FONT face=新宋体>            $color=($er_arr != "") ? $er_arr : 4;   // Default Color</FONT></CODE><LI><CODE><FONT face=新宋体>            $border= ($er_arr != "") ? $er_arr : 2;   // Default Border</FONT></CODE><LI><CODE><FONT face=新宋体>            $rets= <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("&lt;font style=\"FILTER: %s(Freq=%s, Strength=%s); width:%s\"&gt;%s&lt;/font&gt;", $start, $color, $border, $width, $value);</FONT></CODE><LI><CODE><FONT face=新宋体>            break;</FONT></CODE><LI><CODE><FONT face=新宋体>          }</FONT></CODE><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><CODE><FONT face=新宋体>      return$rets;</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    /*****************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    * 字体颜色 xxx </FONT></CODE><LI><CODE><FONT face=新宋体>    * n 可以是 #xxxxxx 或者 xxxxxx (6位16进制数)</FONT></CODE><LI><CODE><FONT face=新宋体>    * red,greed,blue,black等颜色保留字也有效</FONT></CODE><LI><CODE><FONT face=新宋体>    * 等效与html的&lt;font color=n&gt;xxx&lt;/font&gt;</FONT></CODE><LI><CODE><FONT face=新宋体>    * xxxx等效于 </FONT></CODE><LI><CODE><FONT face=新宋体>    *****************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function color($start, $para, $end, $value){</FONT></CODE><LI><CODE><FONT face=新宋体>      $cl= <A href="http://www.php.net/manual/zh/function.strtolower"><U><FONT color=#0000ff>strtolower</FONT></U></A>(<A href="http://www.php.net/manual/zh/function.substr"><U><FONT color=#0000ff>substr</FONT></U></A>($para, 1));</FONT></CODE><LI><CODE><FONT face=新宋体>      if ($cl == "")</FONT></CODE><LI><CODE><FONT face=新宋体>          $cl= "red";</FONT></CODE><LI><CODE><FONT face=新宋体>      if (<A href="http://www.php.net/manual/zh/function.eregi"><U><FONT color=#0000ff>eregi</FONT></U></A>("(^[#]?[[:xdigit:]]{6})|red|green|blue|yellow|blue|white|gray|brown|silver|purple|orange" ,$cl)) </FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("&lt;font color=%s&gt;%s&lt;/font&gt;",$cl, $value);</FONT></CODE><LI><CODE><FONT face=新宋体>      else</FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s%s]%s[%s]", $start, $para, $value, $end);</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    /*****************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    * 字体大小 xxx 1&lt;= n &lt;= 7;</FONT></CODE><LI><CODE><FONT face=新宋体>    * 等效与html的&lt;font size=n&gt;xxx&lt;/font&gt;</FONT></CODE><LI><CODE><FONT face=新宋体>    *****************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function size($start, $para, $end, $value){</FONT></CODE><LI><CODE><FONT face=新宋体>      $size= <A href="http://www.php.net/manual/zh/function.substr"><U><FONT color=#0000ff>substr</FONT></U></A>($para, 1);</FONT></CODE><LI><CODE><FONT face=新宋体>      if ($size &gt;=1 &amp;&amp; $size &lt;=7 &amp;&amp; (<A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($para) &gt; 1))</FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("&lt;font size=%s&gt;%s&lt;/font&gt;",$size, $value);</FONT></CODE><LI><CODE><FONT face=新宋体>      else</FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s%s]%s[%s]", $start, $para, $value, $end);</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    /*****************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    * 字体名字 n字体名称,不需要引号</FONT></CODE><LI><CODE><FONT face=新宋体>    * 等效与html的&lt;font face=n&gt;xxx&lt;/font&gt;</FONT></CODE><LI><CODE><FONT face=新宋体>    *****************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function face($start, $para, $end, $value){</FONT></CODE><LI><CODE><FONT face=新宋体>      $fn= <A href="http://www.php.net/manual/zh/function.substr"><U><FONT color=#0000ff>substr</FONT></U></A>($para, 1);</FONT></CODE><LI><CODE><FONT face=新宋体>      if (!<A href="http://www.php.net/manual/zh/function.eregi"><U><FONT color=#0000ff>eregi</FONT></U></A>("[[:punct:]]", $fn) &amp;&amp; <A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($para) &gt; 1) {</FONT></CODE><LI><CODE><FONT face=新宋体>          switch (<A href="http://www.php.net/manual/zh/function.strtoupper"><U><FONT color=#0000ff>strtoupper</FONT></U></A>($fn))</FONT></CODE><LI><CODE><FONT face=新宋体>          {</FONT></CODE><LI><CODE><FONT face=新宋体>            case "ST":</FONT></CODE><LI><CODE><FONT face=新宋体>            $fn= "宋体";</FONT></CODE><LI><CODE><FONT face=新宋体>            break;</FONT></CODE><LI><CODE><FONT face=新宋体>            case "HT":</FONT></CODE><LI><CODE><FONT face=新宋体>            $fn= "黑体";</FONT></CODE><LI><CODE><FONT face=新宋体>            break;</FONT></CODE><LI><CODE><FONT face=新宋体>            case "KT":</FONT></CODE><LI><CODE><FONT face=新宋体>            $fn= "楷体_GB2312";</FONT></CODE><LI><CODE><FONT face=新宋体>            break;</FONT></CODE><LI><CODE><FONT face=新宋体>            case "FT":</FONT></CODE><LI><CODE><FONT face=新宋体>            $fn= "仿宋_GB2312";</FONT></CODE><LI><CODE><FONT face=新宋体>            break;</FONT></CODE><LI><CODE><FONT face=新宋体>            case "YY":</FONT></CODE><LI><CODE><FONT face=新宋体>            $fn= "幼圆";</FONT></CODE><LI><CODE><FONT face=新宋体>            break;</FONT></CODE><LI><CODE><FONT face=新宋体>            case "LS":</FONT></CODE><LI><CODE><FONT face=新宋体>            $fn= "隶书";</FONT></CODE><LI><CODE><FONT face=新宋体>            break;</FONT></CODE><LI><CODE><FONT face=新宋体>            case "XST":</FONT></CODE><LI><CODE><FONT face=新宋体>            $fn= "新宋体";</FONT></CODE><LI><CODE><FONT face=新宋体>            break;</FONT></CODE><LI><CODE><FONT face=新宋体>            default:</FONT></CODE><LI><CODE><FONT face=新宋体>            $fn= <A href="http://www.php.net/manual/zh/function.substr"><U><FONT color=#0000ff>substr</FONT></U></A>($para, 1);</FONT></CODE><LI><CODE><FONT face=新宋体>          }</FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("&lt;font face=\"%s\"&gt;%s&lt;/font&gt;",$fn, $value);</FONT></CODE><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><CODE><FONT face=新宋体>      else</FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s%s]%s[%s]", $start, $para, $value, $end);</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>   /*****************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    * 文件上传</FONT></CODE><LI><CODE><FONT face=新宋体>    *****************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function upload($start, $para, $end, $value){</FONT></CODE><LI><CODE><FONT face=新宋体>      $fn= <A href="http://www.php.net/manual/zh/function.trim"><U><FONT color=#0000ff>trim</FONT></U></A>(<A href="http://www.php.net/manual/zh/function.substr"><U><FONT color=#0000ff>substr</FONT></U></A>($para, 1));</FONT></CODE><LI><CODE><FONT face=新宋体>      if (!<A href="http://www.php.net/manual/zh/function.eregi"><U><FONT color=#0000ff>eregi</FONT></U></A>("[[:punct:]]", $fn) &amp;&amp; <A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($para) &gt; 1) {</FONT></CODE><LI><CODE><FONT face=新宋体>            if (<A href="http://www.php.net/manual/zh/function.eregi"><U><FONT color=#0000ff>eregi</FONT></U></A>("jpg|jpeg|bmp|gif|png", $fn)) {</FONT></CODE><LI><CODE><FONT face=新宋体>                if ($this-&gt;checkImgURL($value))</FONT></CODE><LI><CODE><FONT face=新宋体>                  return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("&lt;img src=\"images/%s.gif\" align=\"absmiddle\"&gt; 此主题相关图片如下:&lt;br&gt;&lt;br&gt;&lt;a href=\"%s\" target=\"_blank\"&gt;&lt;img src=\"%s\" border=0 alt=\"从新窗口中浏览\"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br&gt;",$fn,$value,$value);</FONT></CODE><LI><CODE><FONT face=新宋体>                else </FONT></CODE><LI><CODE><FONT face=新宋体>                  return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s%s]%s[%s]", $start, $para, $value, $end);    </FONT></CODE><LI><CODE><FONT face=新宋体>            } elseif ($fn == "swf") {</FONT></CODE><LI><CODE><FONT face=新宋体>                return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("&lt;center&gt;&lt;img src=\"images/%s.gif\" align=\"absmiddle\"&gt; 此主题相关Flash:&lt;br&gt;&lt;br&gt;&lt;PARAM NAME=PLAY VALUE=TRUE&gt;&lt;PARAM NAME=LOOP VALUE=TRUE&gt;&lt;PARAM NAME=QUALITY VALUE=HIGH&gt;&lt;embed src=\"%s\" quality=high width=\"500\" height=\"300\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\"&gt;&lt;/embed&gt;&lt;br&gt;&lt;a href=\"%s\" class=\"small\" target=_blank&gt;全屏欣赏&lt;/a&gt; (点右键-&gt;另存为可将动画下载)&lt;/center&gt;",$fn,$value,$value);</FONT></CODE><LI><CODE><FONT face=新宋体>            } elseif (<A href="http://www.php.net/manual/zh/function.eregi"><U><FONT color=#0000ff>eregi</FONT></U></A>("rar|zip|doc", $fn)) {</FONT></CODE><LI><CODE><FONT face=新宋体>                return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("&lt;img src=\"images/%s.gif\" align=\"absmiddle\"&gt; &lt;a href=\"%s\" class=\"small\" target=_blank&gt;点击下载此主题相关附件&lt;/a&gt;&lt;br&gt;",$fn,$value);</FONT></CODE><LI><CODE><FONT face=新宋体>            }</FONT></CODE><LI><CODE><FONT face=新宋体>      } else </FONT></CODE><LI><CODE><FONT face=新宋体>            return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s%s]%s[%s]", $start, $para, $value, $end);            </FONT></CODE><LI><CODE><FONT face=新宋体>    }   </FONT></CODE><LI><CODE><FONT face=新宋体>    /*****************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    * 调试代码标签</FONT></CODE><LI><CODE><FONT face=新宋体>    *****************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function html($start, $para, $end, $value)</FONT></CODE><LI><LI><CODE><FONT face=新宋体>    {</FONT></CODE><LI><CODE><FONT face=新宋体>      if (<A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($value) &gt; 0) {</FONT></CODE><LI><CODE><FONT face=新宋体>          $value = <A href="http://www.php.net/manual/zh/function.eregi_replace"><U><FONT color=#0000ff>eregi_replace</FONT></U></A>('&lt;br[[:space:]]*/?[[:space:]]*&gt;', "", $value);</FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("&lt;br&gt;&lt;span&gt;&lt;textarea cols=70 rows=10 class=\"code\"&gt;%s&lt;/textarea&gt;&lt;br&gt;&lt;input type=button value=\" 运行代码 \" onclick='runCode()' class=\"special\"&gt; &lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;br&gt;",$value);</FONT></CODE><LI><CODE><FONT face=新宋体>      } else {</FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s]%s[%s]", $start, $value, $end);</FONT></CODE><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    /*****************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    * 引用标签</FONT></CODE><LI><CODE><FONT face=新宋体>    *****************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function quote($start, $para, $end, $value)</FONT></CODE><LI><CODE><FONT face=新宋体>    {</FONT></CODE><LI><CODE><FONT face=新宋体>      if (<A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($value) &gt; 0) {</FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("&lt;table width=\"100%%\" align=center border=1 bordercolor=\"#AAAAAA\"&gt;&lt;tr bgcolor=\"#EAEAEA\"&gt;&lt;td class=view&gt;&lt;font color=\"#000099\"&gt;&lt;b&gt;以下为引用内容:&lt;/b&gt;&lt;/font&gt;&lt;br&gt;&lt;font color=\"#000066\"&gt;%s&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;",$value);</FONT></CODE><LI><CODE><FONT face=新宋体>      } else {</FONT></CODE><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s]%s[%s]", $start, $value, $end);</FONT></CODE><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    /*****************************************************</FONT></CODE><LI><CODE><FONT face=新宋体>    * FLASH</FONT></CODE><LI><CODE><FONT face=新宋体>    *****************************************************/</FONT></CODE><LI><CODE><FONT face=新宋体>    function swf($start, $para, $end, $value)</FONT></CODE><LI><LI><CODE><FONT face=新宋体>    {</FONT></CODE><LI><LI><CODE><FONT face=新宋体>      if (<A href="http://www.php.net/manual/zh/function.strlen"><U><FONT color=#0000ff>strlen</FONT></U></A>($value) &gt; 0) {</FONT></CODE><LI><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A> ("&lt;br&gt;&lt;center&gt;&lt;PARAM NAME=PLAY VALUE=TRUE&gt;&lt;PARAM NAME=LOOP VALUE=TRUE&gt;&lt;PARAM NAME=QUALITY VALUE=HIGH&gt;&lt;embed src=\"%s\" quality=high width=\"500\" height=\"300\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\"&gt;&lt;/embed&gt;&lt;br&gt;&lt;a href=\"%s\" class=\"small\" target=_blank&gt;全屏欣赏&lt;/a&gt; (点右键-&gt;另存为可将动画下载)&lt;/center&gt;",$value,$value);</FONT></CODE><LI><LI><CODE><FONT face=新宋体>      } else {</FONT></CODE><LI><LI><CODE><FONT face=新宋体>          return <A href="http://www.php.net/manual/zh/function.sprintf"><U><FONT color=#0000ff>sprintf</FONT></U></A>("[%s]%s[%s]", $start, $value, $end);</FONT></CODE><LI><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><LI><CODE><FONT face=新宋体>}</FONT></CODE><LI><CODE><FONT face=新宋体>?&gt;</FONT></CODE></LI></OL>
页: [1]
查看完整版本: PHP操作ubb代码类