@@ -340,7 +340,7 @@ |
||
340 | 340 | * @param string $haystack |
341 | 341 | * @param string $needle |
342 | 342 | * |
343 | - * @return int|false |
|
343 | + * @return integer |
|
344 | 344 | */ |
345 | 345 | function stripos( $haystack, $needle ) { |
346 | 346 | $haystack = strtolower( $haystack ); |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Some generic functions and mock objects for test variables. |
|
4 | - * |
|
5 | - * @package PHPCheatsheets |
|
6 | - */ |
|
3 | + * Some generic functions and mock objects for test variables. |
|
4 | + * |
|
5 | + * @package PHPCheatsheets |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | // Prevent direct calls to this file. |
9 | 9 | if ( ! defined( 'APP_DIR' ) ) { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | ); |
206 | 206 | |
207 | 207 | // Group some more messages and make error message links work. |
208 | - $preg_search = array( |
|
208 | + $preg_search = array( |
|
209 | 209 | '`^(bc(?:add|sub|mul|div|mod|comp)|str(?:case|natcase|nat)?cmp|strcoll|similar_text|levenshtein)\(\) expects parameter ([12]) to be string, (?:array|object|resource) given$`', |
210 | 210 | '`^fmod\(\) expects parameter ([12]) to be (double|float), (?:string|array|object|resource) given$`', |
211 | 211 | '`^(is_(?:nan|(?:in)?finite))\(\) expects parameter ([12]) to be (double|float), (?:string|array|object|resource) given$`', |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | foreach ( $search as $k => $s ) { |
228 | 228 | if ( strpos( $error_str, $s ) === 0 ) { |
229 | - $error_str = $replace[ $k ]; |
|
229 | + $error_str = $replace[$k]; |
|
230 | 230 | break; |
231 | 231 | } |
232 | 232 | } |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Variable comparison tests. |
|
4 | - * |
|
5 | - * @package PHPCheatsheets |
|
6 | - */ |
|
3 | + * Variable comparison tests. |
|
4 | + * |
|
5 | + * @package PHPCheatsheets |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | // Prevent direct calls to this file. |
9 | 9 | if ( ! defined( 'APP_DIR' ) ) { |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | * @return string |
219 | 219 | */ |
220 | 220 | function get_tab_title( $tab ) { |
221 | - if ( isset( $this->tests[ $tab ]['title'] ) && is_string( $this->tests[ $tab ]['title'] ) && $this->tests[ $tab ]['title'] !== '' ) { |
|
222 | - return $this->tests[ $tab ]['title']; |
|
221 | + if ( isset( $this->tests[$tab]['title'] ) && is_string( $this->tests[$tab]['title'] ) && $this->tests[$tab]['title'] !== '' ) { |
|
222 | + return $this->tests[$tab]['title']; |
|
223 | 223 | } |
224 | 224 | else { |
225 | 225 | return ''; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | function get_test_group( $test_group = null ) { |
250 | 250 | $key = key( $this->tests ); // Get first item in array. |
251 | - if ( isset( $test_group, $this->tests[ $test_group ] ) ) { |
|
251 | + if ( isset( $test_group, $this->tests[$test_group] ) ) { |
|
252 | 252 | $key = $test_group; |
253 | 253 | } |
254 | 254 | return $key; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | function print_table( $test ) { |
322 | 322 | |
323 | - if ( isset( $this->tests[ $test ] ) ) { |
|
323 | + if ( isset( $this->tests[$test] ) ) { |
|
324 | 324 | $GLOBALS['encountered_errors'] = array(); |
325 | 325 | |
326 | 326 | echo ' |
@@ -333,9 +333,9 @@ discard block |
||
333 | 333 | $last_key = null; |
334 | 334 | |
335 | 335 | foreach ( $this->test_data_keys as $key1 ) { |
336 | - $value1 = $this->test_data[ $key1 ]; |
|
336 | + $value1 = $this->test_data[$key1]; |
|
337 | 337 | $legend = ''; |
338 | - if ( isset( $this->test_legend[ $key1 ] ) ) { |
|
338 | + if ( isset( $this->test_legend[$key1] ) ) { |
|
339 | 339 | $legend = '<sup class="fright"><a href="#var-legend-' . $key1 . '">†' . $key1 . '</a></sup>'; |
340 | 340 | } |
341 | 341 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | // Top labels |
414 | 414 | foreach ( $this->test_data_keys as $i => $key ) { |
415 | 415 | |
416 | - $value = $this->test_data[ $key ]; |
|
416 | + $value = $this->test_data[$key]; |
|
417 | 417 | $class = $this->get_table_header_cell_class( $i, $key ); |
418 | 418 | |
419 | 419 | $html .= ' |
@@ -459,15 +459,15 @@ discard block |
||
459 | 459 | */ |
460 | 460 | function get_table_header_group_label( $test ) { |
461 | 461 | $tooltip = ''; |
462 | - if ( isset( $this->tests[ $test ]['tooltip'] ) && $this->tests[ $test ]['tooltip'] !== '' ) { |
|
463 | - $tooltip = ' title="' . $this->tests[ $test ]['tooltip'] . '"'; |
|
462 | + if ( isset( $this->tests[$test]['tooltip'] ) && $this->tests[$test]['tooltip'] !== '' ) { |
|
463 | + $tooltip = ' title="' . $this->tests[$test]['tooltip'] . '"'; |
|
464 | 464 | } |
465 | 465 | |
466 | - if ( isset( $this->tests[ $test ]['url'] ) && $this->tests[ $test ]['url'] !== '' ) { |
|
467 | - $group_label = '<a href="' . $this->tests[ $test ]['url'] . '" target="_blank"' . $tooltip . '><strong>' . $this->tests[ $test ]['title'] . '</strong></a>'; |
|
466 | + if ( isset( $this->tests[$test]['url'] ) && $this->tests[$test]['url'] !== '' ) { |
|
467 | + $group_label = '<a href="' . $this->tests[$test]['url'] . '" target="_blank"' . $tooltip . '><strong>' . $this->tests[$test]['title'] . '</strong></a>'; |
|
468 | 468 | } |
469 | 469 | else { |
470 | - $group_label = '<a href="' . $this->tests[ $test ]['url'] . '" target="_blank"' . $tooltip . '><strong>' . $this->tests[ $test ]['title'] . '</strong></a>'; |
|
470 | + $group_label = '<a href="' . $this->tests[$test]['url'] . '" target="_blank"' . $tooltip . '><strong>' . $this->tests[$test]['title'] . '</strong></a>'; |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | return $group_label; |
@@ -483,8 +483,8 @@ discard block |
||
483 | 483 | */ |
484 | 484 | function get_table_header_group_notes( $test ) { |
485 | 485 | $notes = ''; |
486 | - if ( isset( $this->tests[ $test ]['notes'] ) && ( is_array( $this->tests[ $test ]['notes'] ) && count( $this->tests[ $test ]['notes'] ) > 0 ) ) { |
|
487 | - foreach ( $this->tests[ $test ]['notes'] as $key => $note ) { |
|
486 | + if ( isset( $this->tests[$test]['notes'] ) && ( is_array( $this->tests[$test]['notes'] ) && count( $this->tests[$test]['notes'] ) > 0 ) ) { |
|
487 | + foreach ( $this->tests[$test]['notes'] as $key => $note ) { |
|
488 | 488 | $notes .= ' <sup><a href="#' . $test . '-note' . ( $key + 1 ) . '">‡' . ( $key + 1 ) . '</a></sup>'; |
489 | 489 | } |
490 | 490 | } |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | */ |
503 | 503 | function get_table_header_cell_class( $index, $key ) { |
504 | 504 | $class = ''; |
505 | - if ( ! isset( $this->test_data_keys[ ( $index + 1 ) ] ) || substr( $key, 0, 1 ) !== substr( $this->test_data_keys[ ( $index + 1 ) ], 0, 1 ) ) { |
|
505 | + if ( ! isset( $this->test_data_keys[( $index + 1 )] ) || substr( $key, 0, 1 ) !== substr( $this->test_data_keys[( $index + 1 )], 0, 1 ) ) { |
|
506 | 506 | $class = ' class="end"'; |
507 | 507 | } |
508 | 508 | |
@@ -548,13 +548,13 @@ discard block |
||
548 | 548 | foreach ( $this->test_data_keys as $i => $key2 ) { |
549 | 549 | $GLOBALS['has_error'] = array(); |
550 | 550 | |
551 | - $value2 = $this->test_data[ $key2 ]; |
|
551 | + $value2 = $this->test_data[$key2]; |
|
552 | 552 | $class = $this->get_table_cell_class( $key1, $key2, $i ); |
553 | 553 | |
554 | 554 | echo ' |
555 | 555 | <td' . $class . '>'; |
556 | 556 | |
557 | - $this->tests[ $test ]['test']( $value1, $value2 ); |
|
557 | + $this->tests[$test]['test']( $value1, $value2 ); |
|
558 | 558 | $this->print_row_cell_error_refs(); |
559 | 559 | |
560 | 560 | echo ' </td>'; |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | */ |
577 | 577 | function get_table_cell_class( $key1, $key2, $index ) { |
578 | 578 | $class = array( 'value1-' . $key1, 'value2-' . $key2 ); |
579 | - if ( ! isset( $this->test_data_keys[ ( $index + 1 ) ] ) || substr( $key2, 0, 1 ) !== substr( $this->test_data_keys[ ( $index + 1 ) ], 0, 1 ) ) { |
|
579 | + if ( ! isset( $this->test_data_keys[( $index + 1 )] ) || substr( $key2, 0, 1 ) !== substr( $this->test_data_keys[( $index + 1 )], 0, 1 ) ) { |
|
580 | 580 | $class[] = 'end'; |
581 | 581 | } |
582 | 582 | |
@@ -592,8 +592,8 @@ discard block |
||
592 | 592 | * @param string $test The current subsection |
593 | 593 | */ |
594 | 594 | function print_other_footnotes( $test ) { |
595 | - if ( isset( $this->tests[ $test ]['notes'] ) && ( is_array( $this->tests[ $test ]['notes'] ) && count( $this->tests[ $test ]['notes'] ) > 0 ) ) { |
|
596 | - foreach ( $this->tests[ $test ]['notes'] as $key => $note ) { |
|
595 | + if ( isset( $this->tests[$test]['notes'] ) && ( is_array( $this->tests[$test]['notes'] ) && count( $this->tests[$test]['notes'] ) > 0 ) ) { |
|
596 | + foreach ( $this->tests[$test]['notes'] as $key => $note ) { |
|
597 | 597 | printf( ' |
598 | 598 | <div id="%1$s-note%2$s" class="note-appendix"> |
599 | 599 | <sup>‡ %2$s</sup> %3$s |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * PHP 5+ tests. |
|
4 | - * |
|
5 | - * @package PHPCheatsheets |
|
6 | - */ |
|
3 | + * PHP 5+ tests. |
|
4 | + * |
|
5 | + * @package PHPCheatsheets |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | // Prevent direct calls to this file. |
9 | 9 | if ( ! defined( 'APP_DIR' ) ) { |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * PHP 7+ tests. |
|
4 | - * |
|
5 | - * @package PHPCheatsheets |
|
6 | - */ |
|
3 | + * PHP 7+ tests. |
|
4 | + * |
|
5 | + * @package PHPCheatsheets |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | // Prevent direct calls to this file. |
9 | 9 | if ( ! defined( 'APP_DIR' ) ) { |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Variable testing tests. |
|
4 | - * |
|
5 | - * @package PHPCheatsheets |
|
6 | - */ |
|
3 | + * Variable testing tests. |
|
4 | + * |
|
5 | + * @package PHPCheatsheets |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | // Prevent direct calls to this file. |
9 | 9 | if ( ! defined( 'APP_DIR' ) ) { |
@@ -2263,8 +2263,8 @@ discard block |
||
2263 | 2263 | 'preg_number_unicode', |
2264 | 2264 | ); |
2265 | 2265 | foreach ( $targets as $target ) { |
2266 | - foreach ( $this->tests[ $target ] as $key => $value ) { |
|
2267 | - $this->tests[ $target ][ $key ] = str_replace( '##PREG_DECIMAL_POINT##', $preg_point, $value ); |
|
2266 | + foreach ( $this->tests[$target] as $key => $value ) { |
|
2267 | + $this->tests[$target][$key] = str_replace( '##PREG_DECIMAL_POINT##', $preg_point, $value ); |
|
2268 | 2268 | } |
2269 | 2269 | } |
2270 | 2270 | unset( $preg_point ); |
@@ -2329,7 +2329,7 @@ discard block |
||
2329 | 2329 | |
2330 | 2330 | if ( ( PHP_VERSION_ID >= 50004 && PHP_VERSION_ID <= 50005 ) || phpversion() === '4.3.11' ) { |
2331 | 2331 | $key = array_search( 'f8', $this->test_data_keys, true ); |
2332 | - unset( $this->test_data_keys[ $key ], $this->test_data['f8'] ); |
|
2332 | + unset( $this->test_data_keys[$key], $this->test_data['f8'] ); |
|
2333 | 2333 | } |
2334 | 2334 | } |
2335 | 2335 | } |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Generic variable testing parent class. |
|
4 | - * |
|
5 | - * @package PHPCheatsheets |
|
6 | - */ |
|
3 | + * Generic variable testing parent class. |
|
4 | + * |
|
5 | + * @package PHPCheatsheets |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | // Prevent direct calls to this file. |
9 | 9 | if ( ! defined( 'APP_DIR' ) ) { |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // Create the actual test functions. |
109 | 109 | foreach ( $this->tests as $key => $array ) { |
110 | 110 | // pr_var( $key, 'Creating test for:', true ); |
111 | - $this->tests[ $key ]['test'] = create_function( $array['arg'], $array['function'] ); |
|
111 | + $this->tests[$key]['test'] = create_function( $array['arg'], $array['function'] ); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | function merge_tests( $overload_tests ) { |
130 | 130 | |
131 | 131 | foreach ( $overload_tests as $key => $array ) { |
132 | - if ( isset( $this->tests[ $key ], $this->tests[ $key ]['function'], $array['function'] ) ) { |
|
133 | - $this->tests[ $key ]['function'] = $array['function']; |
|
132 | + if ( isset( $this->tests[$key], $this->tests[$key]['function'], $array['function'] ) ) { |
|
133 | + $this->tests[$key]['function'] = $array['function']; |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | } |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | * @return string |
145 | 145 | */ |
146 | 146 | function get_tab_title( $tab ) { |
147 | - if ( isset( $this->test_groups[ $tab ]['title'] ) && is_string( $this->test_groups[ $tab ]['title'] ) && $this->test_groups[ $tab ]['title'] !== '' ) { |
|
148 | - return $this->test_groups[ $tab ]['title']; |
|
147 | + if ( isset( $this->test_groups[$tab]['title'] ) && is_string( $this->test_groups[$tab]['title'] ) && $this->test_groups[$tab]['title'] !== '' ) { |
|
148 | + return $this->test_groups[$tab]['title']; |
|
149 | 149 | } |
150 | 150 | else { |
151 | 151 | return ''; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | function get_test_group( $test_group = null ) { |
194 | 194 | $key = key( $this->test_groups ); // Set the first test group as the default if no test group given. |
195 | - if ( isset( $test_group, $this->test_groups[ $test_group ] ) ) { |
|
195 | + if ( isset( $test_group, $this->test_groups[$test_group] ) ) { |
|
196 | 196 | $key = $test_group; |
197 | 197 | } |
198 | 198 | return $key; |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | $this->test_legend = $legend_array; |
229 | 229 | |
230 | 230 | // Merge test group specific variables into the test array. |
231 | - if ( isset( $extra_variables[ $test_group ] ) && $extra_variables[ $test_group ] !== array() ) { |
|
232 | - $this->test_data = array_merge( $this->test_data, $extra_variables[ $test_group ] ); |
|
231 | + if ( isset( $extra_variables[$test_group] ) && $extra_variables[$test_group] !== array() ) { |
|
232 | + $this->test_data = array_merge( $this->test_data, $extra_variables[$test_group] ); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | $keys = array_keys( $this->test_data ); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @return int |
254 | 254 | */ |
255 | 255 | function sort_test_data( $var_a, $var_b ) { |
256 | - $primary_order = array( |
|
256 | + $primary_order = array( |
|
257 | 257 | 'n', // null |
258 | 258 | 'b', // boolean |
259 | 259 | 'i', // integer |
@@ -299,11 +299,11 @@ discard block |
||
299 | 299 | ); |
300 | 300 | |
301 | 301 | foreach ( $clean_this as $key => $function ) { |
302 | - if ( isset( $GLOBALS['test_array'], $GLOBALS['test_array'][ $key ] ) && is_resource( $GLOBALS['test_array'][ $key ] ) ) { |
|
303 | - $function( $GLOBALS['test_array'][ $key ] ); |
|
302 | + if ( isset( $GLOBALS['test_array'], $GLOBALS['test_array'][$key] ) && is_resource( $GLOBALS['test_array'][$key] ) ) { |
|
303 | + $function( $GLOBALS['test_array'][$key] ); |
|
304 | 304 | } |
305 | - if ( isset( $this->test_data, $this->test_data[ $key ] ) && is_resource( $this->test_data[ $key ] ) ) { |
|
306 | - $function( $this->test_data[ $key ] ); |
|
305 | + if ( isset( $this->test_data, $this->test_data[$key] ) && is_resource( $this->test_data[$key] ) ) { |
|
306 | + $function( $this->test_data[$key] ); |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | } |
@@ -366,15 +366,15 @@ discard block |
||
366 | 366 | */ |
367 | 367 | function print_table( $test_group ) { |
368 | 368 | |
369 | - if ( isset( $this->test_groups[ $test_group ] ) ) { |
|
369 | + if ( isset( $this->test_groups[$test_group] ) ) { |
|
370 | 370 | $GLOBALS['encountered_errors'] = array(); |
371 | 371 | |
372 | 372 | echo ' |
373 | 373 | <div id="', $test_group, '">'; |
374 | 374 | |
375 | - if ( isset( $this->test_groups[ $test_group ]['urls'] ) && ( is_array( $this->test_groups[ $test_group ]['urls'] ) && count( $this->test_groups[ $test_group ]['urls'] ) > 0 ) ) { |
|
375 | + if ( isset( $this->test_groups[$test_group]['urls'] ) && ( is_array( $this->test_groups[$test_group]['urls'] ) && count( $this->test_groups[$test_group]['urls'] ) > 0 ) ) { |
|
376 | 376 | echo '<p>References:</p><ul>'; |
377 | - foreach ( $this->test_groups[ $test_group ]['urls'] as $url ) { |
|
377 | + foreach ( $this->test_groups[$test_group]['urls'] as $url ) { |
|
378 | 378 | printf( '<li><a href="%1$s" target="_blank">%1$s</a></li>', $url ); |
379 | 379 | } |
380 | 380 | unset( $url ); |
@@ -387,9 +387,9 @@ discard block |
||
387 | 387 | $last_key = null; |
388 | 388 | |
389 | 389 | foreach ( $this->test_data_keys as $key ) { |
390 | - $value = $this->test_data[ $key ]; |
|
390 | + $value = $this->test_data[$key]; |
|
391 | 391 | $legend = ''; |
392 | - if ( isset( $this->test_legend[ $key ] ) ) { |
|
392 | + if ( isset( $this->test_legend[$key] ) ) { |
|
393 | 393 | $legend = '<sup class="fright"><a href="#var-legend-' . $key . '">†' . $key . '</a></sup>'; |
394 | 394 | } |
395 | 395 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $class[] = 'new-var-type'; |
401 | 401 | $last_key = $type; |
402 | 402 | } |
403 | - if ( isset( $this->test_groups[ $test_group ]['target'] ) && $this->test_groups[ $test_group ]['target'] === $type ) { |
|
403 | + if ( isset( $this->test_groups[$test_group]['target'] ) && $this->test_groups[$test_group]['target'] === $type ) { |
|
404 | 404 | $class[] = 'target'; |
405 | 405 | } |
406 | 406 | |
@@ -462,15 +462,15 @@ discard block |
||
462 | 462 | <tr> |
463 | 463 | ' . $group_label; |
464 | 464 | |
465 | - foreach ( $this->test_groups[ $test_group ]['tests'] as $test ) { |
|
465 | + foreach ( $this->test_groups[$test_group]['tests'] as $test ) { |
|
466 | 466 | $class = $this->get_table_header_cell_class( $test_group, $test ); |
467 | - $tooltip = ( isset( $this->tests[ $test ]['tooltip'] ) ? ' title="' . htmlspecialchars( $this->tests[ $test ]['tooltip'], ENT_QUOTES, 'UTF-8' ) . '"' : '' ); |
|
467 | + $tooltip = ( isset( $this->tests[$test]['tooltip'] ) ? ' title="' . htmlspecialchars( $this->tests[$test]['tooltip'], ENT_QUOTES, 'UTF-8' ) . '"' : '' ); |
|
468 | 468 | |
469 | 469 | $html .= ' |
470 | 470 | <th' . $class . '>' . |
471 | - ( ( isset( $this->tests[ $test ]['url'] ) && $this->tests[ $test ]['url'] !== '' ) ? '<a href="' . $this->tests[ $test ]['url'] . '" target="_blank"' . $tooltip . '>' : '' ) . |
|
472 | - $this->tests[ $test ]['title'] . |
|
473 | - ( ( isset( $this->tests[ $test ]['url'] ) && $this->tests[ $test ]['url'] !== '' ) ? '</a>' : '' ); |
|
471 | + ( ( isset( $this->tests[$test]['url'] ) && $this->tests[$test]['url'] !== '' ) ? '<a href="' . $this->tests[$test]['url'] . '" target="_blank"' . $tooltip . '>' : '' ) . |
|
472 | + $this->tests[$test]['title'] . |
|
473 | + ( ( isset( $this->tests[$test]['url'] ) && $this->tests[$test]['url'] !== '' ) ? '</a>' : '' ); |
|
474 | 474 | |
475 | 475 | |
476 | 476 | $html .= $this->get_table_header_note_indicators( $test, $test_group ); |
@@ -495,11 +495,11 @@ discard block |
||
495 | 495 | * @return string |
496 | 496 | */ |
497 | 497 | function get_table_header_group_label( $test_group ) { |
498 | - if ( isset( $this->test_groups[ $test_group ]['book_url'] ) && $this->test_groups[ $test_group ]['book_url'] !== '' ) { |
|
499 | - $group_label = '<th class="label-col"><a href="' . $this->test_groups[ $test_group ]['book_url'] . '" target="_blank">' . $this->test_groups[ $test_group ]['title'] . '</a></th>'; |
|
498 | + if ( isset( $this->test_groups[$test_group]['book_url'] ) && $this->test_groups[$test_group]['book_url'] !== '' ) { |
|
499 | + $group_label = '<th class="label-col"><a href="' . $this->test_groups[$test_group]['book_url'] . '" target="_blank">' . $this->test_groups[$test_group]['title'] . '</a></th>'; |
|
500 | 500 | } |
501 | 501 | else { |
502 | - $group_label = '<th class="label-col">' . $this->test_groups[ $test_group ]['title'] . '</th>'; |
|
502 | + $group_label = '<th class="label-col">' . $this->test_groups[$test_group]['title'] . '</th>'; |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | return $group_label; |
@@ -517,12 +517,12 @@ discard block |
||
517 | 517 | function get_table_header_note_indicators( $test, $test_group ) { |
518 | 518 | $notes = ''; |
519 | 519 | |
520 | - if ( isset( $this->tests[ $test ]['notes'] ) && ( is_array( $this->tests[ $test ]['notes'] ) && count( $this->tests[ $test ]['notes'] ) > 0 ) ) { |
|
520 | + if ( isset( $this->tests[$test]['notes'] ) && ( is_array( $this->tests[$test]['notes'] ) && count( $this->tests[$test]['notes'] ) > 0 ) ) { |
|
521 | 521 | |
522 | - $this->table_notes = array_merge( $this->table_notes, $this->tests[ $test ]['notes'] ); |
|
522 | + $this->table_notes = array_merge( $this->table_notes, $this->tests[$test]['notes'] ); |
|
523 | 523 | $this->table_notes = array_unique( $this->table_notes ); |
524 | 524 | |
525 | - foreach ( $this->tests[ $test ]['notes'] as $note ) { |
|
525 | + foreach ( $this->tests[$test]['notes'] as $note ) { |
|
526 | 526 | $note_id = array_search( $note, $this->table_notes ); |
527 | 527 | if ( $note_id !== false ) { |
528 | 528 | $notes .= ' <sup><a href="#' . $test_group . '-note' . ( $note_id + 1 ) . '">‡' . ( $note_id + 1 ) . '</a></sup>'; |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | $class = array(); |
546 | 546 | |
547 | 547 | foreach ( $this->table_header_class_map as $group_key => $classname ) { |
548 | - if ( isset( $this->test_groups[ $test_group ][ $group_key ] ) && in_array( $test, $this->test_groups[ $test_group ][ $group_key ] ) ) { |
|
548 | + if ( isset( $this->test_groups[$test_group][$group_key] ) && in_array( $test, $this->test_groups[$test_group][$group_key] ) ) { |
|
549 | 549 | $class[] = $classname; |
550 | 550 | } |
551 | 551 | } |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | */ |
583 | 583 | function print_row_cells( $value, $test_group ) { |
584 | 584 | |
585 | - foreach ( $this->test_groups[ $test_group ]['tests'] as $key => $test ) { |
|
585 | + foreach ( $this->test_groups[$test_group]['tests'] as $key => $test ) { |
|
586 | 586 | $GLOBALS['has_error'] = array(); |
587 | 587 | |
588 | 588 | $class = $this->get_table_row_cell_class( $test_group, $test ); |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | <td' . $class . '>'; |
592 | 592 | |
593 | 593 | $val = $this->generate_value( $value ); |
594 | - $this->tests[ $test ]['test']( $val ); |
|
594 | + $this->tests[$test]['test']( $val ); |
|
595 | 595 | $this->print_row_cell_error_refs(); |
596 | 596 | |
597 | 597 | echo ' </td>'; |
@@ -612,13 +612,13 @@ discard block |
||
612 | 612 | */ |
613 | 613 | function get_table_row_cell_class( $test_group, $test ) { |
614 | 614 | $class = array( $test ); |
615 | - if ( in_array( $test, $this->test_groups[ $test_group ]['best'] ) ) { |
|
615 | + if ( in_array( $test, $this->test_groups[$test_group]['best'] ) ) { |
|
616 | 616 | $class[] = 'best'; |
617 | 617 | } |
618 | - else if ( in_array( $test, $this->test_groups[ $test_group ]['good'] ) ) { |
|
618 | + else if ( in_array( $test, $this->test_groups[$test_group]['good'] ) ) { |
|
619 | 619 | $class[] = 'good'; |
620 | 620 | } |
621 | - if ( in_array( $test, $this->test_groups[ $test_group ]['break_at'] ) ) { |
|
621 | + if ( in_array( $test, $this->test_groups[$test_group]['break_at'] ) ) { |
|
622 | 622 | $class[] = 'end'; |
623 | 623 | } |
624 | 624 |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Set up the run environment. |
|
4 | - * |
|
5 | - * @package PHPCheatsheets |
|
6 | - */ |
|
3 | + * Set up the run environment. |
|
4 | + * |
|
5 | + * @package PHPCheatsheets |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | // Prevent direct calls to this file. |
9 | 9 | if ( ! defined( 'APP_DIR' ) ) { |
@@ -121,7 +121,7 @@ |
||
121 | 121 | 'si' => 'is_array', // is_callable |
122 | 122 | ); |
123 | 123 | |
124 | -$extra_variables['boolean_tests'] = array( |
|
124 | +$extra_variables['boolean_tests'] = array( |
|
125 | 125 | 'sq' => 'on', // filter_var boolean |
126 | 126 | 'sr' => 'off', // filter_var boolean |
127 | 127 | 'ss' => 'yes', // filter_var boolean |
@@ -1,25 +1,25 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * File: xvardump.php |
|
4 | - * |
|
5 | - * Group of functions for variable visualisation purposes. |
|
6 | - * |
|
7 | - * The main function pr_var() can be used as a color-coded alternative for var_dump(). |
|
8 | - * |
|
9 | - * A couple of 'shortcut' functions are provided for known variable types. |
|
10 | - * Only use those if you know what you are receiving and don't need variable typing info. |
|
11 | - * |
|
12 | - * @package xvardump |
|
13 | - * @author Juliette Reinders Folmer, {@link http://www.adviesenzo.nl/ Advies en zo} - |
|
14 | - * <[email protected]> |
|
15 | - * |
|
16 | - * @version 1.7 |
|
17 | - * @since 2009-09-30 // Last changed: by Juliette Reinders Folmer |
|
18 | - * @copyright Advies en zo, Meedenken en -doen �2005-2009 |
|
19 | - * @license http://www.opensource.org/licenses/lgpl-license.php GNU Lesser General Public License |
|
20 | - * @license http://opensource.org/licenses/academic Academic Free License Version 1.2 |
|
21 | - * @example example/example.php |
|
22 | - */ |
|
3 | + * File: xvardump.php |
|
4 | + * |
|
5 | + * Group of functions for variable visualisation purposes. |
|
6 | + * |
|
7 | + * The main function pr_var() can be used as a color-coded alternative for var_dump(). |
|
8 | + * |
|
9 | + * A couple of 'shortcut' functions are provided for known variable types. |
|
10 | + * Only use those if you know what you are receiving and don't need variable typing info. |
|
11 | + * |
|
12 | + * @package xvardump |
|
13 | + * @author Juliette Reinders Folmer, {@link http://www.adviesenzo.nl/ Advies en zo} - |
|
14 | + * <[email protected]> |
|
15 | + * |
|
16 | + * @version 1.7 |
|
17 | + * @since 2009-09-30 // Last changed: by Juliette Reinders Folmer |
|
18 | + * @copyright Advies en zo, Meedenken en -doen �2005-2009 |
|
19 | + * @license http://www.opensource.org/licenses/lgpl-license.php GNU Lesser General Public License |
|
20 | + * @license http://opensource.org/licenses/academic Academic Free License Version 1.2 |
|
21 | + * @example example/example.php |
|
22 | + */ |
|
23 | 23 | |
24 | 24 | // Prevent direct calls to this file. |
25 | 25 | if ( ! defined( 'APP_DIR' ) ) { |
@@ -29,18 +29,18 @@ |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | -define( 'XVARDUMP_SPACE_LONG', ' ' ); |
|
33 | -define( 'XVARDUMP_SPACE_SHORT', ' ' ); |
|
34 | - |
|
35 | -define( 'XVARDUMP_CLASS_STRING', 'vt-string' ); |
|
36 | -define( 'XVARDUMP_CLASS_INT', 'vt-int' ); |
|
37 | -define( 'XVARDUMP_CLASS_INT_0', 'vt-int-0' ); |
|
38 | -define( 'XVARDUMP_CLASS_FLOAT', 'vt-float' ); |
|
39 | -define( 'XVARDUMP_CLASS_BOOL', 'vt-bool' ); |
|
40 | -define( 'XVARDUMP_CLASS_B_TRUE', 'vt-b-true' ); |
|
41 | -define( 'XVARDUMP_CLASS_B_FALSE', 'vt-b-false' ); |
|
32 | +define( 'XVARDUMP_SPACE_LONG', ' ' ); |
|
33 | +define( 'XVARDUMP_SPACE_SHORT', ' ' ); |
|
34 | + |
|
35 | +define( 'XVARDUMP_CLASS_STRING', 'vt-string' ); |
|
36 | +define( 'XVARDUMP_CLASS_INT', 'vt-int' ); |
|
37 | +define( 'XVARDUMP_CLASS_INT_0', 'vt-int-0' ); |
|
38 | +define( 'XVARDUMP_CLASS_FLOAT', 'vt-float' ); |
|
39 | +define( 'XVARDUMP_CLASS_BOOL', 'vt-bool' ); |
|
40 | +define( 'XVARDUMP_CLASS_B_TRUE', 'vt-b-true' ); |
|
41 | +define( 'XVARDUMP_CLASS_B_FALSE', 'vt-b-false' ); |
|
42 | 42 | define( 'XVARDUMP_CLASS_RESOURCE', 'vt-resource' ); |
43 | -define( 'XVARDUMP_CLASS_NULL', 'vt-null' ); |
|
43 | +define( 'XVARDUMP_CLASS_NULL', 'vt-null' ); |
|
44 | 44 | |
45 | 45 | |
46 | 46 | /** |