diff --git a/.phpstorm.meta.php b/.phpstorm.meta.php index 3cc0a05787..0d911542aa 100644 --- a/.phpstorm.meta.php +++ b/.phpstorm.meta.php @@ -9,34 +9,35 @@ \tribe(), map( [ // Custom Alias with global namespace. - 'promoter.auth' => \Tribe__Promoter__Auth::class, - 'promoter.pue' => \Tribe__Promoter__PUE::class, - 'promoter.view' => \Tribe__Promoter__View::class, - 'promoter.connector' => \Tribe__Promoter__Connector::class, - 'feature-detection' => \Tribe__Feature_Detection::class, - 'settings.manager' => \Tribe__Settings_Manager::class, - 'settings' => \Tribe__Settings::class, + 'admin.helpers' => \Tribe__Admin__Helpers::class, + 'admin.notice.php.version' => \Tribe__Admin__Notice__Php_Version::class, 'ajax.dropdown' => \Tribe__Ajax__Dropdown::class, - 'asssassets' => \Tribe__Assets::class, - 'assets.pipeline' => \Tribe__Assets_Pipeline::class, 'asset.data' => \Tribe__Asset__Data::class, - 'admin.helpers' => \Tribe__Admin__Helpers::class, - 'tracker' => \Tribe__Tracker::class, - 'chunker' => \Tribe__Meta__Chunker::class, + 'assets' => \Tribe__Assets::class, + 'assets.pipeline' => \Tribe__Assets_Pipeline::class, 'cache' => \Tribe__Cache::class, + 'callback' => \Tribe__Utils__Callback::class, + 'chunker' => \Tribe__Meta__Chunker::class, + 'context' => \Tribe__Context::class, + 'cost-utils' => \Tribe__Cost_Utils::class, + 'customizer' => \Tribe__Customizer::class, + 'db' => \Tribe__Db::class, + 'editor' => \Tribe__Editor::class, + 'feature-detection' => \Tribe__Feature_Detection::class, 'languages.locations' => \Tribe__Languages__Locations::class, - 'plugins.api' => \Tribe__Plugins_API::class, 'logger' => \Tribe__Log::class, - 'cost-utils' => \Tribe__Cost_Utils::class, - 'post-duplicate.strategy-factory' => \Tribe__Duplicate__Strategy_Factory::class, + 'plugins.api' => \Tribe__Plugins_API::class, 'post-duplicate' => \Tribe__Duplicate__Post::class, - 'context' => \Tribe__Context::class, + 'post-duplicate.strategy-factory' => \Tribe__Duplicate__Strategy_Factory::class, 'post-transient' => \Tribe__Post_Transient::class, - 'db' => \Tribe__Db::class, - 'customizer' => \Tribe__Customizer::class, - 'callback' => \Tribe__Utils__Callback::class, + 'promoter.auth' => \Tribe__Promoter__Auth::class, + 'promoter.connector' => \Tribe__Promoter__Connector::class, + 'promoter.pue' => \Tribe__Promoter__PUE::class, + 'promoter.view' => \Tribe__Promoter__View::class, 'pue.notices' => \Tribe__PUE__Notices::class, - 'admin.notice.php.version' => \Tribe__Admin__Notice__Php_Version::class, + 'settings' => \Tribe__Settings::class, + 'settings.manager' => \Tribe__Settings_Manager::class, + 'tracker' => \Tribe__Tracker::class, // Custom alias with tribe namespace. 'tooltip.view' => \Tribe\Tooltip\View::class, @@ -52,4 +53,7 @@ ); override( ContainerInterface::get( 0 ), type( 0 ) ); + + // Mark tribe_exit() as an exit point. + exitPoint( \tribe_exit() ); } diff --git a/composer.lock b/composer.lock index 8013c68115..6e368b19fc 100644 --- a/composer.lock +++ b/composer.lock @@ -193,6 +193,16 @@ "issues": "https://github.com/Seldaek/monolog/issues", "source": "https://github.com/Seldaek/monolog/tree/1.24.0" }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], "time": "2018-11-05T09:00:11+00:00" }, { @@ -405,16 +415,16 @@ }, { "name": "stellarwp/assets", - "version": "1.4.6", + "version": "1.4.8", "source": { "type": "git", "url": "https://github.com/stellarwp/assets.git", - "reference": "8e09adf91804a27da2387f7e60c1b4858d685a97" + "reference": "48903e797c7eebb7146581593d9efeea927f1b09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stellarwp/assets/zipball/8e09adf91804a27da2387f7e60c1b4858d685a97", - "reference": "8e09adf91804a27da2387f7e60c1b4858d685a97", + "url": "https://api.github.com/repos/stellarwp/assets/zipball/48903e797c7eebb7146581593d9efeea927f1b09", + "reference": "48903e797c7eebb7146581593d9efeea927f1b09", "shasum": "" }, "require": { @@ -435,7 +445,6 @@ "symfony/string": "^5.4", "szepeviktor/phpstan-wordpress": "^1.1" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -459,9 +468,9 @@ "description": "A library for managing asset registration and enqueuing in WordPress.", "support": { "issues": "https://github.com/stellarwp/assets/issues", - "source": "https://github.com/stellarwp/assets/tree/1.4.6" + "source": "https://github.com/stellarwp/assets/tree/1.4.8" }, - "time": "2025-04-08T14:25:06+00:00" + "time": "2025-04-11T20:35:05+00:00" }, { "name": "stellarwp/container-contract", @@ -625,12 +634,12 @@ "source": { "type": "git", "url": "https://github.com/stellarwp/models.git", - "reference": "ac30397971ac654278ebe2cf703524db81459630" + "reference": "0dcc15b55846a5ba91fed4dee71aea90587b954e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stellarwp/models/zipball/ac30397971ac654278ebe2cf703524db81459630", - "reference": "ac30397971ac654278ebe2cf703524db81459630", + "url": "https://api.github.com/repos/stellarwp/models/zipball/0dcc15b55846a5ba91fed4dee71aea90587b954e", + "reference": "0dcc15b55846a5ba91fed4dee71aea90587b954e", "shasum": "" }, "require": { @@ -672,22 +681,22 @@ ], "support": { "issues": "https://github.com/stellarwp/models/issues", - "source": "https://github.com/stellarwp/models/tree/1.2.2" + "source": "https://github.com/stellarwp/models/tree/main" }, - "time": "2024-09-26T18:03:55+00:00" + "time": "2025-04-09T22:15:43+00:00" }, { "name": "stellarwp/schema", - "version": "1.1.8", + "version": "1.1.9", "source": { "type": "git", "url": "https://github.com/stellarwp/schema.git", - "reference": "979344c46d9c54a7891a27e7399fd391fa51b755" + "reference": "4c30cd5eab624225fba212ca59a76d867754e7de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stellarwp/schema/zipball/979344c46d9c54a7891a27e7399fd391fa51b755", - "reference": "979344c46d9c54a7891a27e7399fd391fa51b755", + "url": "https://api.github.com/repos/stellarwp/schema/zipball/4c30cd5eab624225fba212ca59a76d867754e7de", + "reference": "4c30cd5eab624225fba212ca59a76d867754e7de", "shasum": "" }, "require": { @@ -705,9 +714,10 @@ "codeception/module-webdriver": "^1.0", "codeception/util-universalframework": "^1.0", "lucatume/di52": "^3.0", - "lucatume/wp-browser": "^3.0.14", + "lucatume/wp-browser": "^3.0 < 3.5", + "php-stubs/wp-cli-stubs": "^2.11", "phpunit/phpunit": "~6.0", - "stellarwp/db": "^1.0", + "stellarwp/db": "^1.1", "symfony/event-dispatcher-contracts": "^2.5.1", "symfony/string": "^5.4", "szepeviktor/phpstan-wordpress": "^1.1" @@ -731,9 +741,9 @@ "description": "A library for simplifying the creation and updates of custom tables within WordPress.", "support": { "issues": "https://github.com/stellarwp/schema/issues", - "source": "https://github.com/stellarwp/schema/tree/1.1.8" + "source": "https://github.com/stellarwp/schema/tree/1.1.9" }, - "time": "2025-01-10T19:40:08+00:00" + "time": "2025-02-26T18:44:59+00:00" }, { "name": "stellarwp/telemetry", @@ -1771,6 +1781,7 @@ "issues": "https://github.com/Codeception/phpunit-wrapper/issues", "source": "https://github.com/Codeception/phpunit-wrapper/tree/9.0.9" }, + "abandoned": true, "time": "2022-05-23T06:24:11+00:00" }, { @@ -1934,51 +1945,6 @@ }, "time": "2022-02-04T12:51:07+00:00" }, - { - "name": "doctrine/deprecations", - "version": "1.1.4", - "source": { - "type": "git", - "url": "https://github.com/doctrine/deprecations.git", - "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/31610dbb31faa98e6b5447b62340826f54fbc4e9", - "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9 || ^12", - "phpstan/phpstan": "1.4.10 || 2.0.3", - "phpstan/phpstan-phpunit": "^1.0 || ^2", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psr/log": "^1 || ^2 || ^3" - }, - "suggest": { - "psr/log": "Allows logging deprecations via PSR-3 logger implementation" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Deprecations\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", - "homepage": "https://www.doctrine-project.org/", - "support": { - "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.4" - }, - "time": "2024-12-07T21:18:45+00:00" - }, { "name": "doctrine/instantiator", "version": "1.5.0", @@ -2163,16 +2129,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.9.2", + "version": "7.9.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "d281ed313b989f213357e3be1a179f02196ac99b" + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", - "reference": "d281ed313b989f213357e3be1a179f02196ac99b", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", "shasum": "" }, "require": { @@ -2269,7 +2235,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.9.2" + "source": "https://github.com/guzzle/guzzle/tree/7.9.3" }, "funding": [ { @@ -2285,20 +2251,20 @@ "type": "tidelift" } ], - "time": "2024-07-24T11:22:20+00:00" + "time": "2025-03-27T13:37:11+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.0.4", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455" + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455", - "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455", + "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", "shasum": "" }, "require": { @@ -2352,7 +2318,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.4" + "source": "https://github.com/guzzle/promises/tree/2.2.0" }, "funding": [ { @@ -2368,20 +2334,20 @@ "type": "tidelift" } ], - "time": "2024-10-17T10:06:22+00:00" + "time": "2025-03-27T13:27:01+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.7.0", + "version": "2.7.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", - "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16", "shasum": "" }, "require": { @@ -2468,7 +2434,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.7.0" + "source": "https://github.com/guzzle/psr7/tree/2.7.1" }, "funding": [ { @@ -2484,7 +2450,7 @@ "type": "tidelift" } ], - "time": "2024-07-18T11:15:46+00:00" + "time": "2025-03-27T12:30:47+00:00" }, { "name": "ifsnop/mysqldump-php", @@ -3425,181 +3391,6 @@ ], "time": "2024-05-20T13:34:27+00:00" }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.6.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8", - "reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8", - "shasum": "" - }, - "require": { - "doctrine/deprecations": "^1.1", - "ext-filter": "*", - "php": "^7.4 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.7", - "phpstan/phpdoc-parser": "^1.7|^2.0", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.5 || ~1.6.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-mockery": "^1.1", - "phpstan/phpstan-webmozart-assert": "^1.2", - "phpunit/phpunit": "^9.5", - "psalm/phar": "^5.26" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.1" - }, - "time": "2024-12-07T09:39:29+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "679e3ce485b99e84c775d28e2e96fade9a7fb50a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/679e3ce485b99e84c775d28e2e96fade9a7fb50a", - "reference": "679e3ce485b99e84c775d28e2e96fade9a7fb50a", - "shasum": "" - }, - "require": { - "doctrine/deprecations": "^1.0", - "php": "^7.3 || ^8.0", - "phpdocumentor/reflection-common": "^2.0", - "phpstan/phpdoc-parser": "^1.18|^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "phpbench/phpbench": "^1.2", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-phpunit": "^1.1", - "phpunit/phpunit": "^9.5", - "rector/rector": "^0.13.9", - "vimeo/psalm": "^4.25" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.10.0" - }, - "time": "2024-11-09T15:12:26+00:00" - }, { "name": "phpoption/phpoption", "version": "1.9.3", @@ -3724,16 +3515,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.19", + "version": "1.12.23", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "c42ba9bab7a940ed00092ecb1c77bad98896d789" + "reference": "29201e7a743a6ab36f91394eab51889a82631428" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c42ba9bab7a940ed00092ecb1c77bad98896d789", - "reference": "c42ba9bab7a940ed00092ecb1c77bad98896d789", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/29201e7a743a6ab36f91394eab51889a82631428", + "reference": "29201e7a743a6ab36f91394eab51889a82631428", "shasum": "" }, "require": { @@ -3778,7 +3569,7 @@ "type": "github" } ], - "time": "2025-02-19T15:42:21+00:00" + "time": "2025-03-23T14:57:32+00:00" }, { "name": "phpunit/php-code-coverage", @@ -5421,16 +5212,16 @@ }, { "name": "sirbrillig/phpcs-variable-analysis", - "version": "v2.11.21", + "version": "v2.12.0", "source": { "type": "git", "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", - "reference": "eb2b351927098c24860daa7484e290d3eed693be" + "reference": "4debf5383d9ade705e0a25121f16c3fecaf433a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/eb2b351927098c24860daa7484e290d3eed693be", - "reference": "eb2b351927098c24860daa7484e290d3eed693be", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/4debf5383d9ade705e0a25121f16c3fecaf433a7", + "reference": "4debf5383d9ade705e0a25121f16c3fecaf433a7", "shasum": "" }, "require": { @@ -5442,7 +5233,6 @@ "phpcsstandards/phpcsdevcs": "^1.1", "phpstan/phpstan": "^1.7", "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.5 || ^7.0 || ^8.0 || ^9.0 || ^10.5.32 || ^11.3.3", - "sirbrillig/phpcs-import-detection": "^1.1", "vimeo/psalm": "^0.2 || ^0.3 || ^1.1 || ^4.24 || ^5.0" }, "type": "phpcodesniffer-standard", @@ -5475,36 +5265,36 @@ "source": "https://github.com/sirbrillig/phpcs-variable-analysis", "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" }, - "time": "2024-12-02T16:37:49+00:00" + "time": "2025-03-17T16:17:38+00:00" }, { "name": "slevomat/coding-standard", - "version": "8.16.0", + "version": "8.17.0", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "7748a4282df19daf966fda1d8c60a8aec803c83a" + "reference": "ace04a4e2e20c9bc26ad14d6c4c737cde6056ec0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/7748a4282df19daf966fda1d8c60a8aec803c83a", - "reference": "7748a4282df19daf966fda1d8c60a8aec803c83a", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/ace04a4e2e20c9bc26ad14d6c4c737cde6056ec0", + "reference": "ace04a4e2e20c9bc26ad14d6c4c737cde6056ec0", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", "php": "^7.4 || ^8.0", "phpstan/phpdoc-parser": "^2.1.0", - "squizlabs/php_codesniffer": "^3.11.3" + "squizlabs/php_codesniffer": "^3.12.1" }, "require-dev": { "phing/phing": "3.0.1", "php-parallel-lint/php-parallel-lint": "1.4.0", - "phpstan/phpstan": "2.1.6", + "phpstan/phpstan": "2.1.11", "phpstan/phpstan-deprecation-rules": "2.0.1", - "phpstan/phpstan-phpunit": "2.0.4", - "phpstan/phpstan-strict-rules": "2.0.3", - "phpunit/phpunit": "9.6.8|10.5.45|11.4.4|11.5.9|12.0.4" + "phpstan/phpstan-phpunit": "2.0.6", + "phpstan/phpstan-strict-rules": "2.0.4", + "phpunit/phpunit": "9.6.8|10.5.45|11.4.4|11.5.17|12.1.2" }, "type": "phpcodesniffer-standard", "extra": { @@ -5528,7 +5318,7 @@ ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/8.16.0" + "source": "https://github.com/slevomat/coding-standard/tree/8.17.0" }, "funding": [ { @@ -5540,7 +5330,7 @@ "type": "tidelift" } ], - "time": "2025-02-23T18:12:49+00:00" + "time": "2025-04-10T06:06:16+00:00" }, { "name": "softcreatr/jsonpath", @@ -5613,16 +5403,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.11.2", + "version": "3.12.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "1368f4a58c3c52114b86b1abe8f4098869cb0079" + "reference": "6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/1368f4a58c3c52114b86b1abe8f4098869cb0079", - "reference": "1368f4a58c3c52114b86b1abe8f4098869cb0079", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa", + "reference": "6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa", "shasum": "" }, "require": { @@ -5689,11 +5479,11 @@ "type": "open_collective" }, { - "url": "https://thanks.dev/phpcsstandards", + "url": "https://thanks.dev/u/gh/phpcsstandards", "type": "thanks_dev" } ], - "time": "2024-12-11T16:04:26+00:00" + "time": "2025-04-13T04:10:18+00:00" }, { "name": "stellarwp/coding-standards", @@ -7765,7 +7555,6 @@ "aliases": [], "minimum-stability": "dev", "stability-flags": { - "stellarwp/assets": 20, "stellarwp/coding-standards": 20, "stellarwp/models": 20, "the-events-calendar/tec-testing-facilities": 20 diff --git a/src/Common/Editor/Block_Logic.php b/src/Common/Editor/Block_Logic.php new file mode 100644 index 0000000000..9944814aa8 --- /dev/null +++ b/src/Common/Editor/Block_Logic.php @@ -0,0 +1,255 @@ +cache = $cache; + } + + /** + * Registers the filters and actions hooks added by the controller. + * + * @since TBD + * + * @return void + */ + protected function do_register(): void { + add_action( 'current_screen', [ $this, 'store_screen' ], 1 ); + } + + /** + * Removes the filters and actions hooks added by the controller. + * + * Bound implementations should not be removed in this method! + * + * @since TBD + * + * @return void Filters and actions hooks added by the controller are be removed. + */ + public function unregister(): void { + $this->screen = null; + remove_action( 'current_screen', [ $this, 'store_screen' ], 1 ); + } + + /** + * Store the current screen object. + * + * @since TBD + * + * @param WP_Screen $screen The current screen object. + * + * @return void + */ + public function store_screen( WP_Screen $screen ): void { + // Store the current screen object as a clone to prevent any side effects. + $this->screen = clone $screen; + } + + /** + * Determine if blocks should be loaded. + * + * @since TBD + * + * @return bool + */ + public function should_load_blocks(): bool { + /** + * Filter to determine if blocks should be loaded by default. + * + * @since TBD + * + * @param bool $default Default value. + */ + $default = (bool) apply_filters( 'tec_common_should_load_blocks_default', true ); + + // When not in the admin area, allow anything to load blocks for rendering. + if ( ! is_admin() ) { + return $this->filter_should_load_blocks( $default, 'not_admin' ); + } + + // Allow for loading blocks in AJAX requests, in case some functionality depends on it. + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { + return $this->filter_should_load_blocks( true, 'admin_ajax_request' ); + } + + // If we don't have the screen object set, we can't determine if we should load blocks. + if ( null === $this->screen ) { + return $this->filter_should_load_blocks( $default, 'no_screen' ); + } + + // If this isn't an editor screen, we don't need to load blocks. + if ( ! $this->is_editor() ) { + return $this->filter_should_load_blocks( false, 'not_editor' ); + } + + // If this is an editor screen, but not a block editor screen, we don't need to load blocks. + if ( ! $this->screen->is_block_editor() ) { + return $this->filter_should_load_blocks( false, 'not_block_editor' ); + } + + // If this isn't a supported post type, we don't need to load blocks. + if ( ! $this->should_load_blocks_for_post_type( $this->screen->post_type ) ) { + return $this->filter_should_load_blocks( false, 'not_supported_post_type' ); + } + + return $this->filter_should_load_blocks( true, 'block_editor' ); + } + + /** + * Return the value of should_load_blocks passed through a filter. + * + * @since TBD + * + * @param bool $should_load The value of should_load_blocks. + * @param string $reason The reason why we are returning this value. + * + * @return bool Whether blocks should be loaded. + */ + private function filter_should_load_blocks( bool $should_load, string $reason ): bool { + /** + * Filter to determine if blocks should be loaded. + * + * This filter is used to determine if blocks should be loaded in the editor. The + * $reason parameter can be used to determine why we are returning this value. + * + * @see self::should_load_blocks() for the reasons. + * + * @since TBD + * + * @param bool $should_load Whether blocks should be loaded. + * @param string $reason The reason why we are returning this value. + * @param ?WP_Screen $screen The current screen object, if it has been set. + */ + return (bool) apply_filters( 'tec_common_should_load_blocks', $should_load, $reason, $this->screen ); + } + + /** + * Determine if blocks should be loaded for a specific post type. + * + * @since TBD + * + * @param string $post_type The post type to check. + * + * @return bool + */ + public function should_load_blocks_for_post_type( string $post_type = '' ): bool { + // If we weren't provided a post type, try to determine the current post type. + if ( empty( $post_type ) ) { + try { + $post_type = $this->determine_current_post_type(); + } catch ( Exception $e ) { + return false; + } + } + + // If we have already checked this post type, return the cached value. + $cache_key = "tec_common_should_load_blocks_for_post_type_{$post_type}"; + $cache_result = $this->cache->get( $cache_key ); + if ( false !== $cache_result ) { + return (bool) $cache_result; + } + + /** + * Filter to determine what post types should have blocks loaded. + * + * @since TBD + * + * @param array $load_blocks_post_types The post types that should have blocks loaded. + */ + $load_blocks_post_types = (array) apply_filters( 'tec_common_load_blocks_post_types', [] ); + + // Cache the post type in the static variable to avoid checking it again. + $result = in_array( $post_type, $load_blocks_post_types, true ); + $this->cache->set( $cache_key, $result ?: null ); + + return $result; + } + + /** + * Determine the current post type. + * + * @since TBD + * + * @return string The current post type. + * @throws Exception If the current post type cannot be determined. + */ + private function determine_current_post_type(): string { + // If we have the screen object, use its post type. + if ( null !== $this->screen ) { + return $this->screen->post_type; + } + + // Try to use the global post object. + if ( isset( $GLOBALS['post']->post_type ) ) { + return $GLOBALS['post']->post_type; + } + + throw new Exception( 'Unable to determine current post type.' ); + } + + /** + * Check if the current screen is an editor screen. + * + * Valid editor screens are: + * - edit + * - post + * + * @since TBD + * + * @return bool Whether the current screen is an editor screen. + */ + private function is_editor(): bool { + $base = $this->screen->base; + + return 'edit' === $base || 'post' === $base; + } +} diff --git a/src/Tribe/Editor/Blocks/Abstract.php b/src/Tribe/Editor/Blocks/Abstract.php index 0e141b9c2c..69f949ead3 100644 --- a/src/Tribe/Editor/Blocks/Abstract.php +++ b/src/Tribe/Editor/Blocks/Abstract.php @@ -1,7 +1,7 @@ slug(), $this->namespace . '/' ) ) { - return $this->namespace . '/' . $this->slug(); + return "{$this->namespace}/{$this->slug()}"; } else { return $this->slug(); } @@ -54,12 +54,11 @@ public function get_namespace(): string { * * @since 4.8 * - * @param array $attributes + * @param array $params The attributes to parse. * * @return array - */ + */ public function attributes( $params = [] ) { - // get the default attributes $default_attributes = $this->default_attributes(); @@ -72,12 +71,10 @@ public function attributes( $params = [] ) { /** * Filters the default attributes for the block * - * @param array $attributes The attributes - * @param object $this The current object + * @param array $attributes The attributes + * @param object $this The current object */ - $attributes = apply_filters( 'tribe_block_attributes_defaults_' . $this->slug(), $attributes, $this ); - - return $attributes; + return apply_filters( "tribe_block_attributes_defaults_{$this->slug()}", $attributes, $this ); } /** @@ -85,23 +82,16 @@ public function attributes( $params = [] ) { * * @since 4.8 * - * @param array $attributes - * * @return array - */ + */ public function default_attributes() { - - $attributes = []; - /** * Filters the default attributes * - * @param array $params The attributes - * @param object $this The current object + * @param array $params The attributes + * @param object $this The current object */ - $attributes = apply_filters( 'tribe_block_attributes_defaults', $attributes, $this ); - - return $attributes; + return apply_filters( 'tribe_block_attributes_defaults', [], $this ); } /** @@ -109,7 +99,7 @@ public function default_attributes() { * * @since 4.8 * - * @param array $attributes + * @param array $attributes The attributes to render. * * @return string */ @@ -117,10 +107,10 @@ public function render( $attributes = [] ) { $json_string = json_encode( $attributes, JSON_PRETTY_PRINT ); return - '
' . + ''; } /** @@ -143,9 +133,11 @@ public function ajax() { * @return void */ public function register() { - $block_args = $this->get_registration_args( [ - 'render_callback' => [ $this, 'render' ], - ] ); + $block_args = $this->get_registration_args( + [ + 'render_callback' => [ $this, 'render' ], + ] + ); // Prevents a block from being registered twice. if ( ! class_exists( 'WP_Block_Type_Registry' ) || WP_Block_Type_Registry::get_instance()->is_registered( $this->name() ) ) { @@ -161,7 +153,7 @@ public function register() { * @since 4.14.13 */ public function load() { - add_action( 'wp_ajax_' . $this->get_ajax_action(), [ $this, 'ajax' ] ); + add_action( "wp_ajax_{$this->get_ajax_action()}", [ $this, 'ajax' ] ); $this->assets(); $this->hook(); @@ -174,10 +166,11 @@ public function load() { * the pattern of a block but not validating its structure. For strict accuracy * you should use the block parser on post content. * - * @since 4.8 + * @see gutenberg_parse_blocks() + * * @since 5.1.5 Added a has_block filter. * - * @see gutenberg_parse_blocks() + * @since 4.8 * * @param int|string|WP_Post|null $post Optional. Post content, post ID, or post object. Defaults to global $post. * @@ -205,13 +198,13 @@ public function has_block( $post = null ) { * * @since 5.1.5 * - * @param bool $has_block Whether the post has this block. - * @param WP_Post|null $wp_post The post object. - * @param int|null $post_id The post ID. - * @param string $block_name The block name. - * @param Tribe__Editor__Blocks__Abstract $this The block object. + * @param bool $has_block Whether the post has this block. + * @param WP_Post|null $wp_post The post object. + * @param int|null $post_id The post ID. + * @param string $block_name The block name. + * @param Tribe__Editor__Blocks__Abstract $this The block object. */ - $has_block = (bool) apply_filters( 'tec_block_has_block', $has_block, $wp_post, $post_id, $this->name(), $this ); + $has_block = (bool) apply_filters( 'tec_block_has_block', $has_block, $wp_post, $post_id, $this->name(), $this ); $block_name = $this->name(); /** @@ -219,10 +212,10 @@ public function has_block( $post = null ) { * * @since 5.1.5 * - * @param bool $has_block Whether the post has this block. - * @param WP_Post|null $wp_post The post object. - * @param int|null $post_id The post ID. - * @param Tribe__Editor__Blocks__Abstract $this The block object. + * @param bool $has_block Whether the post has this block. + * @param WP_Post|null $wp_post The post object. + * @param int|null $post_id The post ID. + * @param Tribe__Editor__Blocks__Abstract $this The block object. */ return (bool) apply_filters( "tec_block_{$block_name}_has_block", $has_block, $wp_post, $post_id, $this ); } @@ -246,16 +239,14 @@ public function get_ajax_action() { * * @return void */ - public function assets() { - } + public function assets() {} /** - * Attach any particular hook for the specif block. + * Attach any particular hook for the specific block. * * @since 4.8 */ - public function hook() { - } + public function hook() {} /** * Returns the block data for the block editor. @@ -287,7 +278,7 @@ public function block_data() { * @param array $block_data The block data. * @param object $this The current object. */ - $block_data = apply_filters( 'tribe_block_block_data_' . $this->slug(), $block_data, $this ); + $block_data = apply_filters( "tribe_block_block_data_{$this->slug()}", $block_data, $this ); return $block_data; } diff --git a/src/Tribe/Editor/Provider.php b/src/Tribe/Editor/Provider.php index 48809dbf13..9a769331f3 100644 --- a/src/Tribe/Editor/Provider.php +++ b/src/Tribe/Editor/Provider.php @@ -1,9 +1,37 @@ A list of fully-qualified implementations provided by the service provider. + */ + public function provides() { + return [ + 'editor', + 'editor.utils', + 'common.editor.configuration', + 'editor.assets', + ]; + } + /** * Binds and sets up implementations. * @@ -12,13 +40,13 @@ class Tribe__Editor__Provider extends Service_Provider { */ public function register() { // Setup to check if gutenberg is active - $this->container->singleton( 'editor', 'Tribe__Editor' ); - $this->container->singleton( 'editor.utils', 'Tribe__Editor__Utils' ); - $this->container->singleton( 'common.editor.configuration', 'Tribe__Editor__Configuration' ); + $this->container->singleton( 'editor', Tribe__Editor::class ); + $this->container->singleton( 'editor.utils', Tribe__Editor__Utils::class ); + $this->container->singleton( 'common.editor.configuration', Tribe__Editor__Configuration::class ); tribe_register_provider( Tribe\Editor\Compatibility::class ); - $this->container->singleton( 'editor.assets', 'Tribe__Editor__Assets', [ 'hook' ] ); + $this->container->singleton( 'editor.assets', Tribe__Editor__Assets::class, [ 'hook' ] ); $this->hook(); @@ -27,16 +55,19 @@ public function register() { } /** - * Any hooking any class needs happen here. + * Any class hooking needs happen here. * * In place of delegating the hooking responsibility to the single classes they are all hooked here. * * @since 4.8 - * + * @since TBD Updated to change the block hooking. */ protected function hook() { - // Setup the registration of Blocks - add_action( 'init', [ $this, 'register_blocks' ], 20 ); + if ( is_admin() ) { + add_action( 'current_screen', [ $this, 'register_blocks' ], 20 ); + } else { + add_action( 'init', [ $this, 'register_blocks' ], 20 ); + } } /** @@ -48,6 +79,13 @@ protected function hook() { * @return void */ public function register_blocks() { + /** @var Block_Logic $block_logic */ + $block_logic = $this->container->get( Block_Logic::class ); + + if ( ! $block_logic->should_load_blocks() ) { + return; + } + /** * Internal Action used to register blocks for Events * @@ -55,13 +93,4 @@ public function register_blocks() { */ do_action( 'tribe_editor_register_blocks' ); } - - /** - * Binds and sets up implementations at boot time. - * - * @since 4.8 - */ - public function boot() { - // no ops - } } diff --git a/src/Tribe/Editor/Utils.php b/src/Tribe/Editor/Utils.php index b4261a4977..07bcbe368f 100644 --- a/src/Tribe/Editor/Utils.php +++ b/src/Tribe/Editor/Utils.php @@ -46,7 +46,7 @@ public function to_block_name( $name = '' ) { * @return bool */ public function remove_block( $post_id, $block_name = '', $replacement = '' ) { - $patttern = '/^\s*\s*$/im'; + $patttern = '#^\s*\s*$#im'; return $this->update_post_content( $post_id, $patttern, $replacement ); } @@ -55,9 +55,9 @@ public function remove_block( $post_id, $block_name = '', $replacement = '' ) { * * @since 4.8.2 * - * @param $post_id - * @param $block_name The name of the block - * @param string $replacement The string used to replace the value of the searched block + * @param int $post_id The post ID. + * @param string $block_name The name of the block. + * @param string $replacement The string used to replace the value of the searched block. * * @return bool */ @@ -72,9 +72,9 @@ public function remove_inner_blocks( $post_id, $block_name, $replacement = '' ) * * @since 4.8.2 * - * @param $post_id - * @param $pattern - * @param string $replacement The string used to replace the value of the searched block + * @param int $post_id The post ID. + * @param string $pattern The pattern used to search the content. + * @param string $replacement The string used to replace the value of the searched block. * * @return bool */ @@ -111,13 +111,9 @@ public function update_post_content( $post_id, $pattern, $replacement = '' ) { * @return string */ public function strip_dynamic_blocks( $content = '' ) { - - if ( ! function_exists( 'strip_dynamic_blocks' ) ) { - return $content; - } - - return strip_dynamic_blocks( $content ); - + return function_exists( 'strip_dynamic_blocks' ) + ? strip_dynamic_blocks( $content ) + : $content; } /** @@ -130,8 +126,7 @@ public function strip_dynamic_blocks( $content = '' ) { * @return string */ public function exclude_tribe_blocks( $content = '' ) { - - $match_blocks_exp = '/\<\!\-\- \/?wp\:tribe.*\/?-->/i'; + $match_blocks_exp = '##i'; if ( ! preg_match( $match_blocks_exp, $content ) ) { return $content; diff --git a/src/Tribe/Main.php b/src/Tribe/Main.php index 07a90e5fef..a534130b71 100644 --- a/src/Tribe/Main.php +++ b/src/Tribe/Main.php @@ -1,11 +1,17 @@ use_test_prefix(); @@ -173,4 +173,4 @@ protected function count_available_logs() { $available = $this->logger->list_available_logs(); return count( $available ); } -} \ No newline at end of file +}' . 'Block Name: ' . $this->name() . "\n" . 'Block Attributes: ' . "\n" . $json_string . - ''; + '