}
# 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);
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);
}
$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>
} else {
echo "<tr class='prof-$profondeur'>
<td class='number'><b>".intval($duree)."</b> ms</td>
- <td class='name'>".htmlspecialchars($cause)."</td>
+ <td class='name'>".spip_htmlspecialchars($cause)."</td>
</tr>\n";
}
}