|
@@ -106,7 +106,7 @@ discard block |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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, true ); |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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
|
|