use Hooks;
use Html;
+use MediaWiki\MediaWikiServices;
use MediaWiki\Widget\SearchInputWidget;
use MWNamespace;
use SearchEngineConfig;
* @return bool
*/
protected function startsWithImage( $term ) {
- global $wgContLang;
-
$parts = explode( ':', $term );
return count( $parts ) > 1
- ? $wgContLang->getNsIndex( $parts[0] ) === NS_FILE
+ ? MediaWikiServices::getInstance()->getContentLanguage()->getNsIndex( $parts[0] ) ===
+ NS_FILE
: false;
}
* @return string HTML
*/
protected function powerSearchBox( $term, array $opts ) {
- global $wgContLang;
-
$rows = [];
$activeNamespaces = $this->specialSearch->getNamespaces();
+ $langConverter = MediaWikiServices::getInstance()->getContentLanguage()->getConverter();
foreach ( $this->searchConfig->searchableNamespaces() as $namespace => $name ) {
$subject = MWNamespace::getSubject( $namespace );
if ( !isset( $rows[$subject] ) ) {
$rows[$subject] = "";
}
- $name = $wgContLang->getConverter()->convertNamespace( $namespace );
+ $name = $langConverter->convertNamespace( $namespace );
if ( $name === '' ) {
$name = $this->specialSearch->msg( 'blanknamespace' )->text();
}