Remove ParserOptions::setSkin() (deprecated since 1.19)
[lhc/web/wiklou.git] / includes / parser / ParserOutput.php
index b7cc490..09f714f 100644 (file)
@@ -57,7 +57,8 @@ class ParserOutput extends CacheTime {
                private $mLimitReportData = array(); # Parser limit report data
                private $mParseStartTime = array(); # Timestamps for getTimeSinceStart()
 
-       const EDITSECTION_REGEX = '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#';
+       const EDITSECTION_REGEX =
+               '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#';
 
        function __construct( $text = '', $languageLinks = array(), $categoryLinks = array(),
                $containsOldMagic = false, $titletext = ''
@@ -116,50 +117,166 @@ class ParserOutput extends CacheTime {
                return call_user_func_array( array( $skin, 'doEditSectionLink' ), $args );
        }
 
-       function &getLanguageLinks()         { return $this->mLanguageLinks; }
-       function getInterwikiLinks()         { return $this->mInterwikiLinks; }
-       function getCategoryLinks()          { return array_keys( $this->mCategories ); }
-       function &getCategories()            { return $this->mCategories; }
-       function getTitleText()              { return $this->mTitleText; }
-       function getSections()               { return $this->mSections; }
-       function getEditSectionTokens()      { return $this->mEditSectionTokens; }
-       function &getLinks()                 { return $this->mLinks; }
-       function &getTemplates()             { return $this->mTemplates; }
-       function &getTemplateIds()           { return $this->mTemplateIds; }
-       function &getImages()                { return $this->mImages; }
-       function &getFileSearchOptions()     { return $this->mFileSearchOptions; }
-       function &getExternalLinks()         { return $this->mExternalLinks; }
-       function getNoGallery()              { return $this->mNoGallery; }
-       function getHeadItems()              { return $this->mHeadItems; }
-       function getModules()                { return $this->mModules; }
-       function getModuleScripts()          { return $this->mModuleScripts; }
-       function getModuleStyles()           { return $this->mModuleStyles; }
-       function getModuleMessages()         { return $this->mModuleMessages; }
+       function &getLanguageLinks() {
+               return $this->mLanguageLinks;
+       }
+
+       function getInterwikiLinks() {
+               return $this->mInterwikiLinks;
+       }
+
+       function getCategoryLinks() {
+               return array_keys( $this->mCategories );
+       }
+
+       function &getCategories() {
+               return $this->mCategories;
+       }
+
+       function getTitleText() {
+               return $this->mTitleText;
+       }
+
+       function getSections() {
+               return $this->mSections;
+       }
+
+       function getEditSectionTokens() {
+               return $this->mEditSectionTokens;
+       }
+
+       function &getLinks() {
+               return $this->mLinks;
+       }
+
+       function &getTemplates() {
+               return $this->mTemplates;
+       }
+
+       function &getTemplateIds() {
+               return $this->mTemplateIds;
+       }
+
+       function &getImages() {
+               return $this->mImages;
+       }
+
+       function &getFileSearchOptions() {
+               return $this->mFileSearchOptions;
+       }
+
+       function &getExternalLinks() {
+               return $this->mExternalLinks;
+       }
+
+       function getNoGallery() {
+               return $this->mNoGallery;
+       }
+
+       function getHeadItems() {
+               return $this->mHeadItems;
+       }
+
+       function getModules() {
+               return $this->mModules;
+       }
+
+       function getModuleScripts() {
+               return $this->mModuleScripts;
+       }
+
+       function getModuleStyles() {
+               return $this->mModuleStyles;
+       }
+
+       function getModuleMessages() {
+               return $this->mModuleMessages;
+       }
+
        /** @since 1.23 */
-       function getJsConfigVars()           { return $this->mJsConfigVars; }
-       function getOutputHooks()            { return (array)$this->mOutputHooks; }
-       function getWarnings()               { return array_keys( $this->mWarnings ); }
-       function getIndexPolicy()            { return $this->mIndexPolicy; }
-       function getTOCHTML()                { return $this->mTOCHTML; }
-       function getTimestamp()              { return $this->mTimestamp; }
-       function getLimitReportData()        { return $this->mLimitReportData; }
-       function getTOCEnabled()             { return $this->mTOCEnabled; }
-
-       function setText( $text )            { return wfSetVar( $this->mText, $text ); }
-       function setLanguageLinks( $ll )     { return wfSetVar( $this->mLanguageLinks, $ll ); }
-       function setCategoryLinks( $cl )     { return wfSetVar( $this->mCategories, $cl ); }
-
-       function setTitleText( $t )          { return wfSetVar( $this->mTitleText, $t ); }
-       function setSections( $toc )         { return wfSetVar( $this->mSections, $toc ); }
-       function setEditSectionTokens( $t )  { return wfSetVar( $this->mEditSectionTokens, $t ); }
-       function setIndexPolicy( $policy )   { return wfSetVar( $this->mIndexPolicy, $policy ); }
-       function setTOCHTML( $tochtml )      { return wfSetVar( $this->mTOCHTML, $tochtml ); }
-       function setTimestamp( $timestamp )  { return wfSetVar( $this->mTimestamp, $timestamp ); }
-       function setTOCEnabled( $flag )      { return wfSetVar( $this->mTOCEnabled, $flag ); }
-
-       function addCategory( $c, $sort )    { $this->mCategories[$c] = $sort; }
-       function addLanguageLink( $t )       { $this->mLanguageLinks[] = $t; }
-       function addWarning( $s )            { $this->mWarnings[$s] = 1; }
+       function getJsConfigVars() {
+               return $this->mJsConfigVars;
+       }
+
+       function getOutputHooks() {
+               return (array)$this->mOutputHooks;
+       }
+
+       function getWarnings() {
+               return array_keys( $this->mWarnings );
+       }
+
+       function getIndexPolicy() {
+               return $this->mIndexPolicy;
+       }
+
+       function getTOCHTML() {
+               return $this->mTOCHTML;
+       }
+
+       function getTimestamp() {
+               return $this->mTimestamp;
+       }
+
+       function getLimitReportData() {
+               return $this->mLimitReportData;
+       }
+
+       function getTOCEnabled() {
+               return $this->mTOCEnabled;
+       }
+
+       function setText( $text ) {
+               return wfSetVar( $this->mText, $text );
+       }
+
+       function setLanguageLinks( $ll ) {
+               return wfSetVar( $this->mLanguageLinks, $ll );
+       }
+
+       function setCategoryLinks( $cl ) {
+               return wfSetVar( $this->mCategories, $cl );
+       }
+
+       function setTitleText( $t ) {
+               return wfSetVar( $this->mTitleText, $t );
+       }
+
+       function setSections( $toc ) {
+               return wfSetVar( $this->mSections, $toc );
+       }
+
+       function setEditSectionTokens( $t ) {
+               return wfSetVar( $this->mEditSectionTokens, $t );
+       }
+
+       function setIndexPolicy( $policy ) {
+               return wfSetVar( $this->mIndexPolicy, $policy );
+       }
+
+       function setTOCHTML( $tochtml ) {
+               return wfSetVar( $this->mTOCHTML, $tochtml );
+       }
+
+       function setTimestamp( $timestamp ) {
+               return wfSetVar( $this->mTimestamp, $timestamp );
+       }
+
+       function setTOCEnabled( $flag ) {
+               return wfSetVar( $this->mTOCEnabled, $flag );
+       }
+
+       function addCategory( $c, $sort ) {
+               $this->mCategories[$c] = $sort;
+       }
+
+       function addLanguageLink( $t ) {
+               $this->mLanguageLinks[] = $t;
+       }
+
+       function addWarning( $s ) {
+               $this->mWarnings[$s] = 1;
+       }
 
        function addOutputHook( $hook, $data = false ) {
                $this->mOutputHooks[] = array( $hook, $data );
@@ -456,10 +573,22 @@ class ParserOutput extends CacheTime {
                $this->mProperties[$name] = $value;
        }
 
+       /**
+        * @param string $name The property name to look up.
+        *
+        * @return mixed|false The value previously set using setProperty(). False if null or no value
+        * was set for the given property name.
+        *
+        * @note You need to use getProperties() to check for boolean and null properties.
+        */
        public function getProperty( $name ) {
                return isset( $this->mProperties[$name] ) ? $this->mProperties[$name] : false;
        }
 
+       public function unsetProperty( $name ) {
+               unset( $this->mProperties[$name] );
+       }
+
        public function getProperties() {
                if ( !isset( $this->mProperties ) ) {
                        $this->mProperties = array();
@@ -512,8 +641,8 @@ class ParserOutput extends CacheTime {
         * extracted from the page's content, including a LinksUpdate object for all links stored in
         * this ParserOutput object.
         *
-        * @note: Avoid using this method directly, use ContentHandler::getSecondaryDataUpdates() instead! The content
-        *        handler may provide additional update objects.
+        * @note Avoid using this method directly, use ContentHandler::getSecondaryDataUpdates()
+        *   instead! The content handler may provide additional update objects.
         *
         * @since 1.20
         *
@@ -589,7 +718,7 @@ class ParserOutput extends CacheTime {
         *
         * @param string $key The key to look up.
         *
-        * @return mixed The value previously set for the given key using setExtensionData( $key ),
+        * @return mixed|null The value previously set for the given key using setExtensionData()
         *         or null if no value was set for this key.
         */
        public function getExtensionData( $key ) {