MediaWiki
REL1_22
|
Public Member Functions | |
__construct ($text= '', $languageLinks=array(), $categoryLinks=array(), $containsOldMagic=false, $titletext= '') | |
addCategory ($c, $sort) | |
addExternalLink ($url) | |
addHeadItem ($section, $tag=false) | |
Add some text to the "<head>". | |
addImage ($name, $timestamp=null, $sha1=null) | |
Register a file dependency for this output. | |
addInterwikiLink ($title) | |
addLanguageLink ($t) | |
addLink (Title $title, $id=null) | |
Record a local or interwiki inline link for saving in future link tables. | |
addModuleMessages ($modules) | |
addModules ($modules) | |
addModuleScripts ($modules) | |
addModuleStyles ($modules) | |
addOutputHook ($hook, $data=false) | |
addOutputPageMetadata (OutputPage $out) | |
Copy items from the OutputPage object into this one. | |
addSecondaryDataUpdate (DataUpdate $update) | |
Adds an update job to the output. | |
addTemplate ($title, $page_id, $rev_id) | |
Register a template dependency for this output. | |
addWarning ($s) | |
& | getCategories () |
getCategoryLinks () | |
getDisplayTitle () | |
Get the title to be used for display. | |
getEditSectionTokens () | |
getExtensionData ($key) | |
Gets extensions data previously attached to this ParserOutput using setExtensionData(). | |
& | getExternalLinks () |
& | getFileSearchOptions () |
getFlag ($flag) | |
getHeadItems () | |
getHideNewSection () | |
& | getImages () |
getIndexPolicy () | |
getInterwikiLinks () | |
& | getLanguageLinks () |
getLimitReportData () | |
& | getLinks () |
getModuleMessages () | |
getModules () | |
getModuleScripts () | |
getModuleStyles () | |
getNewSection () | |
getNoGallery () | |
getOutputHooks () | |
getProperties () | |
getProperty ($name) | |
getSecondaryDataUpdates (Title $title=null, $recursive=true) | |
Returns any DataUpdate jobs to be executed in order to store secondary information extracted from the page's content, including a LinksUpdate object for all links stored in this ParserOutput object. | |
getSections () | |
& | getTemplateIds () |
& | getTemplates () |
getText () | |
getTimeSinceStart ($clock) | |
Returns the time since resetParseStartTime() was last called. | |
getTimestamp () | |
getTitleText () | |
getTOCEnabled () | |
getTOCHTML () | |
getUsedOptions () | |
Returns the options from its ParserOptions which have been taken into account to produce this output or false if not available. | |
getWarnings () | |
hideNewSection ($value) | |
preventClickjacking ($flag=null) | |
Get or set the prevent-clickjacking flag. | |
recordOption ($option) | |
Callback passed by the Parser to the ParserOptions to keep track of which options are used. | |
replaceEditSectionLinksCallback ($m) | |
callback used by getText to replace editsection tokens | |
resetParseStartTime () | |
Resets the parse start timestamps for future calls to getTimeSinceStart() | |
setCategoryLinks ($cl) | |
setDisplayTitle ($text) | |
Override the title to be used for display. | |
setEditSectionTokens ($t) | |
setExtensionData ($key, $value) | |
Attaches arbitrary data to this ParserObject. | |
setFlag ($flag) | |
Fairly generic flag setter thingy. | |
setIndexPolicy ($policy) | |
setLanguageLinks ($ll) | |
setLimitReportData ($key, $value) | |
Sets parser limit report data for a key. | |
setNewSection ($value) | |
setProperty ($name, $value) | |
Set a property to be stored in the page_props database table. | |
setSections ($toc) | |
setText ($text) | |
setTimestamp ($timestamp) | |
setTitleText ($t) | |
setTOCEnabled ($flag) | |
setTOCHTML ($tochtml) | |
Static Public Member Functions | |
static | isLinkInternal ($internal, $url) |
Checks, if a url is pointing to the own server. | |
Public Attributes | |
$mCategories | |
$mEditSectionTokens = false | |
$mExternalLinks = array() | |
$mFileSearchOptions = array() | |
$mHeadItems = array() | |
$mHideNewSection = false | |
$mImages = array() | |
$mInterwikiLinks = array() | |
$mLanguageLinks | |
$mLinks = array() | |
$mModuleMessages = array() | |
$mModules = array() | |
$mModuleScripts = array() | |
$mModuleStyles = array() | |
$mNewSection = false | |
$mNoGallery = false | |
$mOutputHooks = array() | |
$mProperties = array() | |
$mSections = array() | |
$mTemplateIds = array() | |
$mTemplates = array() | |
$mText | |
$mTimestamp | |
$mTitleText | |
$mTOCEnabled = true | |
$mTOCHTML = '' | |
$mWarnings = array() | |
const | EDITSECTION_REGEX = '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#' |
Static Private Member Functions | |
static | getTimes ($clock=null) |
Private Attributes | |
$mAccessedOptions = array() | |
$mExtensionData = array() | |
$mIndexPolicy = '' | |
$mLimitReportData = array() | |
$mParseStartTime = array() | |
$mPreventClickjacking = false | |
$mSecondaryDataUpdates = array() |
Definition at line 24 of file ParserOutput.php.
ParserOutput::__construct | ( | $ | text = '' , |
$ | languageLinks = array() , |
||
$ | categoryLinks = array() , |
||
$ | containsOldMagic = false , |
||
$ | titletext = '' |
||
) |
Definition at line 62 of file ParserOutput.php.
ParserOutput::addCategory | ( | $ | c, |
$ | sort | ||
) |
Definition at line 158 of file ParserOutput.php.
References $sort.
ParserOutput::addExternalLink | ( | $ | url | ) |
Definition at line 197 of file ParserOutput.php.
References global.
ParserOutput::addHeadItem | ( | $ | section, |
$ | tag = false |
||
) |
Add some text to the "<head>".
If $tag is set, the section with that tag will only be included once in a given page.
Definition at line 298 of file ParserOutput.php.
References $section.
ParserOutput::addImage | ( | $ | name, |
$ | timestamp = null , |
||
$ | sha1 = null |
||
) |
Register a file dependency for this output.
string | $name | Title dbKey |
string | $timestamp | MW timestamp of file creation (or false if non-existing) |
string | $sha1 | base 36 SHA-1 of file (or false if non-existing) |
Definition at line 251 of file ParserOutput.php.
References $name, $timestamp, and array().
ParserOutput::addInterwikiLink | ( | $ | title | ) |
$title | Title object, must be an interwiki link |
MWException | if given invalid input |
Definition at line 282 of file ParserOutput.php.
Definition at line 159 of file ParserOutput.php.
References $t.
ParserOutput::addLink | ( | Title $ | title, |
$ | id = null |
||
) |
Record a local or interwiki inline link for saving in future link tables.
$title | Title object |
$id | Mixed: optional known page_id so we can skip the lookup |
Definition at line 216 of file ParserOutput.php.
References array(), Title\getArticleID(), Title\getDBkey(), Title\getNamespace(), and Title\isExternal().
ParserOutput::addModuleMessages | ( | $ | modules | ) |
Definition at line 318 of file ParserOutput.php.
References array().
ParserOutput::addModules | ( | $ | modules | ) |
Definition at line 306 of file ParserOutput.php.
References array().
ParserOutput::addModuleScripts | ( | $ | modules | ) |
Definition at line 310 of file ParserOutput.php.
References array().
ParserOutput::addModuleStyles | ( | $ | modules | ) |
Definition at line 314 of file ParserOutput.php.
References array().
ParserOutput::addOutputHook | ( | $ | hook, |
$ | data = false |
||
) |
Definition at line 162 of file ParserOutput.php.
References array().
Copy items from the OutputPage object into this one.
$out | OutputPage object |
Definition at line 327 of file ParserOutput.php.
References OutputPage\getHeadItemsArray(), OutputPage\getModuleMessages(), OutputPage\getModules(), OutputPage\getModuleScripts(), OutputPage\getModuleStyles(), and OutputPage\getPreventClickjacking().
ParserOutput::addSecondaryDataUpdate | ( | DataUpdate $ | update | ) |
Adds an update job to the output.
Any update jobs added to the output will eventually bexecuted in order to store any secondary information extracted from the page's content.
DataUpdate | $update |
Definition at line 473 of file ParserOutput.php.
ParserOutput::addTemplate | ( | $ | title, |
$ | page_id, | ||
$ | rev_id | ||
) |
Register a template dependency for this output.
$title | Title |
$page_id | |
$rev_id |
Definition at line 265 of file ParserOutput.php.
ParserOutput::addWarning | ( | $ | s | ) |
Definition at line 160 of file ParserOutput.php.
References $s.
Definition at line 122 of file ParserOutput.php.
Definition at line 121 of file ParserOutput.php.
Get the title to be used for display.
Definition at line 354 of file ParserOutput.php.
References $t.
Definition at line 125 of file ParserOutput.php.
ParserOutput::getExtensionData | ( | $ | key | ) |
Gets extensions data previously attached to this ParserOutput using setExtensionData().
Typically, such data would be set while parsing the page, e.g. by a parser function.
string | $key | The key to look up. |
Definition at line 563 of file ParserOutput.php.
References $key.
Definition at line 131 of file ParserOutput.php.
Definition at line 130 of file ParserOutput.php.
ParserOutput::getFlag | ( | $ | flag | ) |
Definition at line 369 of file ParserOutput.php.
Definition at line 133 of file ParserOutput.php.
Definition at line 172 of file ParserOutput.php.
& ParserOutput::getImages | ( | ) |
Definition at line 129 of file ParserOutput.php.
Definition at line 140 of file ParserOutput.php.
Definition at line 120 of file ParserOutput.php.
Definition at line 119 of file ParserOutput.php.
Definition at line 143 of file ParserOutput.php.
& ParserOutput::getLinks | ( | ) |
Definition at line 126 of file ParserOutput.php.
Definition at line 137 of file ParserOutput.php.
Definition at line 134 of file ParserOutput.php.
Definition at line 135 of file ParserOutput.php.
Definition at line 136 of file ParserOutput.php.
Definition at line 175 of file ParserOutput.php.
Definition at line 132 of file ParserOutput.php.
Definition at line 138 of file ParserOutput.php.
References array().
Definition at line 438 of file ParserOutput.php.
References array().
ParserOutput::getProperty | ( | $ | name | ) |
Definition at line 434 of file ParserOutput.php.
References $name.
ParserOutput::getSecondaryDataUpdates | ( | Title $ | title = null , |
$ | recursive = true |
||
) |
Returns any DataUpdate jobs to be executed in order to store secondary information extracted from the page's content, including a LinksUpdate object for all links stored in this ParserOutput object.
$title | Title The title of the page we're updating. If not given, a title object will be created based on $this->getTitleText() |
$recursive | Boolean: queue jobs for recursive updates? |
Definition at line 493 of file ParserOutput.php.
References $linksUpdate, $title, array(), and Title\newFromText().
Definition at line 124 of file ParserOutput.php.
Definition at line 128 of file ParserOutput.php.
Definition at line 127 of file ParserOutput.php.
Definition at line 72 of file ParserOutput.php.
References array(), Parser\TOC_END, and Parser\TOC_START.
static ParserOutput::getTimes | ( | $ | clock = null | ) | [static, private] |
Definition at line 571 of file ParserOutput.php.
ParserOutput::getTimeSinceStart | ( | $ | clock | ) |
Returns the time since resetParseStartTime() was last called.
Clocks available are:
string | $clock |
Definition at line 603 of file ParserOutput.php.
Definition at line 142 of file ParserOutput.php.
Definition at line 123 of file ParserOutput.php.
Definition at line 144 of file ParserOutput.php.
Definition at line 141 of file ParserOutput.php.
Returns the options from its ParserOptions which have been taken into account to produce this output or false if not available.
Definition at line 450 of file ParserOutput.php.
References array().
Definition at line 139 of file ParserOutput.php.
ParserOutput::hideNewSection | ( | $ | value | ) |
Definition at line 169 of file ParserOutput.php.
References $value.
static ParserOutput::isLinkInternal | ( | $ | internal, |
$ | url | ||
) | [static] |
Checks, if a url is pointing to the own server.
string | $internal | the server to check against |
string | $url | the url to check |
Definition at line 186 of file ParserOutput.php.
References check, http, https, in, is, of, query, and server.
Referenced by ParserOutputTest\testIsLinkInternal().
ParserOutput::preventClickjacking | ( | $ | flag = null | ) |
Get or set the prevent-clickjacking flag.
boolean | null | $flag | New flag value, or null to leave it unchanged |
Definition at line 642 of file ParserOutput.php.
References wfSetVar().
ParserOutput::recordOption | ( | $ | option | ) |
Callback passed by the Parser to the ParserOptions to keep track of which options are used.
Definition at line 461 of file ParserOutput.php.
callback used by getText to replace editsection tokens
$m |
MWException |
Definition at line 103 of file ParserOutput.php.
References $skin, $wgLang, $wgOut, array(), global, and Title\newFromText().
Resets the parse start timestamps for future calls to getTimeSinceStart()
Definition at line 588 of file ParserOutput.php.
ParserOutput::setCategoryLinks | ( | $ | cl | ) |
Definition at line 148 of file ParserOutput.php.
References wfSetVar().
ParserOutput::setDisplayTitle | ( | $ | text | ) |
Override the title to be used for display.
-- this is assumed to have been validated (check equal normalisation, etc.)
string | $text | desired title text |
Definition at line 344 of file ParserOutput.php.
Definition at line 152 of file ParserOutput.php.
References $t, and wfSetVar().
ParserOutput::setExtensionData | ( | $ | key, |
$ | value | ||
) |
Attaches arbitrary data to this ParserObject.
This can be used to store some information in the ParserOutput object for later use during page output. The data will be cached along with the ParserOutput object, but unlike data set using setProperty(), it is not recorded in the database.
This method is provided to overcome the unsafe practice of attaching extra information to a ParserObject by directly assigning member variables.
To use setExtensionData() to pass extension information from a hook inside the parser to a hook in the page output, use this in the parser hook:
$parser->getOutput()->setExtensionData( 'my_ext_foo', '...' );
And then later, in OutputPageParserOutput or similar:
$output->getExtensionData( 'my_ext_foo' );
In MediaWiki 1.20 and older, you have to use a custom member variable within the ParserOutput object:
$parser->getOutput()->my_ext_foo = '...';
string | $key | The key for accessing the data. Extensions should take care to avoid conflicts in naming keys. It is suggested to use the extension's name as a prefix. |
mixed | $value | The value to set. Setting a value to null is equivalent to removing the value. |
Definition at line 544 of file ParserOutput.php.
ParserOutput::setFlag | ( | $ | flag | ) |
Fairly generic flag setter thingy.
Definition at line 365 of file ParserOutput.php.
ParserOutput::setIndexPolicy | ( | $ | policy | ) |
Definition at line 153 of file ParserOutput.php.
References wfSetVar().
ParserOutput::setLanguageLinks | ( | $ | ll | ) |
Definition at line 147 of file ParserOutput.php.
References wfSetVar().
ParserOutput::setLimitReportData | ( | $ | key, |
$ | value | ||
) |
Sets parser limit report data for a key.
The key is used as the prefix for various messages used for formatting:
Note that all values are interpreted as wikitext, and so should be encoded with htmlspecialchars() as necessary, but should avoid complex HTML for sanity of display in the "NewPP limit report" comment.
string | $key | Message key |
mixed | $value | Appropriate for Message::params() |
Definition at line 631 of file ParserOutput.php.
ParserOutput::setNewSection | ( | $ | value | ) |
Definition at line 166 of file ParserOutput.php.
References $value.
ParserOutput::setProperty | ( | $ | name, |
$ | value | ||
) |
Set a property to be stored in the page_props database table.
page_props is a key value store indexed by the page ID. This allows the parser to set a property on a page which can then be quickly retrieved given the page ID or via a DB join when given the page title.
setProperty() is thus used to propagate properties from the parsed page to request contexts other than a page view of the currently parsed article.
Some applications examples:
* To implement hidden categories, hiding pages from category listings by storing a property.
* Overriding the displayed article title.
* To implement image tagging, for example displaying an icon on an image thumbnail to indicate that it is listed for deletion on Wikimedia Commons. This is not actually implemented, yet but would be pretty cool.
If you are writing an extension where you want to set a property in the parser which is used by an OutputPageParserOutput hook, you have to associate the extension data directly with the ParserOutput object. Since MediaWiki 1.21, you can use setExtensionData() to do this:
$parser->getOutput()->setExtensionData( 'my_ext_foo', '...' );
And then later, in OutputPageParserOutput or similar:
$output->getExtensionData( 'my_ext_foo' );
In MediaWiki 1.20 and older, you have to use a custom member variable within the ParserOutput object:
$parser->getOutput()->my_ext_foo = '...';
Definition at line 430 of file ParserOutput.php.
ParserOutput::setSections | ( | $ | toc | ) |
Definition at line 151 of file ParserOutput.php.
References wfSetVar().
ParserOutput::setText | ( | $ | text | ) |
Definition at line 146 of file ParserOutput.php.
References wfSetVar().
ParserOutput::setTimestamp | ( | $ | timestamp | ) |
Definition at line 155 of file ParserOutput.php.
References $timestamp, and wfSetVar().
ParserOutput::setTitleText | ( | $ | t | ) |
Definition at line 150 of file ParserOutput.php.
References $t, and wfSetVar().
ParserOutput::setTOCEnabled | ( | $ | flag | ) |
Definition at line 156 of file ParserOutput.php.
References wfSetVar().
ParserOutput::setTOCHTML | ( | $ | tochtml | ) |
Definition at line 154 of file ParserOutput.php.
References wfSetVar().
ParserOutput::$mAccessedOptions = array() [private] |
Definition at line 53 of file ParserOutput.php.
ParserOutput::$mCategories |
Definition at line 25 of file ParserOutput.php.
ParserOutput::$mEditSectionTokens = false |
Definition at line 47 of file ParserOutput.php.
ParserOutput::$mExtensionData = array() [private] |
Definition at line 55 of file ParserOutput.php.
ParserOutput::$mExternalLinks = array() |
Definition at line 34 of file ParserOutput.php.
ParserOutput::$mFileSearchOptions = array() |
Definition at line 33 of file ParserOutput.php.
ParserOutput::$mHeadItems = array() |
Definition at line 39 of file ParserOutput.php.
ParserOutput::$mHideNewSection = false |
Definition at line 37 of file ParserOutput.php.
ParserOutput::$mImages = array() |
Definition at line 32 of file ParserOutput.php.
ParserOutput::$mIndexPolicy = '' [private] |
Definition at line 52 of file ParserOutput.php.
ParserOutput::$mInterwikiLinks = array() |
Definition at line 35 of file ParserOutput.php.
ParserOutput::$mLanguageLinks |
Definition at line 25 of file ParserOutput.php.
ParserOutput::$mLimitReportData = array() [private] |
Definition at line 56 of file ParserOutput.php.
ParserOutput::$mLinks = array() |
Definition at line 29 of file ParserOutput.php.
ParserOutput::$mModuleMessages = array() |
Definition at line 43 of file ParserOutput.php.
ParserOutput::$mModules = array() |
Definition at line 40 of file ParserOutput.php.
ParserOutput::$mModuleScripts = array() |
Definition at line 41 of file ParserOutput.php.
ParserOutput::$mModuleStyles = array() |
Definition at line 42 of file ParserOutput.php.
ParserOutput::$mNewSection = false |
Definition at line 36 of file ParserOutput.php.
ParserOutput::$mNoGallery = false |
Definition at line 38 of file ParserOutput.php.
ParserOutput::$mOutputHooks = array() |
Definition at line 44 of file ParserOutput.php.
ParserOutput::$mParseStartTime = array() [private] |
Definition at line 57 of file ParserOutput.php.
ParserOutput::$mPreventClickjacking = false [private] |
Definition at line 58 of file ParserOutput.php.
ParserOutput::$mProperties = array() |
Definition at line 48 of file ParserOutput.php.
ParserOutput::$mSecondaryDataUpdates = array() [private] |
Definition at line 54 of file ParserOutput.php.
ParserOutput::$mSections = array() |
Definition at line 46 of file ParserOutput.php.
ParserOutput::$mTemplateIds = array() |
Definition at line 31 of file ParserOutput.php.
ParserOutput::$mTemplates = array() |
Definition at line 30 of file ParserOutput.php.
ParserOutput::$mText |
Definition at line 25 of file ParserOutput.php.
ParserOutput::$mTimestamp |
Definition at line 49 of file ParserOutput.php.
ParserOutput::$mTitleText |
Definition at line 25 of file ParserOutput.php.
ParserOutput::$mTOCEnabled = true |
Definition at line 51 of file ParserOutput.php.
ParserOutput::$mTOCHTML = '' |
Definition at line 49 of file ParserOutput.php.
ParserOutput::$mWarnings = array() |
Definition at line 45 of file ParserOutput.php.
const ParserOutput::EDITSECTION_REGEX = '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#' |
Definition at line 60 of file ParserOutput.php.