[SPIP] ~maj v3.0.14-->v3.0.17
[ptitvelo/web/www.git] / www / plugins-dist / textwheel / engine / textwheel.php
index 8421860..b473407 100644 (file)
@@ -164,7 +164,7 @@ class TextWheel {
                }
 
                # optimization: strpos or stripos?
-               if (isset($rule->strpos)) {
+               if (isset($rule->if_str)) {
                        if (strtolower($rule->if_str) !== strtoupper($rule->if_str)) {
                                $rule->if_stri = $rule->if_str;
                                unset($rule->if_str);
@@ -253,18 +253,19 @@ class TextWheel {
                if (isset($rule->if_chars) AND (strpbrk($t, $rule->if_chars) === false))
                        return;
 
-               if (isset($rule->if_str) AND strpos($t, $rule->if_str) === false)
-                       return;
-
-               if (isset($rule->if_stri) AND stripos($t, $rule->if_str) === false)
-                       return;
-
                if (isset($rule->if_match) AND !preg_match($rule->if_match, $t))
                        return;
 
+               // init rule before testing if_str / if_stri as they are optimized by initRule
                if (!isset($rule->func_replace))
                        $this->initRule($rule);
 
+               if (isset($rule->if_str) AND strpos($t, $rule->if_str) === false)
+                       return;
+
+               if (isset($rule->if_stri) AND stripos($t, $rule->if_stri) === false)
+                       return;
+
                $func = $rule->func_replace;
                TextWheel::$func($rule->match,$rule->replace,$t,$count);
        }
@@ -497,7 +498,7 @@ class TextWheelDebug extends TextWheel {
                                $total += $t;
                                if(intval($t*10))
                                        echo "<tr>
-                                       <td class='number strong'>".number_format(round($t*10)/10,1)."</td><td> ".htmlspecialchars($r)."</td>
+                                       <td class='number strong'>".number_format(round($t*10)/10,1)."</td><td> ".spip_htmlspecialchars($r)."</td>
                                        <td"
                                        . (!$applications ? " class='zero'" : "")
                                        .">".$applications."/".intval(TextWheelDebug::$w[$r])."</td>
@@ -528,7 +529,7 @@ class TextWheelDebug extends TextWheel {
                        } else {
                                echo "<tr class='prof-$profondeur'>
                                        <td class='number'><b>".intval($duree)."</b>&nbsp;ms</td>
-                                       <td class='name'>".htmlspecialchars($cause)."</td>
+                                       <td class='name'>".spip_htmlspecialchars($cause)."</td>
                                        </tr>\n";
                        }
                }