50 public function render( $term, $resultSets ) {
51 if ( !is_array( $resultSets ) ) {
52 $resultSets = [ $resultSets ];
58 foreach ( $resultSets as $resultSet ) {
59 foreach ( $resultSet as $result ) {
60 if ( !$result->isBrokenTitle() ) {
61 $iwResults[$result->getTitle()->getInterwiki()][] = $result;
67 foreach ( $iwResults as $iwPrefix => $results ) {
69 $out .= Html::openElement(
'ul', [
'class' =>
'mw-search-iwresults' ] );
72 foreach ( $results as $result ) {
73 $out .= $this->resultWidget->render( $result, $position++ );
75 $out .= Html::closeElement(
'ul' );
78 return Html::rawElement(
80 [
'id' =>
'mw-search-interwiki' ],
83 [
'id' =>
'mw-search-interwiki-caption' ],
84 $this->specialSearch->msg(
'search-interwiki-caption' )->parse()
97 if ( isset( $this->customCaptions[$iwPrefix] ) ) {
98 $caption = $this->customCaptions[$iwPrefix];
100 $interwiki = $this->iwLookup->fetch( $iwPrefix );
102 $caption = $this->specialSearch->msg(
'search-interwiki-default', $parsed[
'host'] )->escaped();
105 $href = Title::makeTitle(
NS_SPECIAL,
'Search',
'', $iwPrefix )->getLocalURL(
106 [
'search' => $term,
'fulltext' => 1 ]
108 $searchLink = Html::rawElement(
111 $this->specialSearch->msg(
'search-interwiki-more' )->escaped()
114 return Html::rawElement(
116 [
'class' =>
'mw-search-interwiki-project' ],
119 [
'class' =>
'mw-search-interwiki-more' ],
126 if ( $this->customCaptions !==
null ) {
130 $this->customCaptions = [];
131 $customLines = explode(
"\n", $this->specialSearch->msg(
'search-interwiki-custom' )->escaped() );
132 foreach ( $customLines as
$line ) {
133 $parts = explode(
':',
$line, 2 );
134 if ( count( $parts ) === 2 ) {
135 $this->customCaptions[$parts[0]] = $parts[1];
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
This class is a collection of static functions that serve two purposes:
implements Special:Search - Run text & title search and display the output
Represents a title within MediaWiki.
A set of SearchEngine results.