From 6394ac791bed48900603f74af6476c0ae2d7d092 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 7 Jul 2011 17:42:19 +0000 Subject: [PATCH] * Don't use isset() to check only for null * Also pass the Title object in RequestContext::msg() --- includes/RequestContext.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/includes/RequestContext.php b/includes/RequestContext.php index 255a175400..ecfe2ab567 100644 --- a/includes/RequestContext.php +++ b/includes/RequestContext.php @@ -78,7 +78,7 @@ class RequestContext { * @return Title */ public function getTitle() { - if ( !isset($this->title) ) { + if ( $this->title === null ) { global $wgTitle; # fallback to $wg till we can improve this $this->title = $wgTitle; } @@ -98,7 +98,7 @@ class RequestContext { * @return OutputPage object */ public function getOutput() { - if ( !isset( $this->output ) ) { + if ( $this->output === null ) { $this->output = new OutputPage( $this ); } return $this->output; @@ -119,7 +119,7 @@ class RequestContext { * @return User */ public function getUser() { - if ( !isset($this->user) ) { + if ( $this->user === null ) { $this->user = User::newFromSession( $this->getRequest() ); } return $this->user; @@ -131,7 +131,7 @@ class RequestContext { * @return Language */ public function getLang() { - if ( !isset($this->lang) ) { + if ( $this->lang === null ) { global $wgLanguageCode, $wgContLang; $code = $this->getRequest()->getVal( 'uselang', @@ -164,7 +164,7 @@ class RequestContext { * @return Skin */ public function getSkin() { - if ( !isset($this->skin) ) { + if ( $this->skin === null ) { wfProfileIn( __METHOD__ . '-createskin' ); global $wgHiddenPrefs; @@ -195,7 +195,7 @@ class RequestContext { */ public function msg() { $args = func_get_args(); - return call_user_func_array( 'wfMessage', $args )->inLanguage( $this->getLang() ); + return call_user_func_array( 'wfMessage', $args )->inLanguage( $this->getLang() )->title( $this->getTitle() ); } /** Static methods **/ @@ -207,7 +207,7 @@ class RequestContext { */ public static function getMain() { static $instance = null; - if ( !isset($instance) ) { + if ( $instance === null ) { $instance = new self; } return $instance; -- 2.20.1