41 if ( $result->isBrokenTitle() || $result->isMissingRevision() ) {
50 if ( !$result->getTitle()->userCan(
'read', $this->specialPage->getUser() ) ) {
51 return "<li>{$link}</li>";
57 $date = $this->specialPage->getLanguage()->userTimeAndDate(
58 $result->getTimestamp(),
59 $this->specialPage->getUser()
62 $snippet = $result->getTextSnippet( $terms );
64 $extract =
"<div class='searchresult'>$snippet</div>";
69 if ( $thumb ===
null ) {
79 if ( !Hooks::run(
'ShowSearchHit', [
80 $this->specialPage, $result, $terms,
82 &$score, &$desc, &$date, &$related, &
$html
89 $joined =
"{$link} {$redirect} {$category} {$section} {$file}";
92 if ( $thumb ===
null ) {
94 "<div class='mw-search-result-heading'>{$joined}</div>" .
98 "<table class='searchResultImage'>" .
100 "<td style='width: 120px; text-align: center; vertical-align: top'>" .
103 "<td style='vertical-align: top'>" .
104 "{$joined} {$extract} {$meta}" .
110 return "<li class='mw-search-result'>{$html}</li>";
125 $snippet = $result->getTitleSnippet();
126 if ( $snippet ===
'' ) {
133 $title = clone $result->getTitle();
136 $attributes = [
'data-serp-pos' =>
$position ];
137 Hooks::run(
'ShowSearchHitTitle',
138 [ &$title, &$snippet, $result, $terms, $this->specialPage, &
$query, &$attributes ] );
140 $link = $this->linkRenderer->makeLink(
161 $inner = $title ===
null
163 : $this->linkRenderer->makeLink( $title, $text ?
new HtmlArmor( $text ) :
null );
165 return "<span class='searchalttitle'>" .
166 $this->specialPage->msg( $msgKey )->rawParams( $inner )->parse()
175 $title = $result->getRedirectTitle();
176 return $title ===
null
186 $title = $result->getSectionTitle();
187 return $title ===
null
197 $snippet = $result->getCategorySnippet();
208 $title = $result->getTitle();
210 $cat = Category::newFromTitle( $title );
211 return $this->specialPage->msg(
'search-result-category-size' )
212 ->numParams( $cat->getPageCount(), $cat->getSubcatCount(), $cat->getFileCount() )
215 }
elseif ( $result->getByteSize() !==
null || $result->getWordCount() > 0 ) {
216 $lang = $this->specialPage->getLanguage();
217 $bytes =
$lang->formatSize( $result->getByteSize() );
218 $words = $result->getWordCount();
220 return $this->specialPage->msg(
'search-result-size', $bytes )
221 ->numParams( $words )
235 $title = $result->getTitle();
236 if ( $title->getNamespace() !==
NS_FILE ) {
237 return [
'',
null,
null ];
240 if ( $result->isFileMatch() ) {
241 $html =
"<span class='searchalttitle'>" .
242 $this->specialPage->msg(
'search-file-match' )->escaped() .
251 $img = $result->getFile() ?:
wfFindFile( $title );
253 $thumb = $img->transform( [
'width' => 120,
'height' => 120 ] );
255 $descHtml = $this->specialPage->msg(
'parentheses' )
256 ->rawParams( $img->getShortDesc() )
258 $thumbHtml = $thumb->toHtml( [
'desc-link' =>
true ] );
273 if ( $desc && $date ) {
274 $meta =
"{$desc} - {$date}";
283 return "<div class='mw-search-result-data'>{$meta}</div>";
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfFindFile( $title, $options=[])
Find a file.
Category objects are immutable, strictly speaking.
Marks HTML that shouldn't be escaped.
implements Special:Search - Run text & title search and display the output
Represents a title within MediaWiki.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
usually copyright or history_copyright This message must be in HTML not wikitext & $link
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
if(!isset( $args[0])) $lang