Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -190,6 +190,37 @@ |
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
| 194 | +if ( !function_exists( 'array_intersect_key' ) ) { |
| 195 | + /** |
| 196 | + * Exists in 5.1.0+ |
| 197 | + * Define our own array_intersect_key function |
| 198 | + */ |
| 199 | + function array_intersect_key( $isec, $keys ) { |
| 200 | + $argc = func_num_args(); |
| 201 | + |
| 202 | + if ( $argc > 2 ) { |
| 203 | + for ( $i = 1; $isec && $i < $argc; $i++ ) { |
| 204 | + $arr = func_get_arg( $i ); |
| 205 | + |
| 206 | + foreach ( array_keys( $isec ) as $key ) { |
| 207 | + if ( !isset( $arr[$key] ) ) |
| 208 | + unset( $isec[$key] ); |
| 209 | + } |
| 210 | + } |
| 211 | + |
| 212 | + return $isec; |
| 213 | + } else { |
| 214 | + $res = array(); |
| 215 | + foreach ( array_keys( $isec ) as $key ) { |
| 216 | + if ( isset( $keys[$key] ) ) |
| 217 | + $res[$key] = $isec[$key]; |
| 218 | + } |
| 219 | + |
| 220 | + return $res; |
| 221 | + } |
| 222 | + } |
| 223 | +} |
| 224 | + |
194 | 225 | // Support for Wietse Venema's taint feature |
195 | 226 | if ( !function_exists( 'istainted' ) ) { |
196 | 227 | function istainted( $var ) { |
Index: trunk/phase3/includes/api/ApiResult.php |
— | — | @@ -315,31 +315,3 @@ |
316 | 316 | return __CLASS__ . ': $Id$'; |
317 | 317 | } |
318 | 318 | } |
319 | | - |
320 | | -/* For compatibility with PHP versions < 5.1.0, define our own array_intersect_key function. */ |
321 | | -if ( !function_exists( 'array_intersect_key' ) ) { |
322 | | - function array_intersect_key( $isec, $keys ) { |
323 | | - $argc = func_num_args(); |
324 | | - |
325 | | - if ( $argc > 2 ) { |
326 | | - for ( $i = 1; $isec && $i < $argc; $i++ ) { |
327 | | - $arr = func_get_arg( $i ); |
328 | | - |
329 | | - foreach ( array_keys( $isec ) as $key ) { |
330 | | - if ( !isset( $arr[$key] ) ) |
331 | | - unset( $isec[$key] ); |
332 | | - } |
333 | | - } |
334 | | - |
335 | | - return $isec; |
336 | | - } else { |
337 | | - $res = array(); |
338 | | - foreach ( array_keys( $isec ) as $key ) { |
339 | | - if ( isset( $keys[$key] ) ) |
340 | | - $res[$key] = $isec[$key]; |
341 | | - } |
342 | | - |
343 | | - return $res; |
344 | | - } |
345 | | - } |
346 | | -} |