Rumah >pembangunan bahagian belakang >tutorial php >转换ubb代码的一个函数

转换ubb代码的一个函数

WBOY
WBOYasal
2016-07-25 09:11:161112semak imbas
  1. unction ubb2html($content)
  2. {
  3. global $article;
  4. //是否自动识别
  5. if ($article['isparseurl'] == "1")
  6. {
  7. $content = parseurl($content);
  8. }
  9. //自动识别结束
  10. $content = eregi_replace(quotemeta("[b]"),quotemeta(""),$content);
  11. $content = eregi_replace(quotemeta("[/b]"),quotemeta("
  12. "),$content);
  13. $content = eregi_replace(quotemeta("[i]"),quotemeta(""),$content);
  14. $content = eregi_replace(quotemeta("[/i]"),quotemeta("
  15. "),$content);
  16. $content = eregi_replace(quotemeta("[u]"),quotemeta(""),$content);
  17. $content = eregi_replace(quotemeta("[/u]"),quotemeta("
  18. "),$content);
  19. $content = eregi_replace(quotemeta("[center]"),quotemeta("
    "),$content);
  20. $content = eregi_replace(quotemeta("[/center]"),quotemeta("
  21. "),$content);
  22. $content = eregi_replace(quotemeta("[quote]"),quotemeta("
    引用:

    "),$content);
  23. $content = eregi_replace(quotemeta("[/quote]"),quotemeta("

  24. "),$content);
  25. $content = eregi_replace(quotemeta("[code]"),quotemeta("
    代码:

    "),$content);
  26. $content = eregi_replace(quotemeta("复制代码"),quotemeta("

  27. "),$content); $content = eregi_replace("\\[images\\]([^\\[]*)\\[/images\\]","转换ubb代码的一个函数 screen.width-333)this.width=screen.width-333\" title=\"用新窗口浏览原始图片\">",$content); $content = eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]", "www.\\1",$content); $content = eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","\\1",$content); $content = eregi_replace("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]","\\2",$content); $content = eregi_replace("\\[email\\]([^\\[]*)\\[/email\\]", "\\1",$content); //$content = preg_replace( '/javascript/i', 'java script', $content); return $content; }[/code]


Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn