diff --git a/404.php b/404.php index 3959133a91..05ed5625a0 100755 --- a/404.php +++ b/404.php @@ -3,14 +3,14 @@ /** * The template for displaying 404 pages (Not Found) * - * Methods for TimberHelper can be found in the /functions sub-directory + * Methods for \Timber\Helper can be found in the /functions sub-directory * * @package WordPress * @subpackage Timber * @since Timber 0.1 */ -$context = Timber::get_context(); +$context = Timber::context(); $options = get_option('planet4_options'); $context['page_notfound_image'] = $options['404_page_bg_image'] diff --git a/archive-p4_action.php b/archive-p4_action.php index 927192bc03..2eb44be24d 100755 --- a/archive-p4_action.php +++ b/archive-p4_action.php @@ -14,7 +14,7 @@ $templates = [ 'all-actions.twig', 'archive.twig', 'index.twig' ]; -$context = Timber::get_context(); +$context = Timber::context(); $context['custom_body_classes'] = 'tax-p4-page-type'; $context['header_title'] = post_type_archive_title('', false); diff --git a/archive.php b/archive.php index eee592c86f..1fd5160896 100755 --- a/archive.php +++ b/archive.php @@ -8,7 +8,7 @@ * * Learn more: http://codex.wordpress.org/Template_Hierarchy * - * Methods for TimberHelper can be found in the /lib sub-directory + * Methods for \Timber\Helper can be found in the /lib sub-directory * * @package WordPress * @subpackage Timber @@ -19,7 +19,7 @@ $templates = [ 'archive.twig', 'index.twig' ]; -$context = Timber::get_context(); +$context = Timber::context(); $context['title'] = 'Archive'; if (is_day()) { diff --git a/author.php b/author.php index 40fe23c2fb..c4e26742e1 100755 --- a/author.php +++ b/author.php @@ -3,22 +3,21 @@ /** * The template for displaying Author Archive pages * - * Methods for TimberHelper can be found in the /lib sub-directory + * Methods for \Timber\Helper can be found in the /lib sub-directory * * @package WordPress * @subpackage Timber * @since Timber 0.1 */ -use P4\MasterTheme\User; use P4\MasterTheme\Post; use P4\MasterTheme\ListingPage; use Timber\Timber; -$context = Timber::get_context(); +$context = Timber::context(); if (isset($wp_query->query_vars['author'])) { - $author = new User($wp_query->query_vars['author']); + $author = Timber::get_user($wp_query->query_vars['author']); $context['author'] = $author; $context['title'] = 'Author Archives: ' . $author->name(); diff --git a/composer.json b/composer.json index 26b639413d..85946d551d 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "phpunit/phpunit": "^7.5||^9.5", "yoast/phpunit-polyfills": "^1.1.0", "doctrine/instantiator": "^1.5.0", - "timber/timber": "1.24.0" + "timber/timber": "2.1.*" }, "scripts": { "fixes": "vendor/bin/phpcbf", diff --git a/composer.lock b/composer.lock index 7640ca3534..ace9cd3c5a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,69 +4,9 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "536f4ac115e69e818c70cf56f130daf3", + "content-hash": "baecc08e6c59f8e18e85ddfa963e3a3e", "packages": [], "packages-dev": [ - { - "name": "altorouter/altorouter", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/dannyvankooten/AltoRouter.git", - "reference": "f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dannyvankooten/AltoRouter/zipball/f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2", - "reference": "f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "require-dev": { - "codeclimate/php-test-reporter": "dev-master", - "phpunit/phpunit": "5.7.*", - "squizlabs/php_codesniffer": "3.4.2" - }, - "type": "library", - "autoload": { - "classmap": [ - "AltoRouter.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Danny van Kooten", - "email": "dannyvankooten@gmail.com", - "homepage": "http://dannyvankooten.com/" - }, - { - "name": "Koen Punt", - "homepage": "https://github.com/koenpunt" - }, - { - "name": "niahoo", - "homepage": "https://github.com/niahoo" - } - ], - "description": "A lightning fast router for PHP", - "homepage": "https://github.com/dannyvankooten/AltoRouter", - "keywords": [ - "lightweight", - "router", - "routing" - ], - "support": { - "issues": "https://github.com/dannyvankooten/AltoRouter/issues", - "source": "https://github.com/dannyvankooten/AltoRouter/tree/2.0.2" - }, - "time": "2020-03-09T08:34:59+00:00" - }, { "name": "composer/installers", "version": "v2.2.0", @@ -658,16 +598,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.27.0", + "version": "1.28.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "86e4d5a4b036f8f0be1464522f4c6b584c452757" + "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/86e4d5a4b036f8f0be1464522f4c6b584c452757", - "reference": "86e4d5a4b036f8f0be1464522f4c6b584c452757", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb", + "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb", "shasum": "" }, "require": { @@ -699,9 +639,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.27.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.28.0" }, - "time": "2024-03-21T13:14:53+00:00" + "time": "2024-04-03T18:51:33+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1024,16 +964,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.18", + "version": "9.6.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "32c2c2d6580b1d8ab3c10b1e9e4dc263cc69bb04" + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/32c2c2d6580b1d8ab3c10b1e9e4dc263cc69bb04", - "reference": "32c2c2d6580b1d8ab3c10b1e9e4dc263cc69bb04", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", "shasum": "" }, "require": { @@ -1107,7 +1047,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.18" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" }, "funding": [ { @@ -1123,7 +1063,7 @@ "type": "tidelift" } ], - "time": "2024-03-21T12:07:32+00:00" + "time": "2024-04-05T04:35:58+00:00" }, { "name": "sebastian/cli-parser", @@ -2155,16 +2095,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.9.0", + "version": "3.9.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b" + "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b", - "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", + "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", "shasum": "" }, "require": { @@ -2231,7 +2171,74 @@ "type": "open_collective" } ], - "time": "2024-02-16T15:06:51+00:00" + "time": "2024-04-23T20:25:34+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2393,17 +2400,17 @@ "time": "2024-01-29T20:11:03+00:00" }, { - "name": "symfony/polyfill-php72", + "name": "symfony/polyfill-php80", "version": "v1.29.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25" + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/861391a8da9a04cbad2d232ddd9e4893220d6e25", - "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", "shasum": "" }, "require": { @@ -2421,14 +2428,21 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - } + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -2438,7 +2452,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -2447,7 +2461,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" }, "funding": [ { @@ -2517,37 +2531,48 @@ }, { "name": "timber/timber", - "version": "1.24.0", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/timber/timber.git", - "reference": "f7c94c6079a8a4c251caf6e3feb45ce5ad117c87" + "reference": "d353d1912a1a051f47ba2d3f2e3ae1af1e5bed53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/timber/timber/zipball/f7c94c6079a8a4c251caf6e3feb45ce5ad117c87", - "reference": "f7c94c6079a8a4c251caf6e3feb45ce5ad117c87", + "url": "https://api.github.com/repos/timber/timber/zipball/d353d1912a1a051f47ba2d3f2e3ae1af1e5bed53", + "reference": "d353d1912a1a051f47ba2d3f2e3ae1af1e5bed53", "shasum": "" }, "require": { "composer/installers": "^1.0 || ^2.0", - "php": ">=7.2.5 || ^8.0", - "twig/cache-extension": "^1.5", - "twig/twig": "^1.44.7 || ^2.10", - "upstatement/routes": "^0.9" + "php": "^7.4 || ^8.0", + "symfony/polyfill-php80": "^1.27", + "twig/twig": "^2.15.3 || ^3.0" }, "require-dev": { - "wpackagist-plugin/advanced-custom-fields": "^5.0", - "wpackagist-plugin/co-authors-plus": "^3.2 || ^3.4", + "ergebnis/composer-normalize": "^2.28", + "php-parallel-lint/php-parallel-lint": "^1.3", + "php-stubs/acf-pro-stubs": "^6.0", + "php-stubs/wp-cli-stubs": "^2.0", + "phpro/grumphp": "^1.12", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.7", + "squizlabs/php_codesniffer": "^3.0", + "symplify/easy-coding-standard": "^12.0", + "szepeviktor/phpstan-wordpress": "^1.1", + "twig/cache-extra": "^3.3", + "wpackagist-plugin/advanced-custom-fields": "^5.0 || ^6.0", + "wpackagist-plugin/co-authors-plus": "^3.3", "yoast/wp-test-utils": "^1.0" }, "suggest": { - "satooshi/php-coveralls": "1.0.* for code coverage" + "php-coveralls/php-coveralls": "^2.0 for code coverage", + "twig/cache-extra": "For using the cache tag in Twig" }, "type": "library", "autoload": { "psr-4": { - "Timber\\": "lib/" + "Timber\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2555,24 +2580,39 @@ "MIT" ], "authors": [ + { + "name": "Erik van der Bas", + "email": "erik@basedonline.nl", + "homepage": "https://basedonline.nl" + }, + { + "name": "Lukas Gächter", + "email": "lukas.gaechter@mind.ch", + "homepage": "https://www.mind.ch" + }, + { + "name": "Nicolas Lemoine", + "email": "nico@n5s.dev", + "homepage": "https://n5s.dev" + }, { "name": "Jared Novack", "email": "jared@upstatement.com", - "homepage": "http://upstatement.com" + "homepage": "https://upstatement.com" }, { - "name": "Connor J. Burton", - "email": "connorjburton@gmail.com", - "homepage": "http://connorburton.com" + "name": "Timber Community", + "homepage": "https://github.com/timber/timber" } ], - "description": "Plugin to write WordPress themes w Object-Oriented Code and the Twig Template Engine", + "description": "Create WordPress themes with beautiful OOP code and the Twig Template Engine", "homepage": "http://timber.upstatement.com", "keywords": [ "templating", "themes", "timber", - "twig" + "twig", + "wordpress" ], "support": { "docs": "https://timber.github.io/docs/", @@ -2585,114 +2625,41 @@ "type": "open_collective" } ], - "time": "2024-01-29T07:04:46+00:00" - }, - { - "name": "twig/cache-extension", - "version": "v1.5.0", - "source": { - "type": "git", - "url": "https://github.com/twigphp/twig-cache-extension.git", - "reference": "2c243643f59132194458bd03c745b079bbb12e78" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/twig-cache-extension/zipball/2c243643f59132194458bd03c745b079bbb12e78", - "reference": "2c243643f59132194458bd03c745b079bbb12e78", - "shasum": "" - }, - "require": { - "php": ">=5.3.2", - "twig/twig": "^1.38|^2.4|^3.0" - }, - "require-dev": { - "doctrine/cache": "~1.0", - "phpunit/phpunit": "^5.0 || ^4.8.36", - "psr/cache": "^1.0", - "sebastian/comparator": "^1.2.4|^2.0" - }, - "suggest": { - "psr/cache-implementation": "To make use of PSR-6 cache implementation via PsrCacheAdapter." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.5-dev" - } - }, - "autoload": { - "psr-4": { - "": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alexander", - "email": "iam.asm89@gmail.com" - } - ], - "description": "Cache fragments of templates directly within Twig.", - "homepage": "https://github.com/twigphp/twig-cache-extension", - "keywords": [ - "cache", - "extension", - "twig" - ], - "support": { - "issues": "https://github.com/twigphp/twig-cache-extension/issues", - "source": "https://github.com/twigphp/twig-cache-extension/tree/v1.5.0" - }, - "funding": [ - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/twig/twig", - "type": "tidelift" - } - ], - "abandoned": "twig/cache-extra", - "time": "2020-10-04T09:56:48+00:00" + "time": "2024-04-10T15:02:17+00:00" }, { "name": "twig/twig", - "version": "v2.16.0", + "version": "v3.9.3", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "0c9cc7ef2e0ec6d20c5af1200522a89ba101f623" + "reference": "a842d75fed59cdbcbd3a3ad7fb9eb768fc350d58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/0c9cc7ef2e0ec6d20c5af1200522a89ba101f623", - "reference": "0c9cc7ef2e0ec6d20c5af1200522a89ba101f623", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/a842d75fed59cdbcbd3a3ad7fb9eb768fc350d58", + "reference": "a842d75fed59cdbcbd3a3ad7fb9eb768fc350d58", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php72": "^1.8" + "symfony/polyfill-php80": "^1.22" }, "require-dev": { - "psr/container": "^1.0", - "symfony/phpunit-bridge": "^5.4.9|^6.3" + "psr/container": "^1.0|^2.0", + "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.16-dev" - } - }, "autoload": { - "psr-0": { - "Twig_": "lib/" - }, + "files": [ + "src/Resources/core.php", + "src/Resources/debug.php", + "src/Resources/escaper.php", + "src/Resources/string_loader.php" + ], "psr-4": { "Twig\\": "src/" } @@ -2725,7 +2692,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v2.16.0" + "source": "https://github.com/twigphp/Twig/tree/v3.9.3" }, "funding": [ { @@ -2737,63 +2704,7 @@ "type": "tidelift" } ], - "time": "2023-12-22T07:22:15+00:00" - }, - { - "name": "upstatement/routes", - "version": "0.9.1", - "source": { - "type": "git", - "url": "https://github.com/Upstatement/routes.git", - "reference": "cac3c844ab824e4039fd26edbea5402415aa6d0a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Upstatement/routes/zipball/cac3c844ab824e4039fd26edbea5402415aa6d0a", - "reference": "cac3c844ab824e4039fd26edbea5402415aa6d0a", - "shasum": "" - }, - "require": { - "altorouter/altorouter": "^2.0.2", - "composer/installers": "^1.0 || ^2.0", - "php": ">=5.6.0|7.*" - }, - "require-dev": { - "phpunit/phpunit": "5.7.16", - "satooshi/php-coveralls": "*", - "wp-cli/wp-cli": "*" - }, - "type": "library", - "autoload": { - "psr-0": { - "Routes": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jared Novack", - "email": "jared@upstatement.com", - "homepage": "https://www.upstatement.com" - } - ], - "description": "Manage rewrites and routes in WordPress with this dead-simple plugin", - "homepage": "https://www.upstatement.com", - "keywords": [ - "redirects", - "rewrite", - "routes", - "routing" - ], - "support": { - "issues": "https://github.com/Upstatement/routes/issues", - "source": "https://github.com/Upstatement/routes", - "wiki": "https://github.com/Upstatement/routes/wiki" - }, - "time": "2022-06-22T19:53:51+00:00" + "time": "2024-04-18T11:59:33+00:00" }, { "name": "wp-coding-standards/wpcs", @@ -2848,16 +2759,16 @@ }, { "name": "yoast/phpunit-polyfills", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", - "reference": "224e4a1329c03d8bad520e3fc4ec980034a4b212" + "reference": "a0f7d708794a738f328d7b6c94380fd1d6c40446" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/224e4a1329c03d8bad520e3fc4ec980034a4b212", - "reference": "224e4a1329c03d8bad520e3fc4ec980034a4b212", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/a0f7d708794a738f328d7b6c94380fd1d6c40446", + "reference": "a0f7d708794a738f328d7b6c94380fd1d6c40446", "shasum": "" }, "require": { @@ -2865,7 +2776,9 @@ "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "require-dev": { - "yoast/yoastcs": "^2.3.0" + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "yoast/yoastcs": "^3.1.0" }, "type": "library", "extra": { @@ -2902,9 +2815,10 @@ ], "support": { "issues": "https://github.com/Yoast/PHPUnit-Polyfills/issues", + "security": "https://github.com/Yoast/PHPUnit-Polyfills/security/policy", "source": "https://github.com/Yoast/PHPUnit-Polyfills" }, - "time": "2023-08-19T14:25:08+00:00" + "time": "2024-04-05T16:01:51+00:00" } ], "aliases": [], diff --git a/functions.php b/functions.php index 5223a9d902..989c6337d7 100644 --- a/functions.php +++ b/functions.php @@ -4,7 +4,6 @@ use P4\MasterTheme\Loader; use P4\MasterTheme\MediaArchive\Rest; use P4\MasterTheme\Post; -use Timber\Timber; // This theme vendor dir if (file_exists(__DIR__ . '/vendor/autoload.php')) { @@ -80,7 +79,7 @@ function planet4_get_option(string $key = '', $default = null) } // Timber loading -if (!class_exists(Timber::class)) { +if (!class_exists('\\Timber\\Timber')) { add_action('admin_notices', function (): void { echo '

