* @file
*/
+use MediaWiki\MediaWikiServices;
+
/**
* Image gallery
*
public $mParser;
/**
- * @var Title Contextual title, used when images are being screened against
+ * @var Title|null Contextual title, used when images are being screened against
* the bad image list
*/
- protected $contextTitle = false;
+ protected $contextTitle = null;
/** @var array */
protected $mAttribs = [];
/** @var bool */
- static private $modeMapping = false;
+ private static $modeMapping = false;
/**
* Get a new image gallery. This is the method other callers
* @throws MWException
*/
static function factory( $mode = false, IContextSource $context = null ) {
- global $wgContLang;
self::loadModes();
if ( !$context ) {
$context = RequestContext::getMainAndWarn( __METHOD__ );
$mode = $galleryOptions['mode'];
}
- $mode = $wgContLang->lc( $mode );
+ $mode = MediaWikiServices::getInstance()->getContentLanguage()->lc( $mode );
if ( isset( self::$modeMapping[$mode] ) ) {
$class = self::$modeMapping[$mode];
/**
* Set the contextual title
*
- * @param Title $title Contextual title
+ * @param Title|null $title Contextual title
*/
public function setContextTitle( $title ) {
$this->contextTitle = $title;
/**
* Get the contextual title, if applicable
*
- * @return Title|bool Title or false
+ * @return Title|null
*/
public function getContextTitle() {
- return is_object( $this->contextTitle ) && $this->contextTitle instanceof Title
- ? $this->contextTitle
- : false;
+ return $this->contextTitle;
}
/**