--- inc/global.php 2001/09/19 12:23:56 1.11
+++ inc/global.php 2001/09/19 14:16:34 1.12
@@ -23,24 +23,22 @@
strtr(MyUpper($b), $slova, $weights));
}
- function nonl($str, $start, $end, $log = false) {
+ function my_replace($str, $start, $end, $pat = "", $rep = "") {
+ if (!$pat) $pat = '\s*(\r\n?|\n\r?)';
$idx1 = $idx2 = -1;
while (true) {
- $idx1 = strpos(strtoupper($str), $start, $idx1 + 1);
- $idx2 = strpos(strtoupper($str), $end, $idx2 + 1);
+ $str2 = strtoupper($str);
+ $idx1 = strpos($str2, $start, $idx1 + 1);
if ($idx1 === false) break;
+ $idx2 = strpos($str2, $end, $idx2 + 1);
if ($idx2 === false) break;
if ($idx1 > $idx2) break;
$idx2 += strlen($end);
- $str = substr($str, 0, $idx1).preg_replace('/\s*(\r\n?|\n\r?)/m', '',
- substr($str, $idx1, $idx2 - $idx1)).substr($str,
- $idx2, strlen($str) - $idx2);
-if ($log) {
-echo "[$idx1] [$idx2]
\n";
-echo "1: [".substr($str, 0, $idx1)."]
\n";
-echo "2: [".substr($str, $idx1, $idx2 - $idx1)."]
\n";
-echo "3: [".substr($str, $idx2, strlen($str) - $idx2)."]
\n";
-}
+ $str1 = substr($str, 0, $idx1);
+ $str2 = preg_replace('/'.$pat.'/m', $rep,
+ substr($str, $idx1, $idx2 - $idx1));
+ $str3 = substr($str, $idx2, strlen($str) - $idx2);
+ $str = $str1.$str2.$str3;
}
return $str;
}
@@ -52,22 +50,10 @@
'\$allowed,false)?"\1":HTMLSpecialChars("\1")', $str);
$str = preg_replace('/(\<\s*A\b)/i', '\\1 target=_blank class=more', $str);
$str = preg_replace('/(\<\s*TABLE\b)/i', '\\1 class=normal', $str);
- $str = nonl($str, "