首頁 >後端開發 >php教程 >轉換ubb程式碼的一個函數

轉換ubb程式碼的一個函數

WBOY
WBOY原創
2016-07-25 09:11:161112瀏覽
  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(""),$content);
  12. $content = eregi_replace(quotemeta("[i]"),quotemeta(""),$content);
  13. $content = eregi_replace(quotemeta("[/i]"),quotemeta(""),$content);
  14. $content = eregi_replace(quotemeta("[u]"),quotemeta(""),$content);
  15. $content = eregi_replace(quotemeta("[/u]"),quotemeta(""),$content);
  16. $content = eregi_replace(quotemeta("[center]"),quotemeta("
    "),$content);
  17. $content = eregi_replace(quotemeta("[/center]"),quotemeta(""),$content);
  18. $content = eregi_replace(quotemeta("[quote]"),quotemeta("
    引用:

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

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

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

    "),$content); $content = eregi_replace("\[images\]([^\[]*)\[/images\]","轉換ubb程式碼的一個函數",$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 腳本', $content); 返回$內容; }[/code]


陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn