X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FOutputHandler.php;h=5104a1ab042ef5b9d2c4dbd5132459bba721da54;hb=42333412833ab7f7515e193b83a909921c34887d;hp=6b40c3076e28d1d113dd213016f6babefdef54e6;hpb=24535f19b3a3085b30b3e2f67a6b9d35dabc024e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/OutputHandler.php b/includes/OutputHandler.php index 6b40c3076e..5104a1ab04 100644 --- a/includes/OutputHandler.php +++ b/includes/OutputHandler.php @@ -64,10 +64,10 @@ function wfOutputHandler( $s ) { */ function wfRequestExtension() { /// @todo FIXME: this sort of dupes some code in WebRequest::getRequestUrl() - if( isset( $_SERVER['REQUEST_URI'] ) ) { + if ( isset( $_SERVER['REQUEST_URI'] ) ) { // Strip the query string... list( $path ) = explode( '?', $_SERVER['REQUEST_URI'], 2 ); - } elseif( isset( $_SERVER['SCRIPT_NAME'] ) ) { + } elseif ( isset( $_SERVER['SCRIPT_NAME'] ) ) { // Probably IIS. QUERY_STRING appears separately. $path = $_SERVER['SCRIPT_NAME']; } else { @@ -76,7 +76,7 @@ function wfRequestExtension() { } $period = strrpos( $path, '.' ); - if( $period !== false ) { + if ( $period !== false ) { return strtolower( substr( $path, $period ) ); } return ''; @@ -91,17 +91,17 @@ function wfRequestExtension() { * @return string */ function wfGzipHandler( $s ) { - if( !function_exists( 'gzencode' ) ) { + if ( !function_exists( 'gzencode' ) ) { wfDebug( __FUNCTION__ . "() skipping compression (gzencode unavailable)\n" ); return $s; } - if( headers_sent() ) { + if ( headers_sent() ) { wfDebug( __FUNCTION__ . "() skipping compression (headers already sent)\n" ); return $s; } $ext = wfRequestExtension(); - if( $ext == '.gz' || $ext == '.tgz' ) { + if ( $ext == '.gz' || $ext == '.tgz' ) { // Don't do gzip compression if the URL path ends in .gz or .tgz // This confuses Safari and triggers a download of the page, // even though it's pretty clearly labeled as viewable HTML. @@ -109,7 +109,7 @@ function wfGzipHandler( $s ) { return $s; } - if( wfClientAcceptsGzip() ) { + if ( wfClientAcceptsGzip() ) { wfDebug( __FUNCTION__ . "() is compressing output\n" ); header( 'Content-Encoding: gzip' ); $s = gzencode( $s, 6 ); @@ -177,20 +177,8 @@ function wfHtmlValidationHandler( $s ) { header( 'Cache-Control: no-cache' ); - $out = << - - -HTML validation error - - - -

HTML validation error

-'; - $out .= '
' . htmlspecialchars( $errors ) . '
'; - $out .= "
    \n"; + $out .= Html::closeElement( 'ul' ); + $out .= Html::element( 'pre', null, $errors ); + $out .= Html::openElement( 'ol' ) . "\n"; $line = strtok( $s, "\n" ); $i = 1; while ( $line !== false ) { + $attrs = array(); if ( isset( $badLines[$i] ) ) { - $out .= "
  1. "; - } else { - $out .= '
  2. '; + $attrs['class'] = 'highlight'; + $attrs['id'] = "line-$i"; } - $out .= htmlspecialchars( $line ) . "
  3. \n"; + $out .= Html::element( 'li', $attrs, $line ) . "\n"; $line = strtok( "\n" ); $i++; } - $out .= '
'; + $out .= Html::closeElement( 'ol' ); + + $style = << 'en', 'dir' => 'ltr' ) ) . + Html::rawElement( 'head', null, + Html::element( 'title', null, 'HTML validation error' ) . + Html::inlineStyle( $style ) ) . + Html::rawElement( 'body', null, $out ) . + Html::closeElement( 'html' ); + return $out; }