X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FOutputHandler.php;h=2dc373201103ee38f375d2c508d2478ed90fe3ec;hb=537bc1df7d20002d05667436a9b21dc2e43a6927;hp=39716ca0b4ee7c98824015ece877cce24344b80a;hpb=ff9f2fa33719753ff0c708f9b4a84c57593b9e58;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/OutputHandler.php b/includes/OutputHandler.php index 39716ca0b4..2dc3732011 100644 --- a/includes/OutputHandler.php +++ b/includes/OutputHandler.php @@ -154,15 +154,15 @@ function wfGzipHandler( $s ) { */ function wfMangleFlashPolicy( $s ) { # Avoid weird excessive memory usage in PCRE on big articles - if ( preg_match( '/\<\s*cross-domain-policy\s*\>/i', $s ) ) { - return preg_replace( '/\<\s*cross-domain-policy\s*\>/i', '', $s ); + if ( preg_match( '/\<\s*cross-domain-policy(?=\s|\>)/i', $s ) ) { + return preg_replace( '/\<(\s*)(cross-domain-policy(?=\s|\>))/i', '<$1NOT-$2', $s ); } else { return $s; } } /** - * Add a Content-Length header if possible. This makes it cooperate with squid better. + * Add a Content-Length header if possible. This makes it cooperate with CDN better. * * @param int $length */ @@ -183,7 +183,6 @@ function wfDoContentLength( $length ) { * @return string */ function wfHtmlValidationHandler( $s ) { - $errors = ''; if ( MWTidy::checkErrors( $s, $errors ) ) { return $s; @@ -195,13 +194,13 @@ function wfHtmlValidationHandler( $s ) { $out .= Html::openElement( 'ul' ); $error = strtok( $errors, "\n" ); - $badLines = array(); + $badLines = []; while ( $error !== false ) { if ( preg_match( '/^line (\d+)/', $error, $m ) ) { $lineNum = intval( $m[1] ); $badLines[$lineNum] = true; $out .= Html::rawElement( 'li', null, - Html::element( 'a', array( 'href' => "#line-{$lineNum}" ), $error ) ) . "\n"; + Html::element( 'a', [ 'href' => "#line-{$lineNum}" ], $error ) ) . "\n"; } $error = strtok( "\n" ); } @@ -212,7 +211,7 @@ function wfHtmlValidationHandler( $s ) { $line = strtok( $s, "\n" ); $i = 1; while ( $line !== false ) { - $attrs = array(); + $attrs = []; if ( isset( $badLines[$i] ) ) { $attrs['class'] = 'highlight'; $attrs['id'] = "line-$i"; @@ -228,7 +227,7 @@ function wfHtmlValidationHandler( $s ) { li { white-space: pre } CSS; - $out = Html::htmlHeader( array( 'lang' => 'en', 'dir' => 'ltr' ) ) . + $out = Html::htmlHeader( [ 'lang' => 'en', 'dir' => 'ltr' ] ) . Html::rawElement( 'head', null, Html::element( 'title', null, 'HTML validation error' ) . Html::inlineStyle( $style ) ) .