- /**
- * @private
- */
- function setupUserCss() {
- $fname = 'SkinTemplate::setupUserCss';
- wfProfileIn( $fname );
-
- global $wgRequest, $wgAllowUserCss, $wgUseSiteCss, $wgContLang, $wgSquidMaxage, $wgStylePath, $wgUser;
-
- $sitecss = '';
- $usercss = '';
- $siteargs = '&maxage=' . $wgSquidMaxage;
- if( $this->loggedin ) {
- // Ensure that logged-in users' generated CSS isn't clobbered
- // by anons' publicly cacheable generated CSS.
- $siteargs .= '&smaxage=0';
- }
-
- # Add user-specific code if this is a user and we allow that kind of thing
-
- if ( $wgAllowUserCss && $this->loggedin ) {
- $action = $wgRequest->getText('action');
-
- # if we're previewing the CSS page, use it
- if( $this->mTitle->isCssSubpage() and $this->userCanPreview( $action ) ) {
- $siteargs = "&smaxage=0&maxage=0";
- $usercss = $wgRequest->getText('wpTextbox1');
- } else {
- $usercss = '@import "' .
- self::makeUrl($this->userpage . '/'.$this->skinname.'.css',
- 'action=raw&ctype=text/css') . '";' ."\n";
- }
-
- $siteargs .= '&ts=' . $wgUser->mTouched;
- }
-
- if( $wgContLang->isRTL() ) {
- global $wgStyleVersion;
- $sitecss .= "@import \"$wgStylePath/$this->stylename/rtl.css?$wgStyleVersion\";\n";
- }
-
- # If we use the site's dynamic CSS, throw that in, too
- if ( $wgUseSiteCss ) {
- $query = "usemsgcache=yes&action=raw&ctype=text/css&smaxage=$wgSquidMaxage";
- $skinquery = '';
- if (($us = $wgRequest->getVal('useskin', '')) !== '')
- $skinquery = "&useskin=$us";
- $sitecss .= '@import "' . self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI) . '";' . "\n";
- $sitecss .= '@import "' . self::makeNSUrl( ucfirst( $this->skinname ) . '.css', $query, NS_MEDIAWIKI ) . '";' . "\n";
- $sitecss .= '@import "' . self::makeUrl( '-', "action=raw&gen=css$siteargs$skinquery" ) . '";' . "\n";
- }
-
- # If we use any dynamic CSS, make a little CDATA block out of it.
-
- if ( !empty($sitecss) || !empty($usercss) ) {
- $this->usercss = "/*<![CDATA[*/\n" . $sitecss . $usercss . '/*]]>*/';
- }
- wfProfileOut( $fname );
- }
-