From: Alexandre Emsenhuber Date: Mon, 4 Aug 2008 18:07:36 +0000 (+0000) Subject: Add declaration of $links in SkinTemplate::buildCssLinks() X-Git-Tag: 1.31.0-rc.0~46143 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=e1ada36d7234e9e3915aa4bb607f8eb30a05740c;p=lhc%2Fweb%2Fwiklou.git Add declaration of $links in SkinTemplate::buildCssLinks() --- diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index cd1568f84c..0f16c694e2 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -86,7 +86,7 @@ class SkinTemplate extends Skin { * will actually fill the template. */ var $template; - + /** * An array of stylesheet filenames (relative from skins path), with options * for CSS media, IE conditions, and RTL/LTR direction. @@ -108,7 +108,7 @@ class SkinTemplate extends Skin { $this->skinname = 'monobook'; $this->stylename = 'monobook'; $this->template = 'QuickTemplate'; - + $this->addStyle( 'common/shared.css', 'screen' ); $this->addStyle( 'common/commonPrint.css', 'print' ); } @@ -964,7 +964,7 @@ class SkinTemplate extends Skin { */ function setupUserCss() { global $wgRequest, $wgAllowUserCss, $wgUseSiteCss, $wgContLang, $wgSquidMaxage, $wgStylePath, $wgUser; - + wfProfileIn( __METHOD__ ); $siteargs = array( @@ -1004,7 +1004,7 @@ class SkinTemplate extends Skin { # if we're previewing the CSS page, use it if( $this->mTitle->isCssSubpage() && $this->userCanPreview( $action ) ) { $previewCss = $wgRequest->getText('wpTextbox1'); - + /// @fixme properly escape the cdata! $this->usercss = "/*styles as $file => $options ) { $link = $this->styleLink( $file, $options ); if( $link ) $links[] = $link; } - + return implode( "\n\t\t", $links ); } - + protected function styleLink( $style, $options ) { global $wgRequest; - + if( isset( $options['dir'] ) ) { global $wgContLang; $siteDir = $wgContLang->isRTL() ? 'rtl' : 'ltr'; if( $siteDir != $options['dir'] ) return ''; } - + if( isset( $options['media'] ) ) { $media = $this->transformCssMedia( $options['media'] ); if( is_null( $media ) ) { @@ -1146,7 +1147,7 @@ class SkinTemplate extends Skin { } else { $media = ''; } - + if( substr( $style, 0, 1 ) == '/' || substr( $style, 0, 5 ) == 'http:' || substr( $style, 0, 6 ) == 'https:' ) { @@ -1155,7 +1156,7 @@ class SkinTemplate extends Skin { global $wgStylePath, $wgStyleVersion; $url = $wgStylePath . '/' . $style . '?' . $wgStyleVersion; } - + $attribs = array( 'rel' => 'stylesheet', 'href' => $url, @@ -1172,10 +1173,10 @@ class SkinTemplate extends Skin { } return $link; } - + function transformCssMedia( $media ) { global $wgRequest, $wgHandheldForIPhone; - + // Switch in on-screen display for media testing $switches = array( 'printable' => 'print', @@ -1190,19 +1191,19 @@ class SkinTemplate extends Skin { } } } - + // Expand longer media queries as iPhone doesn't grok 'handheld' if( $wgHandheldForIPhone ) { $mediaAliases = array( 'screen' => 'screen and (min-device-width: 481px)', 'handheld' => 'handheld, only screen and (max-device-width: 480px)', ); - + if( isset( $mediaAliases[$media] ) ) { $media = $mediaAliases[$media]; } } - + return $media; }