X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fwidget%2Fsearch%2FSearchFormWidget.php;h=735806b0dfc5e47a970fee994640f3bdbae65915;hb=fe25fde55bc9e58741965ad0f2275a7ba2ac77fa;hp=2c885630aaf7ec13522a392879cffc8b18067d43;hpb=304ef40c3372907165d032b616ae1f17db058204;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/widget/search/SearchFormWidget.php b/includes/widget/search/SearchFormWidget.php index 2c885630aa..735806b0df 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 ) . - ''; + '' . + ''; } /** @@ -100,6 +103,10 @@ class SearchFormWidget { $html .= $layout; + if ( $this->specialSearch->getPrefix() !== '' ) { + $html .= Html::hidden( 'prefix', $this->specialSearch->getPrefix() ); + } + if ( $totalResults > 0 && $offset < $totalResults ) { $html .= Xml::tags( 'div', @@ -165,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; } @@ -230,8 +236,6 @@ class SearchFormWidget { * @return string HTML */ protected function powerSearchBox( $term, array $opts ) { - global $wgContLang; - $rows = []; $activeNamespaces = $this->specialSearch->getNamespaces(); foreach ( $this->searchConfig->searchableNamespaces() as $namespace => $name ) { @@ -240,7 +244,8 @@ class SearchFormWidget { $rows[$subject] = ""; } - $name = $wgContLang->getConverter()->convertNamespace( $namespace ); + $name = MediaWikiServices::getInstance()->getContentLanguage()->getConverter()-> + convertNamespace( $namespace ); if ( $name === '' ) { $name = $this->specialSearch->msg( 'blanknamespace' )->text(); } @@ -270,7 +275,7 @@ class SearchFormWidget { $showSections = [ 'namespaceTables' => "" . implode( '
', $namespaceTables ) . '
', ]; - Hooks::run( 'SpecialSearchPowerBox', [ &$showSections, $term, $opts ] ); + Hooks::run( 'SpecialSearchPowerBox', [ &$showSections, $term, &$opts ] ); $hidden = ''; foreach ( $opts as $key => $value ) {