From: Max Semenik Date: Fri, 8 Feb 2013 22:58:38 +0000 (+0400) Subject: Allow adding arbitrary properties to OutputPage X-Git-Tag: 1.31.0-rc.0~20599^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/?a=commitdiff_plain;h=5397c668ab2e4a3cf5a7a9fc0202d601d1eedc0c;p=lhc%2Fweb%2Fwiklou.git Allow adding arbitrary properties to OutputPage Helps to pass extension-specific data Change-Id: Iea98510abc100128733361f2d2287802f35bb359 --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 89d7c0bc3b..b0ee8158d2 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -248,6 +248,11 @@ class OutputPage extends ContextSource { */ private $mRedirectedFrom = null; + /** + * Additional key => value data + */ + private $mProperties = array(); + /** * Constructor for OutputPage. This should not be called directly. * Instead a new RequestContext should be created and it will implicitly create @@ -620,6 +625,32 @@ class OutputPage extends ContextSource { return $this->mArticleBodyOnly; } + /** + * Set an additional output property + * @since 1.21 + * + * @param string $name + * @param mixed $value + */ + public function setProperty( $name, $value ) { + $this->mProperties[$name] = $value; + } + + /** + * Get an additional output property + * @since 1.21 + * + * @param $name + * @return mixed: Property value or null if not found + */ + public function getProperty( $name ) { + if ( isset( $this->mProperties[$name] ) ) { + return $this->mProperties[$name]; + } else { + return null; + } + } + /** * checkLastModified tells the client to use the client-cached page if * possible. If successful, the OutputPage is disabled so that