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' );
154 ? substr( $term, strpos( $term,
':' ) + 1 )
156 $lang = $this->specialSearch->getLanguage();
158 foreach ( $this->profiles as $id => $profileConfig ) {
159 $profileConfig[
'parameters'][
'profile'] = $id;
160 $tooltipParam = isset( $profileConfig[
'namespace-messages'] )
161 ?
$lang->commaList( $profileConfig[
'namespace-messages'] )
163 $items[] = Xml::tags(
165 [
'class' => $profile === $id ?
'current' :
'normal' ],
168 $this->specialSearch->msg( $profileConfig[
'message'] )->text(),
169 $this->specialSearch->msg( $profileConfig[
'tooltip'], $tooltipParam )->text(),
170 $profileConfig[
'parameters']
175 return "<div class='search-types'>" .
176 "<ul>" . implode(
'', $items ) .
"</ul>" .
187 $parts = explode(
':', $term );
188 return count( $parts ) > 1
203 protected function makeSearchLink( $term, $label, $tooltip, array $params = [] ) {
212 'href' => $this->specialSearch->getPageTitle()->getLocalURL( $params ),
228 protected function optionsHtml( $term, $isPowerSearch, $profile ) {
231 if ( $isPowerSearch ) {
235 Hooks::run(
'SpecialSearchProfileForm', [
236 $this->specialSearch, &$form, $profile, $term, []
252 $activeNamespaces = $this->specialSearch->getNamespaces();
253 $langConverter = $this->specialSearch->getLanguage();
254 foreach ( $this->searchConfig->searchableNamespaces() as $namespace => $name ) {
256 getSubject( $namespace );
257 if ( !isset( $rows[$subject] ) ) {
258 $rows[$subject] =
"";
261 $name = $langConverter->convertNamespace( $namespace );
262 if ( $name ===
'' ) {
263 $name = $this->specialSearch->msg(
'blanknamespace' )->text();
271 "mw-search-ns{$namespace}",
272 in_array( $namespace, $activeNamespaces )
280 foreach ( $rows as $row ) {
281 $tableRows[] =
"<tr>{$row}</tr>";
283 $namespaceTables = [];
284 foreach ( array_chunk( $tableRows, 4 ) as $chunk ) {
285 $namespaceTables[] = implode(
'', $chunk );
289 'namespaceTables' =>
"<table>" . implode(
'</table><table>', $namespaceTables ) .
'</table>',
291 Hooks::run(
'SpecialSearchPowerBox', [ &$showSections, $term, &$opts ] );
294 foreach ( $opts as $key => $value ) {
295 $hidden .= Html::hidden( $key, $value );
298 $divider =
"<div class='divider'></div>";
301 $user = $this->specialSearch->getUser();
303 if ( $user->isLoggedIn() ) {
304 $remember = $divider . Xml::checkLabel(
305 $this->specialSearch->msg(
'powersearch-remember' )->text(),
307 'mw-search-powersearch-remember',
311 [
'value' => $user->getEditToken(
313 $this->specialSearch->getRequest()
318 return "<fieldset id='mw-searchoptions'>" .
319 "<legend>" . $this->specialSearch->msg(
'powersearch-legend' )->escaped() .
'</legend>' .
320 "<h4>" . $this->specialSearch->msg(
'powersearch-ns' )->parse() .
'</h4>' .
322 '<div id="mw-search-togglebox">' .
323 '<label>' . $this->specialSearch->msg(
'powersearch-togglelabel' )->escaped() .
'</label>' .
324 '<input type="button" id="mw-search-toggleall" value="' .
325 $this->specialSearch->msg(
'powersearch-toggleall' )->escaped() .
'"/>' .
326 '<input type="button" id="mw-search-togglenone" value="' .
327 $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