From 94452df8dc076e41fb74a4845f03167f9e20754f Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 9 Aug 2008 18:24:06 +0000 Subject: [PATCH] Tweak css load order (broken for extensions since r38116) --- includes/SkinTemplate.php | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 89b0f690d8..249ec1a348 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -982,41 +982,42 @@ class SkinTemplate extends Skin { $siteargs['ts'] = $wgUser->mTouched; } + $sitecss = $usercss = ''; // If we use the site's dynamic CSS, throw that in, too // Per-site custom styles - if ( $wgUseSiteCss ) { + if( $wgUseSiteCss ) { $query = wfArrayToCGI( array( 'usemsgcache' => 'yes', 'ctype' => 'text/css', 'smaxage' => $wgSquidMaxage ) + $siteargs ); - $this->addStyle( self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI ) ); - $this->addStyle( self::makeNSUrl( ucfirst( $this->skinname ) . '.css', $query, NS_MEDIAWIKI ), - 'screen' ); + # Site settings must override extension css! (bug 15025) + $sitecss .= '@import "' . self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI) . '";' . "\n"; + $sitecss .= '@import "' . self::makeNSUrl( ucfirst( $this->skinname ) . '.css', $query, NS_MEDIAWIKI ) . '";' . "\n"; } // Per-user styles based on preferences $siteargs['gen'] = 'css'; - if( ( $us = $wgRequest->getVal( 'useskin', '' ) ) !== '' ) + if( ( $us = $wgRequest->getVal( 'useskin', '' ) ) !== '' ) { $siteargs['useskin'] = $us; - $this->addStyle( self::makeUrl( '-', wfArrayToCGI( $siteargs ) ), 'screen' ); + } + $prefcss = '@import "' . self::makeUrl( '-', wfArrayToCGI( $siteargs ) ) . '";' . "\n"; // Per-user custom style pages - if ( $wgAllowUserCss && $this->loggedin ) { + if( $wgAllowUserCss && $this->loggedin ) { $action = $wgRequest->getVal('action'); - - # if we're previewing the CSS page, use it + # 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 = "/**/"; + // @FIXME: properly escape the cdata! + $this->usercss = "/**/"; } else { - $this->addStyle( self::makeUrl($this->userpage . '/'.$this->skinname.'.css', - 'action=raw&ctype=text/css'), 'screen' ); + $usercss .= '@import "' . self::makeUrl($this->userpage .'/'.$this->skinname .'.css', + 'action=raw&ctype=text/css') . '";' . "\n"; + $this->usercss = "/**/'; } + } else { + $this->usercss = "/**/'; } wfProfileOut( __METHOD__ ); -- 2.20.1