*/
class OutputPage {
var $mMetatags = array(), $mKeywords = array(), $mLinktags = array();
+ var $mExtStyles = array();
var $mPagetitle = '', $mBodytext = '', $mDebugtext = '';
var $mHTMLtitle = '', $mIsarticle = true, $mPrintable = false;
var $mSubtitle = '', $mRedirect = '', $mStatusCode;
'href' => $wgStylePath . '/' . $style . '?' . $wgStyleVersion,
'type' => 'text/css' ) );
}
+
+ function addExtensionStyle( $url ) {
+ $linkarr = array( 'rel' => 'stylesheet', 'href' => $url, 'type' => 'text/css' );
+ array_push( $this->mExtStyles, $linkarr );
+ }
/**
* Add a JavaScript file out of skins/common, or a given relative path.
} else {
$path = "{$wgStylePath}/common/{$file}";
}
- $encPath = htmlspecialchars( $path );
$this->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$path?$wgStyleVersion\"></script>\n" );
}
# $linkarr should be an associative array of attributes. We'll escape on output.
array_push( $this->mLinktags, $linkarr );
}
+
+ # Get all links added by extensions
+ function getExtStyle() {
+ return $this->mExtStyles;
+ }
function addMetadataLink( $linkarr ) {
# note: buggy CC software only reads first "meta" link
$ret .= "<link rel='stylesheet' type='text/css' $media href='$printsheet' />\n";
$sk = $wgUser->getSkin();
+ // Load order here is key
$ret .= $sk->getHeadScripts( $this->mAllowUserJs );
$ret .= $this->mScripts;
+ $ret .= $sk->getSiteStyles();
+ foreach( $this->mExtStyles as $tag ) {
+ $ret .= Xml::element( 'link', $tag ) . "\n";
+ }
$ret .= $sk->getUserStyles();
$ret .= $this->getHeadItems();
$wgRequest->getVal( 'wpEditToken' ) );
}
- # get the user/site-specific stylesheet, SkinTemplate loads via RawPage.php (settings are cached that way)
- function getUserStylesheet() {
- global $wgStylePath, $wgRequest, $wgContLang, $wgSquidMaxage, $wgStyleVersion;
+ /**
+ * Get the site-specific stylesheet, SkinTemplate loads via RawPage.php (settings are cached that way)
+ */
+ function getSiteStylesheet() {
+ global $wgStylePath, $wgContLang, $wgStyleVersion;
$sheet = $this->getStylesheet();
$s = "@import \"$wgStylePath/common/shared.css?$wgStyleVersion\";\n";
$s .= "@import \"$wgStylePath/common/oldshared.css?$wgStyleVersion\";\n";
$s .= "@import \"$wgStylePath/$sheet?$wgStyleVersion\";\n";
- if($wgContLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css?$wgStyleVersion\";\n";
+ if( $wgContLang->isRTL() )
+ $s .= "@import \"$wgStylePath/common/common_rtl.css?$wgStyleVersion\";\n";
+ return "$s\n";
+ }
+ /**
+ * Get the user-specific stylesheet, SkinTemplate loads via RawPage.php (settings are cached that way)
+ */
+ function getUserStylesheet() {
+ global $wgContLang, $wgSquidMaxage, $wgStyleVersion;
$query = "usemsgcache=yes&action=raw&ctype=text/css&smaxage=$wgSquidMaxage";
- $s .= '@import "' . self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI ) . "\";\n" .
- '@import "' . self::makeNSUrl( ucfirst( $this->getSkinName() . '.css' ), $query, NS_MEDIAWIKI ) . "\";\n";
-
+ $s = '@import "' . self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI ) . "\";\n";
+ $s .= '@import "' . self::makeNSUrl( ucfirst( $this->getSkinName() . '.css' ), $query, NS_MEDIAWIKI ) . "\";\n";
$s .= $this->doGetUserStyles();
- return $s."\n";
+ return "$s\n";
}
/**
return $s;
}
+ /**
+ * Return html code that include site stylesheets
+ */
+ function getSiteStyles() {
+ $s = "<style type='text/css'>\n";
+ $s .= "/*/*/ /*<![CDATA[*/\n"; # <-- Hide the styles from Netscape 4 without hiding them from IE/Mac
+ $s .= $this->getSiteStylesheet();
+ $s .= "/*]]>*/ /* */\n";
+ $s .= "</style>\n";
+ return $s;
+ }
+
/**
* Return html code that include User stylesheets
*/
}
$this->usercss = $this->userjs = $this->userjsprev = false;
- $this->setupUserCss();
+ $this->setupUserCss( $out->getExtStyle() );
$this->setupUserJs( $out->isUserJsAllowed() );
$this->titletxt = $this->mTitle->getPrefixedText();
wfProfileOut( __METHOD__."-stuff" );
/**
* @private
*/
- function setupUserCss() {
+ function setupUserCss( $extCSS = array() ) {
global $wgRequest, $wgAllowUserCss, $wgUseSiteCss, $wgContLang, $wgSquidMaxage, $wgStylePath, $wgUser;
wfProfileIn( __METHOD__ );
$siteargs['smaxage'] = '0';
$siteargs['ts'] = $wgUser->mTouched;
}
+
+ // Add any extension CSS
+ foreach( $extCSS as $tag ) {
+ $this->addStyle( $tag['href'] );
+ }
// If we use the site's dynamic CSS, throw that in, too
// Per-site custom styles