From 5397c668ab2e4a3cf5a7a9fc0202d601d1eedc0c Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Sat, 9 Feb 2013 02:58:38 +0400 Subject: [PATCH] Allow adding arbitrary properties to OutputPage Helps to pass extension-specific data Change-Id: Iea98510abc100128733361f2d2287802f35bb359 --- includes/OutputPage.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) 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 -- 2.20.1