Index: trunk/extensions/QPoll/qp_eval.php |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | # math |
116 | 116 | 'round', 'ceil', 'floor', |
117 | 117 | # arrays |
118 | | - 'is_array', 'array_search', 'count', |
| 118 | + 'is_array', 'array_search', 'count', 'array_intersect', 'array_diff', |
119 | 119 | # strings |
120 | 120 | 'trim', 'preg_match', 'preg_match_all', 'preg_split', 'qp_lc', |
121 | 121 | # debug |
Index: trunk/extensions/QPoll/qp_user.php |
— | — | @@ -78,25 +78,38 @@ |
79 | 79 | ); |
80 | 80 | } |
81 | 81 | |
82 | | -function qp_debug() { |
| 82 | +/** |
| 83 | + * Interpretation script debug function |
| 84 | + * @param $args array $args[0] - string message |
| 85 | + * $args[1] - variable to dump (optional) |
| 86 | + * $args[2] - bool true / false enable / disable output (optional) |
| 87 | + */ |
| 88 | +function qp_debug( /* $args */ ) { |
83 | 89 | $args = func_get_args(); |
84 | | - if ( count( $args ) < 2 ) { |
| 90 | + if ( count( $args ) < 1 ) { |
85 | 91 | return; |
86 | 92 | } |
87 | | - list( $var_name, $var_value ) = $args; |
| 93 | + $message = $args[0]; |
88 | 94 | $debug = true; |
89 | 95 | if ( count( $args ) > 2 ) { |
90 | 96 | $debug = $args[2]; |
91 | 97 | } |
92 | | - if ( $debug === true) { |
| 98 | + if ( $debug !== true) { |
| 99 | + return; |
| 100 | + } |
| 101 | + if ( count( $args ) > 1 ) { |
93 | 102 | ob_start(); |
94 | | - var_dump( $var_value ); |
| 103 | + var_dump( $args[1] ); |
95 | 104 | $var_value = ob_get_contents(); |
96 | 105 | ob_end_clean(); |
97 | | - wfDebugLog( 'qpoll', "{$var_name} = {$var_value}\n" ); |
| 106 | + $message = "{$message} = {$var_value}\n"; |
98 | 107 | } |
| 108 | + wfDebugLog( 'qpoll', $message ); |
99 | 109 | } |
100 | 110 | |
| 111 | +/** |
| 112 | + * Interpretation script text lowercase function (according to content language) |
| 113 | + */ |
101 | 114 | function qp_lc( $text ) { |
102 | 115 | global $wgContLang; |
103 | 116 | return $wgContLang->lc( $text ); |