Index: trunk/extensions/AbuseFilter/AbuseFilter.php |
— | — | @@ -167,4 +167,5 @@ |
168 | 168 | // Block duration |
169 | 169 | $wgAbuseFilterBlockDuration = 'indefinite'; |
170 | 170 | |
171 | | -$wgAbuseFilterCustomActionsHandlers = false; |
\ No newline at end of file |
| 171 | +// Callback functions for custom actions |
| 172 | +$wgAbuseFilterCustomActionsHandlers = array(); |
\ No newline at end of file |
Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php |
— | — | @@ -1075,19 +1075,17 @@ |
1076 | 1076 | AbuseFilter::$tagsToSet[$actionID] = $parameters; |
1077 | 1077 | break; |
1078 | 1078 | default: |
1079 | | - if( is_array( $wgAbuseFilterCustomActionsHandlers ) && |
1080 | | - in_array( $action, array_keys( $wgAbuseFilterCustomActionsHandlers ) ) ) |
1081 | | - { |
| 1079 | + if( isset( $wgAbuseFilterCustomActionsHandlers[$action] ) ) { |
1082 | 1080 | $custom_function = $wgAbuseFilterCustomActionsHandlers[$action]; |
1083 | 1081 | if( is_callable( $custom_function ) ) { |
1084 | | - $ok = call_user_func( $custom_function, $action, $parameters, $title, $vars, $rule_desc ); |
| 1082 | + $msg = call_user_func( $custom_function, $action, $parameters, $title, $vars, $rule_desc ); |
1085 | 1083 | } |
1086 | | - if( $ok ) { |
1087 | | - $display .= wfMsgExt( 'abusefilter-' . $action, 'parseinline', array() ) . "<br />\n"; |
| 1084 | + if( isset( $msg ) ) { |
| 1085 | + $display .= wfMsgExt( $msg, 'parseinline', array() ) . "<br />\n"; |
1088 | 1086 | } |
1089 | | - break; |
| 1087 | + } else { |
| 1088 | + wfDebugLog( 'AbuseFilter', "Unrecognised action $action" ); |
1090 | 1089 | } |
1091 | | - wfDebugLog( 'AbuseFilter', "Unrecognised action $action" ); |
1092 | 1090 | } |
1093 | 1091 | |
1094 | 1092 | return $display; |