55 if ( !is_array( $resultSets ) ) {
56 $resultSets = [ $resultSets ];
61 if ( $this->showMultimedia ) {
62 $this->
output->addModules(
'mediawiki.special.search.commonsInterwikiWidget' );
64 $this->
output->addModuleStyles(
'mediawiki.special.search.interwikiwidget.styles' );
67 foreach ( $resultSets as $resultSet ) {
68 $result = $resultSet->next();
70 if ( !$result->isBrokenTitle() ) {
71 $iwResults[$result->getTitle()->getInterwiki()][] =
$result;
73 $result = $resultSet->next();
78 $iwResultListOutput =
'';
80 foreach ( $iwResults as $iwPrefix => $results ) {
83 $iwResultItemOutput =
'';
85 foreach ( $results as $result ) {
86 $iwResultItemOutput .= $this->resultWidget->render( $result,
$term, $position++ );
90 $iwResultListOutput .= Html::rawElement(
'li',
92 'class' =>
'iw-resultset',
93 'data-iw-resultset-pos' => $iwResultSetPos,
94 'data-iw-resultset-source' => $iwPrefix
104 return Html::rawElement(
106 [
'id' =>
'mw-interwiki-results' ],
109 [
'class' =>
'iw-headline' ],
110 $this->specialSearch->msg(
'search-interwiki-caption' )->parse()
113 'ul', [
'class' =>
'iw-results', ], $iwResultListOutput
126 $href = Title::makeTitle(
NS_SPECIAL,
'Search',
null, $iwPrefix )->getLocalURL(
127 [
'search' =>
$term,
'fulltext' => 1 ]
130 $interwiki = $this->iwLookup->fetch( $iwPrefix );
133 if ( isset( $this->customCaptions[$iwPrefix] ) ) {
134 $caption = $this->customCaptions[$iwPrefix];
136 $caption = $this->specialSearch->msg(
'search-interwiki-default', $parsed[
'host'] )->escaped();
139 $searchLink = Html::rawElement(
'em',
null,
140 Html::rawElement(
'a', [
'href' => $href,
'target' =>
'_blank' ], $caption )
143 return Html::rawElement(
'div',
144 [
'class' =>
'iw-result__footer' ],
145 $this->
iwIcon( $iwPrefix ) . $searchLink );
149 if ( $this->customCaptions !==
null ) {
153 $this->customCaptions = [];
154 $customLines = explode(
"\n", $this->specialSearch->msg(
'search-interwiki-custom' )->escaped() );
155 foreach ( $customLines as
$line ) {
156 $parts = explode(
':',
$line, 2 );
157 if ( count( $parts ) === 2 ) {
158 $this->customCaptions[$parts[0]] = $parts[1];
173 $interwiki = $this->iwLookup->fetch( $iwPrefix );
176 $iwIconUrl = $parsed[
'scheme'] .
177 $parsed[
'delimiter'] .
179 ( isset( $parsed[
'port'] ) ?
':' . $parsed[
'port'] :
'' ) .
182 $iwIcon =
new OOUI\IconWidget( [
186 $iwIcon->setAttributes( [
'style' =>
"background-image:url($iwIconUrl);" ] );
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
This class is a collection of static functions that serve two purposes:
getOutput()
Get the OutputPage being used for this instance.
implements Special:Search - Run text & title search and display the output
Represents a title within MediaWiki.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful
external whereas SearchGetNearMatch runs after $term
namespace being checked & $result