]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-21026 improved entity handling
authorPetr Skoda <skodak@moodle.org>
Wed, 2 Dec 2009 21:08:45 +0000 (21:08 +0000)
committerPetr Skoda <skodak@moodle.org>
Wed, 2 Dec 2009 21:08:45 +0000 (21:08 +0000)
lib/weblib.php

index 37c148f505c0da0a74a1e352d8cb22a0ebec3205..d175fcc6d7927c77dff56964c152c01b1dc50364 100644 (file)
@@ -1149,8 +1149,8 @@ function wikify_links($string) {
  * @return string
  */
 function fix_non_standard_entities($string) {
-    $text = preg_replace('/(&#[0-9]+)(;?)/', '$1;', $string);
-    $text = preg_replace('/(&#x[0-9a-fA-F]+)(;?)/', '$1;', $text);
+    $text = preg_replace('/&#0*([0-9]+);?/', '&#$1;', $string);
+    $text = preg_replace('/&#x0*([0-9a-fA-F]+);?/', '&#x$1;', $text);
     return $text;
 }