X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSanitizer.php;h=11c30a25912e6b49f839780bc659890ff015efdc;hb=df96347d4761f2c9b9a522024c880b1fb520f04a;hp=bca2f67e91386be4a76d2d06f7a0a17e0fb883fc;hpb=4ffe4ca50b44eed5846ea9947d8ab4ad9877dbe2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index bca2f67e91..11c30a2591 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -510,15 +510,12 @@ class Sanitizer { $newparams = ''; } else { # Keep track for later - if ( isset( $tabletags[$t] ) && - !in_array( 'table', $tagstack ) ) { + if ( isset( $tabletags[$t] ) && !in_array( 'table', $tagstack ) ) { $badtag = true; - } elseif ( in_array( $t, $tagstack ) && - !isset( $htmlnest[$t] ) ) { + } elseif ( in_array( $t, $tagstack ) && !isset( $htmlnest[$t] ) ) { $badtag = true; # Is it a self closed htmlpair ? (bug 5487) - } elseif ( $brace == '/>' && - isset( $htmlpairs[$t] ) ) { + } elseif ( $brace == '/>' && isset( $htmlpairs[$t] ) ) { $badtag = true; } elseif ( isset( $htmlsingleonly[$t] ) ) { # Hack to force empty tag for unclosable elements @@ -530,8 +527,7 @@ class Sanitizer { # the tag stack so that we can match end tags # instead of marking them as bad. array_push( $tagstack, $t ); - } elseif ( isset( $tabletags[$t] ) - && in_array( $t, $tagstack ) ) { + } elseif ( isset( $tabletags[$t] ) && in_array( $t, $tagstack ) ) { // New table tag but forgot to close the previous one $text .= ""; } else { @@ -1120,14 +1116,14 @@ class Sanitizer { $id = preg_replace( '/[ \t\n\r\f_\'"&#%]+/', '_', $id ); $id = trim( $id, '_' ); if ( $id === '' ) { - # Must have been all whitespace to start with. + // Must have been all whitespace to start with. return '_'; } else { return $id; } } - # HTML4-style escaping + // HTML4-style escaping static $replace = array( '%3A' => ':', '%' => '.' @@ -1136,8 +1132,7 @@ class Sanitizer { $id = urlencode( strtr( $id, ' ', '_' ) ); $id = str_replace( array_keys( $replace ), array_values( $replace ), $id ); - if ( !preg_match( '/^[a-zA-Z]/', $id ) - && !in_array( 'noninitial', $options ) ) { + if ( !preg_match( '/^[a-zA-Z]/', $id ) && !in_array( 'noninitial', $options ) ) { // Initial character must be a letter! $id = "x$id"; } @@ -1368,8 +1363,7 @@ class Sanitizer { static function normalizeEntity( $name ) { if ( isset( self::$htmlEntityAliases[$name] ) ) { return '&' . self::$htmlEntityAliases[$name] . ';'; - } elseif ( in_array( $name, - array( 'lt', 'gt', 'amp', 'quot' ) ) ) { + } elseif ( in_array( $name, array( 'lt', 'gt', 'amp', 'quot' ) ) ) { return "&$name;"; } elseif ( isset( self::$htmlEntities[$name] ) ) { return '&#' . self::$htmlEntities[$name] . ';'; @@ -1861,7 +1855,7 @@ class Sanitizer { */ public static function validateEmail( $addr ) { $result = null; - if ( !wfRunHooks( 'isValidEmailAddr', array( $addr, &$result ) ) ) { + if ( !Hooks::run( 'isValidEmailAddr', array( $addr, &$result ) ) ) { return $result; }