Timber not activated. ' . 'Make sure you installed the composer package `timber/timber`.

'; @@ -91,8 +90,7 @@ function planet4_get_option(string $key = '', $default = null) ); return; } -Timber::$cache = defined('WP_DEBUG') ? !WP_DEBUG : true; -$timber = new Timber(); +\Timber\Timber::init(); add_action( 'rest_api_init', diff --git a/index.php b/index.php index 3625f001a8..51a62e43bf 100755 --- a/index.php +++ b/index.php @@ -7,7 +7,7 @@ * It is used to display a page when nothing more specific matches a query. * E.g., it puts together the home page when no home.php file exists * - * Methods for TimberHelper can be found in the /lib sub-directory + * Methods for \Timber\Helper can be found in the /lib sub-directory * * @package WordPress * @subpackage Timber @@ -15,15 +15,14 @@ */ use P4\MasterTheme\Context; -use P4\MasterTheme\Post; use P4\MasterTheme\ListingPage; use Timber\Timber; -$context = Timber::get_context(); +$context = Timber::context(); $templates = [ 'index.twig' ]; if (is_home()) { - $post = new Post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited + $post = Timber::get_post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $post->set_data_layer(); $data_layer = $post->get_data_layer(); diff --git a/package-lock.json b/package-lock.json index f4f7cdc4bd..e05d69cf84 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5561,133 +5561,6 @@ "requireindex": "^1.2.0" } }, - "node_modules/@wordpress/eslint-plugin/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "peer": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@wordpress/eslint-plugin/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "peer": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@wordpress/eslint-plugin/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "peer": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@wordpress/eslint-plugin/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true, - "peer": true - }, - "node_modules/@wordpress/eslint-plugin/node_modules/cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "peer": true, - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "node_modules/@wordpress/eslint-plugin/node_modules/cross-spawn/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "dev": true, - "peer": true, - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/@wordpress/eslint-plugin/node_modules/eslint": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", - "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", - "dev": true, - "peer": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "ajv": "^6.10.0", - "chalk": "^2.1.0", - "cross-spawn": "^6.0.5", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "eslint-scope": "^5.0.0", - "eslint-utils": "^1.4.3", - "eslint-visitor-keys": "^1.1.0", - "espree": "^6.1.2", - "esquery": "^1.0.1", - "esutils": "^2.0.2", - "file-entry-cache": "^5.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "inquirer": "^7.0.0", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.3.0", - "lodash": "^4.17.14", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "natural-compare": "^1.4.0", - "optionator": "^0.8.3", - "progress": "^2.0.0", - "regexpp": "^2.0.1", - "semver": "^6.1.2", - "strip-ansi": "^5.2.0", - "strip-json-comments": "^3.0.1", - "table": "^5.2.3", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/@wordpress/eslint-plugin/node_modules/eslint-plugin-react-hooks": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.7.0.tgz", @@ -5700,119 +5573,6 @@ "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" } }, - "node_modules/@wordpress/eslint-plugin/node_modules/eslint-utils": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", - "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", - "dev": true, - "peer": true, - "dependencies": { - "eslint-visitor-keys": "^1.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@wordpress/eslint-plugin/node_modules/espree": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", - "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", - "dev": true, - "peer": true, - "dependencies": { - "acorn": "^7.1.1", - "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.1.0" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@wordpress/eslint-plugin/node_modules/file-entry-cache": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", - "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", - "dev": true, - "peer": true, - "dependencies": { - "flat-cache": "^2.0.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@wordpress/eslint-plugin/node_modules/globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", - "dev": true, - "peer": true, - "dependencies": { - "type-fest": "^0.8.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@wordpress/eslint-plugin/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "peer": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@wordpress/eslint-plugin/node_modules/regexpp": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", - "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", - "dev": true, - "peer": true, - "engines": { - "node": ">=6.5.0" - } - }, - "node_modules/@wordpress/eslint-plugin/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "peer": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@wordpress/eslint-plugin/node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "peer": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@wordpress/eslint-plugin/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "peer": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/@wordpress/hooks": { "version": "3.41.0", "resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.41.0.tgz", @@ -6016,22 +5776,6 @@ "react-dom": "^16.0.0-0" } }, - "node_modules/@wordpress/jest-preset-default/node_modules/react-dom": { - "version": "16.14.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.14.0.tgz", - "integrity": "sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==", - "dev": true, - "peer": true, - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2", - "scheduler": "^0.19.1" - }, - "peerDependencies": { - "react": "^16.14.0" - } - }, "node_modules/@wordpress/jest-preset-default/node_modules/semver": { "version": "5.7.2", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", @@ -9229,29 +8973,6 @@ "node": ">=6" } }, - "node_modules/cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, - "peer": true, - "dependencies": { - "restore-cursor": "^3.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cli-width": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", - "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", - "dev": true, - "peer": true, - "engines": { - "node": ">= 10" - } - }, "node_modules/clipboard": { "version": "2.0.11", "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz", @@ -12018,22 +11739,6 @@ "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==", "dev": true }, - "node_modules/figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dev": true, - "peer": true, - "dependencies": { - "escape-string-regexp": "^1.0.5" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -13666,83 +13371,6 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, - "node_modules/inquirer": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", - "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==", - "dev": true, - "peer": true, - "dependencies": { - "ansi-escapes": "^4.2.1", - "chalk": "^4.1.0", - "cli-cursor": "^3.1.0", - "cli-width": "^3.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.19", - "mute-stream": "0.0.8", - "run-async": "^2.4.0", - "rxjs": "^6.6.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/inquirer/node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "peer": true, - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/inquirer/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "peer": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/inquirer/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "peer": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/inquirer/node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true, - "peer": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/internal-slot": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", @@ -17995,13 +17623,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "node_modules/mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true, - "peer": true - }, "node_modules/nan": { "version": "2.17.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", @@ -18694,6 +18315,7 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -20892,6 +20514,7 @@ "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", @@ -21208,6 +20831,7 @@ "version": "16.14.0", "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==", + "dev": true, "dependencies": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", @@ -21250,7 +20874,8 @@ "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true }, "node_modules/react-remove-scroll": { "version": "2.5.5", @@ -21948,20 +21573,6 @@ "deprecated": "https://github.com/lydell/resolve-url#deprecated", "dev": true }, - "node_modules/restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, - "peer": true, - "dependencies": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", @@ -29881,8 +29492,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.0.1.tgz", "integrity": "sha512-jT/qyKZ9rzLErtrjGgdkMBn2OP8wl0G3sQlBb3YPryvKHsjvINUhVaPFfP+fpBcOkmrVOVEEHQFJ7nbj2TH2gw==", - "dev": true, - "requires": {} + "dev": true }, "@emotion/utils": { "version": "1.2.1", @@ -31341,8 +30951,7 @@ "version": "1.8.0", "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", - "dev": true, - "requires": {} + "dev": true }, "commander": { "version": "2.20.3", @@ -31827,8 +31436,7 @@ "version": "2.7.0", "resolved": "https://registry.npmjs.org/@wordpress/babel-plugin-import-jsx-pragma/-/babel-plugin-import-jsx-pragma-2.7.0.tgz", "integrity": "sha512-yR+rSyfHKfevW84vKBOERpjEslD/o00CaYMftywVYOjsOQ8GLS6xv/VgDcpQ8JomJ9eRRInLRpeGKTM3lOa4xQ==", - "dev": true, - "requires": {} + "dev": true }, "@wordpress/babel-preset-default": { "version": "4.20.0", @@ -32015,8 +31623,7 @@ "version": "0.15.2", "resolved": "https://registry.npmjs.org/reakit-utils/-/reakit-utils-0.15.2.tgz", "integrity": "sha512-i/RYkq+W6hvfFmXw5QW7zvfJJT/K8a4qZ0hjA79T61JAFPGt23DsfxwyBbyK91GZrJ9HMrXFVXWMovsKBc1qEQ==", - "dev": true, - "requires": {} + "dev": true }, "reakit-warning": { "version": "0.6.2", @@ -32345,200 +31952,11 @@ "requireindex": "^1.2.0" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "peer": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "peer": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "peer": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true, - "peer": true - }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "peer": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "dependencies": { - "semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "dev": true, - "peer": true - } - } - }, - "eslint": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", - "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", - "dev": true, - "peer": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "ajv": "^6.10.0", - "chalk": "^2.1.0", - "cross-spawn": "^6.0.5", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "eslint-scope": "^5.0.0", - "eslint-utils": "^1.4.3", - "eslint-visitor-keys": "^1.1.0", - "espree": "^6.1.2", - "esquery": "^1.0.1", - "esutils": "^2.0.2", - "file-entry-cache": "^5.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "inquirer": "^7.0.0", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.3.0", - "lodash": "^4.17.14", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "natural-compare": "^1.4.0", - "optionator": "^0.8.3", - "progress": "^2.0.0", - "regexpp": "^2.0.1", - "semver": "^6.1.2", - "strip-ansi": "^5.2.0", - "strip-json-comments": "^3.0.1", - "table": "^5.2.3", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - } - }, "eslint-plugin-react-hooks": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.7.0.tgz", "integrity": "sha512-iXTCFcOmlWvw4+TOE8CLWj6yX1GwzT0Y6cUfHHZqWnSk144VmVIRcVGtUAzrLES7C798lmvnt02C7rxaOX1HNA==", - "dev": true, - "requires": {} - }, - "eslint-utils": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", - "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", - "dev": true, - "peer": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - } - }, - "espree": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", - "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", - "dev": true, - "peer": true, - "requires": { - "acorn": "^7.1.1", - "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.1.0" - } - }, - "file-entry-cache": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", - "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", - "dev": true, - "peer": true, - "requires": { - "flat-cache": "^2.0.1" - } - }, - "globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", - "dev": true, - "peer": true, - "requires": { - "type-fest": "^0.8.1" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "peer": true - }, - "regexpp": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", - "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", - "dev": true, - "peer": true - }, - "semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "peer": true - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "peer": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "peer": true, - "requires": { - "has-flag": "^3.0.0" - } + "dev": true } } }, @@ -32697,19 +32115,6 @@ "semver": "^5.7.0" } }, - "react-dom": { - "version": "16.14.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.14.0.tgz", - "integrity": "sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==", - "dev": true, - "peer": true, - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2", - "scheduler": "^0.19.1" - } - }, "semver": { "version": "5.7.2", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", @@ -32733,8 +32138,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/@wordpress/npm-package-json-lint-config/-/npm-package-json-lint-config-2.2.0.tgz", "integrity": "sha512-8Td9vWekCwZCPfWkVWKQllim/F/m0uN1cma3KkBsKxi0liftj/iXpDBDH6wDxsv8z1Gbwq+H9a4D6w7Ob8SqtQ==", - "dev": true, - "requires": {} + "dev": true }, "@wordpress/primitives": { "version": "3.39.0", @@ -33635,8 +33039,7 @@ "acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "requires": {} + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==" }, "acorn-walk": { "version": "6.2.0", @@ -33695,15 +33098,13 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz", "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==", - "dev": true, - "requires": {} + "dev": true }, "ajv-keywords": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true, - "requires": {} + "dev": true }, "ansi-colors": { "version": "4.1.3", @@ -34554,8 +33955,7 @@ "version": "5.1.3", "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.3.tgz", "integrity": "sha512-fcQztozJ8jToQWXxVuEyXWW+dSo8AiXWKwiSSrKWsRB/Qt+Ewwza+JWoLKiTuQLaEPhdNAJ7+Dosc9DOIqNy7Q==", - "dev": true, - "requires": {} + "dev": true }, "brace-expansion": { "version": "1.1.11", @@ -35315,23 +34715,6 @@ "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", "dev": true }, - "cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, - "peer": true, - "requires": { - "restore-cursor": "^3.1.0" - } - }, - "cli-width": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", - "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", - "dev": true, - "peer": true - }, "clipboard": { "version": "2.0.11", "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz", @@ -35650,8 +35033,7 @@ "version": "4.4.0", "resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-4.4.0.tgz", "integrity": "sha512-BabizFdC3wBHhbI4kJh0VkQP9GkBfoHPydD0COMce1nJ1kJAB3F2TmJ/I7diULBKtmEWSwEbuN/KDtgnmUUVmw==", - "dev": true, - "requires": {} + "dev": true }, "create-ecdh": { "version": "4.0.4", @@ -36947,8 +36329,7 @@ "version": "4.6.0", "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz", "integrity": "sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==", - "dev": true, - "requires": {} + "dev": true }, "eslint-scope": { "version": "5.1.1", @@ -37568,16 +36949,6 @@ "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==", "dev": true }, - "figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dev": true, - "peer": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, "file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -38845,64 +38216,6 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, - "inquirer": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", - "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==", - "dev": true, - "peer": true, - "requires": { - "ansi-escapes": "^4.2.1", - "chalk": "^4.1.0", - "cli-cursor": "^3.1.0", - "cli-width": "^3.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.19", - "mute-stream": "0.0.8", - "run-async": "^2.4.0", - "rxjs": "^6.6.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6" - }, - "dependencies": { - "ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "peer": true, - "requires": { - "type-fest": "^0.21.3" - } - }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "peer": true - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "peer": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true, - "peer": true - } - } - }, "internal-slot": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", @@ -40351,8 +39664,7 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", - "dev": true, - "requires": {} + "dev": true }, "jest-puppeteer": { "version": "4.4.0", @@ -42311,13 +41623,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true, - "peer": true - }, "nan": { "version": "2.17.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", @@ -42875,7 +42180,8 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true }, "object-copy": { "version": "0.1.0", @@ -43096,8 +42402,7 @@ "version": "6.4.0", "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.0.tgz", "integrity": "sha512-jDfsatwWMWN0MODAFuHszfjphEXfNw9JUAhmY4pLu3TyTU+ohUpsbVtbU+1MZn4a47D9kqh03i4eyOm+74+zew==", - "dev": true, - "requires": {} + "dev": true }, "cssnano": { "version": "5.1.15", @@ -43151,8 +42456,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-3.1.0.tgz", "integrity": "sha512-JQNR19/YZhz4psLX/rQ9M83e3z2Wf/HdJbryzte4a3NSuafyp9w/I4U+hx5C2S9g41qlstH7DEWnZaaj83OuEA==", - "dev": true, - "requires": {} + "dev": true }, "normalize-url": { "version": "6.1.0", @@ -43213,29 +42517,25 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-5.1.2.tgz", "integrity": "sha512-+L8208OVbHVF2UQf1iDmRcbdjJkuBF6IS29yBDSiWUIzpYaAhtNl6JYnYm12FnkeCwQqF5LeklOu6rAqgfBZqQ==", - "dev": true, - "requires": {} + "dev": true }, "postcss-discard-duplicates": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-5.1.0.tgz", "integrity": "sha512-zmX3IoSI2aoenxHV6C7plngHWWhUOV3sP1T8y2ifzxzbtnuhk1EdPwm0S1bIUNaJ2eNbWeGLEwzw8huPD67aQw==", - "dev": true, - "requires": {} + "dev": true }, "postcss-discard-empty": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-5.1.1.tgz", "integrity": "sha512-zPz4WljiSuLWsI0ir4Mcnr4qQQ5e1Ukc3i7UfE2XcrwKK2LIPIqE5jxMRxO6GbI3cv//ztXDsXwEWT3BHOGh3A==", - "dev": true, - "requires": {} + "dev": true }, "postcss-discard-overridden": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-5.1.0.tgz", "integrity": "sha512-21nOL7RqWR1kasIVdKs8HNqQJhFxLsyRfAnUDm4Fe4t4mCWL9OJiHvlHPjcd8zc5Myu89b/7wZDnOSjFgeWRtw==", - "dev": true, - "requires": {} + "dev": true }, "postcss-merge-longhand": { "version": "5.1.7", @@ -43303,8 +42603,7 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-5.1.0.tgz", "integrity": "sha512-mSgUJ+pd/ldRGVx26p2wz9dNZ7ji6Pn8VWBajMXFf8jk7vUoSrZ2lt/wZR7DtlZYKesmZI680qjr2CeFF2fbUg==", - "dev": true, - "requires": {} + "dev": true }, "postcss-normalize-display-values": { "version": "5.1.0", @@ -44180,8 +43479,7 @@ "version": "1.16.0", "resolved": "https://registry.npmjs.org/postcss-prefix-selector/-/postcss-prefix-selector-1.16.0.tgz", "integrity": "sha512-rdVMIi7Q4B0XbXqNUEI+Z4E+pueiu/CS5E6vRCQommzdQ/sgsS4dK42U7GX8oJR+TJOtT+Qv3GkNo6iijUMp3Q==", - "dev": true, - "requires": {} + "dev": true }, "postcss-reporter": { "version": "6.0.1", @@ -44295,8 +43593,7 @@ "version": "0.36.2", "resolved": "https://registry.npmjs.org/postcss-syntax/-/postcss-syntax-0.36.2.tgz", "integrity": "sha512-nBRg/i7E3SOHWxF3PpF5WnJM/jQ1YpY9000OaVXlAQj6Zp/kIqJxEDWIZ67tAd7NLuk7zqN4yqe9nc0oNAOs1w==", - "dev": true, - "requires": {} + "dev": true }, "postcss-value-parser": { "version": "4.2.0", @@ -44535,6 +43832,7 @@ "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, "requires": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", @@ -44796,13 +44094,13 @@ "version": "6.9.9", "resolved": "https://registry.npmjs.org/re-resizable/-/re-resizable-6.9.9.tgz", "integrity": "sha512-l+MBlKZffv/SicxDySKEEh42hR6m5bAHfNu3Tvxks2c4Ah+ldnWjfnVRwxo/nxF27SsUsxDS0raAzFuJNKABXA==", - "dev": true, - "requires": {} + "dev": true }, "react": { "version": "16.14.0", "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==", + "dev": true, "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", @@ -44813,8 +44111,7 @@ "version": "5.6.1", "resolved": "https://registry.npmjs.org/react-colorful/-/react-colorful-5.6.1.tgz", "integrity": "sha512-1exovf0uGTGyq5mXQT0zgQ80uvj2PCwvF8zY1RN9/vbJVSjSo3fsB/4L3ObbF7u70NduSiK4xu4Y6q1MHoUGEw==", - "dev": true, - "requires": {} + "dev": true }, "react-dom": { "version": "18.2.0", @@ -44838,7 +44135,8 @@ "react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true }, "react-remove-scroll": { "version": "2.5.5", @@ -45396,17 +44694,6 @@ "integrity": "sha512-ZuF55hVUQaaczgOIwqWzkEcEidmlD/xl44x1UZnhOXcYuFN2S6+rcxpG+C1N3So0wvNI3DmJICUFfu2SxhBmvg==", "dev": true }, - "restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, - "peer": true, - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", @@ -47124,8 +46411,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-2.2.0.tgz", "integrity": "sha512-bZ+d4RiNEfmoR74KZtCKmsABdBJr4iXRiCso+6LtMJPw5rd/KnxUWTxht7TbafrTJK1YRjNgnN0iVZaJfc3xJA==", - "dev": true, - "requires": {} + "dev": true }, "stylelint-config-recommended-scss": { "version": "3.3.0", @@ -48708,8 +47994,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.1.2.tgz", "integrity": "sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==", - "dev": true, - "requires": {} + "dev": true }, "use-lilius": { "version": "2.0.3", @@ -48724,8 +48009,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/use-memo-one/-/use-memo-one-1.1.3.tgz", "integrity": "sha512-g66/K7ZQGYrI6dy8GLpVcMsBp4s17xNkYJVSMvTEevGy3nDxHOfE6z8BVE22+5G5x7t3+bhzrlTDB7ObrEE0cQ==", - "dev": true, - "requires": {} + "dev": true }, "use-sidecar": { "version": "1.1.2", @@ -48749,8 +48033,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", - "dev": true, - "requires": {} + "dev": true }, "user-home": { "version": "2.0.0", diff --git a/page-templates/evergreen.php b/page-templates/evergreen.php index eb9f4c2fa5..5a96ed7eab 100755 --- a/page-templates/evergreen.php +++ b/page-templates/evergreen.php @@ -11,7 +11,7 @@ * /mytheme/page-mypage.php * (in which case you'll want to duplicate this file and save to the above path) * - * Methods for TimberHelper can be found in the /lib sub-directory + * Methods for \Timber\Helper can be found in the /lib sub-directory * * @package WordPress * @subpackage Timber @@ -19,11 +19,10 @@ */ use P4\MasterTheme\Context; -use P4\MasterTheme\Post; use Timber\Timber; -$context = Timber::get_context(); -$post = new Post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited +$context = Timber::context(); +$post = Timber::get_post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $page_meta_data = get_post_meta($post->ID); $page_meta_data = array_map(fn ($v) => reset($v), $page_meta_data); diff --git a/page-templates/sitemap.php b/page-templates/sitemap.php index bf65980b66..1f342e4805 100644 --- a/page-templates/sitemap.php +++ b/page-templates/sitemap.php @@ -8,11 +8,10 @@ */ use P4\MasterTheme\Sitemap; -use P4\MasterTheme\Post; use Timber\Timber; -$context = Timber::get_context(); -$post = new Post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited +$context = Timber::context(); +$post = Timber::get_post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $page_meta_data = get_post_meta($post->ID); $context['post'] = $post; diff --git a/page.php b/page.php index d74c259458..8ec3309381 100755 --- a/page.php +++ b/page.php @@ -15,7 +15,7 @@ * /mytheme/page-mypage.php * (in which case you'll want to duplicate this file and save to the above path) * - * Methods for TimberHelper can be found in the /lib sub-directory + * Methods for \Timber\Helper can be found in the /lib sub-directory * * @package WordPress * @subpackage Timber @@ -30,11 +30,10 @@ use P4\MasterTheme\Context; use P4\MasterTheme\Features\RedirectRedirectPages; -use P4\MasterTheme\Post; use Timber\Timber; -$context = Timber::get_context(); -$post = new Post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited +$context = Timber::context(); +$post = Timber::get_post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $page_meta_data = get_post_meta($post->ID) ?: []; $page_meta_data = array_map(fn($v) => reset($v), $page_meta_data); diff --git a/search.php b/search.php index 0be3e57bae..6b702c78de 100755 --- a/search.php +++ b/search.php @@ -2,6 +2,12 @@ /** * Search results page + * + * Methods for \Timber\Helper can be found in the /lib sub-directory + * + * @package WordPress + * @subpackage Timber + * @since Timber 0.1 */ use P4\MasterTheme\Search\SearchPage; diff --git a/single-attachment.php b/single-attachment.php index 49c66b7c32..27ed2822b8 100755 --- a/single-attachment.php +++ b/single-attachment.php @@ -3,7 +3,7 @@ /** * The Template for displaying all attachment posts * - * Methods for TimberHelper can be found in the /lib sub-directory + * Methods for \Timber\Helper can be found in the /lib sub-directory * * @package WordPress * @subpackage Timber @@ -14,13 +14,13 @@ use Timber\Timber; // Initializing variables. -$context = Timber::get_context(); +$context = Timber::context(); /** * P4 Post Object * * @var Post $post */ -$post = Timber::query_post(false, Post::class); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited +$post = Timber::get_post(false); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $context['post'] = $post; $context['social_accounts'] = Post::filter_social_accounts($context['footer_social_menu'] ?: []); diff --git a/single-campaign.php b/single-campaign.php index b44cff52dd..2fbd4f450f 100644 --- a/single-campaign.php +++ b/single-campaign.php @@ -7,18 +7,17 @@ */ use P4\MasterTheme\Context; -use P4\MasterTheme\Post; use Timber\Timber; // Initializing variables. -$context = Timber::get_context(); +$context = Timber::context(); /** * Post object. * * @var Post $post * */ -$post = Timber::query_post(false, Post::class); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited +$post = Timber::query_post(false); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $context['post'] = $post; $meta = get_post_meta($post->ID); diff --git a/single-p4_action.php b/single-p4_action.php index 0bc4b6fa31..a31be2120d 100755 --- a/single-p4_action.php +++ b/single-p4_action.php @@ -3,7 +3,7 @@ /** * The Template for displaying all action pages * - * Methods for TimberHelper can be found in the /lib sub-directory + * Methods for \Timber\Helper can be found in the /lib sub-directory * * (Note: This file is a copy of page.php to use the same template for action pages.) * @@ -13,11 +13,10 @@ */ use P4\MasterTheme\Context; -use P4\MasterTheme\Post; use Timber\Timber; -$context = Timber::get_context(); -$post = new Post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited +$context = Timber::context(); +$post = Timber::get_post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $page_meta_data = get_post_meta($post->ID); $page_meta_data = array_map(fn ($v) => reset($v), $page_meta_data); diff --git a/single.php b/single.php index 167067d48f..9769a24688 100755 --- a/single.php +++ b/single.php @@ -3,7 +3,7 @@ /** * The Template for displaying all single posts * - * Methods for TimberHelper can be found in the /lib sub-directory + * Methods for \Timber\Helper can be found in the /lib sub-directory * * @package WordPress * @subpackage Timber @@ -11,18 +11,17 @@ */ use P4\MasterTheme\Context; -use P4\MasterTheme\Post; use P4\MasterTheme\Settings\CommentsGdpr; use Timber\Timber; // Initializing variables. -$context = Timber::get_context(); +$context = Timber::context(); /** * P4 Post Object * * @var Post $post */ -$post = Timber::query_post(false, Post::class); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited +$post = Timber::get_post(false); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $context['post'] = $post; // Set Navigation Issues links. diff --git a/src/Context.php b/src/Context.php index 2dd49861f0..35b333eba3 100644 --- a/src/Context.php +++ b/src/Context.php @@ -113,7 +113,7 @@ public static function set_p4_blocks_datalayer(array &$context, object $post): v $post_content .= $post->take_action_boxout; } - preg_match_all('/wp:planet4-blocks\/(\S+)|wp:gravityforms\/(\S+)*/', $post_content, $matches); + preg_match_all('/wp:planet4-blocks\/(\S+)|wp:gravityforms\/(\S+)*/', $post_content ?? '', $matches); $p4_blocks = array_map( function ($block) { diff --git a/src/GravityFormsExtensions.php b/src/GravityFormsExtensions.php index d59f367cd5..06aca4c8b2 100644 --- a/src/GravityFormsExtensions.php +++ b/src/GravityFormsExtensions.php @@ -372,8 +372,8 @@ public function p4_gf_custom_confirmation($confirmation, $form, $entry) return $confirmation; } - $context = Timber::get_context(); - $post = Timber::query_post(false, Post::class); + $context = Timber::context(); + $post = Timber::get_post(false); $current_confirmation = $form['confirmation']; diff --git a/src/MasterBlocks.php b/src/MasterBlocks.php index 62db99e996..b01f21a62f 100644 --- a/src/MasterBlocks.php +++ b/src/MasterBlocks.php @@ -4,7 +4,6 @@ use P4\MasterTheme\Controllers\EnsapiController; use P4\MasterTheme\Blocks\ENForm; -use Twig_SimpleFilter; /** * Class MasterBlocks @@ -47,7 +46,7 @@ private function hooks(): void add_filter('timber/twig', function ($twig) { // Adding functions as filters. $twig->addFilter( - new Twig_SimpleFilter( + new \Twig\TwigFilter( 'object_to_array_theme', function ($std_class_object) { $response = []; diff --git a/src/MasterSite.php b/src/MasterSite.php index 8e4eb5c87a..424be7af72 100644 --- a/src/MasterSite.php +++ b/src/MasterSite.php @@ -5,12 +5,8 @@ use P4\MasterTheme\Features\Dev\CoreBlockPatterns; use P4\MasterTheme\Features\LazyYoutubePlayer; use Timber\Timber; -use Timber\Site as TimberSite; -use Timber\Menu as TimberMenu; -use Twig_Extension_StringLoader; -use Twig_Environment; -use Twig_Markup; -use Twig_SimpleFilter; +use Twig\Extension\StringLoaderExtension; +use Twig\Markup; use WP_Error; use WP_Post; @@ -18,7 +14,7 @@ * Class MasterSite. * The main class that handles Planet4 Master Theme. */ -class MasterSite extends TimberSite +class MasterSite extends \Timber\Site { /** * Key of notice seen by user @@ -77,7 +73,6 @@ public function __construct() */ protected function settings(): void { - Timber::$autoescape = true; Timber::$dirname = ['templates', 'templates/blocks', 'views']; $this->theme_dir = get_template_directory_uri(); $this->theme_images_dir = $this->theme_dir . '/images/'; @@ -111,8 +106,8 @@ protected function hooks(): void add_post_type_support('page', 'excerpt'); // Added excerpt option to pages. - add_filter('timber_context', [$this, 'add_to_context']); - add_filter('get_twig', [$this, 'add_to_twig']); + add_filter('timber/context', [$this, 'add_to_context']); + add_filter('timber/twig', [$this, 'add_to_twig']); add_action('init', [$this, 'register_taxonomies'], 2); add_action('init', [$this, 'register_oembed_provider']); add_action('admin_menu', [$this, 'add_post_revisions_setting']); @@ -320,6 +315,7 @@ function (): void { 10 ); + TimberSettings::hooks(); AuthorPage::hooks(); Search\Search::hooks(); Sendgrid::hooks(); @@ -623,19 +619,21 @@ public function add_to_context(array $context) $context['domain'] = 'planet4-master-theme'; $context['foo'] = 'bar'; // For unit test purposes. - $menu = new TimberMenu('navigation-bar-menu'); - $menu_items = $menu->get_items(); - $context['navbar_menu'] = $menu; - $context['navbar_menu_items'] = array_filter( - $menu_items, - function ($item) { - return !in_array('wpml-ls-item', $item->classes ?? [], true); - } - ); + if (has_nav_menu('navigation-bar-menu')) { + $menu = Timber::get_menu('navigation-bar-menu'); + $menu_items = $menu->get_items(); + $context['navbar_menu'] = $menu; + $context['navbar_menu_items'] = array_filter( + $menu_items, + function ($item) { + return !in_array('wpml-ls-item', $item->classes ?? [], true); + } + ); + } // Check if the menu has been created. if (has_nav_menu('donate-menu')) { - $donate_menu = new TimberMenu('donate-menu'); + $donate_menu = Timber::get_menu('donate-menu'); // Check if it has at least 1 item added into the menu. if (!empty($donate_menu->get_items())) { @@ -745,11 +743,10 @@ function ($item) { * * @return mixed */ - public function add_to_twig(Twig_Environment $twig) + public function add_to_twig(\Twig\Environment $twig) { - $twig->addExtension(new Twig_Extension_StringLoader()); - $twig->addFilter(new Twig_SimpleFilter('svgicon', [$this, 'svgicon'])); - + $twig->addExtension(new StringLoaderExtension()); + $twig->addFilter(new \Twig\TwigFilter('svgicon', [$this, 'svgicon'])); return $twig; } @@ -758,12 +755,12 @@ public function add_to_twig(Twig_Environment $twig) * * @param string $name Icon name. */ - public function svgicon(string $name): Twig_Markup + public function svgicon(string $name): Markup { $svg_icon_template = ''; - return new Twig_Markup($svg_icon_template, 'UTF-8'); + return new Markup($svg_icon_template, 'UTF-8'); } /** diff --git a/src/Post.php b/src/Post.php index 1260c67689..1a3b09197c 100644 --- a/src/Post.php +++ b/src/Post.php @@ -2,58 +2,54 @@ namespace P4\MasterTheme; -use Timber\Post as TimberPost; +use Timber\Timber; use WP_Block; use WP_Error; /** * Add planet4 specific functionality. */ -class Post extends TimberPost +class Post extends \Timber\Post { /** * Issues navigation * * @var array|null $issues_nav_data */ - protected ?array $issues_nav_data = null; + public ?array $issues_nav_data = null; /** * Content type * */ - protected string $content_type; + public string $content_type; /** * Page types * - * @var TimberTerm[] $page_types + * @var \Timber\Term[] $page_types */ - protected array $page_types = []; + public array $page_types = []; /** * Author * */ - protected User $author; + public ?User $author; /** * Associative array with the values to be passed to GTM Data Layer. * */ - protected array $data_layer; + public array $data_layer; - /** - * Post constructor. - * - * @param mixed $pid The post id. - * If left null it will try to figure out the current post id based on being inside The_Loop. - */ - public function __construct($pid = null) + public static function build(\WP_Post $wp_post): self { - parent::__construct($pid); - $this->set_page_types(); - $this->set_author(); + $post = parent::build($wp_post); + $post->set_page_types(); + $post->set_author(); + + return $post; } /** @@ -206,7 +202,7 @@ public function get_custom_terms(): array */ public function set_page_types(): void { - $taxonomies = $this->get_terms(CustomTaxonomy::TAXONOMY); + $taxonomies = $this->terms(CustomTaxonomy::TAXONOMY); if (!$taxonomies || is_wp_error($taxonomies)) { return; @@ -348,9 +344,9 @@ public function set_author(): void { $author_override = get_post_meta($this->id, 'p4_author_override', true); if ('' !== $author_override) { - $this->author = new User(false, $author_override); // Create fake User. + $this->author = Timber::get_user(false, $author_override); // Create fake User. } else { - $this->author = new User((int) $this->post_author); + $this->author = Timber::get_user((int) $this->post_author); } } @@ -440,6 +436,10 @@ public function is_password_valid(): bool */ public function reading_time(): int { + if (empty($this->id)) { + //return 0; + } + $cache_key = $this->id . '~' . $this->post_modified; $from_cache = wp_cache_get($cache_key); if ($from_cache) { @@ -491,7 +491,7 @@ public static function reading_time_block( string $content, WP_Block $block ): string { - $time = (new self($block->context['postId'] ?? null))->reading_time_for_display(); + $time = (Timber::get_post($block->context['postId'] ?? false))->reading_time_for_display(); return $time ? '' // translators: reading time in min. diff --git a/src/PublicAssets.php b/src/PublicAssets.php index 4ed099ec7a..27d2be5138 100644 --- a/src/PublicAssets.php +++ b/src/PublicAssets.php @@ -14,6 +14,10 @@ final class PublicAssets */ public static function enqueue_js(): void { + if (!file_exists(get_template_directory() . '/assets/build/index.js')) { + return; + } + $js_creation = filectime(get_template_directory() . '/assets/build/index.js'); $theme_dir = get_template_directory_uri(); diff --git a/src/Search/SearchPage.php b/src/Search/SearchPage.php index cb62b44905..3fc5dc9ce4 100644 --- a/src/Search/SearchPage.php +++ b/src/Search/SearchPage.php @@ -32,7 +32,7 @@ public function __construct(WP_Query $query) { $this->query = $query; $this->posts = $query->posts; - $this->context = Timber::get_context(); + $this->context = Timber::context(); $this->populate_context($query); } diff --git a/src/TimberSettings.php b/src/TimberSettings.php new file mode 100644 index 0000000000..8fca5ddb12 --- /dev/null +++ b/src/TimberSettings.php @@ -0,0 +1,39 @@ + Post::class, + 'post' => Post::class, + //'tag' => Post::class, + 'campaign' => Post::class, + 'p4-page-type' => Post::class, + ]; + + return array_merge($classmap, $custom_classmap); + }); + + add_filter('timber/user/class', fn() => User::class); + + add_filter('timber/twig/environment/options', static function (array $options): array { + $options['autoescape'] = 'html'; + $options['cache'] = defined('WP_DEBUG') ? !WP_DEBUG : true; + return $options; + }); + + add_filter('timber/locations', static function (array $locations): array { + $locations['enform'] = [ + dirname(__DIR__) . '/templates/block_templates', + dirname(__DIR__) . '/templates/block_templates/enform', + ]; + return $locations; + }); + } +} diff --git a/src/User.php b/src/User.php index 6a7fad3cef..6a946cb9f8 100644 --- a/src/User.php +++ b/src/User.php @@ -17,20 +17,10 @@ class User extends Timber\User */ public bool $is_fake = false; - /** - * User constructor. - * - * @param object|int|bool $uid The User id. - * @param string $author_override The author override display name. - */ - public function __construct($uid = false, string $author_override = '') + public static function build(\WP_User $wp_user): self { - if (! $author_override) { - parent::__construct($uid); - } else { - $this->display_name = $author_override; - $this->is_fake = true; - } + $user = parent::build($wp_user); + return $user; } /** diff --git a/src/View/View.php b/src/View/View.php index be5c21ff7b..44cdeece0e 100644 --- a/src/View/View.php +++ b/src/View/View.php @@ -41,8 +41,6 @@ public function get_template( array $data, string $relevant_dir = 'block_templates/' ): bool|string { - Timber::$locations = $this->get_template_dir($template_name, $relevant_dir); - return Timber::compile([$relevant_dir . $template_name . '.twig'], $data); } @@ -61,8 +59,6 @@ public function view_template( string $relevant_dir = '', bool $compile = false ): string|null { - Timber::$locations = $this->get_template_dir($template_name, $relevant_dir); - if ($compile) { return Timber::compile([$relevant_dir . $template_name . '.twig'], $data); } @@ -123,7 +119,6 @@ public function block( ): void { $template_dir = $this->get_template_dir($template_name, $relevant_dir, $template_ext); if ('twig' === $template_ext) { - Timber::$locations = $template_dir; Timber::render([$relevant_dir . $template_name . '.' . $template_ext], $data); } else { include_once $template_dir . $relevant_dir . $template_name . '.' . $template_ext; diff --git a/tag.php b/tag.php index 1ff53597bf..a97d8a444b 100644 --- a/tag.php +++ b/tag.php @@ -11,7 +11,6 @@ */ use P4\MasterTheme\Context; -use P4\MasterTheme\Post; use P4\MasterTheme\ListingPage; use Timber\Timber; @@ -35,10 +34,10 @@ exit(); } -$post = Timber::query_post(false, Post::class); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -$context = Timber::get_context(); +$post = Timber::get_post(false); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited +$context = Timber::context(); if ($post instanceof \WP_Post) { - $post = new Post($post->ID); + $post = Timber::get_post($post->ID); Context::set_og_meta_fields($context, $post); } diff --git a/taxonomy.php b/taxonomy.php index 96d9683621..336193c43b 100755 --- a/taxonomy.php +++ b/taxonomy.php @@ -12,7 +12,7 @@ $templates = [ 'taxonomy.twig', 'index.twig' ]; -$context = Timber::get_context(); +$context = Timber::context(); $taxonomy = get_queried_object(); $context['taxonomy'] = $taxonomy; diff --git a/templates/author.twig b/templates/author.twig index d0a92fb21a..6b49f652e9 100644 --- a/templates/author.twig +++ b/templates/author.twig @@ -12,7 +12,7 @@

{{ author.name }}

{% if ( author.description ) %} -

{{ fn('wpautop', fn('the_author_meta', 'description', author.id))|e('wp_kses_post')|raw }}

+

{{ fn('wpautop', author.description)|e('wp_kses_post')|raw }}

{% endif %}
diff --git a/templates/burger-menu-items.twig b/templates/burger-menu-items.twig index cc821fe6c0..f5ea9bee58 100644 --- a/templates/burger-menu-items.twig +++ b/templates/burger-menu-items.twig @@ -11,7 +11,7 @@
>>>>>> ef0eeee4 (PLANET-7390: Update to Timber 2.1) data-ga-category="Submenu Navigation" data-ga-action="{{ link_ga_action }}" data-ga-label="{{ page_category }}"> diff --git a/templates/desktop-menu.twig b/templates/desktop-menu.twig index 9286502d88..60942840c1 100644 --- a/templates/desktop-menu.twig +++ b/templates/desktop-menu.twig @@ -12,7 +12,7 @@ {% endif %} {% endif %} - {{ wp_head }} + {{ function('wp_head') }} {% if preconnect_domains %} {% for domain in preconnect_domains %} diff --git a/templates/navigation-bar.twig b/templates/navigation-bar.twig index 65a6b53fc5..12c55158e7 100644 --- a/templates/navigation-bar.twig +++ b/templates/navigation-bar.twig @@ -60,7 +60,7 @@