X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fwidget%2Fsearch%2FSearchFormWidget.php;h=7eb92fdfd6a1d1a8571c6b7c9ca9a55e5bdd2282;hb=7c4b637cca308651cb98d40b2bd7dca187160e81;hp=2302177f2864d260f71c1e0694ed60f25d5bbf62;hpb=62fa503bc36330c7db64f1511e0f61affa3afb86;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/widget/search/SearchFormWidget.php b/includes/widget/search/SearchFormWidget.php index 2302177f28..7eb92fdfd6 100644 --- a/includes/widget/search/SearchFormWidget.php +++ b/includes/widget/search/SearchFormWidget.php @@ -4,6 +4,7 @@ namespace MediaWiki\Widget\Search; use Hooks; use Html; +use MediaWiki\MediaWikiServices; use MediaWiki\Widget\SearchInputWidget; use MWNamespace; use SearchEngineConfig; @@ -50,7 +51,8 @@ class SearchFormWidget { $offset, $isPowerSearch ) { - return Xml::openElement( + return '
' . + Xml::openElement( 'form', [ 'id' => $isPowerSearch ? 'powersearch' : 'search', @@ -67,7 +69,8 @@ class SearchFormWidget { "
" . "
" . $this->optionsHtml( $term, $isPowerSearch, $profile ) . - ''; + '' . + ''; } /** @@ -169,11 +172,10 @@ class SearchFormWidget { * @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; } @@ -234,17 +236,16 @@ class SearchFormWidget { * @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(); }