Index: trunk/extensions/Configure/Configure.api.php |
— | — | @@ -238,6 +238,19 @@ |
239 | 239 | $result->setIndexedTagName( $arr['values'], 'value' ); |
240 | 240 | $settingRet['values'][] = $arr; |
241 | 241 | } |
| 242 | + case 'rate-limits': |
| 243 | + $settingRet['values'] = array(); |
| 244 | + $result->setIndexedTagName( $settingRet['values'], 'action' ); |
| 245 | + foreach ( $settingVal as $action => $limits ) { |
| 246 | + $arr = array( 'name' => $action ); |
| 247 | + foreach( $limits as $group => $values ){ |
| 248 | + $count = isset( $values[0] ) ? $values[0] : 0; |
| 249 | + $period = isset( $values[1] ) ? $values[1] : 0; |
| 250 | + $arr[] = array( 'name' => $group, 'count' => $values[0], 'period' => $values[1] ); |
| 251 | + } |
| 252 | + $result->setIndexedTagName( $arr, 'group' ); |
| 253 | + $settingRet['values'][] = $arr; |
| 254 | + } |
242 | 255 | } |
243 | 256 | break; |
244 | 257 | default: |
Index: trunk/extensions/Configure/Configure.page.php |
— | — | @@ -985,18 +985,18 @@ |
986 | 986 | $text .= '</table>'; |
987 | 987 | return $text; |
988 | 988 | } |
989 | | - if ($type == 'rate-limits') { ## Some of this is stolen from assoc, since it's an assoc with an assoc. |
| 989 | + if ( $type == 'rate-limits' ) { ## Some of this is stolen from assoc, since it's an assoc with an assoc. |
990 | 990 | $keydesc = wfMsgExt( "configure-setting-$conf-key", 'parseinline' ); |
991 | 991 | $valdesc = wfMsgExt( "configure-setting-$conf-value", 'parseinline' ); |
992 | 992 | |
993 | | - if (wfEmptyMsg( "configure-setting-$conf-key", $keydesc )) |
| 993 | + if ( wfEmptyMsg( "configure-setting-$conf-key", $keydesc ) ) |
994 | 994 | $keydesc = wfMsgHtml( 'configure-desc-key' ); |
995 | | - if (wfEmptyMsg( "configure-setting-$conf-value", $valdesc )) |
| 995 | + if ( wfEmptyMsg( "configure-setting-$conf-value", $valdesc ) ) |
996 | 996 | $valdesc = wfMsgHtml( 'configure-desc-val' ); |
997 | 997 | |
998 | | - $classes = array('configure-array-table', 'configure-rate-limits'); |
| 998 | + $classes = array( 'configure-array-table', 'configure-rate-limits' ); |
999 | 999 | |
1000 | | - if (!$allowed) |
| 1000 | + if ( !$allowed ) |
1001 | 1001 | $classes[] = 'disabled'; |
1002 | 1002 | |
1003 | 1003 | $rows = Xml::tags( 'tr', null, Xml::tags( 'th', null, $keydesc ) . " " . Xml::tags( 'th', null, $valdesc ) )."\n"; |
— | — | @@ -1007,26 +1007,26 @@ |
1008 | 1008 | |
1009 | 1009 | foreach( $validActions as $action ) { |
1010 | 1010 | $val = array(); |
1011 | | - if (@isset($default[$action])) |
| 1011 | + if ( isset( $default[$action] ) ) |
1012 | 1012 | $val = $default[$action]; |
1013 | 1013 | |
1014 | 1014 | $key = Xml::tags( 'td', null, wfMsgExt( "configure-throttle-action-$action", 'parseinline' ) ); |
1015 | 1015 | |
1016 | 1016 | ## Build YET ANOTHER ASSOC TABLE ARGH! |
1017 | | - $innerRows = Xml::tags( 'tr', null, Xml::tags( 'th', null, wfMsgExt( 'configure-throttle-group', 'parseinline' ) ) . " " . Xml::tags( 'th', null, wfMsgExt( 'configure-throttle-limit', 'parseinline' ) ) )."\n"; |
| 1017 | + $innerRows = Xml::tags( 'tr', null, Xml::tags( 'th', null, wfMsgExt( 'configure-throttle-group', 'parseinline' ) ) . ' ' . Xml::tags( 'th', null, wfMsgExt( 'configure-throttle-limit', 'parseinline' ) ) )."\n"; |
1018 | 1018 | foreach( $validGroups as $type ) { |
1019 | 1019 | $limits = null; |
1020 | | - if (@isset($default[$action][$type])) |
| 1020 | + if ( isset( $default[$action][$type] ) ) |
1021 | 1021 | $limits = $default[$action][$type]; |
1022 | | - if (is_array($limits) && count($limits) == 2) |
1023 | | - list($count, $period) = $limits; |
| 1022 | + if ( is_array( $limits ) && count( $limits ) == 2 ) |
| 1023 | + list( $count, $period ) = $limits; |
1024 | 1024 | else |
1025 | 1025 | $count = $period = 0; |
1026 | 1026 | |
1027 | 1027 | $id = 'wp'.$conf.'-key-'.$action.'-'.$type; |
1028 | 1028 | $left_col = Xml::tags( 'td', null, wfMsgExt( "configure-throttle-group-$type", 'parseinline' ) ); |
1029 | 1029 | |
1030 | | - if ($allowed) { |
| 1030 | + if ( $allowed ) { |
1031 | 1031 | $right_col = Xml::inputLabel( wfMsg( 'configure-throttle-count' ), "$id-count", "$id-count", 15, $count ) . ' <br /> ' . |
1032 | 1032 | Xml::inputLabel( wfMsg( 'configure-throttle-period' ), "$id-period", "$id-period", 15, $period ); |
1033 | 1033 | } else { |
— | — | @@ -1036,7 +1036,7 @@ |
1037 | 1037 | } |
1038 | 1038 | $right_col = Xml::tags( 'td', null, $right_col ); |
1039 | 1039 | |
1040 | | - $innerRows .= Xml::tags( 'tr', array( 'id' => $id), $left_col . $right_col ) . "\n"; |
| 1040 | + $innerRows .= Xml::tags( 'tr', array( 'id' => $id ), $left_col . $right_col ) . "\n"; |
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | $value = Xml::tags( 'td', null, Xml::tags( 'table', array( 'class' => 'configure-biglist configure-rate-limits-action' ), Xml::tags( 'tbody', null, $innerRows ) ) ); |