$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 );
- # 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";
+ $this->addStyle( self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI ) );
+ $this->addStyle( self::makeNSUrl( ucfirst( $this->skinname ) . '.css', $query, NS_MEDIAWIKI ),
+ 'screen' );
}
// Per-user styles based on preferences
$siteargs['gen'] = 'css';
- if( ( $us = $wgRequest->getVal( 'useskin', '' ) ) !== '' ) {
+ if( ( $us = $wgRequest->getVal( 'useskin', '' ) ) !== '' )
$siteargs['useskin'] = $us;
- }
- $prefcss = '@import "' . self::makeUrl( '-', wfArrayToCGI( $siteargs ) ) . '";' . "\n";
+ $this->addStyle( self::makeUrl( '-', wfArrayToCGI( $siteargs ) ), 'screen' );
// 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 = "/*<![CDATA[*/\n" . $sitecss . $prefcss . $usercss . $previewCss . "/*]]>*/";
+
+ /// @fixme properly escape the cdata!
+ $this->usercss = "/*<![CDATA[*/\n" .
+ $previewCss .
+ "/*]]>*/";
} else {
- $usercss .= '@import "' . self::makeUrl($this->userpage .'/'.$this->skinname .'.css',
- 'action=raw&ctype=text/css') . '";' . "\n";
- $this->usercss = "/*<![CDATA[*/\n" . $sitecss . $prefcss . $usercss . '/*]]>*/';
+ $this->addStyle( self::makeUrl($this->userpage . '/'.$this->skinname.'.css',
+ 'action=raw&ctype=text/css'), 'screen' );
}
- } else {
- $this->usercss = "/*<![CDATA[*/\n" . $sitecss . $prefcss . '/*]]>*/';
}
wfProfileOut( __METHOD__ );