Refactor, pretty up and spread localisation of filter consequences (in logs, history, filter summary, etc)

This commit is contained in:
Andrew Garrett 2009-01-28 01:26:38 +00:00
parent 6a4457d8f5
commit 36b78662b0
5 changed files with 17 additions and 7 deletions

View file

@ -751,4 +751,10 @@ class AbuseFilter {
return array( $af_row, $actions_output );
}
static function getActionDisplay( $action ) {
$display = wfMsg( "abusefilter-action-$action" );
$display = wfEmptyMsg( "abusefilter-action-$action", $display ) ? $action : $display;
return $display;
}
}

View file

@ -195,6 +195,14 @@ class SpecialAbuseLog extends SpecialPage {
$actions_taken = $row->afl_actions;
if (!strlen(trim($actions_taken))) {
$actions_taken = wfMsg( 'abusefilter-log-noactions' );
} else {
$actions = explode(',', $actions_taken);
$displayActions = array();
foreach( $actions as $action ) {
$displayActions[] = AbuseFilter::getActionDisplay( $action );;
}
$actions_taken = implode( ', ', $displayActions );
}
if ($this->canSeeDetails()) {

View file

@ -133,7 +133,7 @@ class AbuseFilterHistoryPager extends TablePager {
$display_actions = '';
foreach( $actions as $action => $parameters ) {
$display_actions .= Xml::tags( 'li', null, wfMsgExt( 'abusefilter-history-action', array( 'parseinline' ), array($action, implode('; ', $parameters)) ) );
$display_actions .= Xml::tags( 'li', null, wfMsgExt( 'abusefilter-history-action', array( 'parseinline' ), array( AbuseFilter::getActionDisplay($action), implode('; ', $parameters)) ) );
}
$display_actions = Xml::tags( 'ul', null, $display_actions );

View file

@ -172,9 +172,7 @@ class AbuseFilterPager extends TablePager {
$actions = explode(',', $value);
$displayActions = array();
foreach( $actions as $action ) {
$display = wfMsg( "abusefilter-action-$action" );
$display = wfEmptyMsg( "abusefilter-action-$action", $display ) ? $action : $display;
$displayActions[] = $display;
$displayActions[] = AbuseFilter::getActionDisplay( $action );;
}
return htmlspecialchars( implode( ', ', $displayActions ) );
case 'status':

View file

@ -47,9 +47,7 @@ class AbuseFilterViewRevert extends AbuseFilterView {
$displayActions = array();
global $wgLang;
foreach( $result['actions'] as $action ) {
$displayActions[] = wfMsgExt( "abusefilter-action-$action", 'parseinline' );
}
$displayActions = array_map( array( 'AbuseFilter', 'getActionDisplay' ), $result['actions'] );
$msg = wfMsgExt( 'abusefilter-revert-preview-item', array( 'parseinline', 'replaceafter' ),
array( $wgLang->timeanddate( $result['timestamp'] ), $sk->userLink( $result['userid'],