@@ -22,8 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | * To require its presence, you can require `composer-runtime-api ^2.0` |
24 | 24 | */ |
25 | -class InstalledVersions |
|
26 | -{ |
|
25 | +class InstalledVersions { |
|
27 | 26 | /** |
28 | 27 | * @var mixed[]|null |
29 | 28 | * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null |
@@ -47,8 +46,7 @@ discard block |
||
47 | 46 | * @return string[] |
48 | 47 | * @psalm-return list<string> |
49 | 48 | */ |
50 | - public static function getInstalledPackages() |
|
51 | - { |
|
49 | + public static function getInstalledPackages() { |
|
52 | 50 | $packages = array(); |
53 | 51 | foreach (self::getInstalled() as $installed) { |
54 | 52 | $packages[] = array_keys($installed['versions']); |
@@ -68,8 +66,7 @@ discard block |
||
68 | 66 | * @return string[] |
69 | 67 | * @psalm-return list<string> |
70 | 68 | */ |
71 | - public static function getInstalledPackagesByType($type) |
|
72 | - { |
|
69 | + public static function getInstalledPackagesByType($type) { |
|
73 | 70 | $packagesByType = array(); |
74 | 71 | |
75 | 72 | foreach (self::getInstalled() as $installed) { |
@@ -92,8 +89,7 @@ discard block |
||
92 | 89 | * @param bool $includeDevRequirements |
93 | 90 | * @return bool |
94 | 91 | */ |
95 | - public static function isInstalled($packageName, $includeDevRequirements = true) |
|
96 | - { |
|
92 | + public static function isInstalled($packageName, $includeDevRequirements = true) { |
|
97 | 93 | foreach (self::getInstalled() as $installed) { |
98 | 94 | if (isset($installed['versions'][$packageName])) { |
99 | 95 | return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); |
@@ -115,8 +111,7 @@ discard block |
||
115 | 111 | * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package |
116 | 112 | * @return bool |
117 | 113 | */ |
118 | - public static function satisfies(VersionParser $parser, $packageName, $constraint) |
|
119 | - { |
|
114 | + public static function satisfies(VersionParser $parser, $packageName, $constraint) { |
|
120 | 115 | $constraint = $parser->parseConstraints($constraint); |
121 | 116 | $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); |
122 | 117 | |
@@ -132,8 +127,7 @@ discard block |
||
132 | 127 | * @param string $packageName |
133 | 128 | * @return string Version constraint usable with composer/semver |
134 | 129 | */ |
135 | - public static function getVersionRanges($packageName) |
|
136 | - { |
|
130 | + public static function getVersionRanges($packageName) { |
|
137 | 131 | foreach (self::getInstalled() as $installed) { |
138 | 132 | if (!isset($installed['versions'][$packageName])) { |
139 | 133 | continue; |
@@ -163,8 +157,7 @@ discard block |
||
163 | 157 | * @param string $packageName |
164 | 158 | * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present |
165 | 159 | */ |
166 | - public static function getVersion($packageName) |
|
167 | - { |
|
160 | + public static function getVersion($packageName) { |
|
168 | 161 | foreach (self::getInstalled() as $installed) { |
169 | 162 | if (!isset($installed['versions'][$packageName])) { |
170 | 163 | continue; |
@@ -184,8 +177,7 @@ discard block |
||
184 | 177 | * @param string $packageName |
185 | 178 | * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present |
186 | 179 | */ |
187 | - public static function getPrettyVersion($packageName) |
|
188 | - { |
|
180 | + public static function getPrettyVersion($packageName) { |
|
189 | 181 | foreach (self::getInstalled() as $installed) { |
190 | 182 | if (!isset($installed['versions'][$packageName])) { |
191 | 183 | continue; |
@@ -205,8 +197,7 @@ discard block |
||
205 | 197 | * @param string $packageName |
206 | 198 | * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference |
207 | 199 | */ |
208 | - public static function getReference($packageName) |
|
209 | - { |
|
200 | + public static function getReference($packageName) { |
|
210 | 201 | foreach (self::getInstalled() as $installed) { |
211 | 202 | if (!isset($installed['versions'][$packageName])) { |
212 | 203 | continue; |
@@ -226,8 +217,7 @@ discard block |
||
226 | 217 | * @param string $packageName |
227 | 218 | * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. |
228 | 219 | */ |
229 | - public static function getInstallPath($packageName) |
|
230 | - { |
|
220 | + public static function getInstallPath($packageName) { |
|
231 | 221 | foreach (self::getInstalled() as $installed) { |
232 | 222 | if (!isset($installed['versions'][$packageName])) { |
233 | 223 | continue; |
@@ -243,8 +233,7 @@ discard block |
||
243 | 233 | * @return array |
244 | 234 | * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} |
245 | 235 | */ |
246 | - public static function getRootPackage() |
|
247 | - { |
|
236 | + public static function getRootPackage() { |
|
248 | 237 | $installed = self::getInstalled(); |
249 | 238 | |
250 | 239 | return $installed[0]['root']; |
@@ -257,8 +246,7 @@ discard block |
||
257 | 246 | * @return array[] |
258 | 247 | * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} |
259 | 248 | */ |
260 | - public static function getRawData() |
|
261 | - { |
|
249 | + public static function getRawData() { |
|
262 | 250 | @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); |
263 | 251 | |
264 | 252 | if (null === self::$installed) { |
@@ -280,8 +268,7 @@ discard block |
||
280 | 268 | * @return array[] |
281 | 269 | * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
282 | 270 | */ |
283 | - public static function getAllRawData() |
|
284 | - { |
|
271 | + public static function getAllRawData() { |
|
285 | 272 | return self::getInstalled(); |
286 | 273 | } |
287 | 274 | |
@@ -303,8 +290,7 @@ discard block |
||
303 | 290 | * |
304 | 291 | * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data |
305 | 292 | */ |
306 | - public static function reload($data) |
|
307 | - { |
|
293 | + public static function reload($data) { |
|
308 | 294 | self::$installed = $data; |
309 | 295 | self::$installedByVendor = array(); |
310 | 296 | } |
@@ -313,8 +299,7 @@ discard block |
||
313 | 299 | * @return array[] |
314 | 300 | * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
315 | 301 | */ |
316 | - private static function getInstalled() |
|
317 | - { |
|
302 | + private static function getInstalled() { |
|
318 | 303 | if (null === self::$canGetVendors) { |
319 | 304 | self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); |
320 | 305 | } |
@@ -2,12 +2,10 @@ discard block |
||
2 | 2 | |
3 | 3 | // autoload_real.php @generated by Composer |
4 | 4 | |
5 | -class ComposerAutoloaderInit984ed95bef2b0e3d4eeb0208a88dc67d |
|
6 | -{ |
|
5 | +class ComposerAutoloaderInit984ed95bef2b0e3d4eeb0208a88dc67d { |
|
7 | 6 | private static $loader; |
8 | 7 | |
9 | - public static function loadClassLoader($class) |
|
10 | - { |
|
8 | + public static function loadClassLoader($class) { |
|
11 | 9 | if ('Composer\Autoload\ClassLoader' === $class) { |
12 | 10 | require __DIR__ . '/ClassLoader.php'; |
13 | 11 | } |
@@ -16,8 +14,7 @@ discard block |
||
16 | 14 | /** |
17 | 15 | * @return \Composer\Autoload\ClassLoader |
18 | 16 | */ |
19 | - public static function getLoader() |
|
20 | - { |
|
17 | + public static function getLoader() { |
|
21 | 18 | if (null !== self::$loader) { |
22 | 19 | return self::$loader; |
23 | 20 | } |
@@ -70,8 +67,7 @@ discard block |
||
70 | 67 | * @param string $file |
71 | 68 | * @return void |
72 | 69 | */ |
73 | -function composerRequire984ed95bef2b0e3d4eeb0208a88dc67d($fileIdentifier, $file) |
|
74 | -{ |
|
70 | +function composerRequire984ed95bef2b0e3d4eeb0208a88dc67d($fileIdentifier, $file) { |
|
75 | 71 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { |
76 | 72 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; |
77 | 73 |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | // Dequeue other jQuery styles even if no-conflict is off. |
124 | 124 | // Terrible-looking tabs help no one. |
125 | - if( !empty( $wp_styles->registered ) ) { |
|
125 | + if( !empty( $wp_styles->registered ) ) { |
|
126 | 126 | foreach ($wp_styles->registered as $key => $style) { |
127 | 127 | if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
128 | 128 | wp_dequeue_style( $key ); |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | |
206 | 206 | //unregistering scripts |
207 | 207 | $registered = array(); |
208 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
209 | - if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ){ |
|
208 | + foreach( $wp_objects->registered as $handle => $script_registration ) { |
|
209 | + if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ) { |
|
210 | 210 | $registered[ $handle ] = $script_registration; |
211 | 211 | } |
212 | 212 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | // If doing ajax, get outta here. |
129 | - if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) { |
|
129 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) { |
|
130 | 130 | return; |
131 | 131 | } |
132 | 132 | |
@@ -191,7 +191,8 @@ discard block |
||
191 | 191 | if ( empty( $license_data ) ) { |
192 | 192 | if ( $is_ajax ) { |
193 | 193 | exit( json_encode( array() ) ); |
194 | - } else { // Non-ajax call |
|
194 | + } else { |
|
195 | +// Non-ajax call |
|
195 | 196 | return json_encode( array() ); |
196 | 197 | } |
197 | 198 | } |
@@ -226,7 +227,8 @@ discard block |
||
226 | 227 | |
227 | 228 | if ( $is_ajax ) { |
228 | 229 | exit( $json ); |
229 | - } else { // Non-ajax call |
|
230 | + } else { |
|
231 | +// Non-ajax call |
|
230 | 232 | return ( Utils::_GET( 'format', Utils::get( $data, 'format' ) ) === 'object' ) ? $license_data : $json; |
231 | 233 | } |
232 | 234 | } |
@@ -291,7 +291,7 @@ |
||
291 | 291 | public function settings() { |
292 | 292 | |
293 | 293 | // If doing ajax, get outta here. |
294 | - if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) { |
|
294 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) { |
|
295 | 295 | return; |
296 | 296 | } |
297 | 297 |