PHP 解析纺织

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 解析纺织相关的知识,希望对你有一定的参考价值。

if (!function_exists('parse_textile')) {

   function parse_textile($content, $safe_tags = '<a>, <b>, <i>, <u>, <blockquote>, <code>') {

      $content = ' ' . trim($content) . ' ';

      $modifiers = Array('\*\*'=>'b', '\__'=>'i', '\*'=>'strong', '\_'=>'em', '\-'=>'del', '\?\?'=>'cite', '%'=>'span', '\+'=>'ins', '\^'=>'sup', '\~'=>'sub', '@'=>'code');

      $content = strip_tags($content, $safe_tags);

      $content = ereg_replace('([[:space:]])"[[:<:]](.*)[[:>:]]"([[:space:]])', '\1“\2”\3', $content);

      $content = ereg_replace('([)([[:alnum:]]){1,5}(])', '<sup><a href="#fn\1">\1</a></sup>', $content);

      $content = ereg_replace('(<p>)(fn([[:alnum:]]){1,}. )([[:alnum:][:punct:][:space:]]+)(<\/p>)', '<p id="fn\3">\4</p>', $content);

      $content = str_replace(Array('--', '...', ' x ', '(TM)', '(R)', '(C)'), Array('—', '…', ' × ', '™', '®', '©'), $content);

      while (list($key, $value) = @each($modifiers)) {
         $content = ereg_replace('([[:space:]])' . $key . '([[:alnum:]\(\)\*_-~\\+\\^!?\.<\\/>]{1,}([[:alnum:][:space:]\(\)\*_-~\\+\\^!?\.<\\/>"]+)?)' . $key, '\1<' . $value . '>\2</' . $value . '>', $content);
      }

      $content = ereg_replace('([[:alnum:]]+)(\()+([[:alnum:][:space:]]+)(\))', '<acronym title="\3">\1</acronym>', $content);

      $content = ereg_replace('([[:space:]])((http://)[[:alnum:][:punct:]]+)([[:space:]])?', '\1<a href="\2" rel="nofollow">\2</a>\4', $content);

      $content = str_replace("\n", "<br />\n", trim($content));

      return $content;

   }

}

以上是关于PHP 解析纺织的主要内容,如果未能解决你的问题,请参考以下文章

激发整个纺织品 - 许多小文件

迷你纺织品类

纺织行业系统_纺织行业ERP哪个好

指点纺织行业管理系统软件

纺织品后整理中dwr和wr的区别是啥

数商云纺织服装智能经销商管理系统:提升纺织服装企业决策效率,实现经高效协同