55 $user = $this->specialSearch->getUser();
57 return '<div class="mw-search-form-wrapper">' .
61 'id' => $isPowerSearch ?
'powersearch' :
'search',
63 'method' => ( $isPowerSearch && $user->isLoggedIn() ) ?
'post' :
'get',
67 '<div id="mw-search-top-table">' .
68 $this->
shortDialogHtml( $profile, $term, $numResults, $totalResults, $offset, $options ) .
70 "<div class='mw-search-visualclear'></div>" .
71 "<div class='mw-search-profile-tabs'>" .
73 "<div style='clear:both'></div>" .
75 $this->
optionsHtml( $term, $isPowerSearch, $profile ) .
100 'id' =>
'searchText',
102 'autofocus' => trim( $term ) ===
'',
104 'dataLocation' =>
'content',
108 $layout = new \OOUI\ActionFieldLayout( $searchWidget,
new \OOUI\ButtonInputWidget( [
110 'label' => $this->specialSearch->msg(
'searchbutton' )->text(),
111 'flags' => [
'progressive',
'primary' ],
118 if ( $this->specialSearch->getPrefix() !==
'' ) {
119 $html .= Html::hidden(
'prefix', $this->specialSearch->getPrefix() );
122 if ( $totalResults > 0 && $offset < $totalResults ) {
126 'class' =>
'results-info',
127 'data-mw-num-results-offset' => $offset,
128 'data-mw-num-results-total' => $totalResults
130 $this->specialSearch->msg(
'search-showingresults' )
131 ->numParams( $offset + 1, $offset + $numResults, $totalResults )
132 ->numParams( $numResults )
138 Html::hidden(
'title', $this->specialSearch->getPageTitle()->getPrefixedText() ) .
139 Html::hidden(
'profile', $profile ) .
140 Html::hidden(
'fulltext',
'1' );
155 ? substr( $term, strpos( $term,
':' ) + 1 )
157 $lang = $this->specialSearch->getLanguage();
159 foreach ( $this->profiles as $id => $profileConfig ) {
160 $profileConfig[
'parameters'][
'profile'] = $id;
161 $tooltipParam = isset( $profileConfig[
'namespace-messages'] )
162 ?
$lang->commaList( $profileConfig[
'namespace-messages'] )
166 [
'class' => $profile === $id ?
'current' :
'normal' ],
169 $this->specialSearch->msg( $profileConfig[
'message'] )->text(),
170 $this->specialSearch->msg( $profileConfig[
'tooltip'], $tooltipParam )->text(),
171 $profileConfig[
'parameters']
176 return "<div class='search-types'>" .
177 "<ul>" . implode(
'', $items ) .
"</ul>" .
188 $parts = explode(
':', $term );
189 return count( $parts ) > 1
204 protected function makeSearchLink( $term, $label, $tooltip, array $params = [] ) {
213 'href' => $this->specialSearch->getPageTitle()->getLocalURL( $params ),
229 protected function optionsHtml( $term, $isPowerSearch, $profile ) {
232 if ( $isPowerSearch ) {
237 $this->specialSearch, &$form, $profile, $term, []
253 $activeNamespaces = $this->specialSearch->getNamespaces();
254 $langConverter = $this->specialSearch->getLanguage();
255 foreach ( $this->searchConfig->searchableNamespaces() as $namespace => $name ) {
257 getSubject( $namespace );
258 if ( !isset( $rows[$subject] ) ) {
259 $rows[$subject] =
"";
262 $name = $langConverter->convertNamespace( $namespace );
263 if ( $name ===
'' ) {
264 $name = $this->specialSearch->msg(
'blanknamespace' )->text();
272 "mw-search-ns{$namespace}",
273 in_array( $namespace, $activeNamespaces )
281 foreach ( $rows as $row ) {
282 $tableRows[] =
"<tr>{$row}</tr>";
284 $namespaceTables = [];
285 foreach ( array_chunk( $tableRows, 4 ) as $chunk ) {
286 $namespaceTables[] = implode(
'', $chunk );
290 'namespaceTables' =>
"<table>" . implode(
'</table><table>', $namespaceTables ) .
'</table>',
292 Hooks::run(
'SpecialSearchPowerBox', [ &$showSections, $term, &$opts ] );
295 foreach ( $opts as $key => $value ) {
296 $hidden .= Html::hidden( $key, $value );
299 $divider =
"<div class='divider'></div>";
302 $user = $this->specialSearch->getUser();
304 if ( $user->isLoggedIn() ) {
306 $this->specialSearch->msg(
'powersearch-remember' )->text(),
308 'mw-search-powersearch-remember',
312 [
'value' => $user->getEditToken(
314 $this->specialSearch->getRequest()
319 return "<fieldset id='mw-searchoptions'>" .
320 "<legend>" . $this->specialSearch->msg(
'powersearch-legend' )->escaped() .
'</legend>' .
321 "<h4>" . $this->specialSearch->msg(
'powersearch-ns' )->parse() .
'</h4>' .
323 '<div id="mw-search-togglebox">' .
324 '<label>' . $this->specialSearch->msg(
'powersearch-togglelabel' )->escaped() .
'</label>' .
325 '<input type="button" id="mw-search-toggleall" value="' .
326 $this->specialSearch->msg(
'powersearch-toggleall' )->escaped() .
'"/>' .
327 '<input type="button" id="mw-search-togglenone" value="' .
328 $this->specialSearch->msg(
'powersearch-togglenone' )->escaped() .
'"/>' .