23 |
strtr(MyUpper($b), $slova, $weights)); |
strtr(MyUpper($b), $slova, $weights)); |
24 |
} |
} |
25 |
|
|
26 |
function nonl($str, $start, $end, $log = false) { |
function my_replace($str, $start, $end, $pat = "", $rep = "") { |
27 |
|
if (!$pat) $pat = '\s*(\r\n?|\n\r?)'; |
28 |
$idx1 = $idx2 = -1; |
$idx1 = $idx2 = -1; |
29 |
while (true) { |
while (true) { |
30 |
$idx1 = strpos(strtoupper($str), $start, $idx1 + 1); |
$str2 = strtoupper($str); |
31 |
$idx2 = strpos(strtoupper($str), $end, $idx2 + 1); |
$idx1 = strpos($str2, $start, $idx1 + 1); |
32 |
if ($idx1 === false) break; |
if ($idx1 === false) break; |
33 |
|
$idx2 = strpos($str2, $end, $idx2 + 1); |
34 |
if ($idx2 === false) break; |
if ($idx2 === false) break; |
35 |
if ($idx1 > $idx2) break; |
if ($idx1 > $idx2) break; |
36 |
$idx2 += strlen($end); |
$idx2 += strlen($end); |
37 |
$str = substr($str, 0, $idx1).preg_replace('/\s*(\r\n?|\n\r?)/m', '', |
$str1 = substr($str, 0, $idx1); |
38 |
substr($str, $idx1, $idx2 - $idx1)).substr($str, |
$str2 = preg_replace('/'.$pat.'/m', $rep, |
39 |
$idx2, strlen($str) - $idx2); |
substr($str, $idx1, $idx2 - $idx1)); |
40 |
if ($log) { |
$str3 = substr($str, $idx2, strlen($str) - $idx2); |
41 |
echo "<BIG>[$idx1] [$idx2]</BIG><BR>\n"; |
$str = $str1.$str2.$str3; |
|
echo "<BIG>1:</BIG> [".substr($str, 0, $idx1)."]<BR>\n"; |
|
|
echo "<BIG>2:</BIG> [".substr($str, $idx1, $idx2 - $idx1)."]<BR>\n"; |
|
|
echo "<BIG>3:</BIG> [".substr($str, $idx2, strlen($str) - $idx2)."]<BR>\n"; |
|
|
} |
|
42 |
} |
} |
43 |
return $str; |
return $str; |
44 |
} |
} |
50 |
'\$allowed,false)?"\1":HTMLSpecialChars("\1")', $str); |
'\$allowed,false)?"\1":HTMLSpecialChars("\1")', $str); |
51 |
$str = preg_replace('/(\<\s*A\b)/i', '\\1 target=_blank class=more', $str); |
$str = preg_replace('/(\<\s*A\b)/i', '\\1 target=_blank class=more', $str); |
52 |
$str = preg_replace('/(\<\s*TABLE\b)/i', '\\1 class=normal', $str); |
$str = preg_replace('/(\<\s*TABLE\b)/i', '\\1 class=normal', $str); |
53 |
$str = nonl($str, "<TABLE", "/TABLE>"); |
$str = my_replace($str, "<TABLE", "/TABLE>"); |
54 |
$str = nonl($str, "<UL", "/UL>", true); |
$str = my_replace($str, "<UL", "/UL>", true); |
55 |
$str = nonl($str, "<OL", "/OL>"); |
$str = my_replace($str, "<OL", "/OL>"); |
56 |
if (!$full) { |
if (!$full) my_replace($str, "<", ">", '"', "'|'"); |
|
$idx1 = $idx2 = -1; |
|
|
while (true) { |
|
|
$idx1 = strpos($str, "<", $idx1 + 1); |
|
|
$idx2 = strpos($str, ">", $idx2 + 1); |
|
|
if ($idx1 === false) break; |
|
|
if ($idx2 === false) break; |
|
|
if ($idx1 > $idx2) break; |
|
|
$str = substr($str, 0, $idx1).str_replace('"', "'|'", |
|
|
substr($str, $idx1, $idx2 - $idx1)).substr($str, |
|
|
$idx2, strlen($str) - $idx2); |
|
|
} |
|
|
} |
|
57 |
$str = str_replace('"', """, $str); |
$str = str_replace('"', """, $str); |
58 |
if (!$full) $str = str_replace("'|'", '"', $str); |
if (!$full) $str = str_replace("'|'", '"', $str); |
59 |
return $str; |
return $str; |