Revision 490
Added by Matthias over 17 years ago
functions.php | ||
---|---|---|
341 | 341 |
// Function as replecement for php's htmlspecialchars() |
342 | 342 |
function my_htmlspecialchars($string) { |
343 | 343 |
$string = preg_replace("/&(?=[#a-z0-9]+;)/i", "_x_", $string); |
344 |
$string = strtr($string, array("<"=>"<", ">"=>">", "&"=>"&", "\""=>""", "\'"=>"'"));
|
|
344 |
$string = strtr($string, array("<"=>"<", ">"=>">", "&"=>"&", "\""=>""", "\'"=>"'")); |
|
345 | 345 |
$string = preg_replace("/_x_(?=[#a-z0-9]+;)/i", "&", $string); |
346 | 346 |
return($string); |
347 | 347 |
} |
... | ... | |
431 | 431 |
} |
432 | 432 |
} |
433 | 433 |
} else { |
434 |
$string = strtr($string, array("<"=>"&_lt;", ">"=>"&_gt;", "&"=>"&_amp;", """=>"&_quot;", "'"=>"&_#039;"));
|
|
434 |
$string = strtr($string, array("<"=>"&_lt;", ">"=>"&_gt;", "&"=>"&_amp;", """=>"&_quot;", "'"=>"&_#39;"));
|
|
435 | 435 |
$string=mb_convert_encoding($string, $charset_out, $charset_in); |
436 |
$string = strtr($string, array("&_lt;"=>"<", "&_gt;"=>">", "&_amp;"=>"&", "&_quot;"=>""", "&_#039;"=>"'"));
|
|
436 |
$string = strtr($string, array("&_lt;"=>"<", "&_gt;"=>">", "&_amp;"=>"&", "&_quot;"=>""", "&_#39;"=>"'"));
|
|
437 | 437 |
} |
438 | 438 |
return $string; |
439 | 439 |
} |
... | ... | |
613 | 613 |
); |
614 | 614 |
|
615 | 615 |
if ($in == 'HTML-ENTITIES') { |
616 |
$string = strtr($string, array('''=>''')); // fix a broken entity |
|
616 | 617 |
$string = strtr($string, $named_to_numbered_entities); |
617 | 618 |
$string = preg_replace("/&#([0-9]+);/e", "code_to_utf8($1)", $string); |
618 | 619 |
} |
Also available in: Unified diff
Fixed issue with escaped single and double quotes in search result (Thanks to thorn)