summaryrefslogtreecommitdiff
path: root/includes/parser/ParserOutput.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/parser/ParserOutput.php')
-rw-r--r--includes/parser/ParserOutput.php63
1 files changed, 30 insertions, 33 deletions
diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php
index f98d5641..35cb5c92 100644
--- a/includes/parser/ParserOutput.php
+++ b/includes/parser/ParserOutput.php
@@ -5,25 +5,26 @@
*/
class ParserOutput
{
- var $mText, # The output text
- $mLanguageLinks, # List of the full text of language links, in the order they appear
- $mCategories, # Map of category names to sort keys
- $mContainsOldMagic, # Boolean variable indicating if the input contained variables like {{CURRENTDAY}}
- $mCacheTime, # Time when this object was generated, or -1 for uncacheable. Used in ParserCache.
- $mVersion, # Compatibility check
- $mTitleText, # title text of the chosen language variant
- $mLinks, # 2-D map of NS/DBK to ID for the links in the document. ID=zero for broken.
- $mTemplates, # 2-D map of NS/DBK to ID for the template references. ID=zero for broken.
- $mTemplateIds, # 2-D map of NS/DBK to rev 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
- $mNewSection, # Show a new section link?
- $mNoGallery, # No gallery on category page? (__NOGALLERY__)
- $mHeadItems, # Items to put in the <head> section
- $mOutputHooks, # Hook tags as per $wgParserOutputHooks
- $mWarnings, # Warning text to be returned to the user. Wikitext formatted, in the key only
- $mSections, # Table of contents
- $mProperties; # Name/value pairs to be cached in the DB
+ var $mText, # The output text
+ $mLanguageLinks, # List of the full text of language links, in the order they appear
+ $mCategories, # Map of category names to sort keys
+ $mContainsOldMagic, # Boolean variable indicating if the input contained variables like {{CURRENTDAY}}
+ $mTitleText, # title text of the chosen language variant
+ $mCacheTime = '', # Time when this object was generated, or -1 for uncacheable. Used in ParserCache.
+ $mVersion = Parser::VERSION, # Compatibility check
+ $mLinks = array(), # 2-D map of NS/DBK to ID for the links in the document. ID=zero for broken.
+ $mTemplates = array(), # 2-D map of NS/DBK to ID for the template references. ID=zero for broken.
+ $mTemplateIds = array(), # 2-D map of NS/DBK to rev ID for the template references. ID=zero for broken.
+ $mImages = array(), # DB keys of the images used, in the array key only
+ $mExternalLinks = array(), # External link URLs, in the key only
+ $mNewSection = false, # Show a new section link?
+ $mNoGallery = false, # No gallery on category page? (__NOGALLERY__)
+ $mHeadItems = array(), # Items to put in the <head> section
+ $mOutputHooks = array(), # Hook tags as per $wgParserOutputHooks
+ $mWarnings = array(), # Warning text to be returned to the user. Wikitext formatted, in the key only
+ $mSections = array(), # Table of contents
+ $mProperties = array(); # Name/value pairs to be cached in the DB
+ private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change.
/**
* Overridden title for display
@@ -37,21 +38,7 @@ class ParserOutput
$this->mLanguageLinks = $languageLinks;
$this->mCategories = $categoryLinks;
$this->mContainsOldMagic = $containsOldMagic;
- $this->mCacheTime = '';
- $this->mVersion = Parser::VERSION;
$this->mTitleText = $titletext;
- $this->mSections = array();
- $this->mLinks = array();
- $this->mTemplates = array();
- $this->mImages = array();
- $this->mExternalLinks = array();
- $this->mNewSection = false;
- $this->mNoGallery = false;
- $this->mHeadItems = array();
- $this->mTemplateIds = array();
- $this->mOutputHooks = array();
- $this->mWarnings = array();
- $this->mProperties = array();
}
function getText() { return $this->mText; }
@@ -69,6 +56,7 @@ class ParserOutput
function getSubtitle() { return $this->mSubtitle; }
function getOutputHooks() { return (array)$this->mOutputHooks; }
function getWarnings() { return array_keys( $this->mWarnings ); }
+ function getIndexPolicy() { return $this->mIndexPolicy; }
function containsOldMagic() { return $this->mContainsOldMagic; }
function setText( $text ) { return wfSetVar( $this->mText, $text ); }
@@ -78,6 +66,7 @@ class ParserOutput
function setCacheTime( $t ) { return wfSetVar( $this->mCacheTime, $t ); }
function setTitleText( $t ) { return wfSetVar( $this->mTitleText, $t ); }
function setSections( $toc ) { return wfSetVar( $this->mSections, $toc ); }
+ function setIndexPolicy( $policy ) { return wfSetVar( $this->mIndexPolicy, $policy ); }
function addCategory( $c, $sort ) { $this->mCategories[$c] = $sort; }
function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; }
@@ -98,6 +87,14 @@ class ParserOutput
function addLink( $title, $id = null ) {
$ns = $title->getNamespace();
$dbk = $title->getDBkey();
+ if ( $ns == NS_MEDIA ) {
+ // Normalize this pseudo-alias if it makes it down here...
+ $ns = NS_FILE;
+ } elseif( $ns == NS_SPECIAL ) {
+ // We don't record Special: links currently
+ // It might actually be wise to, but we'd need to do some normalization.
+ return;
+ }
if ( !isset( $this->mLinks[$ns] ) ) {
$this->mLinks[$ns] = array();
}