@@ -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' ) ) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | // Create the actual test functions. |
108 | 108 | foreach ( $this->tests as $key => $array ) { |
109 | - $this->tests[ $key ]['test'] = create_function( $array['arg'], $array['function'] ); |
|
109 | + $this->tests[$key]['test'] = create_function( $array['arg'], $array['function'] ); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | function merge_tests( $overload_tests ) { |
128 | 128 | |
129 | 129 | foreach ( $overload_tests as $key => $array ) { |
130 | - if ( isset( $this->tests[ $key ], $this->tests[ $key ]['function'], $array['function'] ) ) { |
|
131 | - $this->tests[ $key ]['function'] = $array['function']; |
|
130 | + if ( isset( $this->tests[$key], $this->tests[$key]['function'], $array['function'] ) ) { |
|
131 | + $this->tests[$key]['function'] = $array['function']; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | * @return string |
143 | 143 | */ |
144 | 144 | function get_tab_title( $tab ) { |
145 | - if ( isset( $this->test_groups[ $tab ]['title'] ) && is_string( $this->test_groups[ $tab ]['title'] ) && $this->test_groups[ $tab ]['title'] !== '' ) { |
|
146 | - return $this->test_groups[ $tab ]['title']; |
|
145 | + if ( isset( $this->test_groups[$tab]['title'] ) && is_string( $this->test_groups[$tab]['title'] ) && $this->test_groups[$tab]['title'] !== '' ) { |
|
146 | + return $this->test_groups[$tab]['title']; |
|
147 | 147 | } |
148 | 148 | else { |
149 | 149 | return ''; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | function get_test_group( $test_group = null ) { |
192 | 192 | $key = key( $this->test_groups ); // Set the first test group as the default if no test group given. |
193 | - if ( isset( $test_group, $this->test_groups[ $test_group ] ) ) { |
|
193 | + if ( isset( $test_group, $this->test_groups[$test_group] ) ) { |
|
194 | 194 | $key = $test_group; |
195 | 195 | } |
196 | 196 | return $key; |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | $this->test_legend = $legend_array; |
227 | 227 | |
228 | 228 | // Merge test group specific variables into the test array. |
229 | - if ( isset( $extra_variables[ $test_group ] ) && $extra_variables[ $test_group ] !== array() ) { |
|
230 | - $this->test_data = array_merge( $this->test_data, $extra_variables[ $test_group ] ); |
|
229 | + if ( isset( $extra_variables[$test_group] ) && $extra_variables[$test_group] !== array() ) { |
|
230 | + $this->test_data = array_merge( $this->test_data, $extra_variables[$test_group] ); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | $keys = array_keys( $this->test_data ); |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @return int |
252 | 252 | */ |
253 | 253 | function sort_test_data( $var_a, $var_b ) { |
254 | - $primary_order = array( |
|
254 | + $primary_order = array( |
|
255 | 255 | 'n', // Type null. |
256 | 256 | 'b', // Type boolean. |
257 | 257 | 'i', // Type integer. |
@@ -297,11 +297,11 @@ discard block |
||
297 | 297 | ); |
298 | 298 | |
299 | 299 | foreach ( $clean_this as $key => $function ) { |
300 | - if ( isset( $GLOBALS['test_array'], $GLOBALS['test_array'][ $key ] ) && is_resource( $GLOBALS['test_array'][ $key ] ) ) { |
|
301 | - $function( $GLOBALS['test_array'][ $key ] ); |
|
300 | + if ( isset( $GLOBALS['test_array'], $GLOBALS['test_array'][$key] ) && is_resource( $GLOBALS['test_array'][$key] ) ) { |
|
301 | + $function( $GLOBALS['test_array'][$key] ); |
|
302 | 302 | } |
303 | - if ( isset( $this->test_data, $this->test_data[ $key ] ) && is_resource( $this->test_data[ $key ] ) ) { |
|
304 | - $function( $this->test_data[ $key ] ); |
|
303 | + if ( isset( $this->test_data, $this->test_data[$key] ) && is_resource( $this->test_data[$key] ) ) { |
|
304 | + $function( $this->test_data[$key] ); |
|
305 | 305 | } |
306 | 306 | } |
307 | 307 | } |
@@ -364,15 +364,15 @@ discard block |
||
364 | 364 | */ |
365 | 365 | function print_table( $test_group ) { |
366 | 366 | |
367 | - if ( isset( $this->test_groups[ $test_group ] ) ) { |
|
367 | + if ( isset( $this->test_groups[$test_group] ) ) { |
|
368 | 368 | $GLOBALS['encountered_errors'] = array(); |
369 | 369 | |
370 | 370 | echo ' |
371 | 371 | <div id="', $test_group, '">'; |
372 | 372 | |
373 | - if ( isset( $this->test_groups[ $test_group ]['urls'] ) && ( is_array( $this->test_groups[ $test_group ]['urls'] ) && count( $this->test_groups[ $test_group ]['urls'] ) > 0 ) ) { |
|
373 | + if ( isset( $this->test_groups[$test_group]['urls'] ) && ( is_array( $this->test_groups[$test_group]['urls'] ) && count( $this->test_groups[$test_group]['urls'] ) > 0 ) ) { |
|
374 | 374 | echo '<p>References:</p><ul>'; |
375 | - foreach ( $this->test_groups[ $test_group ]['urls'] as $url ) { |
|
375 | + foreach ( $this->test_groups[$test_group]['urls'] as $url ) { |
|
376 | 376 | printf( '<li><a href="%1$s" target="_blank">%1$s</a></li>', $url ); |
377 | 377 | } |
378 | 378 | unset( $url ); |
@@ -385,9 +385,9 @@ discard block |
||
385 | 385 | $last_key = null; |
386 | 386 | |
387 | 387 | foreach ( $this->test_data_keys as $key ) { |
388 | - $value = $this->test_data[ $key ]; |
|
388 | + $value = $this->test_data[$key]; |
|
389 | 389 | $legend = ''; |
390 | - if ( isset( $this->test_legend[ $key ] ) ) { |
|
390 | + if ( isset( $this->test_legend[$key] ) ) { |
|
391 | 391 | $legend = '<sup class="fright"><a href="#var-legend-' . $key . '">†' . $key . '</a></sup>'; |
392 | 392 | } |
393 | 393 | |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $class[] = 'new-var-type'; |
399 | 399 | $last_key = $type; |
400 | 400 | } |
401 | - if ( isset( $this->test_groups[ $test_group ]['target'] ) && $this->test_groups[ $test_group ]['target'] === $type ) { |
|
401 | + if ( isset( $this->test_groups[$test_group]['target'] ) && $this->test_groups[$test_group]['target'] === $type ) { |
|
402 | 402 | $class[] = 'target'; |
403 | 403 | } |
404 | 404 | |
@@ -460,15 +460,15 @@ discard block |
||
460 | 460 | <tr> |
461 | 461 | ' . $group_label; |
462 | 462 | |
463 | - foreach ( $this->test_groups[ $test_group ]['tests'] as $test ) { |
|
463 | + foreach ( $this->test_groups[$test_group]['tests'] as $test ) { |
|
464 | 464 | $class = $this->get_table_header_cell_class( $test_group, $test ); |
465 | - $tooltip = ( isset( $this->tests[ $test ]['tooltip'] ) ? ' title="' . htmlspecialchars( $this->tests[ $test ]['tooltip'], ENT_QUOTES, 'UTF-8' ) . '"' : '' ); |
|
465 | + $tooltip = ( isset( $this->tests[$test]['tooltip'] ) ? ' title="' . htmlspecialchars( $this->tests[$test]['tooltip'], ENT_QUOTES, 'UTF-8' ) . '"' : '' ); |
|
466 | 466 | |
467 | 467 | $html .= ' |
468 | 468 | <th' . $class . '>' . |
469 | - ( ( isset( $this->tests[ $test ]['url'] ) && $this->tests[ $test ]['url'] !== '' ) ? '<a href="' . $this->tests[ $test ]['url'] . '" target="_blank"' . $tooltip . '>' : '' ) . |
|
470 | - $this->tests[ $test ]['title'] . |
|
471 | - ( ( isset( $this->tests[ $test ]['url'] ) && $this->tests[ $test ]['url'] !== '' ) ? '</a>' : '' ); |
|
469 | + ( ( isset( $this->tests[$test]['url'] ) && $this->tests[$test]['url'] !== '' ) ? '<a href="' . $this->tests[$test]['url'] . '" target="_blank"' . $tooltip . '>' : '' ) . |
|
470 | + $this->tests[$test]['title'] . |
|
471 | + ( ( isset( $this->tests[$test]['url'] ) && $this->tests[$test]['url'] !== '' ) ? '</a>' : '' ); |
|
472 | 472 | |
473 | 473 | |
474 | 474 | $html .= $this->get_table_header_note_indicators( $test, $test_group ); |
@@ -493,11 +493,11 @@ discard block |
||
493 | 493 | * @return string |
494 | 494 | */ |
495 | 495 | function get_table_header_group_label( $test_group ) { |
496 | - if ( isset( $this->test_groups[ $test_group ]['book_url'] ) && $this->test_groups[ $test_group ]['book_url'] !== '' ) { |
|
497 | - $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>'; |
|
496 | + if ( isset( $this->test_groups[$test_group]['book_url'] ) && $this->test_groups[$test_group]['book_url'] !== '' ) { |
|
497 | + $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 | 498 | } |
499 | 499 | else { |
500 | - $group_label = '<th class="label-col">' . $this->test_groups[ $test_group ]['title'] . '</th>'; |
|
500 | + $group_label = '<th class="label-col">' . $this->test_groups[$test_group]['title'] . '</th>'; |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | return $group_label; |
@@ -515,12 +515,12 @@ discard block |
||
515 | 515 | function get_table_header_note_indicators( $test, $test_group ) { |
516 | 516 | $notes = ''; |
517 | 517 | |
518 | - if ( isset( $this->tests[ $test ]['notes'] ) && ( is_array( $this->tests[ $test ]['notes'] ) && count( $this->tests[ $test ]['notes'] ) > 0 ) ) { |
|
518 | + if ( isset( $this->tests[$test]['notes'] ) && ( is_array( $this->tests[$test]['notes'] ) && count( $this->tests[$test]['notes'] ) > 0 ) ) { |
|
519 | 519 | |
520 | - $this->table_notes = array_merge( $this->table_notes, $this->tests[ $test ]['notes'] ); |
|
520 | + $this->table_notes = array_merge( $this->table_notes, $this->tests[$test]['notes'] ); |
|
521 | 521 | $this->table_notes = array_unique( $this->table_notes ); |
522 | 522 | |
523 | - foreach ( $this->tests[ $test ]['notes'] as $note ) { |
|
523 | + foreach ( $this->tests[$test]['notes'] as $note ) { |
|
524 | 524 | $note_id = array_search( $note, $this->table_notes ); |
525 | 525 | if ( $note_id !== false ) { |
526 | 526 | $notes .= ' <sup><a href="#' . $test_group . '-note' . ( $note_id + 1 ) . '">‡' . ( $note_id + 1 ) . '</a></sup>'; |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $class = array(); |
544 | 544 | |
545 | 545 | foreach ( $this->table_header_class_map as $group_key => $classname ) { |
546 | - if ( isset( $this->test_groups[ $test_group ][ $group_key ] ) && in_array( $test, $this->test_groups[ $test_group ][ $group_key ], true ) ) { |
|
546 | + if ( isset( $this->test_groups[$test_group][$group_key] ) && in_array( $test, $this->test_groups[$test_group][$group_key], true ) ) { |
|
547 | 547 | $class[] = $classname; |
548 | 548 | } |
549 | 549 | } |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | */ |
581 | 581 | function print_row_cells( $value, $test_group ) { |
582 | 582 | |
583 | - foreach ( $this->test_groups[ $test_group ]['tests'] as $key => $test ) { |
|
583 | + foreach ( $this->test_groups[$test_group]['tests'] as $key => $test ) { |
|
584 | 584 | $GLOBALS['has_error'] = array(); |
585 | 585 | |
586 | 586 | $class = $this->get_table_row_cell_class( $test_group, $test ); |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | <td' . $class . '>'; |
590 | 590 | |
591 | 591 | $val = $this->generate_value( $value ); |
592 | - $this->tests[ $test ]['test']( $val ); |
|
592 | + $this->tests[$test]['test']( $val ); |
|
593 | 593 | $this->print_row_cell_error_refs(); |
594 | 594 | |
595 | 595 | echo ' </td>'; |
@@ -610,13 +610,13 @@ discard block |
||
610 | 610 | */ |
611 | 611 | function get_table_row_cell_class( $test_group, $test ) { |
612 | 612 | $class = array( $test ); |
613 | - if ( in_array( $test, $this->test_groups[ $test_group ]['best'], true ) ) { |
|
613 | + if ( in_array( $test, $this->test_groups[$test_group]['best'], true ) ) { |
|
614 | 614 | $class[] = 'best'; |
615 | 615 | } |
616 | - else if ( in_array( $test, $this->test_groups[ $test_group ]['good'], true ) ) { |
|
616 | + else if ( in_array( $test, $this->test_groups[$test_group]['good'], true ) ) { |
|
617 | 617 | $class[] = 'good'; |
618 | 618 | } |
619 | - if ( in_array( $test, $this->test_groups[ $test_group ]['break_at'], true ) ) { |
|
619 | + if ( in_array( $test, $this->test_groups[$test_group]['break_at'], true ) ) { |
|
620 | 620 | $class[] = 'end'; |
621 | 621 | } |
622 | 622 |
@@ -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 | /** |