OSDN Git Service

BugTrack/779: Simplify strip_htmltag(): Don't compute so many
authorhenoheno <henoheno>
Fri, 6 May 2005 12:35:21 +0000 (21:35 +0900)
committerhenoheno <henoheno>
Fri, 6 May 2005 12:35:21 +0000 (21:35 +0900)
lib/html.php

index 2abd40b..4dad592 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: html.php,v 1.34 2005/04/30 05:21:00 henoheno Exp $
+// $Id: html.php,v 1.35 2005/05/06 12:35:21 henoheno Exp $
 // Copyright (C)
 //   2002-2005 PukiWiki Developers Team
 //   2001-2002 Originally written by yu-ji
@@ -312,12 +312,15 @@ function make_line_rules($str)
 function strip_htmltag($str)
 {
        global $_symbol_noexists;
+       static $noexists_pattern;
 
-       $noexists_pattern = '#<span class="noexists">([^<]*)<a[^>]+>' .
-               preg_quote($_symbol_noexists, '#') . '</a></span>#';
+       if (! isset($noexists_pattern))
+               $noexists_pattern = '#<span class="noexists">([^<]*)<a[^>]+>' .
+                       preg_quote($_symbol_noexists, '#') . '</a></span>#';
 
        $str = preg_replace($noexists_pattern, '$1', $str);
        //$str = preg_replace('/<a[^>]+>\?<\/a>/', '', $str);
+
        return preg_replace('/<[^>]+>/', '', $str);
 }