+ /**
+ * @private
+ */
+ function setupUserCss( OutputPage $out ) {
+ global $wgRequest, $wgContLang, $wgUser;
+ global $wgAllowUserCss, $wgUseSiteCss, $wgSquidMaxage, $wgStylePath;
+
+ wfProfileIn( __METHOD__ );
+
+ $this->setupSkinUserCss( $out );
+
+ $siteargs = array(
+ 'action' => 'raw',
+ 'maxage' => $wgSquidMaxage,
+ );
+
+ // Add any extension CSS
+ foreach( $out->getExtStyle() as $tag ) {
+ $out->addStyle( $tag['href'] );
+ }
+
+ // If we use the site's dynamic CSS, throw that in, too
+ // Per-site custom styles
+ if( $wgUseSiteCss ) {
+ global $wgHandheldStyle;
+ $query = wfArrayToCGI( array(
+ 'usemsgcache' => 'yes',
+ 'ctype' => 'text/css',
+ 'smaxage' => $wgSquidMaxage
+ ) + $siteargs );
+ # Site settings must override extension css! (bug 15025)
+ $out->addStyle( self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI ) );
+ $out->addStyle( self::makeNSUrl( 'Print.css', $query, NS_MEDIAWIKI ), 'print' );
+ if( $wgHandheldStyle ) {
+ $out->addStyle( self::makeNSUrl( 'Handheld.css', $query, NS_MEDIAWIKI ), 'handheld' );
+ }
+ $out->addStyle( self::makeNSUrl( $this->getSkinName() . '.css', $query, NS_MEDIAWIKI ) );
+ }
+
+ if( $wgUser->isLoggedIn() ) {
+ // Ensure that logged-in users' generated CSS isn't clobbered
+ // by anons' publicly cacheable generated CSS.
+ $siteargs['smaxage'] = '0';
+ $siteargs['ts'] = $wgUser->mTouched;
+ }
+ // Per-user styles based on preferences
+ $siteargs['gen'] = 'css';
+ if( ( $us = $wgRequest->getVal( 'useskin', '' ) ) !== '' ) {
+ $siteargs['useskin'] = $us;
+ }
+ $out->addStyle( self::makeUrl( '-', wfArrayToCGI( $siteargs ) ) );
+
+ // Per-user custom style pages
+ if( $wgAllowUserCss && $wgUser->isLoggedIn() ) {
+ $action = $wgRequest->getVal('action');
+ # 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" . $previewCss . "/*]]>*/";
+ } else {
+ $out->addStyle( self::makeUrl($this->userpage . '/' . $this->getSkinName() .'.css',
+ 'action=raw&ctype=text/css' ) );
+ }
+ }
+
+ wfProfileOut( __METHOD__ );
+ }
+
+ /**
+ * Add skin specific stylesheets
+ * @param $out OutputPage
+ */
+ function setupSkinUserCss( OutputPage $out ) {
+ $out->addStyle( 'common/shared.css' );
+ $out->addStyle( 'common/oldshared.css' );
+ $out->addStyle( $this->getStylesheet() );
+ $out->addStyle( 'common/common_rtl.css', '', '', 'rtl' );
+ }
+