# If there's an exact or very near match, jump right there.
$title = SearchEngine::getNearMatch( $term );
- if ( !is_null( $title ) ) {
- $this->getOutput()->redirect( $title->getFullURL() );
+ if ( !is_null( $title ) &&
+ Hooks::run( 'SpecialSearchGoResult', [ $term, $title, &$url ] )
+ ) {
+ if ( $url === null ) {
+ $url = $title->getFullURL();
+ }
+ $this->getOutput()->redirect( $url );
return;
}
}
// start rendering the page
- $out->addHtml(
+ $out->addHTML(
Xml::openElement(
'form',
[
$num = $titleMatchesNum + $textMatchesNum;
$totalRes = $numTitleMatches + $numTextMatches;
- $out->addHtml(
+ $out->addHTML(
# This is an awful awful ID name. It's not a table, but we
# named it poorly from when this was a table so now we're
# stuck with it
return;
}
- $out->addHtml( "<div class='searchresults'>" );
+ $out->addHTML( "<div class='searchresults'>" );
// prev/next links
$prevnext = null;
$out->addHTML( "<p class='mw-search-pager-bottom'>{$prevnext}</p>\n" );
}
- $out->addHtml( "</div>" );
+ $out->addHTML( "</div>" );
Hooks::run( 'SpecialSearchResultsAppend', [ $this, $out, $term ] );
) {
// invalid title
// preserve the paragraph for margins etc...
- $this->getOutput()->addHtml( '<p></p>' );
+ $this->getOutput()->addHTML( '<p></p>' );
return;
}
$this->getOutput()->wrapWikiMsg( "<p class=\"$linkClass\">\n$1</p>", $params );
} else {
// preserve the paragraph for margins etc...
- $this->getOutput()->addHtml( '<p></p>' );
+ $this->getOutput()->addHTML( '<p></p>' );
}
}
'size' => '50',
'autofocus' => trim( $term ) === '',
'class' => 'mw-ui-input mw-ui-input-inline',
+ // identifies the location of the search bar for tracking purposes
+ 'data-search-loc' => 'content',
] ) . "\n";
$out .= Html::hidden( 'fulltext', 'Search' ) . "\n";
$out .= Html::submitButton(