<?php
+/**
+ * Delayed loading of global objects.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
/**
* Class to implement stub globals, which are globals that delay loading the
*
* @param $name String: name of the function called
* @param $args Array: arguments
+ * @return mixed
*/
function _call( $name, $args ) {
$this->_unstub( $name, 5 );
/**
* Create a new object to replace this stub object.
+ * @return object
*/
function _newObject() {
return MWFunction::newObj( $this->mClass, $this->mParams );
*
* @param $name String: name of the function called
* @param $args Array: arguments
+ * @return mixed
*/
function __call( $name, $args ) {
return $this->_call( $name, $args );
function _unstub( $name = '_unstub', $level = 2 ) {
static $recursionLevel = 0;
- if ( !($GLOBALS[$this->mGlobal] instanceof StubObject) )
+ if ( !($GLOBALS[$this->mGlobal] instanceof StubObject) ) {
return $GLOBALS[$this->mGlobal]; // already unstubbed.
-
+ }
+
if ( get_class( $GLOBALS[$this->mGlobal] ) != $this->mClass ) {
$fname = __METHOD__.'-'.$this->mGlobal;
wfProfileIn( $fname );
class StubContLang extends StubObject {
function __construct() {
+ wfDeprecated( __CLASS__, '1.18' );
parent::__construct( 'wgContLang' );
}
return $this->_call( $name, $args );
}
+ /**
+ * @return Language
+ */
function _newObject() {
global $wgLanguageCode;
$obj = Language::factory( $wgLanguageCode );
return $this->_call( $name, $args );
}
+ /**
+ * @return Language
+ */
function _newObject() {
- return RequestContext::getMain()->getLang();
+ return RequestContext::getMain()->getLanguage();
}
}