$row .= "<td $selected style='white-space: nowrap;'>";
if ( !$file->userCan( File::DELETED_FILE, $user ) ) {
# Don't link to unviewable files
- $row .= '<span class="history-deleted">'
- . $lang->userTimeAndDate( $timestamp, $user ) . '</span>';
+ $row .= Html::element( 'span', [ 'class' => 'history-deleted' ],
+ $lang->userTimeAndDate( $timestamp, $user )
+ );
} elseif ( $file->isDeleted( File::DELETED_FILE ) ) {
+ $timeAndDate = htmlspecialchars( $lang->userTimeAndDate( $timestamp, $user ) );
if ( $local ) {
$this->preventClickjacking();
$revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
# Make a link to review the image
$url = Linker::linkKnown(
$revdel,
- $lang->userTimeAndDate( $timestamp, $user ),
+ $timeAndDate,
[],
[
'target' => $this->title->getPrefixedText(),
]
);
} else {
- $url = $lang->userTimeAndDate( $timestamp, $user );
+ $url = $timeAndDate;
}
$row .= '<span class="history-deleted">' . $url . '</span>';
} elseif ( !$file->exists() ) {
- $row .= '<span class="mw-file-missing">'
- . $lang->userTimeAndDate( $timestamp, $user ) . '</span>';
+ $row .= Html::element( 'span', [ 'class' => 'mw-file-missing' ],
+ $lang->userTimeAndDate( $timestamp, $user )
+ );
} else {
$url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl( $img );
$row .= Xml::element(
$row .= '<td><span class="history-deleted">' .
$this->msg( 'rev-deleted-comment' )->escaped() . '</span></td>';
} else {
- $row .=
- '<td dir="' . MediaWikiServices::getInstance()->getContentLanguage()->getDir() .
- '">' . Linker::formatComment( $description, $this->title ) . '</td>';
+ $contLang = MediaWikiServices::getInstance()->getContentLanguage();
+ $row .= Html::rawElement(
+ 'td',
+ [ 'dir' => $contLang->getDir() ],
+ Linker::formatComment( $description, $this->title )
+ );
}
$rowClass = null;
$url = str_replace( '$1', urlencode( $term ), $searchForwardUrl );
$out->redirect( $url );
} else {
- $out->addHTML(
- "<fieldset>" .
- "<legend>" .
- $this->msg( 'search-external' )->escaped() .
- "</legend>" .
- "<p class='mw-searchdisabled'>" .
- $this->msg( 'searchdisabled' )->escaped() .
- "</p>" .
- $this->msg( 'googlesearch' )->rawParams(
- htmlspecialchars( $term ),
- 'UTF-8',
- $this->msg( 'searchbutton' )->escaped()
- )->text() .
- "</fieldset>"
- );
+ $this->showGoogleSearch( $term );
}
return;
$this->showResults( $term );
}
+ /**
+ * Output a google search form if search is disabled
+ *
+ * @param string $term Search term
+ * @todo FIXME Maybe we should get rid of this raw html message at some future time
+ * @suppress SecurityCheck-XSS
+ */
+ private function showGoogleSearch( $term ) {
+ $this->getOutput()->addHTML(
+ "<fieldset>" .
+ "<legend>" .
+ $this->msg( 'search-external' )->escaped() .
+ "</legend>" .
+ "<p class='mw-searchdisabled'>" .
+ $this->msg( 'searchdisabled' )->escaped() .
+ "</p>" .
+ $this->msg( 'googlesearch' )->rawParams(
+ htmlspecialchars( $term ),
+ 'UTF-8',
+ $this->msg( 'searchbutton' )->escaped()
+ )->text() .
+ "</fieldset>"
+ );
+ }
+
/**
* Set up basic search parameters from the request and user settings.
*