X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSanitizer.php;h=96193a74af73436fef701096c0a7f9f87adc0e43;hb=2d563cf587efb97c87be23feea65537d54cfcaa9;hp=f215f5f1d6813b14e63997b1f841be036523b2da;hpb=a985acd573f19b7fd36d9d4c18783401e710c3e9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index f215f5f1d6..96193a74af 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -573,27 +573,25 @@ class Sanitizer { } else { # this might be possible using tidy itself foreach ( $bits as $x ) { - preg_match( self::ELEMENT_BITS_REGEX, $x, $regs ); - - wfSuppressWarnings(); - list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs; - wfRestoreWarnings(); + if ( preg_match( self::ELEMENT_BITS_REGEX, $x, $regs ) ) { + list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs; - $badtag = false; - if ( isset( $htmlelements[$t = strtolower( $t )] ) ) { - if ( is_callable( $processCallback ) ) { - call_user_func_array( $processCallback, array( &$params, $args ) ); - } + $badtag = false; + if ( isset( $htmlelements[$t = strtolower( $t )] ) ) { + if ( is_callable( $processCallback ) ) { + call_user_func_array( $processCallback, array( &$params, $args ) ); + } - if ( !Sanitizer::validateTag( $params, $t ) ) { - $badtag = true; - } + if ( !Sanitizer::validateTag( $params, $t ) ) { + $badtag = true; + } - $newparams = Sanitizer::fixTagAttributes( $params, $t ); - if ( !$badtag ) { - $rest = str_replace( '>', '>', $rest ); - $text .= "<$slash$t$newparams$brace$rest"; - continue; + $newparams = Sanitizer::fixTagAttributes( $params, $t ); + if ( !$badtag ) { + $rest = str_replace( '>', '>', $rest ); + $text .= "<$slash$t$newparams$brace$rest"; + continue; + } } } $text .= '<' . str_replace( '>', '>', $x ); @@ -865,7 +863,7 @@ class Sanitizer { $value = preg_replace_callback( '/[!-[]-z]/u', // U+FF01 to U+FF5A, excluding U+FF3C (bug 58088) function ( $matches ) { - $cp = utf8ToCodepoint( $matches[0] ); + $cp = UtfNormal\Utils::utf8ToCodepoint( $matches[0] ); if ( $cp === false ) { return ''; } @@ -971,7 +969,7 @@ class Sanitizer { // Line continuation return ''; } elseif ( $matches[2] !== '' ) { - $char = codepointToUtf8( hexdec( $matches[2] ) ); + $char = UtfNormal\Utils::codepointToUtf8( hexdec( $matches[2] ) ); } elseif ( $matches[3] !== '' ) { $char = $matches[3]; } else { @@ -1452,9 +1450,9 @@ class Sanitizer { */ static function decodeChar( $codepoint ) { if ( Sanitizer::validateCodepoint( $codepoint ) ) { - return codepointToUtf8( $codepoint ); + return UtfNormal\Utils::codepointToUtf8( $codepoint ); } else { - return UTF8_REPLACEMENT; + return UtfNormal\Constants::UTF8_REPLACEMENT; } } @@ -1471,7 +1469,7 @@ class Sanitizer { $name = self::$htmlEntityAliases[$name]; } if ( isset( self::$htmlEntities[$name] ) ) { - return codepointToUtf8( self::$htmlEntities[$name] ); + return UtfNormal\Utils::codepointToUtf8( self::$htmlEntities[$name] ); } else { return "&$name;"; }