<?php
+/**
+ * Base implementations for deletable items.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup RevisionDelete
+ */
+
/**
* List for revision table items
*
/**
* Get the HTML link to the revision text.
* Overridden by RevDel_ArchiveItem.
+ * @return string
*/
protected function getRevisionLink() {
- $date = $this->list->getLanguage()->timeanddate( $this->revision->getTimestamp(), true );
+ $date = $this->list->getLanguage()->userTimeAndDate(
+ $this->revision->getTimestamp(), $this->list->getUser() );
if ( $this->isDeleted() && !$this->canViewContent() ) {
return $date;
}
/**
* Get the HTML link to the diff.
* Overridden by RevDel_ArchiveItem
+ * @return string
*/
protected function getDiffLink() {
if ( $this->isDeleted() && !$this->canViewContent() ) {
- return wfMsgHtml('diff');
+ return $this->list->msg( 'diff' )->escaped();
} else {
return
Linker::link(
$this->list->title,
- wfMsgHtml('diff'),
+ $this->list->msg( 'diff' )->escaped(),
array(),
array(
'diff' => $this->revision->getId(),
}
public function getHTML() {
- $difflink = $this->getDiffLink();
+ $difflink = wfMessage( 'parentheses' )->rawParams( $this->getDiffLink() );
$revlink = $this->getRevisionLink();
$userlink = Linker::revUserLink( $this->revision );
$comment = Linker::revComment( $this->revision );
if ( $this->isDeleted() ) {
$revlink = "<span class=\"history-deleted\">$revlink</span>";
}
- return "<li>($difflink) $revlink $userlink $comment</li>";
+ return "<li>$difflink $revlink $userlink $comment</li>";
}
}
public function __construct( $list, $row ) {
RevDel_Item::__construct( $list, $row );
$this->revision = Revision::newFromArchiveRow( $row,
- array( 'page' => $this->list->title->getArticleId() ) );
+ array( 'page' => $this->list->title->getArticleID() ) );
}
public function getIdField() {
protected function getRevisionLink() {
$undelete = SpecialPage::getTitleFor( 'Undelete' );
- $date = $this->list->getLanguage()->timeanddate( $this->revision->getTimestamp(), true );
+ $date = $this->list->getLanguage()->userTimeAndDate(
+ $this->revision->getTimestamp(), $this->list->getUser() );
if ( $this->isDeleted() && !$this->canViewContent() ) {
return $date;
}
protected function getDiffLink() {
if ( $this->isDeleted() && !$this->canViewContent() ) {
- return wfMsgHtml( 'diff' );
+ return $this->list->msg( 'diff' )->escaped();
}
$undelete = SpecialPage::getTitleFor( 'Undelete' );
- return Linker::link( $undelete, wfMsgHtml('diff'), array(),
+ return Linker::link( $undelete, $this->list->msg( 'diff' )->escaped(), array(),
array(
'target' => $this->list->title->getPrefixedText(),
'diff' => 'prev',
RevDel_Item::__construct( $list, $row );
$this->revision = Revision::newFromArchiveRow( $row,
- array( 'page' => $this->list->title->getArticleId() ) );
+ array( 'page' => $this->list->title->getArticleID() ) );
}
public function getIdField() {
/**
* Get the link to the file.
* Overridden by RevDel_ArchivedFileItem.
+ * @return string
*/
protected function getLink() {
- $date = $this->list->getLanguage()->timeanddate( $this->file->getTimestamp(), true );
+ $date = $this->list->getLanguage()->userTimeAndDate(
+ $this->file->getTimestamp(), $this->list->getUser() );
if ( $this->isDeleted() ) {
# Hidden files...
if ( !$this->canViewContent() ) {
$link = Linker::userLink( $this->file->user, $this->file->user_text ) .
Linker::userToolLinks( $this->file->user, $this->file->user_text );
} else {
- $link = wfMsgHtml( 'rev-deleted-user' );
+ $link = $this->list->msg( 'rev-deleted-user' )->escaped();
}
if( $this->file->isDeleted( Revision::DELETED_USER ) ) {
return '<span class="history-deleted">' . $link . '</span>';
if( $this->file->userCan( File::DELETED_COMMENT, $this->list->getUser() ) ) {
$block = Linker::commentBlock( $this->file->description );
} else {
- $block = ' ' . wfMsgHtml( 'rev-deleted-comment' );
+ $block = ' ' . $this->list->msg( 'rev-deleted-comment' )->escaped();
}
if( $this->file->isDeleted( File::DELETED_COMMENT ) ) {
return "<span class=\"history-deleted\">$block</span>";
public function getHTML() {
$data =
- wfMsg(
- 'widthheight',
- $this->list->getLanguage()->formatNum( $this->file->getWidth() ),
- $this->list->getLanguage()->formatNum( $this->file->getHeight() )
- ) .
- ' (' .
- wfMsgExt( 'nbytes', 'parsemag', $this->list->getLanguage()->formatNum( $this->file->getSize() ) ) .
- ')';
+ $this->list->msg( 'widthheight' )->numParams(
+ $this->file->getWidth(), $this->file->getHeight() )->text() .
+ ' (' . $this->list->msg( 'nbytes' )->numParams( $this->file->getSize() )->text() . ')';
return '<li>' . $this->getLink() . ' ' . $this->getUserTools() . ' ' .
$data . ' ' . $this->getComment(). '</li>';
}
protected function getLink() {
- $date = $this->list->getLanguage()->timeanddate( $this->file->getTimestamp(), true );
+ $date = $this->list->getLanguage()->userTimeAndDate(
+ $this->file->getTimestamp(), $this->list->getUser() );
$undelete = SpecialPage::getTitleFor( 'Undelete' );
$key = $this->file->getKey();
# Hidden files...
}
public function getHTML() {
- $date = htmlspecialchars( $this->list->getLanguage()->timeanddate( $this->row->log_timestamp ) );
- $paramArray = LogPage::extractParams( $this->row->log_params );
+ $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
+ $this->row->log_timestamp, $this->list->getUser() ) );
$title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
+ $formatter = LogFormatter::newFromRow( $this->row );
+ $formatter->setContext( $this->list->getContext() );
+ $formatter->setAudience( LogFormatter::FOR_THIS_USER );
// Log link for this page
$loglink = Linker::link(
SpecialPage::getTitleFor( 'Log' ),
- wfMsgHtml( 'log' ),
+ $this->list->msg( 'log' )->escaped(),
array(),
array( 'page' => $title->getPrefixedText() )
);
- // Action text
- if( !$this->canView() ) {
- $action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
- } else {
- $skin = $this->list->getUser()->getSkin();
- $action = LogPage::actionText( $this->row->log_type, $this->row->log_action,
- $title, $skin, $paramArray, true, true );
- if( $this->row->log_deleted & LogPage::DELETED_ACTION )
- $action = '<span class="history-deleted">' . $action . '</span>';
- }
- // User links
- $userLink = Linker::userLink( $this->row->log_user,
- User::WhoIs( $this->row->log_user ) );
- if( LogEventsList::isDeleted($this->row,LogPage::DELETED_USER) ) {
- $userLink = '<span class="history-deleted">' . $userLink . '</span>';
- }
+ $loglink = wfMessage( 'parentheses' )->rawParams( $loglink );
+ // User links and action text
+ $action = $formatter->getActionText();
// Comment
$comment = $this->list->getLanguage()->getDirMark() . Linker::commentBlock( $this->row->log_comment );
if( LogEventsList::isDeleted($this->row,LogPage::DELETED_COMMENT) ) {
$comment = '<span class="history-deleted">' . $comment . '</span>';
}
- return "<li>($loglink) $date $userLink $action $comment</li>";
+
+ return "<li>$loglink $date $action $comment</li>";
}
}