mediawiki-extensions-AbuseF.../Views/AbuseFilterView.php
Siebrand Mazeland 8ecd76b867 Use Linker statically.
No constant check needed for files only containing a class.
2011-09-02 15:34:55 +00:00

70 lines
1.5 KiB
PHP

<?php
abstract class AbuseFilterView {
function __construct( $page, $params ) {
$this->mPage = $page;
$this->mParams = $params;
}
/**
* @param string $subpage
* @return Title
*/
function getTitle( $subpage = '' ) {
return $this->mPage->getTitle( $subpage );
}
abstract function show();
/**
* @return bool
*/
function canEdit() {
global $wgUser;
static $canEdit = null;
if ( is_null( $canEdit ) ) {
$canEdit = $wgUser->isAllowed( 'abusefilter-modify' );
}
return $canEdit;
}
/**
* @return bool
*/
function canViewPrivate() {
global $wgUser;
static $canView = null;
if ( is_null( $canView ) ) {
$canView = $this->canEdit() || $wgUser->isAllowed( 'abusefilter-view-private' );
}
return $canView;
}
}
class AbuseFilterChangesList extends OldChangesList {
public function insertExtra( &$s, &$rc, &$classes ) {
$examineParams = empty( $rc->examineParams ) ? array() : $rc->examineParams;
$title = SpecialPage::getTitleFor( 'AbuseFilter', 'examine/' . $rc->mAttribs['rc_id'] );
$examineLink = Linker::link( $title, wfMsgExt( 'abusefilter-changeslist-examine', 'parseinline' ), array(), $examineParams );
$s .= " ($examineLink)";
# If we have a match..
if ( isset( $rc->filterResult ) ) {
$class = $rc->filterResult ?
'mw-abusefilter-changeslist-match' :
'mw-abusefilter-changeslist-nomatch';
$classes[] = $class;
}
}
// Kill rollback links.
public function insertRollback( &$s, &$rc ) { }
}