$this->mParserOptions = null;
$this->mSquidMaxage = 0;
$this->mScripts = '';
+ $this->mHeadItems = array();
$this->mETag = false;
$this->mRevisionId = null;
$this->mNewSectionLink = false;
$this->mScripts .= "<script type=\"$wgJsMimeType\">/*<![CDATA[*/\n$script\n/*]]>*/</script>";
}
- function getScript() { return $this->mScripts; }
+ function getScript() {
+ return $this->mScripts . $this->getHeadItems();
+ }
+
+ function getHeadItems() {
+ $s = '';
+ foreach ( $this->mHeadItems as $item ) {
+ $s .= $item;
+ }
+ return $s;
+ }
+
function setETag($tag) { $this->mETag = $tag; }
function setArticleBodyOnly($only) { $this->mArticleBodyOnly = $only; }
$this->mSubtitle .= $parserOutput->mSubtitle ;
}
$this->mNoGallery = $parserOutput->getNoGallery();
+ $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->mHeadItems );
wfRunHooks( 'OutputPageParserOutput', array( &$this, $parserOutput ) );
}
$ret .= $sk->getHeadScripts();
$ret .= $this->mScripts;
$ret .= $sk->getUserStyles();
+ $ret .= $this->getHeadItems();
if ($wgUseTrackbacks && $this->isArticleRelated())
$ret .= $wgTitle->trackbackRDF();
$mTemplates, # 2-D map of NS/DBK to ID for the template references. ID=zero for broken.
$mImages, # DB keys of the images used, in the array key only
$mExternalLinks, # External link URLs, in the key only
- $mHTMLtitle, # Display HTML title
- $mSubtitle, # Additional subtitle
- $mNewSection, # Show a new section link?
- $mNoGallery; # No gallery on category page? (__NOGALLERY__)
+ $mHTMLtitle, # Display HTML title
+ $mSubtitle, # Additional subtitle
+ $mNewSection, # Show a new section link?
+ $mNoGallery, # No gallery on category page? (__NOGALLERY__)
+ $mHeadItems; # Items to put in the <head> section
function ParserOutput( $text = '', $languageLinks = array(), $categoryLinks = array(),
$containsOldMagic = false, $titletext = '' )
$this->mSubtitle = "" ;
$this->mNewSection = false;
$this->mNoGallery = false;
+ $this->mHeadItems = array();
}
function getText() { return $this->mText; }
!isset( $this->mVersion ) ||
version_compare( $this->mVersion, Parser::VERSION, "lt" );
}
+
+ /**
+ * Add some text to the <head>.
+ * If $tag is set, the section with that tag will only be included once
+ * in a given page.
+ */
+ function addHeadItem( $section, $tag = false ) {
+ if ( $tag !== false ) {
+ $this->mHeadItems[$tag] = $section;
+ } else {
+ $this->mHeadItems[] = $section;
+ }
+ }
}
?>