@@ -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 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 | - * 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 | - * 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,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Define test variables. |
|
| 4 | - * |
|
| 5 | - * @package PHPCheatsheets |
|
| 6 | - */ |
|
| 3 | + * Define test variables. |
|
| 4 | + * |
|
| 5 | + * @package PHPCheatsheets |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | // Prevent direct calls to this file. |
| 9 | 9 | 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 | /** |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * HTML content: About page. |
|
| 4 | - * |
|
| 5 | - * @package PHPCheatsheets |
|
| 6 | - */ |
|
| 3 | + * HTML content: About page. |
|
| 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 | - * HTML content: Homepage content. |
|
| 4 | - * |
|
| 5 | - * @package PHPCheatsheets |
|
| 6 | - */ |
|
| 3 | + * HTML content: Homepage content. |
|
| 4 | + * |
|
| 5 | + * @package PHPCheatsheets |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | // Prevent direct calls to this file. |
| 9 | 9 | if ( ! defined( 'APP_DIR' ) ) { |