|
@@ -5,23 +5,23 @@ discard block |
|
|
block discarded – undo |
|
5
|
5
|
/** |
|
6
|
6
|
* Autoload. |
|
7
|
7
|
*/ |
|
8
|
|
-$loader = require_once $root_dir . '/vendor/autoload.php'; |
|
|
8
|
+$loader = require_once $root_dir.'/vendor/autoload.php'; |
|
9
|
9
|
|
|
10
|
10
|
/** |
|
11
|
11
|
* Package. |
|
12
|
12
|
*/ |
|
13
|
|
-$data = file_get_contents( $root_dir . '/package.json' ); |
|
|
13
|
+$data = file_get_contents( $root_dir.'/package.json' ); |
|
14
|
14
|
$pkg = json_decode( $data ); |
|
15
|
15
|
|
|
16
|
16
|
// Check readme.txt |
|
17
|
17
|
// @see https://github.com/WordPress/WordPress/blob/4.9/wp-includes/functions.php#L4810-L4868 |
|
18
|
18
|
$filename = 'readme.txt'; |
|
19
|
19
|
|
|
20
|
|
-$readme_txt_lines = file( $root_dir . '/' . $filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ); |
|
|
20
|
+$readme_txt_lines = file( $root_dir.'/'.$filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ); |
|
21
|
21
|
|
|
22
|
22
|
$search_string = sprintf( 'Stable tag: %s', $pkg->version ); |
|
23
|
23
|
|
|
24
|
|
-if ( ! in_array( $search_string, $readme_txt_lines, true ) ) { |
|
|
24
|
+if ( !in_array( $search_string, $readme_txt_lines, true ) ) { |
|
25
|
25
|
printf( '❌ ' ); |
|
26
|
26
|
printf( 'Could not find "%s" in file "%s".', $search_string, $filename ); |
|
27
|
27
|
|
|
@@ -38,7 +38,7 @@ discard block |
|
|
block discarded – undo |
|
38
|
38
|
// @see https://github.com/WordPress/WordPress/blob/4.9/wp-includes/functions.php#L4810-L4868 |
|
39
|
39
|
$filename = 'pronamic-ideal.php'; |
|
40
|
40
|
|
|
41
|
|
-$plugin_file = file_get_contents( $root_dir . '/' . $filename ); |
|
|
41
|
+$plugin_file = file_get_contents( $root_dir.'/'.$filename ); |
|
42
|
42
|
|
|
43
|
43
|
$file_header = ''; |
|
44
|
44
|
|
|
@@ -46,9 +46,9 @@ discard block |
|
|
block discarded – undo |
|
46
|
46
|
|
|
47
|
47
|
foreach ( $tokens as $token ) { |
|
48
|
48
|
if ( is_array( $token ) ) { |
|
49
|
|
- $type = $token[0]; |
|
50
|
|
- $value = $token[1]; |
|
51
|
|
- $line = $token[2]; |
|
|
49
|
+ $type = $token[ 0 ]; |
|
|
50
|
+ $value = $token[ 1 ]; |
|
|
51
|
+ $line = $token[ 2 ]; |
|
52
|
52
|
|
|
53
|
53
|
if ( in_array( $type, array( T_COMMENT, T_DOC_COMMENT ), true ) && false !== strpos( $value, 'Plugin Name' ) ) { |
|
54
|
54
|
$file_header = $value; |
|
@@ -66,7 +66,7 @@ discard block |
|
|
block discarded – undo |
|
66
|
66
|
|
|
67
|
67
|
$search_string = sprintf( 'Version: %s', $pkg->version ); |
|
68
|
68
|
|
|
69
|
|
-if ( ! in_array( $search_string, $file_header_lines, true ) ) { |
|
|
69
|
+if ( !in_array( $search_string, $file_header_lines, true ) ) { |
|
70
|
70
|
printf( '❌ ' ); |
|
71
|
71
|
printf( 'Could not find "%s" in file "%s".', $search_string, $filename ); |
|
72
|
72
|
|
|
@@ -83,21 +83,21 @@ discard block |
|
|
block discarded – undo |
|
83
|
83
|
|
|
84
|
84
|
$default_properties = $plugin_class_reflection->getDefaultProperties(); |
|
85
|
85
|
|
|
86
|
|
-if ( ! array_key_exists( 'version', $default_properties ) ) { |
|
|
86
|
+if ( !array_key_exists( 'version', $default_properties ) ) { |
|
87
|
87
|
printf( '❌ ' ); |
|
88
|
88
|
printf( 'Could not find "version" property in class "%s".', $plugin_class_reflection->getName() ); |
|
89
|
89
|
|
|
90
|
90
|
exit( 1 ); |
|
91
|
91
|
} |
|
92
|
92
|
|
|
93
|
|
-if ( $default_properties['version'] !== $pkg->version ) { |
|
|
93
|
+if ( $default_properties[ 'version' ] !== $pkg->version ) { |
|
94
|
94
|
printf( '❌ ' ); |
|
95
|
|
- printf( 'The "version" property value "%s" in class "%s" does not match.', $default_properties['version'], $plugin_class_reflection->getName() ); |
|
|
95
|
+ printf( 'The "version" property value "%s" in class "%s" does not match.', $default_properties[ 'version' ], $plugin_class_reflection->getName() ); |
|
96
|
96
|
|
|
97
|
97
|
exit( 1 ); |
|
98
|
98
|
} |
|
99
|
99
|
|
|
100
|
100
|
printf( '✅ ' ); |
|
101
|
|
-printf( 'The "version" property value "%s" in class "%s" matches.', $default_properties['version'], $plugin_class_reflection->getName() ); |
|
|
101
|
+printf( 'The "version" property value "%s" in class "%s" matches.', $default_properties[ 'version' ], $plugin_class_reflection->getName() ); |
|
102
|
102
|
|
|
103
|
103
|
echo PHP_EOL; |