dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Split Pager classes out of SpecialPage files
[lhc/web/wiklou.git]
/
includes
/
specials
/
SpecialSearch.php
diff --git
a/includes/specials/SpecialSearch.php
b/includes/specials/SpecialSearch.php
index
5b9778c
..
dfab8d4
100644
(file)
--- a/
includes/specials/SpecialSearch.php
+++ b/
includes/specials/SpecialSearch.php
@@
-204,8
+204,13
@@
class SpecialSearch extends SpecialPage {
# If there's an exact or very near match, jump right there.
$title = SearchEngine::getNearMatch( $term );
# 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;
}
return;
}
@@
-294,7
+299,7
@@
class SpecialSearch extends SpecialPage {
}
// start rendering the page
}
// start rendering the page
- $out->addH
tml
(
+ $out->addH
TML
(
Xml::openElement(
'form',
[
Xml::openElement(
'form',
[
@@
-318,7
+323,7
@@
class SpecialSearch extends SpecialPage {
$num = $titleMatchesNum + $textMatchesNum;
$totalRes = $numTitleMatches + $numTextMatches;
$num = $titleMatchesNum + $textMatchesNum;
$totalRes = $numTitleMatches + $numTextMatches;
- $out->addH
tml
(
+ $out->addH
TML
(
# 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
# 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
@@
-337,7
+342,7
@@
class SpecialSearch extends SpecialPage {
return;
}
return;
}
- $out->addH
tml
( "<div class='searchresults'>" );
+ $out->addH
TML
( "<div class='searchresults'>" );
// prev/next links
$prevnext = null;
// prev/next links
$prevnext = null;
@@
-424,7
+429,7
@@
class SpecialSearch extends SpecialPage {
$out->addHTML( "<p class='mw-search-pager-bottom'>{$prevnext}</p>\n" );
}
$out->addHTML( "<p class='mw-search-pager-bottom'>{$prevnext}</p>\n" );
}
- $out->addH
tml
( "</div>" );
+ $out->addH
TML
( "</div>" );
Hooks::run( 'SpecialSearchResultsAppend', [ $this, $out, $term ] );
Hooks::run( 'SpecialSearchResultsAppend', [ $this, $out, $term ] );
@@
-546,7
+551,7
@@
class SpecialSearch extends SpecialPage {
) {
// invalid title
// preserve the paragraph for margins etc...
) {
// invalid title
// preserve the paragraph for margins etc...
- $this->getOutput()->addH
tml
( '<p></p>' );
+ $this->getOutput()->addH
TML
( '<p></p>' );
return;
}
return;
}
@@
-575,7
+580,7
@@
class SpecialSearch extends SpecialPage {
$this->getOutput()->wrapWikiMsg( "<p class=\"$linkClass\">\n$1</p>", $params );
} else {
// preserve the paragraph for margins etc...
$this->getOutput()->wrapWikiMsg( "<p class=\"$linkClass\">\n$1</p>", $params );
} else {
// preserve the paragraph for margins etc...
- $this->getOutput()->addH
tml
( '<p></p>' );
+ $this->getOutput()->addH
TML
( '<p></p>' );
}
}
}
}
@@
-1221,6
+1226,8
@@
class SpecialSearch extends SpecialPage {
'size' => '50',
'autofocus' => trim( $term ) === '',
'class' => 'mw-ui-input mw-ui-input-inline',
'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(
] ) . "\n";
$out .= Html::hidden( 'fulltext', 'Search' ) . "\n";
$out .= Html::submitButton(