From: Alexandre Emsenhuber Date: Mon, 28 Jul 2008 19:10:13 +0000 (+0000) Subject: * Per talk with brion, use wfArrayToCGI()\n* Avoid blank lines between CSS X-Git-Tag: 1.31.0-rc.0~46323 X-Git-Url: https://git.cyclocoop.org/%27%20.%20%24this-%3EgetSkin%28%29-%3EescapeSearchLink%28%29%20.%20%27?a=commitdiff_plain;h=62251d416d4a304deb51308801dcf7a97bdfc0e1;p=lhc%2Fweb%2Fwiklou.git * Per talk with brion, use wfArrayToCGI()\n* Avoid blank lines between CSS --- diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 886809acde..cd1568f84c 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -959,17 +959,6 @@ class SkinTemplate extends Skin { return $this->mTitle->getNamespaceKey(); } - /** - * Callback to get args for CSS query string, a bit like wfArrayTpCGI, but - * does not escape args - * - * @param $val - * @param $key - */ - static function cssWalkCallback( &$val, $key ){ - $val = "$key=$val"; - } - /** * @private */ @@ -992,15 +981,13 @@ class SkinTemplate extends Skin { // If we use the site's dynamic CSS, throw that in, too // Per-site custom styles if ( $wgUseSiteCss ) { - $query = array( + $query = wfArrayToCGI( array( 'usemsgcache' => 'yes', 'ctype' => 'text/css', 'smaxage' => $wgSquidMaxage - ) + $siteargs; - array_walk( $query, array( __CLASS__, 'cssWalkCallback' ) ); - $queryString = implode( '&', $query ); - $this->addStyle( self::makeNSUrl( 'Common.css', $queryString, NS_MEDIAWIKI ) ); - $this->addStyle( self::makeNSUrl( ucfirst( $this->skinname ) . '.css', $queryString, NS_MEDIAWIKI ), + ) + $siteargs ); + $this->addStyle( self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI ) ); + $this->addStyle( self::makeNSUrl( ucfirst( $this->skinname ) . '.css', $query, NS_MEDIAWIKI ), 'screen' ); } @@ -1008,8 +995,7 @@ class SkinTemplate extends Skin { $siteargs['gen'] = 'css'; if( ( $us = $wgRequest->getVal( 'useskin', '' ) ) !== '' ) $siteargs['useskin'] = $us; - array_walk( $siteargs, array( __CLASS__, 'cssWalkCallback' ) ); - $this->addStyle( self::makeUrl( '-', implode( '&', $siteargs ) ), 'screen' ); + $this->addStyle( self::makeUrl( '-', wfArrayToCGI( $siteargs ) ), 'screen' ); // Per-user custom style pages if ( $wgAllowUserCss && $this->loggedin ) { @@ -1134,7 +1120,9 @@ class SkinTemplate extends Skin { */ protected function buildCssLinks() { foreach( $this->styles as $file => $options ) { - $links[] = $this->styleLink( $file, $options ); + $link = $this->styleLink( $file, $options ); + if( $link ) + $links[] = $link; } return implode( "\n\t\t", $links );