64 $user = $this->specialSearch->getUser();
66 return '<div class="mw-search-form-wrapper">' .
70 'id' => $isPowerSearch ?
'powersearch' :
'search',
72 'method' => ( $isPowerSearch && $user->isLoggedIn() ) ?
'post' :
'get',
76 '<div id="mw-search-top-table">' .
77 $this->
shortDialogHtml( $profile, $term, $numResults, $totalResults, $offset, $options ) .
79 "<div class='mw-search-visualclear'></div>" .
80 "<div class='mw-search-profile-tabs'>" .
82 "<div style='clear:both'></div>" .
84 $this->
optionsHtml( $term, $isPowerSearch, $profile ) .
109 'id' =>
'searchText',
111 'autofocus' => trim( $term ) ===
'',
112 'title' => $this->specialSearch->msg(
'searchsuggest-search' )->text(),
114 'dataLocation' =>
'content',
118 $layout = new \OOUI\ActionFieldLayout( $searchWidget,
new \OOUI\ButtonInputWidget( [
120 'label' => $this->specialSearch->msg(
'searchbutton' )->text(),
121 'flags' => [
'progressive',
'primary' ],
128 if ( $this->specialSearch->getPrefix() !==
'' ) {
129 $html .= Html::hidden(
'prefix', $this->specialSearch->getPrefix() );
132 if ( $totalResults > 0 && $offset < $totalResults ) {
136 'class' =>
'results-info',
137 'data-mw-num-results-offset' => $offset,
138 'data-mw-num-results-total' => $totalResults
140 $this->specialSearch->msg(
'search-showingresults' )
141 ->numParams( $offset + 1, $offset + $numResults, $totalResults )
142 ->numParams( $numResults )
148 Html::hidden(
'title', $this->specialSearch->getPageTitle()->getPrefixedText() ) .
149 Html::hidden(
'profile', $profile ) .
150 Html::hidden(
'fulltext',
'1' );
164 ? substr( $term, strpos( $term,
':' ) + 1 )
166 $lang = $this->specialSearch->getLanguage();
168 foreach ( $this->profiles as $id => $profileConfig ) {
169 $profileConfig[
'parameters'][
'profile'] = $id;
170 $tooltipParam = isset( $profileConfig[
'namespace-messages'] )
171 ?
$lang->commaList( $profileConfig[
'namespace-messages'] )
173 $items[] = Xml::tags(
175 [
'class' => $profile === $id ?
'current' :
'normal' ],
178 $this->specialSearch->msg( $profileConfig[
'message'] )->text(),
179 $this->specialSearch->msg( $profileConfig[
'tooltip'], $tooltipParam )->text(),
180 $profileConfig[
'parameters']
185 return "<div class='search-types'>" .
186 "<ul>" . implode(
'', $items ) .
"</ul>" .
197 $parts = explode(
':', $term );
198 return count( $parts ) > 1
213 protected function makeSearchLink( $term, $label, $tooltip, array $params = [] ) {
222 'href' => $this->specialSearch->getPageTitle()->getLocalURL( $params ),
238 protected function optionsHtml( $term, $isPowerSearch, $profile ) {
241 if ( $isPowerSearch ) {
246 $this->specialSearch, $form, $profile, $term, [] );
261 $activeNamespaces = $this->specialSearch->getNamespaces();
262 $langConverter = $this->specialSearch->getLanguage();
263 foreach ( $this->searchConfig->searchableNamespaces() as $namespace => $name ) {
265 getSubject( $namespace );
266 if ( !isset( $rows[$subject] ) ) {
267 $rows[$subject] =
"";
270 $name = $langConverter->convertNamespace( $namespace );
271 if ( $name ===
'' ) {
272 $name = $this->specialSearch->msg(
'blanknamespace' )->text();
280 "mw-search-ns{$namespace}",
281 in_array( $namespace, $activeNamespaces )
289 foreach ( $rows as $row ) {
290 $tableRows[] =
"<tr>{$row}</tr>";
292 $namespaceTables = [];
293 foreach ( array_chunk( $tableRows, 4 ) as $chunk ) {
294 $namespaceTables[] = implode(
'', $chunk );
298 'namespaceTables' =>
"<table>" . implode(
'</table><table>', $namespaceTables ) .
'</table>',
300 $this->
getHookRunner()->onSpecialSearchPowerBox( $showSections, $term, $opts );
303 foreach ( $opts as $key => $value ) {
304 $hidden .= Html::hidden( $key, $value );
307 $divider =
"<div class='divider'></div>";
310 $user = $this->specialSearch->getUser();
312 if ( $user->isLoggedIn() ) {
313 $remember = $divider . Xml::checkLabel(
314 $this->specialSearch->msg(
'powersearch-remember' )->text(),
316 'mw-search-powersearch-remember',
320 [
'value' => $user->getEditToken(
322 $this->specialSearch->getRequest()
327 return "<fieldset id='mw-searchoptions'>" .
328 "<legend>" . $this->specialSearch->msg(
'powersearch-legend' )->escaped() .
'</legend>' .
329 "<h4>" . $this->specialSearch->msg(
'powersearch-ns' )->parse() .
'</h4>' .
331 '<div id="mw-search-togglebox">' .
332 '<label>' . $this->specialSearch->msg(
'powersearch-togglelabel' )->escaped() .
'</label>' .
333 '<input type="button" id="mw-search-toggleall" value="' .
334 $this->specialSearch->msg(
'powersearch-toggleall' )->escaped() .
'"/>' .
335 '<input type="button" id="mw-search-togglenone" value="' .
336 $this->specialSearch->msg(
'powersearch-togglenone' )->escaped() .
'"/>' .
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
This class is a collection of static functions that serve two purposes:
Configuration handling class for SearchEngine.
implements Special:Search - Run text & title search and display the output
Module of static functions for generating XML.
if(!isset( $args[0])) $lang