@@ -5,10 +5,10 @@ |
||
5 | 5 | |
6 | 6 | // Autoloader for dependencies. |
7 | 7 | if ( file_exists( __DIR__ . '/third-party/vendor/scoper-autoload.php' ) ) { |
8 | - require __DIR__ . '/third-party/vendor/scoper-autoload.php'; |
|
8 | + require __DIR__ . '/third-party/vendor/scoper-autoload.php'; |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | // Autoloader for plugin itself. |
12 | 12 | if ( file_exists( __DIR__ . '/includes/vendor/autoload.php' ) ) { |
13 | - require __DIR__ . '/includes/vendor/autoload.php'; |
|
13 | + require __DIR__ . '/includes/vendor/autoload.php'; |
|
14 | 14 | } |
@@ -4,11 +4,11 @@ |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | // Autoloader for dependencies. |
7 | -if ( file_exists( __DIR__ . '/third-party/vendor/scoper-autoload.php' ) ) { |
|
8 | - require __DIR__ . '/third-party/vendor/scoper-autoload.php'; |
|
7 | +if (file_exists(__DIR__.'/third-party/vendor/scoper-autoload.php')) { |
|
8 | + require __DIR__.'/third-party/vendor/scoper-autoload.php'; |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | // Autoloader for plugin itself. |
12 | -if ( file_exists( __DIR__ . '/includes/vendor/autoload.php' ) ) { |
|
13 | - require __DIR__ . '/includes/vendor/autoload.php'; |
|
12 | +if (file_exists(__DIR__.'/includes/vendor/autoload.php')) { |
|
13 | + require __DIR__.'/includes/vendor/autoload.php'; |
|
14 | 14 | } |
@@ -16,97 +16,97 @@ |
||
16 | 16 | $wp_constants = json_decode( file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-constants.json' ), true ); |
17 | 17 | |
18 | 18 | return array( |
19 | - // The prefix configuration. If a non null value is be used, a random prefix |
|
20 | - // will be generated instead. |
|
21 | - // |
|
22 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#prefix |
|
23 | - 'prefix' => 'Wordlift\Modules\Common', |
|
19 | + // The prefix configuration. If a non null value is be used, a random prefix |
|
20 | + // will be generated instead. |
|
21 | + // |
|
22 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#prefix |
|
23 | + 'prefix' => 'Wordlift\Modules\Common', |
|
24 | 24 | |
25 | - // By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working |
|
26 | - // directory. You can however define which files should be scoped by defining a collection of Finders in the |
|
27 | - // following configuration key. |
|
28 | - // |
|
29 | - // This configuration entry is completely ignored when using Box. |
|
30 | - // |
|
31 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#finders-and-paths |
|
32 | - 'finders' => array( |
|
33 | - Finder::create() |
|
34 | - ->files() |
|
35 | - ->ignoreVCS( true ) |
|
36 | - ->notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/' ) |
|
37 | - ->exclude( |
|
38 | - array( |
|
39 | - 'doc', |
|
40 | - 'test', |
|
41 | - 'test_old', |
|
42 | - 'tests', |
|
43 | - 'Tests', |
|
44 | - 'vendor-bin', |
|
45 | - ) |
|
46 | - ) |
|
47 | - ->in( |
|
48 | - array( |
|
49 | - 'vendor/cweagans/composer-patches', |
|
50 | - 'vendor/mcaskill/composer-exclude-files', |
|
51 | - 'vendor/psr/container', |
|
52 | - 'vendor/symfony/config', |
|
53 | - 'vendor/symfony/dependency-injection', |
|
54 | - 'vendor/symfony/filesystem', |
|
55 | - 'vendor/symfony/polyfill-ctype', |
|
56 | - 'vendor/symfony/polyfill-php73', |
|
57 | - 'vendor/symfony/polyfill-php80', |
|
58 | - 'vendor/symfony/yaml', |
|
59 | - ) |
|
60 | - ), |
|
25 | + // By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working |
|
26 | + // directory. You can however define which files should be scoped by defining a collection of Finders in the |
|
27 | + // following configuration key. |
|
28 | + // |
|
29 | + // This configuration entry is completely ignored when using Box. |
|
30 | + // |
|
31 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#finders-and-paths |
|
32 | + 'finders' => array( |
|
33 | + Finder::create() |
|
34 | + ->files() |
|
35 | + ->ignoreVCS( true ) |
|
36 | + ->notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/' ) |
|
37 | + ->exclude( |
|
38 | + array( |
|
39 | + 'doc', |
|
40 | + 'test', |
|
41 | + 'test_old', |
|
42 | + 'tests', |
|
43 | + 'Tests', |
|
44 | + 'vendor-bin', |
|
45 | + ) |
|
46 | + ) |
|
47 | + ->in( |
|
48 | + array( |
|
49 | + 'vendor/cweagans/composer-patches', |
|
50 | + 'vendor/mcaskill/composer-exclude-files', |
|
51 | + 'vendor/psr/container', |
|
52 | + 'vendor/symfony/config', |
|
53 | + 'vendor/symfony/dependency-injection', |
|
54 | + 'vendor/symfony/filesystem', |
|
55 | + 'vendor/symfony/polyfill-ctype', |
|
56 | + 'vendor/symfony/polyfill-php73', |
|
57 | + 'vendor/symfony/polyfill-php80', |
|
58 | + 'vendor/symfony/yaml', |
|
59 | + ) |
|
60 | + ), |
|
61 | 61 | |
62 | - // Symfony mbstring polyfill. |
|
63 | - Finder::create() |
|
64 | - ->files() |
|
65 | - ->ignoreVCS( true ) |
|
66 | - ->ignoreDotFiles( true ) |
|
67 | - ->name( '/\.*.php8?/' ) |
|
68 | - ->in( 'vendor/symfony/polyfill-mbstring/Resources' ) |
|
69 | - ->append( |
|
70 | - array( |
|
71 | - 'vendor/symfony/polyfill-mbstring/Mbstring.php', |
|
72 | - 'vendor/symfony/polyfill-mbstring/composer.json', |
|
73 | - ) |
|
74 | - ), |
|
62 | + // Symfony mbstring polyfill. |
|
63 | + Finder::create() |
|
64 | + ->files() |
|
65 | + ->ignoreVCS( true ) |
|
66 | + ->ignoreDotFiles( true ) |
|
67 | + ->name( '/\.*.php8?/' ) |
|
68 | + ->in( 'vendor/symfony/polyfill-mbstring/Resources' ) |
|
69 | + ->append( |
|
70 | + array( |
|
71 | + 'vendor/symfony/polyfill-mbstring/Mbstring.php', |
|
72 | + 'vendor/symfony/polyfill-mbstring/composer.json', |
|
73 | + ) |
|
74 | + ), |
|
75 | 75 | |
76 | - Finder::create()->append( |
|
77 | - array( |
|
78 | - 'composer.json', |
|
79 | - ) |
|
80 | - ), |
|
81 | - ), |
|
76 | + Finder::create()->append( |
|
77 | + array( |
|
78 | + 'composer.json', |
|
79 | + ) |
|
80 | + ), |
|
81 | + ), |
|
82 | 82 | |
83 | - // List of excluded files, i.e. files for which the content will be left untouched. |
|
84 | - // Paths are relative to the configuration file unless if they are already absolute |
|
85 | - // |
|
86 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
87 | - 'exclude-files' => array(), |
|
83 | + // List of excluded files, i.e. files for which the content will be left untouched. |
|
84 | + // Paths are relative to the configuration file unless if they are already absolute |
|
85 | + // |
|
86 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
87 | + 'exclude-files' => array(), |
|
88 | 88 | |
89 | - // When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the |
|
90 | - // original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited |
|
91 | - // support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your |
|
92 | - // heart contents. |
|
93 | - // |
|
94 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
95 | - 'patchers' => array(), |
|
89 | + // When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the |
|
90 | + // original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited |
|
91 | + // support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your |
|
92 | + // heart contents. |
|
93 | + // |
|
94 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
95 | + 'patchers' => array(), |
|
96 | 96 | |
97 | - // List of symbols to consider internal i.e. to leave untouched. |
|
98 | - // |
|
99 | - // For more information see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#excluded-symbols |
|
100 | - 'exclude-namespaces' => array( |
|
101 | - // 'Acme\Foo' // The Acme\Foo namespace (and sub-namespaces) |
|
102 | - // '~^PHPUnit\\\\Framework$~', // The whole namespace PHPUnit\Framework (but not sub-namespaces) |
|
103 | - // '~^$~', // The root namespace only |
|
104 | - // '', // Any namespace |
|
105 | - ), |
|
106 | - 'exclude-classes' => $wp_classes, |
|
97 | + // List of symbols to consider internal i.e. to leave untouched. |
|
98 | + // |
|
99 | + // For more information see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#excluded-symbols |
|
100 | + 'exclude-namespaces' => array( |
|
101 | + // 'Acme\Foo' // The Acme\Foo namespace (and sub-namespaces) |
|
102 | + // '~^PHPUnit\\\\Framework$~', // The whole namespace PHPUnit\Framework (but not sub-namespaces) |
|
103 | + // '~^$~', // The root namespace only |
|
104 | + // '', // Any namespace |
|
105 | + ), |
|
106 | + 'exclude-classes' => $wp_classes, |
|
107 | 107 | |
108 | - 'exclude-functions' => $wp_functions, |
|
108 | + 'exclude-functions' => $wp_functions, |
|
109 | 109 | |
110 | - 'exclude-constants' => $wp_constants, |
|
110 | + 'exclude-constants' => $wp_constants, |
|
111 | 111 | |
112 | 112 | ); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types=1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | use Isolated\Symfony\Component\Finder\Finder; |
6 | 6 | |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | // to auto-load any code here: it can result in a conflict or even corrupt |
12 | 12 | // the PHP-Scoper analysis. |
13 | 13 | |
14 | -$wp_classes = json_decode( file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-classes.json' ), true ); |
|
15 | -$wp_functions = json_decode( file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-functions.json' ), true ); |
|
16 | -$wp_constants = json_decode( file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-constants.json' ), true ); |
|
14 | +$wp_classes = json_decode(file_get_contents('vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-classes.json'), true); |
|
15 | +$wp_functions = json_decode(file_get_contents('vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-functions.json'), true); |
|
16 | +$wp_constants = json_decode(file_get_contents('vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-constants.json'), true); |
|
17 | 17 | |
18 | 18 | return array( |
19 | 19 | // The prefix configuration. If a non null value is be used, a random prefix |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | 'finders' => array( |
33 | 33 | Finder::create() |
34 | 34 | ->files() |
35 | - ->ignoreVCS( true ) |
|
36 | - ->notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/' ) |
|
35 | + ->ignoreVCS(true) |
|
36 | + ->notName('/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/') |
|
37 | 37 | ->exclude( |
38 | 38 | array( |
39 | 39 | 'doc', |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | // Symfony mbstring polyfill. |
63 | 63 | Finder::create() |
64 | 64 | ->files() |
65 | - ->ignoreVCS( true ) |
|
66 | - ->ignoreDotFiles( true ) |
|
67 | - ->name( '/\.*.php8?/' ) |
|
68 | - ->in( 'vendor/symfony/polyfill-mbstring/Resources' ) |
|
65 | + ->ignoreVCS(true) |
|
66 | + ->ignoreDotFiles(true) |
|
67 | + ->name('/\.*.php8?/') |
|
68 | + ->in('vendor/symfony/polyfill-mbstring/Resources') |
|
69 | 69 | ->append( |
70 | 70 | array( |
71 | 71 | 'vendor/symfony/polyfill-mbstring/Mbstring.php', |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'wp-polyfill' ), |
|
3 | - 'version' => '022d010eb0a303b836a98db9ff7c08a7', |
|
2 | + 'dependencies' => array( 'wp-polyfill' ), |
|
3 | + 'version' => '022d010eb0a303b836a98db9ff7c08a7', |
|
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'wp-polyfill' ), |
|
2 | + 'dependencies' => array('wp-polyfill'), |
|
3 | 3 | 'version' => '022d010eb0a303b836a98db9ff7c08a7', |
4 | 4 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | public static function loadClassLoader($class) |
10 | 10 | { |
11 | 11 | if ('Wordlift_Modules_Common_Composer\Autoload\ClassLoader' === $class) { |
12 | - require __DIR__ . '/ClassLoader.php'; |
|
12 | + require __DIR__.'/ClassLoader.php'; |
|
13 | 13 | } |
14 | 14 | } |
15 | 15 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | self::$loader = $loader = new \Wordlift_Modules_Common_Composer\Autoload\ClassLoader(\dirname(__DIR__)); |
27 | 27 | spl_autoload_unregister(array('ComposerAutoloaderInit8bd2b6d4ccd6b50e0809e5ba62169420', 'loadClassLoader')); |
28 | 28 | |
29 | - require __DIR__ . '/autoload_static.php'; |
|
29 | + require __DIR__.'/autoload_static.php'; |
|
30 | 30 | call_user_func(\Wordlift_Modules_Common_Composer\Autoload\ComposerStaticInit8bd2b6d4ccd6b50e0809e5ba62169420::getInitializer($loader)); |
31 | 31 | |
32 | 32 | $loader->setClassMapAuthoritative(true); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function getPrefixes() |
115 | 115 | { |
116 | - if (!empty($this->prefixesPsr0)) { |
|
116 | + if ( ! empty($this->prefixesPsr0)) { |
|
117 | 117 | return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); |
118 | 118 | } |
119 | 119 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function add($prefix, $paths, $prepend = false) |
185 | 185 | { |
186 | - if (!$prefix) { |
|
186 | + if ( ! $prefix) { |
|
187 | 187 | if ($prepend) { |
188 | 188 | $this->fallbackDirsPsr0 = array_merge( |
189 | 189 | (array) $paths, |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | } |
201 | 201 | |
202 | 202 | $first = $prefix[0]; |
203 | - if (!isset($this->prefixesPsr0[$first][$prefix])) { |
|
203 | + if ( ! isset($this->prefixesPsr0[$first][$prefix])) { |
|
204 | 204 | $this->prefixesPsr0[$first][$prefix] = (array) $paths; |
205 | 205 | |
206 | 206 | return; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function addPsr4($prefix, $paths, $prepend = false) |
234 | 234 | { |
235 | - if (!$prefix) { |
|
235 | + if ( ! $prefix) { |
|
236 | 236 | // Register directories for the root namespace. |
237 | 237 | if ($prepend) { |
238 | 238 | $this->fallbackDirsPsr4 = array_merge( |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | (array) $paths |
246 | 246 | ); |
247 | 247 | } |
248 | - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { |
|
248 | + } elseif ( ! isset($this->prefixDirsPsr4[$prefix])) { |
|
249 | 249 | // Register directories for a new namespace. |
250 | 250 | $length = strlen($prefix); |
251 | 251 | if ('\\' !== $prefix[$length - 1]) { |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | public function set($prefix, $paths) |
281 | 281 | { |
282 | - if (!$prefix) { |
|
282 | + if ( ! $prefix) { |
|
283 | 283 | $this->fallbackDirsPsr0 = (array) $paths; |
284 | 284 | } else { |
285 | 285 | $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function setPsr4($prefix, $paths) |
301 | 301 | { |
302 | - if (!$prefix) { |
|
302 | + if ( ! $prefix) { |
|
303 | 303 | $this->fallbackDirsPsr4 = (array) $paths; |
304 | 304 | } else { |
305 | 305 | $length = strlen($prefix); |
@@ -493,18 +493,18 @@ discard block |
||
493 | 493 | private function findFileWithExtension($class, $ext) |
494 | 494 | { |
495 | 495 | // PSR-4 lookup |
496 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
496 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
497 | 497 | |
498 | 498 | $first = $class[0]; |
499 | 499 | if (isset($this->prefixLengthsPsr4[$first])) { |
500 | 500 | $subPath = $class; |
501 | 501 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
502 | 502 | $subPath = substr($subPath, 0, $lastPos); |
503 | - $search = $subPath . '\\'; |
|
503 | + $search = $subPath.'\\'; |
|
504 | 504 | if (isset($this->prefixDirsPsr4[$search])) { |
505 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
505 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
506 | 506 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
507 | - if (file_exists($file = $dir . $pathEnd)) { |
|
507 | + if (file_exists($file = $dir.$pathEnd)) { |
|
508 | 508 | return $file; |
509 | 509 | } |
510 | 510 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | |
515 | 515 | // PSR-4 fallback dirs |
516 | 516 | foreach ($this->fallbackDirsPsr4 as $dir) { |
517 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
517 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
518 | 518 | return $file; |
519 | 519 | } |
520 | 520 | } |
@@ -526,14 +526,14 @@ discard block |
||
526 | 526 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
527 | 527 | } else { |
528 | 528 | // PEAR-like class name |
529 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
529 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | if (isset($this->prefixesPsr0[$first])) { |
533 | 533 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
534 | 534 | if (0 === strpos($class, $prefix)) { |
535 | 535 | foreach ($dirs as $dir) { |
536 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
536 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
537 | 537 | return $file; |
538 | 538 | } |
539 | 539 | } |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | |
544 | 544 | // PSR-0 fallback dirs |
545 | 545 | foreach ($this->fallbackDirsPsr0 as $dir) { |
546 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
546 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
547 | 547 | return $file; |
548 | 548 | } |
549 | 549 | } |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'wp-polyfill' ), |
|
3 | - 'version' => '987963517f530493f1ac4e2dd3e1765f', |
|
2 | + 'dependencies' => array( 'wp-polyfill' ), |
|
3 | + 'version' => '987963517f530493f1ac4e2dd3e1765f', |
|
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'wp-polyfill' ), |
|
2 | + 'dependencies' => array('wp-polyfill'), |
|
3 | 3 | 'version' => '987963517f530493f1ac4e2dd3e1765f', |
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'react', 'wp-polyfill' ), |
|
3 | - 'version' => 'dd1f1b601ad30aaa2c1eb3517d6d6608', |
|
2 | + 'dependencies' => array( 'react', 'wp-polyfill' ), |
|
3 | + 'version' => 'dd1f1b601ad30aaa2c1eb3517d6d6608', |
|
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'react', 'wp-polyfill' ), |
|
2 | + 'dependencies' => array('react', 'wp-polyfill'), |
|
3 | 3 | 'version' => 'dd1f1b601ad30aaa2c1eb3517d6d6608', |
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'wp-polyfill' ), |
|
3 | - 'version' => '770585f407a031cbfbe03bf329b7ca50', |
|
2 | + 'dependencies' => array( 'wp-polyfill' ), |
|
3 | + 'version' => '770585f407a031cbfbe03bf329b7ca50', |
|
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'wp-polyfill' ), |
|
2 | + 'dependencies' => array('wp-polyfill'), |
|
3 | 3 | 'version' => '770585f407a031cbfbe03bf329b7ca50', |
4 | 4 | ); |
@@ -4,105 +4,105 @@ |
||
4 | 4 | |
5 | 5 | class Schema { |
6 | 6 | |
7 | - public function get_context_type() { |
|
8 | - |
|
9 | - if ( isset( $_REQUEST['post'] ) || isset( $_REQUEST['post_ID'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
10 | - return Context::POST; |
|
11 | - } |
|
12 | - if ( isset( $_REQUEST['tag_ID'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
13 | - return Context::TERM; |
|
14 | - } |
|
15 | - |
|
16 | - if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
17 | - return Context::ADMIN_AJAX; |
|
18 | - } |
|
19 | - |
|
20 | - return Context::UNKNOWN; |
|
21 | - } |
|
22 | - |
|
23 | - /** |
|
24 | - * @return Context |
|
25 | - */ |
|
26 | - public function get() { |
|
27 | - // we need to identify the context to filter the results. |
|
28 | - |
|
29 | - $identifier = isset( $_REQUEST['post'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['post'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
30 | - : sanitize_text_field( wp_unslash( isset( $_REQUEST['post_ID'] ) ? $_REQUEST['post_ID'] : '' ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
31 | - |
|
32 | - if ( $identifier ) { |
|
33 | - // If post identifier, get schema. |
|
34 | - return new Context( Context::POST, $identifier, $this->get_fields_for_post( $identifier ) ); |
|
35 | - } |
|
36 | - |
|
37 | - $identifier = isset( $_REQUEST['tag_ID'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tag_ID'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
38 | - |
|
39 | - if ( $identifier ) { |
|
40 | - // If post identifier, get schema. |
|
41 | - return new Context( Context::TERM, $identifier, $this->get_fields_for_term( $identifier ) ); |
|
42 | - } |
|
43 | - |
|
44 | - if ( is_admin() && defined( 'DOING_AJAX' ) ) { |
|
45 | - return new Context( Context::ADMIN_AJAX, null, $this->get_all_fields() ); |
|
46 | - } |
|
47 | - |
|
48 | - return new Context( Context::UNKNOWN, null, null ); |
|
49 | - |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * @return Schema_Field_Group[] |
|
54 | - */ |
|
55 | - private function get_fields_for_post( $identifier ) { |
|
56 | - $types = \Wordlift_Entity_Type_Service::get_instance()->get_names( $identifier ); |
|
57 | - $schema_classes = \Wordlift_Schema_Service::get_instance(); |
|
58 | - |
|
59 | - return array_map( |
|
60 | - function ( $schema_type ) use ( $schema_classes ) { |
|
61 | - $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
62 | - |
|
63 | - return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
64 | - }, |
|
65 | - $types |
|
66 | - ); |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * @return Schema_Field_Group[] |
|
71 | - */ |
|
72 | - private function get_fields_for_term( $identifier ) { |
|
73 | - $term_entity_types = get_term_meta( (int) $identifier, \Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
74 | - $schema_classes = \Wordlift_Schema_Service::get_instance(); |
|
75 | - |
|
76 | - return array_filter( |
|
77 | - array_map( |
|
78 | - function ( $schema_type ) use ( $schema_classes ) { |
|
79 | - $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
80 | - |
|
81 | - if ( ! $data ) { |
|
82 | - return false; |
|
83 | - } |
|
84 | - |
|
85 | - return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
86 | - }, |
|
87 | - $term_entity_types |
|
88 | - ) |
|
89 | - ); |
|
90 | - } |
|
91 | - |
|
92 | - private function get_all_fields() { |
|
93 | - $schema_classes = \Wordlift_Schema_Service::get_instance(); |
|
94 | - $all_schema_slugs = $schema_classes->get_all_schema_slugs(); |
|
95 | - |
|
96 | - return array_filter( |
|
97 | - array_map( |
|
98 | - function ( $schema_type ) use ( $schema_classes ) { |
|
99 | - $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
100 | - |
|
101 | - return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
102 | - }, |
|
103 | - $all_schema_slugs |
|
104 | - ) |
|
105 | - ); |
|
106 | - } |
|
7 | + public function get_context_type() { |
|
8 | + |
|
9 | + if ( isset( $_REQUEST['post'] ) || isset( $_REQUEST['post_ID'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
10 | + return Context::POST; |
|
11 | + } |
|
12 | + if ( isset( $_REQUEST['tag_ID'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
13 | + return Context::TERM; |
|
14 | + } |
|
15 | + |
|
16 | + if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
17 | + return Context::ADMIN_AJAX; |
|
18 | + } |
|
19 | + |
|
20 | + return Context::UNKNOWN; |
|
21 | + } |
|
22 | + |
|
23 | + /** |
|
24 | + * @return Context |
|
25 | + */ |
|
26 | + public function get() { |
|
27 | + // we need to identify the context to filter the results. |
|
28 | + |
|
29 | + $identifier = isset( $_REQUEST['post'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['post'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
30 | + : sanitize_text_field( wp_unslash( isset( $_REQUEST['post_ID'] ) ? $_REQUEST['post_ID'] : '' ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
31 | + |
|
32 | + if ( $identifier ) { |
|
33 | + // If post identifier, get schema. |
|
34 | + return new Context( Context::POST, $identifier, $this->get_fields_for_post( $identifier ) ); |
|
35 | + } |
|
36 | + |
|
37 | + $identifier = isset( $_REQUEST['tag_ID'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tag_ID'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
38 | + |
|
39 | + if ( $identifier ) { |
|
40 | + // If post identifier, get schema. |
|
41 | + return new Context( Context::TERM, $identifier, $this->get_fields_for_term( $identifier ) ); |
|
42 | + } |
|
43 | + |
|
44 | + if ( is_admin() && defined( 'DOING_AJAX' ) ) { |
|
45 | + return new Context( Context::ADMIN_AJAX, null, $this->get_all_fields() ); |
|
46 | + } |
|
47 | + |
|
48 | + return new Context( Context::UNKNOWN, null, null ); |
|
49 | + |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * @return Schema_Field_Group[] |
|
54 | + */ |
|
55 | + private function get_fields_for_post( $identifier ) { |
|
56 | + $types = \Wordlift_Entity_Type_Service::get_instance()->get_names( $identifier ); |
|
57 | + $schema_classes = \Wordlift_Schema_Service::get_instance(); |
|
58 | + |
|
59 | + return array_map( |
|
60 | + function ( $schema_type ) use ( $schema_classes ) { |
|
61 | + $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
62 | + |
|
63 | + return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
64 | + }, |
|
65 | + $types |
|
66 | + ); |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * @return Schema_Field_Group[] |
|
71 | + */ |
|
72 | + private function get_fields_for_term( $identifier ) { |
|
73 | + $term_entity_types = get_term_meta( (int) $identifier, \Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
74 | + $schema_classes = \Wordlift_Schema_Service::get_instance(); |
|
75 | + |
|
76 | + return array_filter( |
|
77 | + array_map( |
|
78 | + function ( $schema_type ) use ( $schema_classes ) { |
|
79 | + $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
80 | + |
|
81 | + if ( ! $data ) { |
|
82 | + return false; |
|
83 | + } |
|
84 | + |
|
85 | + return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
86 | + }, |
|
87 | + $term_entity_types |
|
88 | + ) |
|
89 | + ); |
|
90 | + } |
|
91 | + |
|
92 | + private function get_all_fields() { |
|
93 | + $schema_classes = \Wordlift_Schema_Service::get_instance(); |
|
94 | + $all_schema_slugs = $schema_classes->get_all_schema_slugs(); |
|
95 | + |
|
96 | + return array_filter( |
|
97 | + array_map( |
|
98 | + function ( $schema_type ) use ( $schema_classes ) { |
|
99 | + $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
100 | + |
|
101 | + return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
102 | + }, |
|
103 | + $all_schema_slugs |
|
104 | + ) |
|
105 | + ); |
|
106 | + } |
|
107 | 107 | |
108 | 108 | } |
@@ -6,14 +6,14 @@ discard block |
||
6 | 6 | |
7 | 7 | public function get_context_type() { |
8 | 8 | |
9 | - if ( isset( $_REQUEST['post'] ) || isset( $_REQUEST['post_ID'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
9 | + if (isset($_REQUEST['post']) || isset($_REQUEST['post_ID'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
10 | 10 | return Context::POST; |
11 | 11 | } |
12 | - if ( isset( $_REQUEST['tag_ID'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
12 | + if (isset($_REQUEST['tag_ID'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
13 | 13 | return Context::TERM; |
14 | 14 | } |
15 | 15 | |
16 | - if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
16 | + if (is_admin() && ! defined('DOING_AJAX')) { |
|
17 | 17 | return Context::ADMIN_AJAX; |
18 | 18 | } |
19 | 19 | |
@@ -26,41 +26,41 @@ discard block |
||
26 | 26 | public function get() { |
27 | 27 | // we need to identify the context to filter the results. |
28 | 28 | |
29 | - $identifier = isset( $_REQUEST['post'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['post'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
30 | - : sanitize_text_field( wp_unslash( isset( $_REQUEST['post_ID'] ) ? $_REQUEST['post_ID'] : '' ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
29 | + $identifier = isset($_REQUEST['post']) ? sanitize_text_field(wp_unslash($_REQUEST['post'])) // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
30 | + : sanitize_text_field(wp_unslash(isset($_REQUEST['post_ID']) ? $_REQUEST['post_ID'] : '')); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
31 | 31 | |
32 | - if ( $identifier ) { |
|
32 | + if ($identifier) { |
|
33 | 33 | // If post identifier, get schema. |
34 | - return new Context( Context::POST, $identifier, $this->get_fields_for_post( $identifier ) ); |
|
34 | + return new Context(Context::POST, $identifier, $this->get_fields_for_post($identifier)); |
|
35 | 35 | } |
36 | 36 | |
37 | - $identifier = isset( $_REQUEST['tag_ID'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tag_ID'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
37 | + $identifier = isset($_REQUEST['tag_ID']) ? sanitize_text_field(wp_unslash($_REQUEST['tag_ID'])) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
38 | 38 | |
39 | - if ( $identifier ) { |
|
39 | + if ($identifier) { |
|
40 | 40 | // If post identifier, get schema. |
41 | - return new Context( Context::TERM, $identifier, $this->get_fields_for_term( $identifier ) ); |
|
41 | + return new Context(Context::TERM, $identifier, $this->get_fields_for_term($identifier)); |
|
42 | 42 | } |
43 | 43 | |
44 | - if ( is_admin() && defined( 'DOING_AJAX' ) ) { |
|
45 | - return new Context( Context::ADMIN_AJAX, null, $this->get_all_fields() ); |
|
44 | + if (is_admin() && defined('DOING_AJAX')) { |
|
45 | + return new Context(Context::ADMIN_AJAX, null, $this->get_all_fields()); |
|
46 | 46 | } |
47 | 47 | |
48 | - return new Context( Context::UNKNOWN, null, null ); |
|
48 | + return new Context(Context::UNKNOWN, null, null); |
|
49 | 49 | |
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @return Schema_Field_Group[] |
54 | 54 | */ |
55 | - private function get_fields_for_post( $identifier ) { |
|
56 | - $types = \Wordlift_Entity_Type_Service::get_instance()->get_names( $identifier ); |
|
55 | + private function get_fields_for_post($identifier) { |
|
56 | + $types = \Wordlift_Entity_Type_Service::get_instance()->get_names($identifier); |
|
57 | 57 | $schema_classes = \Wordlift_Schema_Service::get_instance(); |
58 | 58 | |
59 | 59 | return array_map( |
60 | - function ( $schema_type ) use ( $schema_classes ) { |
|
61 | - $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
60 | + function($schema_type) use ($schema_classes) { |
|
61 | + $data = $schema_classes->get_schema(strtolower($schema_type)); |
|
62 | 62 | |
63 | - return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
63 | + return new Schema_Field_Group($schema_type, $data['custom_fields']); |
|
64 | 64 | }, |
65 | 65 | $types |
66 | 66 | ); |
@@ -69,20 +69,20 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * @return Schema_Field_Group[] |
71 | 71 | */ |
72 | - private function get_fields_for_term( $identifier ) { |
|
73 | - $term_entity_types = get_term_meta( (int) $identifier, \Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
72 | + private function get_fields_for_term($identifier) { |
|
73 | + $term_entity_types = get_term_meta((int) $identifier, \Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME); |
|
74 | 74 | $schema_classes = \Wordlift_Schema_Service::get_instance(); |
75 | 75 | |
76 | 76 | return array_filter( |
77 | 77 | array_map( |
78 | - function ( $schema_type ) use ( $schema_classes ) { |
|
79 | - $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
78 | + function($schema_type) use ($schema_classes) { |
|
79 | + $data = $schema_classes->get_schema(strtolower($schema_type)); |
|
80 | 80 | |
81 | - if ( ! $data ) { |
|
81 | + if ( ! $data) { |
|
82 | 82 | return false; |
83 | 83 | } |
84 | 84 | |
85 | - return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
85 | + return new Schema_Field_Group($schema_type, $data['custom_fields']); |
|
86 | 86 | }, |
87 | 87 | $term_entity_types |
88 | 88 | ) |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | |
96 | 96 | return array_filter( |
97 | 97 | array_map( |
98 | - function ( $schema_type ) use ( $schema_classes ) { |
|
99 | - $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
98 | + function($schema_type) use ($schema_classes) { |
|
99 | + $data = $schema_classes->get_schema(strtolower($schema_type)); |
|
100 | 100 | |
101 | - return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
101 | + return new Schema_Field_Group($schema_type, $data['custom_fields']); |
|
102 | 102 | }, |
103 | 103 | $all_schema_slugs |
104 | 104 | ) |