From c95fc5a796dfcc166f4916366d23cb7f6aa269a4 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 6 May 2024 18:37:09 -0400 Subject: [PATCH 01/29] require features module --- composer.json | 3 +- composer.lock | 98 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 98 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 72d2e55..24d1be3 100644 --- a/composer.json +++ b/composer.json @@ -30,6 +30,7 @@ "newfold-labs/wp-module-context": "^1.0", "wp-forge/collection": "^1.0", "wp-forge/wp-htaccess-manager": "^1.0", - "wpscholar/url": "^1.2" + "wpscholar/url": "^1.2", + "newfold-labs/wp-module-features": "dev-main" } } diff --git a/composer.lock b/composer.lock index 1e8a5ea..6298427 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f5b5633a0d4cf80f98952b761fb0a1c6", + "content-hash": "cfbfc049f84baaa443c4613d62e54795", "packages": [ { "name": "doctrine/inflector", @@ -156,6 +156,61 @@ }, "time": "2024-02-22T18:22:13+00:00" }, + { + "name": "newfold-labs/wp-module-features", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/newfold-labs/wp-module-features.git", + "reference": "7ca3bd83d181c5e21440cd729a2b90576065f788" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/newfold-labs/wp-module-features/zipball/7ca3bd83d181c5e21440cd729a2b90576065f788", + "reference": "7ca3bd83d181c5e21440cd729a2b90576065f788", + "shasum": "" + }, + "require": { + "wp-forge/wp-options": "^1.1" + }, + "require-dev": { + "newfold-labs/wp-php-standards": "^1.2" + }, + "default-branch": true, + "type": "library", + "autoload": { + "psr-4": { + "NewfoldLabs\\WP\\Module\\Features\\": "includes" + } + }, + "scripts": { + "fix": [ + "vendor/bin/phpcbf . --standard=phpcs.xml" + ], + "lint": [ + "vendor/bin/phpcs . --standard=phpcs.xml -s" + ] + }, + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Micah Wood", + "homepage": "https://wpscholar.com" + }, + { + "name": "Evan Mullins", + "homepage": "https://evanmullins.com" + } + ], + "description": "A module for providing an interface for features.", + "support": { + "source": "https://github.com/newfold-labs/wp-module-features/tree/main", + "issues": "https://github.com/newfold-labs/wp-module-features/issues" + }, + "time": "2024-05-03T15:58:51+00:00" + }, { "name": "wp-forge/collection", "version": "1.0.2", @@ -277,6 +332,43 @@ }, "time": "2022-04-01T16:21:01+00:00" }, + { + "name": "wp-forge/wp-options", + "version": "1.1", + "source": { + "type": "git", + "url": "https://github.com/wp-forge/wp-options.git", + "reference": "df8899255dee19365599caa8801c75803e94e413" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-forge/wp-options/zipball/df8899255dee19365599caa8801c75803e94e413", + "reference": "df8899255dee19365599caa8801c75803e94e413", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "WP_Forge\\Options\\": "includes" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Micah Wood", + "email": "micah@wpscholar.com" + } + ], + "description": "A WordPress helper class for managing plugin options.", + "support": { + "issues": "https://github.com/wp-forge/wp-options/issues", + "source": "https://github.com/wp-forge/wp-options/tree/1.1" + }, + "time": "2022-03-04T16:23:42+00:00" + }, { "name": "wpscholar/url", "version": "1.2.2", @@ -319,7 +411,9 @@ "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "newfold-labs/wp-module-features": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": [], From a05c7e2a99f79c546b7867d287322fd5edbf66ca Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 7 May 2024 12:13:30 -0400 Subject: [PATCH 02/29] move module registration into PerformanceFeature class and remove bootstrap --- bootstrap.php | 78 --------------------------- composer.json | 3 +- includes/PerformanceFeature.php | 96 +++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 80 deletions(-) delete mode 100644 bootstrap.php create mode 100644 includes/PerformanceFeature.php diff --git a/bootstrap.php b/bootstrap.php deleted file mode 100644 index 733139b..0000000 --- a/bootstrap.php +++ /dev/null @@ -1,78 +0,0 @@ - 'performance', - 'label' => __( 'Performance', 'newfold' ), - 'callback' => function ( Container $container ) { - if ( 'atomic' === getContext( 'platform' ) ) { - return; - } - new Performance( $container ); - }, - 'isActive' => true, - 'isHidden' => true, - ] - ); - - } - ); - - add_action( - 'newfold_container_set', - function ( Container $container ) { - if ( 'atomic' === getContext( 'platform' ) ) { - return; - } - - register_activation_hook( - $container->plugin()->file, - function () use ( $container ) { - - Skip404::onActivation(); - File::onActivation(); - Browser::onActivation(); - - // Add headers to .htaccess - $responseHeaderManager = new ResponseHeaderManager(); - $responseHeaderManager->addHeader( 'X-Newfold-Cache-Level', absint( getCacheLevel() ) ); - - } - ); - - register_deactivation_hook( - $container->plugin()->file, - function () use ( $container ) { - - Skip404::onDeactivation(); - File::onDeactivation(); - Browser::onDeactivation(); - - // Remove all headers from .htaccess - $responseHeaderManager = new ResponseHeaderManager(); - $responseHeaderManager->removeAllHeaders(); - - } - ); - - } - ); - -} diff --git a/composer.json b/composer.json index 24d1be3..00ce49a 100644 --- a/composer.json +++ b/composer.json @@ -13,8 +13,7 @@ "NewfoldLabs\\WP\\Module\\Performance\\": "includes" }, "files": [ - "includes/functions.php", - "bootstrap.php" + "includes/functions.php" ] }, "repositories": [ diff --git a/includes/PerformanceFeature.php b/includes/PerformanceFeature.php new file mode 100644 index 0000000..b2256b6 --- /dev/null +++ b/includes/PerformanceFeature.php @@ -0,0 +1,96 @@ + 'performance', + 'label' => __( 'Performance', 'newfold' ), + 'callback' => function ( Container $container ) { + new Performance( $container ); + }, + 'isActive' => true, + 'isHidden' => true, + ] + ); + + } + ); + + // Container Hooks + add_action( + 'newfold_container_set', + function ( Container $container ) { + + register_activation_hook( + $container->plugin()->file, + function () use ( $container ) { + + Skip404::onActivation(); + File::onActivation(); + Browser::onActivation(); + + // Add headers to .htaccess + $responseHeaderManager = new ResponseHeaderManager(); + $responseHeaderManager->addHeader( 'X-Newfold-Cache-Level', absint( getCacheLevel() ) ); + + } + ); + + register_deactivation_hook( + $container->plugin()->file, + function () use ( $container ) { + + Skip404::onDeactivation(); + File::onDeactivation(); + Browser::onDeactivation(); + + // Remove all headers from .htaccess + $responseHeaderManager = new ResponseHeaderManager(); + $responseHeaderManager->removeAllHeaders(); + } + ); + } + ); + + } + } + +} \ No newline at end of file From 752b1eca87f28188a840659c559021ab574b9059 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 7 May 2024 12:20:10 -0400 Subject: [PATCH 03/29] update performance feature based on context in bootstrap --- bootstrap.php | 31 +++++++++++++++++++++++++++++++ composer.json | 3 ++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 bootstrap.php diff --git a/bootstrap.php b/bootstrap.php new file mode 100644 index 0000000..cdb5f0b --- /dev/null +++ b/bootstrap.php @@ -0,0 +1,31 @@ +disable(); + } + } + } + ); +} \ No newline at end of file diff --git a/composer.json b/composer.json index 00ce49a..24d1be3 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,8 @@ "NewfoldLabs\\WP\\Module\\Performance\\": "includes" }, "files": [ - "includes/functions.php" + "includes/functions.php", + "bootstrap.php" ] }, "repositories": [ From 971b27050a3e42655acecc6a41fd719f1f9fdd61 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 7 May 2024 13:11:22 -0400 Subject: [PATCH 04/29] remove module loader registration --- includes/PerformanceFeature.php | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/includes/PerformanceFeature.php b/includes/PerformanceFeature.php index b2256b6..5e19254 100644 --- a/includes/PerformanceFeature.php +++ b/includes/PerformanceFeature.php @@ -11,7 +11,7 @@ use NewfoldLabs\WP\Module\Performance\ResponseHeaderManager; use function NewfoldLabs\WP\Module\Performance\getCacheLevel; -use function NewfoldLabs\WP\ModuleLoader\register; +use function NewfoldLabs\WP\ModuleLoader\container as getContainer; /** * Child class for a feature @@ -39,18 +39,7 @@ public function initialize() { add_action( 'plugins_loaded', function () { - register( - [ - 'name' => 'performance', - 'label' => __( 'Performance', 'newfold' ), - 'callback' => function ( Container $container ) { - new Performance( $container ); - }, - 'isActive' => true, - 'isHidden' => true, - ] - ); - + new Performance( getContainer() ); } ); From ffc9ec0fe0e004aea0652c7e665768a76fae2c1e Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Fri, 10 May 2024 17:45:15 -0400 Subject: [PATCH 05/29] set up actions for contextual feature management --- bootstrap.php | 53 ++++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/bootstrap.php b/bootstrap.php index cdb5f0b..fa7b195 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -1,31 +1,36 @@ disable(); - } - } - } - ); + // Filter as needed based on context + add_filter( 'newfold/features/filter/isEnabled:performance', 'performanceFeatureFilter' ); + + // Force disable based on context + add_action( 'newfold/features/action/onEnable:performance', 'maybeDisable' ); + + // if atomic context, disable performance feature + add_action( 'after_setup_theme', 'maybeDisable' ); + +} + +// Maybe disable based on context +function maybeDisable() { + if ( shouldDisablePerformanceFeature() ) { + disableFeature('performance'); + } +} + +// Feature filter based on context +function performanceFeatureFilter( $value ) { + if ( shouldDisablePerformanceFeature() ) { + $value = false; + } + return $value; +} + +function shouldDisablePerformanceFeature() { + return 'atomic' === getContext( 'platform' ); } \ No newline at end of file From 8578eeaba31fe3eb548f6a2846774a43cdfb0629 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 13 May 2024 14:18:06 -0400 Subject: [PATCH 06/29] update to release version of features module --- composer.json | 2 +- composer.lock | 40 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/composer.json b/composer.json index 24d1be3..4bcd959 100644 --- a/composer.json +++ b/composer.json @@ -31,6 +31,6 @@ "wp-forge/collection": "^1.0", "wp-forge/wp-htaccess-manager": "^1.0", "wpscholar/url": "^1.2", - "newfold-labs/wp-module-features": "dev-main" + "newfold-labs/wp-module-features": "^1.1" } } diff --git a/composer.lock b/composer.lock index 6298427..08d9836 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cfbfc049f84baaa443c4613d62e54795", + "content-hash": "c2d789d3ceda80096175580d82f57ad4", "packages": [ { "name": "doctrine/inflector", @@ -158,30 +158,32 @@ }, { "name": "newfold-labs/wp-module-features", - "version": "dev-main", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-features.git", - "reference": "7ca3bd83d181c5e21440cd729a2b90576065f788" + "reference": "a6780ec96584aab97036468de5d42939978b39c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-features/zipball/7ca3bd83d181c5e21440cd729a2b90576065f788", - "reference": "7ca3bd83d181c5e21440cd729a2b90576065f788", + "url": "https://api.github.com/repos/newfold-labs/wp-module-features/zipball/a6780ec96584aab97036468de5d42939978b39c6", + "reference": "a6780ec96584aab97036468de5d42939978b39c6", "shasum": "" }, "require": { - "wp-forge/wp-options": "^1.1" + "wp-forge/wp-options": "^1.1.1" }, "require-dev": { - "newfold-labs/wp-php-standards": "^1.2" + "newfold-labs/wp-php-standards": "^1.2.3" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { "NewfoldLabs\\WP\\Module\\Features\\": "includes" - } + }, + "files": [ + "includes/functions.php" + ] }, "scripts": { "fix": [ @@ -206,10 +208,10 @@ ], "description": "A module for providing an interface for features.", "support": { - "source": "https://github.com/newfold-labs/wp-module-features/tree/main", + "source": "https://github.com/newfold-labs/wp-module-features/tree/1.1.0", "issues": "https://github.com/newfold-labs/wp-module-features/issues" }, - "time": "2024-05-03T15:58:51+00:00" + "time": "2024-05-13T17:34:22+00:00" }, { "name": "wp-forge/collection", @@ -334,16 +336,16 @@ }, { "name": "wp-forge/wp-options", - "version": "1.1", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/wp-forge/wp-options.git", - "reference": "df8899255dee19365599caa8801c75803e94e413" + "reference": "511b1c5e626582dd4c3c1b5602e7a20352dabc1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-forge/wp-options/zipball/df8899255dee19365599caa8801c75803e94e413", - "reference": "df8899255dee19365599caa8801c75803e94e413", + "url": "https://api.github.com/repos/wp-forge/wp-options/zipball/511b1c5e626582dd4c3c1b5602e7a20352dabc1b", + "reference": "511b1c5e626582dd4c3c1b5602e7a20352dabc1b", "shasum": "" }, "type": "library", @@ -365,9 +367,9 @@ "description": "A WordPress helper class for managing plugin options.", "support": { "issues": "https://github.com/wp-forge/wp-options/issues", - "source": "https://github.com/wp-forge/wp-options/tree/1.1" + "source": "https://github.com/wp-forge/wp-options/tree/1.1.1" }, - "time": "2022-03-04T16:23:42+00:00" + "time": "2024-05-10T14:57:37+00:00" }, { "name": "wpscholar/url", @@ -411,9 +413,7 @@ "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "newfold-labs/wp-module-features": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": [], From 61dafb73264aab5e07389aa4d091e27e0029caf7 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 13 May 2024 15:08:58 -0400 Subject: [PATCH 07/29] use feature hooks class for managing the hooks --- bootstrap.php | 35 ++----------------- includes/PerformanceFeatureHooks.php | 52 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 33 deletions(-) create mode 100644 includes/PerformanceFeatureHooks.php diff --git a/bootstrap.php b/bootstrap.php index fa7b195..937044a 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -1,36 +1,5 @@ hooks(); + } + + /** + * Add hooks. + */ + public function hooks() { + + // Filter vale based on context + add_filter( 'newfold/features/filter/isEnabled:performance', array( $this, 'filterValue' ) ); + + // Force disable based on context + add_action( 'newfold/features/action/onEnable:performance', array( $this, 'maybeDisable' ) ); + + // Check if should disable on setup + add_action( 'after_setup_theme', array( $this, 'maybeDisable' ) ); + + } + + // Feature filter based on context + function filterValue( $value ) { + if ( $this->shouldDisable() ) { + $value = false; + } + return $value; + } + + // Maybe disable + function maybeDisable() { + if ( $this->shouldDisable() ) { + disableFeature('performance'); + } + } + + // Context condition for disabling feature + function shouldDisable() { + // check for atomic context + return 'atomic' === getContext( 'platform' ); + } +} \ No newline at end of file From 06baa2884c1a7be960523e37897ab739a569bc81 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 13 May 2024 15:36:50 -0400 Subject: [PATCH 08/29] target plugin branch with features module for tests --- .github/workflows/brand-plugin-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/brand-plugin-test.yml b/.github/workflows/brand-plugin-test.yml index f31d801..1369202 100644 --- a/.github/workflows/brand-plugin-test.yml +++ b/.github/workflows/brand-plugin-test.yml @@ -31,6 +31,7 @@ jobs: module-repo: ${{ github.repository }} module-branch: ${{ needs.setup.outputs.branch }} plugin-repo: 'bluehost/bluehost-wordpress-plugin' + plugin-branch: 'add/features-module' secrets: inherit hostgator: From be22ad100ba4522293945f61ee5815a6ec4d40ad Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 13 May 2024 16:33:00 -0400 Subject: [PATCH 09/29] require the feature class --- bootstrap.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootstrap.php b/bootstrap.php index 937044a..e13031d 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -2,4 +2,6 @@ namespace NewfoldLabs\WP\Module\Performance; +require_once( __DIR__ . '/includes/PerformanceFeature.php' ); + new PerformanceFeatureHooks(); \ No newline at end of file From 8ad6dc84c8439d36396ec05feed9d371b1f6fc4b Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 13 May 2024 17:43:55 -0400 Subject: [PATCH 10/29] reference global wp hook methods --- includes/PerformanceFeatureHooks.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/PerformanceFeatureHooks.php b/includes/PerformanceFeatureHooks.php index b317666..97cf6b3 100644 --- a/includes/PerformanceFeatureHooks.php +++ b/includes/PerformanceFeatureHooks.php @@ -19,13 +19,13 @@ public function __construct() { public function hooks() { // Filter vale based on context - add_filter( 'newfold/features/filter/isEnabled:performance', array( $this, 'filterValue' ) ); + \add_filter( 'newfold/features/filter/isEnabled:performance', array( $this, 'filterValue' ) ); // Force disable based on context - add_action( 'newfold/features/action/onEnable:performance', array( $this, 'maybeDisable' ) ); + \add_action( 'newfold/features/action/onEnable:performance', array( $this, 'maybeDisable' ) ); // Check if should disable on setup - add_action( 'after_setup_theme', array( $this, 'maybeDisable' ) ); + \add_action( 'after_setup_theme', array( $this, 'maybeDisable' ) ); } From 6d8ee67e533be04d42a376506363694d5c816515 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 14 May 2024 10:40:21 -0400 Subject: [PATCH 11/29] add feature hooks after plugins_loaded --- includes/PerformanceFeatureHooks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/PerformanceFeatureHooks.php b/includes/PerformanceFeatureHooks.php index 97cf6b3..26efdef 100644 --- a/includes/PerformanceFeatureHooks.php +++ b/includes/PerformanceFeatureHooks.php @@ -10,7 +10,7 @@ class PerformanceFeatureHooks { * Constructor. */ public function __construct() { - $this->hooks(); + \add_action( 'plugins_loaded', array( $this, 'hooks' ) ); } /** From b24f55aac663f25e2ebadfe292d4245280f0b4a0 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 14 May 2024 10:52:20 -0400 Subject: [PATCH 12/29] defensive code cleanup --- includes/PerformanceFeatureHooks.php | 70 ++++++++++++++-------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/includes/PerformanceFeatureHooks.php b/includes/PerformanceFeatureHooks.php index 26efdef..7f5bc29 100644 --- a/includes/PerformanceFeatureHooks.php +++ b/includes/PerformanceFeatureHooks.php @@ -10,43 +10,45 @@ class PerformanceFeatureHooks { * Constructor. */ public function __construct() { - \add_action( 'plugins_loaded', array( $this, 'hooks' ) ); - } + if ( function_exists( 'add_action' ) ) { + add_action( 'plugins_loaded', array( $this, 'hooks' ) ); + } + } - /** + /** * Add hooks. */ public function hooks() { - // Filter vale based on context - \add_filter( 'newfold/features/filter/isEnabled:performance', array( $this, 'filterValue' ) ); - - // Force disable based on context - \add_action( 'newfold/features/action/onEnable:performance', array( $this, 'maybeDisable' ) ); - - // Check if should disable on setup - \add_action( 'after_setup_theme', array( $this, 'maybeDisable' ) ); - - } - - // Feature filter based on context - function filterValue( $value ) { - if ( $this->shouldDisable() ) { - $value = false; - } - return $value; - } - - // Maybe disable - function maybeDisable() { - if ( $this->shouldDisable() ) { - disableFeature('performance'); - } - } - - // Context condition for disabling feature - function shouldDisable() { - // check for atomic context - return 'atomic' === getContext( 'platform' ); - } + // Filter vale based on context + add_filter( 'newfold/features/filter/isEnabled:performance', array( $this, 'filterValue' ) ); + + // Force disable based on context + add_action( 'newfold/features/action/onEnable:performance', array( $this, 'maybeDisable' ) ); + + // Check if should disable on setup + add_action( 'after_setup_theme', array( $this, 'maybeDisable' ) ); + + } + + // Feature filter based on context + function filterValue( $value ) { + if ( $this->shouldDisable() ) { + $value = false; + } + return $value; + } + + // Maybe disable + function maybeDisable() { + if ( $this->shouldDisable() ) { + disableFeature('performance'); + } + } + + // Context condition for disabling feature + function shouldDisable() { + // check for atomic context + return 'atomic' === getContext( 'platform' ); + } } \ No newline at end of file From a8708446381dfecd43f988a7f96d83ba6dfed0c6 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 14 May 2024 11:13:32 -0400 Subject: [PATCH 13/29] add lint workflow --- .github/workflows/lint.yml | 63 ++++++++++++++++++++++++++++++++++++++ phpcs.xml | 12 ++++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/workflows/lint.yml create mode 100644 phpcs.xml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..697910d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,63 @@ +name: Lint +on: + push: + branches: + - '**' + paths: + - '**.php' + pull_request: + types: [opened, edited, reopened, ready_for_review] + paths: + - '**.php' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + +jobs: + phpcs: + name: Run PHP Code Sniffer + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v3 + + # User PHP 7.4 here for compatibility with the WordPress codesniffer rules. + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + tools: composer, cs2pr + + - uses: technote-space/get-diff-action@v6 + with: + SUFFIX_FILTER: .php + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + if: "!! env.GIT_DIFF" + + - name: Cache Composer vendor directory + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + if: "!! env.GIT_DIFF" + + - name: Validate composer.json and composer.lock + run: composer validate + if: "!! env.GIT_DIFF" + + - name: Install dependencies + run: composer install --no-progress --optimize-autoloader --prefer-dist + if: "!! env.GIT_DIFF" + + - name: Detecting PHP Code Standards Violations + run: vendor/bin/phpcs --standard=phpcs.xml -s ${{ env.GIT_DIFF }} + if: "!! env.GIT_DIFF" diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..3541898 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + From fcfdb56e5d16c6b62eb4002428233360d604c9bf Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 14 May 2024 11:17:57 -0400 Subject: [PATCH 14/29] add newfold php standards package --- composer.json | 8 + composer.lock | 636 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 642 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 4bcd959..29f0e61 100644 --- a/composer.json +++ b/composer.json @@ -32,5 +32,13 @@ "wp-forge/wp-htaccess-manager": "^1.0", "wpscholar/url": "^1.2", "newfold-labs/wp-module-features": "^1.1" + }, + "require-dev": { + "newfold-labs/wp-php-standards": "^1.2" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } } diff --git a/composer.lock b/composer.lock index 08d9836..bd908ab 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c2d789d3ceda80096175580d82f57ad4", + "content-hash": "72005544831b83a635ed20bfc3033b0f", "packages": [ { "name": "doctrine/inflector", @@ -410,7 +410,639 @@ "time": "2020-10-27T20:10:04+00:00" } ], - "packages-dev": [], + "packages-dev": [ + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "4be43904336affa5c2f70744a348312336afd0da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", + "reference": "4be43904336affa5c2f70744a348312336afd0da", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "*", + "ext-json": "*", + "ext-zip": "*", + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0", + "yoast/phpunit-polyfills": "^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcbf", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "source": "https://github.com/PHPCSStandards/composer-installer" + }, + "time": "2023-01-05T11:28:13+00:00" + }, + { + "name": "newfold-labs/wp-php-standards", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/newfold-labs/wp-php-standards.git", + "reference": "a486fb541e890ee87dc387eaea0644101e728464" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/newfold-labs/wp-php-standards/zipball/a486fb541e890ee87dc387eaea0644101e728464", + "reference": "a486fb541e890ee87dc387eaea0644101e728464", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "@stable", + "phpcompatibility/phpcompatibility-wp": "@stable", + "squizlabs/php_codesniffer": "@stable", + "wp-coding-standards/wpcs": "@stable" + }, + "type": "phpcodesniffer-standard", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Micah Wood", + "email": "micah@wpscholar.com" + } + ], + "description": "PHP Code Sniffer Standards for Newfold WordPress projects.", + "support": { + "source": "https://github.com/newfold-labs/wp-php-standards/tree/1.2.3", + "issues": "https://github.com/newfold-labs/wp-php-standards/issues" + }, + "time": "2024-04-22T20:09:45+00:00" + }, + { + "name": "phpcompatibility/php-compatibility", + "version": "9.3.5", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + }, + "conflict": { + "squizlabs/php_codesniffer": "2.6.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "homepage": "https://github.com/wimg", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" + } + ], + "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", + "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", + "keywords": [ + "compatibility", + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibility" + }, + "time": "2019-12-27T09:44:58+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-paragonie", + "version": "1.3.3", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/293975b465e0e709b571cbf0c957c6c0a7b9a2ac", + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "paragonie/random_compat": "dev-master", + "paragonie/sodium_compat": "dev-master" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "paragonie", + "phpcs", + "polyfill", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/security/policy", + "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" + }, + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T21:30:46+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-wp", + "version": "2.1.5", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/01c1ff2704a58e46f0cb1ca9d06aee07b3589082", + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0", + "phpcompatibility/phpcompatibility-paragonie": "^1.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "phpcs", + "standards", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityWP/security/policy", + "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" + }, + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T21:37:59+00:00" + }, + { + "name": "phpcsstandards/phpcsextra", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.0.9", + "squizlabs/php_codesniffer": "^3.8.0" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "phpcsstandards/phpcsdevtools": "^1.2.1", + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" + } + ], + "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSExtra" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2023-12-08T16:49:07+00:00" + }, + { + "name": "phpcsstandards/phpcsutils", + "version": "1.0.11", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", + "reference": "c457da9dabb60eb7106dd5e3c05132b1a6539c6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/c457da9dabb60eb7106dd5e3c05132b1a6539c6a", + "reference": "c457da9dabb60eb7106dd5e3c05132b1a6539c6a", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.9.0 || 4.0.x-dev@dev" + }, + "require-dev": { + "ext-filter": "*", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPCSUtils/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" + } + ], + "description": "A suite of utility functions for use with PHP_CodeSniffer", + "homepage": "https://phpcsutils.com/", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "phpcs3", + "standards", + "static analysis", + "tokens", + "utility" + ], + "support": { + "docs": "https://phpcsutils.com/", + "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", + "security": "https://github.com/PHPCSStandards/PHPCSUtils/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSUtils" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T11:47:18+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.9.2", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", + "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "bin": [ + "bin/phpcbf", + "bin/phpcs" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-23T20:25:34+00:00" + }, + { + "name": "wp-coding-standards/wpcs", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", + "reference": "9333efcbff231f10dfd9c56bb7b65818b4733ca7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/9333efcbff231f10dfd9c56bb7b65818b4733ca7", + "reference": "9333efcbff231f10dfd9c56bb7b65818b4733ca7", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-libxml": "*", + "ext-tokenizer": "*", + "ext-xmlreader": "*", + "php": ">=5.4", + "phpcsstandards/phpcsextra": "^1.2.1", + "phpcsstandards/phpcsutils": "^1.0.10", + "squizlabs/php_codesniffer": "^3.9.0" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcompatibility/php-compatibility": "^9.0", + "phpcsstandards/phpcsdevtools": "^1.2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "suggest": { + "ext-iconv": "For improved results", + "ext-mbstring": "For improved results" + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Contributors", + "homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions", + "keywords": [ + "phpcs", + "standards", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/WordPress/WordPress-Coding-Standards/issues", + "source": "https://github.com/WordPress/WordPress-Coding-Standards", + "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" + }, + "funding": [ + { + "url": "https://opencollective.com/php_codesniffer", + "type": "custom" + } + ], + "time": "2024-03-25T16:39:00+00:00" + } + ], "aliases": [], "minimum-stability": "stable", "stability-flags": [], From 9a37188701f2132b04b0f6b7cfc714f573115d59 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 14 May 2024 11:22:39 -0400 Subject: [PATCH 15/29] fix lint --- bootstrap.php | 4 ++-- includes/PerformanceFeature.php | 14 +++++++---- includes/PerformanceFeatureHooks.php | 36 ++++++++++++++++++---------- 3 files changed, 35 insertions(+), 19 deletions(-) diff --git a/bootstrap.php b/bootstrap.php index e13031d..cc5aaa9 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -2,6 +2,6 @@ namespace NewfoldLabs\WP\Module\Performance; -require_once( __DIR__ . '/includes/PerformanceFeature.php' ); +require_once __DIR__ . '/includes/PerformanceFeature.php'; -new PerformanceFeatureHooks(); \ No newline at end of file +new PerformanceFeatureHooks(); diff --git a/includes/PerformanceFeature.php b/includes/PerformanceFeature.php index 5e19254..d7ad3a5 100644 --- a/includes/PerformanceFeature.php +++ b/includes/PerformanceFeature.php @@ -20,17 +20,23 @@ * Child class naming convention is {FeatureName}Feature. */ class PerformanceFeature extends \NewfoldLabs\WP\Module\Features\Feature { + /** * The feature name. * * @var string */ protected $name = 'performance'; + + /** + * The feature value. Defaults to on. + * + * @var boolean + */ protected $value = true; // default to on /** - * Initialize performance feature - * + * Initialize performance feature. */ public function initialize() { if ( function_exists( 'add_action' ) ) { @@ -78,8 +84,6 @@ function () use ( $container ) { ); } ); - } } - -} \ No newline at end of file +} diff --git a/includes/PerformanceFeatureHooks.php b/includes/PerformanceFeatureHooks.php index 7f5bc29..6a49247 100644 --- a/includes/PerformanceFeatureHooks.php +++ b/includes/PerformanceFeatureHooks.php @@ -4,6 +4,9 @@ use function NewfoldLabs\WP\Context\getContext; use function NewfoldLabs\WP\Module\Features\disable as disableFeature; +/** + * This class adds performance feature hooks. + **/ class PerformanceFeatureHooks { /** @@ -19,36 +22,45 @@ public function __construct() { * Add hooks. */ public function hooks() { - // Filter vale based on context add_filter( 'newfold/features/filter/isEnabled:performance', array( $this, 'filterValue' ) ); - // Force disable based on context add_action( 'newfold/features/action/onEnable:performance', array( $this, 'maybeDisable' ) ); - // Check if should disable on setup add_action( 'after_setup_theme', array( $this, 'maybeDisable' ) ); - } - // Feature filter based on context - function filterValue( $value ) { + /** + * Feature filter based on context. + * + * @param boolean $value the value + * @return boolean the filtered value + */ + public function filterValue( $value ) { if ( $this->shouldDisable() ) { $value = false; } return $value; } - // Maybe disable - function maybeDisable() { + /** + * Maybe disable the feature. + * + * @return void + */ + public function maybeDisable() { if ( $this->shouldDisable() ) { - disableFeature('performance'); + disableFeature( 'performance' ); } } - // Context condition for disabling feature - function shouldDisable() { + /** + * Context condition for disabling feature. + * + * @return boolean whether the feature should be disabled + */ + public function shouldDisable() { // check for atomic context return 'atomic' === getContext( 'platform' ); } -} \ No newline at end of file +} From a85e586439937496a3ebb337863fe8620dad54b5 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 14 May 2024 11:24:13 -0400 Subject: [PATCH 16/29] tabs --- includes/PerformanceFeature.php | 108 +++++++++++++++----------------- 1 file changed, 51 insertions(+), 57 deletions(-) diff --git a/includes/PerformanceFeature.php b/includes/PerformanceFeature.php index d7ad3a5..8461198 100644 --- a/includes/PerformanceFeature.php +++ b/includes/PerformanceFeature.php @@ -15,75 +15,69 @@ /** * Child class for a feature - * + * * Child classes should define a name property as the feature name for all API calls. This name will be used in the registry. * Child class naming convention is {FeatureName}Feature. */ class PerformanceFeature extends \NewfoldLabs\WP\Module\Features\Feature { - /** - * The feature name. - * - * @var string - */ - protected $name = 'performance'; + /** + * The feature name. + * + * @var string + */ + protected $name = 'performance'; /** * The feature value. Defaults to on. * * @var boolean */ - protected $value = true; // default to on + protected $value = true; // default to on - /** - * Initialize performance feature. - */ - public function initialize() { - if ( function_exists( 'add_action' ) ) { - - // Register module - add_action( - 'plugins_loaded', - function () { - new Performance( getContainer() ); - } - ); + /** + * Initialize performance feature. + */ + public function initialize() { + if ( function_exists( 'add_action' ) ) { - // Container Hooks - add_action( - 'newfold_container_set', - function ( Container $container ) { + // Register module + add_action( + 'plugins_loaded', + function () { + new Performance( getContainer() ); + } + ); - register_activation_hook( - $container->plugin()->file, - function () use ( $container ) { - - Skip404::onActivation(); - File::onActivation(); - Browser::onActivation(); - - // Add headers to .htaccess - $responseHeaderManager = new ResponseHeaderManager(); - $responseHeaderManager->addHeader( 'X-Newfold-Cache-Level', absint( getCacheLevel() ) ); - - } - ); - - register_deactivation_hook( - $container->plugin()->file, - function () use ( $container ) { - - Skip404::onDeactivation(); - File::onDeactivation(); - Browser::onDeactivation(); - - // Remove all headers from .htaccess - $responseHeaderManager = new ResponseHeaderManager(); - $responseHeaderManager->removeAllHeaders(); - } - ); - } - ); - } - } + // Container Hooks + add_action( + 'newfold_container_set', + function ( Container $container ) { + register_activation_hook( + $container->plugin()->file, + function () use ( $container ) { + Skip404::onActivation(); + File::onActivation(); + Browser::onActivation(); + // Add headers to .htaccess + $responseHeaderManager = new ResponseHeaderManager(); + $responseHeaderManager->addHeader( 'X-Newfold-Cache-Level', absint( getCacheLevel() ) ); + + } + ); + register_deactivation_hook( + $container->plugin()->file, + function () use ( $container ) { + Skip404::onDeactivation(); + File::onDeactivation(); + Browser::onDeactivation(); + // Remove all headers from .htaccess + $responseHeaderManager = new ResponseHeaderManager(); + $responseHeaderManager->removeAllHeaders(); + } + ); + } + ); + } + } } From efe8f6ffab2524facc09814e86168608a3889ad1 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 14 May 2024 11:25:45 -0400 Subject: [PATCH 17/29] fix lint --- includes/PerformanceFeature.php | 1 - 1 file changed, 1 deletion(-) diff --git a/includes/PerformanceFeature.php b/includes/PerformanceFeature.php index 8461198..2d25fa3 100644 --- a/includes/PerformanceFeature.php +++ b/includes/PerformanceFeature.php @@ -62,7 +62,6 @@ function () use ( $container ) { // Add headers to .htaccess $responseHeaderManager = new ResponseHeaderManager(); $responseHeaderManager->addHeader( 'X-Newfold-Cache-Level', absint( getCacheLevel() ) ); - } ); register_deactivation_hook( From 371bc7c2ecbdff8c80c527a924c710ab9d56917b Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Wed, 15 May 2024 16:29:10 -0400 Subject: [PATCH 18/29] load file via composer rather than require_once --- bootstrap.php | 2 -- composer.json | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/bootstrap.php b/bootstrap.php index cc5aaa9..3ff7321 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -2,6 +2,4 @@ namespace NewfoldLabs\WP\Module\Performance; -require_once __DIR__ . '/includes/PerformanceFeature.php'; - new PerformanceFeatureHooks(); diff --git a/composer.json b/composer.json index 29f0e61..e1d65bb 100644 --- a/composer.json +++ b/composer.json @@ -13,6 +13,7 @@ "NewfoldLabs\\WP\\Module\\Performance\\": "includes" }, "files": [ + "includes/PerformanceFeature.php", "includes/functions.php", "bootstrap.php" ] From 220206732a5280138bf24d1eca30b666c0fbe653 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Wed, 15 May 2024 16:29:55 -0400 Subject: [PATCH 19/29] move container hooks into hooks class also incorporate them to feature enable and disable hooks --- includes/PerformanceFeature.php | 37 ------------------ includes/PerformanceFeatureHooks.php | 58 +++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 38 deletions(-) diff --git a/includes/PerformanceFeature.php b/includes/PerformanceFeature.php index 2d25fa3..624856d 100644 --- a/includes/PerformanceFeature.php +++ b/includes/PerformanceFeature.php @@ -2,15 +2,8 @@ namespace NewfoldLabs\WP\Module\Performance; -use NewfoldLabs\WP\ModuleLoader\Container; use NewfoldLabs\WP\Module\Performance\Performance; -use NewfoldLabs\WP\Module\Performance\CacheTypes\Browser; -use NewfoldLabs\WP\Module\Performance\CacheTypes\Cloudflare; -use NewfoldLabs\WP\Module\Performance\CacheTypes\File; -use NewfoldLabs\WP\Module\Performance\CacheTypes\Skip404; -use NewfoldLabs\WP\Module\Performance\ResponseHeaderManager; -use function NewfoldLabs\WP\Module\Performance\getCacheLevel; use function NewfoldLabs\WP\ModuleLoader\container as getContainer; /** @@ -40,7 +33,6 @@ class PerformanceFeature extends \NewfoldLabs\WP\Module\Features\Feature { */ public function initialize() { if ( function_exists( 'add_action' ) ) { - // Register module add_action( 'plugins_loaded', @@ -48,35 +40,6 @@ function () { new Performance( getContainer() ); } ); - - // Container Hooks - add_action( - 'newfold_container_set', - function ( Container $container ) { - register_activation_hook( - $container->plugin()->file, - function () use ( $container ) { - Skip404::onActivation(); - File::onActivation(); - Browser::onActivation(); - // Add headers to .htaccess - $responseHeaderManager = new ResponseHeaderManager(); - $responseHeaderManager->addHeader( 'X-Newfold-Cache-Level', absint( getCacheLevel() ) ); - } - ); - register_deactivation_hook( - $container->plugin()->file, - function () use ( $container ) { - Skip404::onDeactivation(); - File::onDeactivation(); - Browser::onDeactivation(); - // Remove all headers from .htaccess - $responseHeaderManager = new ResponseHeaderManager(); - $responseHeaderManager->removeAllHeaders(); - } - ); - } - ); } } } diff --git a/includes/PerformanceFeatureHooks.php b/includes/PerformanceFeatureHooks.php index 6a49247..8b838bb 100644 --- a/includes/PerformanceFeatureHooks.php +++ b/includes/PerformanceFeatureHooks.php @@ -1,8 +1,18 @@ shouldDisable() ) { disableFeature( 'performance' ); + $this->onDeactivation(); + } + } + + /** + * On enable callback. + * + * @return void + */ + public function onFeatureEnable() { + $this->maybeDisable(); + if ( isEnabled( 'performance' ) ) { + $this->onActivation(); } } @@ -63,4 +87,36 @@ public function shouldDisable() { // check for atomic context return 'atomic' === getContext( 'platform' ); } + + /** + * Hooks for plugin activation/deactivation + */ + public function pluginHooks( Container $container ) { + register_activation_hook( $container->plugin()->file, array( $this, 'onActivation' ) ); + register_deactivation_hook( $container->plugin()->file, array( $this, 'onDeactivation' ) ); + } + + /** + * Activation hook to perform when plugin is activated or feature is enabled + */ + public function onActivation() { + Skip404::onActivation(); + File::onActivation(); + Browser::onActivation(); + // Add headers to .htaccess + $responseHeaderManager = new ResponseHeaderManager(); + $responseHeaderManager->addHeader( 'X-Newfold-Cache-Level', absint( getCacheLevel() ) ); + } + + /** + * Deactivation hook to perform when plugin is deactivated or feature is disabled + */ + public function onDeactivation() { + Skip404::onDeactivation(); + File::onDeactivation(); + Browser::onDeactivation(); + // Remove all headers from .htaccess + $responseHeaderManager = new ResponseHeaderManager(); + $responseHeaderManager->removeAllHeaders(); + } } From eefe02f2b2415badcb3f422f711e7f779de648fe Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 20 May 2024 15:09:29 -0400 Subject: [PATCH 20/29] remove atomic detection hooks it has been moved to a standalone module --- includes/PerformanceFeatureHooks.php | 60 ---------------------------- 1 file changed, 60 deletions(-) diff --git a/includes/PerformanceFeatureHooks.php b/includes/PerformanceFeatureHooks.php index 8b838bb..ce7a445 100644 --- a/includes/PerformanceFeatureHooks.php +++ b/includes/PerformanceFeatureHooks.php @@ -24,70 +24,10 @@ class PerformanceFeatureHooks { */ public function __construct() { if ( function_exists( 'add_action' ) ) { - add_action( 'plugins_loaded', array( $this, 'hooks' ) ); add_action( 'newfold_container_set', array( $this, 'pluginHooks') ); } } - /** - * Add hooks. - */ - public function hooks() { - // Filter vale based on context - add_filter( 'newfold/features/filter/isEnabled:performance', array( $this, 'filterValue' ) ); - // Force disable based on context - add_action( 'newfold/features/action/onEnable:performance', array( $this, 'onFeatureEnable' ) ); - // Check if should disable on setup - add_action( 'after_setup_theme', array( $this, 'maybeDisable' ) ); - } - - /** - * Feature filter based on context. - * - * @param boolean $value the value - * @return boolean the filtered value - */ - public function filterValue( $value ) { - if ( $this->shouldDisable() ) { - $value = false; - } - return $value; - } - - /** - * Maybe disable the feature. - * - * @return void - */ - public function maybeDisable() { - if ( $this->shouldDisable() ) { - disableFeature( 'performance' ); - $this->onDeactivation(); - } - } - - /** - * On enable callback. - * - * @return void - */ - public function onFeatureEnable() { - $this->maybeDisable(); - if ( isEnabled( 'performance' ) ) { - $this->onActivation(); - } - } - - /** - * Context condition for disabling feature. - * - * @return boolean whether the feature should be disabled - */ - public function shouldDisable() { - // check for atomic context - return 'atomic' === getContext( 'platform' ); - } - /** * Hooks for plugin activation/deactivation */ From cf5ffd4abfe4bc75dd9e182cc8b928614cff8103 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 20 May 2024 16:02:21 -0400 Subject: [PATCH 21/29] update to latest features module --- composer.json | 8 ++++---- composer.lock | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index e1d65bb..6222222 100644 --- a/composer.json +++ b/composer.json @@ -29,13 +29,13 @@ ], "require": { "newfold-labs/wp-module-context": "^1.0", - "wp-forge/collection": "^1.0", + "wp-forge/collection": "^1.0.2", "wp-forge/wp-htaccess-manager": "^1.0", - "wpscholar/url": "^1.2", - "newfold-labs/wp-module-features": "^1.1" + "wpscholar/url": "^1.2.2", + "newfold-labs/wp-module-features": "^1.2" }, "require-dev": { - "newfold-labs/wp-php-standards": "^1.2" + "newfold-labs/wp-php-standards": "^1.2.3" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index bd908ab..95e68d8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "72005544831b83a635ed20bfc3033b0f", + "content-hash": "ffcfc5b4c6a227c1e28fc7c3e4515b41", "packages": [ { "name": "doctrine/inflector", @@ -158,16 +158,16 @@ }, { "name": "newfold-labs/wp-module-features", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-features.git", - "reference": "a6780ec96584aab97036468de5d42939978b39c6" + "reference": "e46032e09a14ab76e28ca20c276a76fa0c6a9023" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-features/zipball/a6780ec96584aab97036468de5d42939978b39c6", - "reference": "a6780ec96584aab97036468de5d42939978b39c6", + "url": "https://api.github.com/repos/newfold-labs/wp-module-features/zipball/e46032e09a14ab76e28ca20c276a76fa0c6a9023", + "reference": "e46032e09a14ab76e28ca20c276a76fa0c6a9023", "shasum": "" }, "require": { @@ -208,10 +208,10 @@ ], "description": "A module for providing an interface for features.", "support": { - "source": "https://github.com/newfold-labs/wp-module-features/tree/1.1.0", + "source": "https://github.com/newfold-labs/wp-module-features/tree/1.2.0", "issues": "https://github.com/newfold-labs/wp-module-features/issues" }, - "time": "2024-05-13T17:34:22+00:00" + "time": "2024-05-20T16:52:34+00:00" }, { "name": "wp-forge/collection", From 1afaf029bb88f17aa72d9fb44e6df4ba1534dedc Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 21 May 2024 12:53:26 -0400 Subject: [PATCH 22/29] add hooks to run act/deactivation steps when feature is en/disabled --- includes/PerformanceFeatureHooks.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/includes/PerformanceFeatureHooks.php b/includes/PerformanceFeatureHooks.php index ce7a445..a660ccc 100644 --- a/includes/PerformanceFeatureHooks.php +++ b/includes/PerformanceFeatureHooks.php @@ -1,7 +1,6 @@ plugin()->file, array( $this, 'onActivation' ) ); register_deactivation_hook( $container->plugin()->file, array( $this, 'onDeactivation' ) ); + + } + + /** + * Add hooks. + */ + public function hooks() { + add_action( 'newfold/features/action/onEnable:performance', array( $this, 'onActivation' ) ); + add_action( 'newfold/features/action/onDisable:performance', array( $this, 'onDeactivation' ) ); } /** From 727f5bf08feaf456c92ccd4d4e6deaa06ec6d5bd Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 21 May 2024 13:48:02 -0400 Subject: [PATCH 23/29] lint fixes --- includes/PerformanceFeatureHooks.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/PerformanceFeatureHooks.php b/includes/PerformanceFeatureHooks.php index a660ccc..f6dbfbc 100644 --- a/includes/PerformanceFeatureHooks.php +++ b/includes/PerformanceFeatureHooks.php @@ -19,18 +19,19 @@ class PerformanceFeatureHooks { */ public function __construct() { if ( function_exists( 'add_action' ) ) { - add_action( 'newfold_container_set', array( $this, 'pluginHooks') ); + add_action( 'newfold_container_set', array( $this, 'pluginHooks' ) ); add_action( 'plugins_loaded', array( $this, 'hooks' ) ); } } /** * Hooks for plugin activation/deactivation + * + * @param Container $container from the plugin */ public function pluginHooks( Container $container ) { register_activation_hook( $container->plugin()->file, array( $this, 'onActivation' ) ); register_deactivation_hook( $container->plugin()->file, array( $this, 'onDeactivation' ) ); - } /** From 0c28f91bc5dbf0205f0682e9eda12685ca4a3966 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 21 May 2024 14:13:40 -0400 Subject: [PATCH 24/29] remove whitespace --- includes/PerformanceFeatureHooks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/PerformanceFeatureHooks.php b/includes/PerformanceFeatureHooks.php index f6dbfbc..6372a73 100644 --- a/includes/PerformanceFeatureHooks.php +++ b/includes/PerformanceFeatureHooks.php @@ -26,7 +26,7 @@ public function __construct() { /** * Hooks for plugin activation/deactivation - * + * * @param Container $container from the plugin */ public function pluginHooks( Container $container ) { From 2e3710f65aa26b4d2b511fbae4dad1ee1ea04c16 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 21 May 2024 14:49:00 -0400 Subject: [PATCH 25/29] require PerformanceFeature file --- bootstrap.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootstrap.php b/bootstrap.php index 3ff7321..cc5aaa9 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -2,4 +2,6 @@ namespace NewfoldLabs\WP\Module\Performance; +require_once __DIR__ . '/includes/PerformanceFeature.php'; + new PerformanceFeatureHooks(); From 00058b5281a0686e40b760e7f3135b2142bc1d8b Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 21 May 2024 16:25:01 -0400 Subject: [PATCH 26/29] register feature with new filter --- bootstrap.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bootstrap.php b/bootstrap.php index cc5aaa9..ba34214 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -2,6 +2,11 @@ namespace NewfoldLabs\WP\Module\Performance; -require_once __DIR__ . '/includes/PerformanceFeature.php'; +add_filter( + 'newfold/features/filter/register', + function( $features ) { + return array_merge( $features, array( PerformanceFeature::class ) ); + } +); new PerformanceFeatureHooks(); From 08f3180cb55834a461883fc9f5b795d67766f714 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 21 May 2024 16:45:59 -0400 Subject: [PATCH 27/29] check function_exists first --- bootstrap.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bootstrap.php b/bootstrap.php index ba34214..3ac636b 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -2,11 +2,13 @@ namespace NewfoldLabs\WP\Module\Performance; -add_filter( - 'newfold/features/filter/register', - function( $features ) { - return array_merge( $features, array( PerformanceFeature::class ) ); - } -); +if ( function_exists( 'add_filter' ) ) { + add_filter( + 'newfold/features/filter/register', + function( $features ) { + return array_merge( $features, array( PerformanceFeature::class ) ); + } + ); +} new PerformanceFeatureHooks(); From 329a2fd27b2e87ccf79ff5d9ea4586a82806849f Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 21 May 2024 17:16:19 -0400 Subject: [PATCH 28/29] update feature module --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 6222222..5a7b690 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "wp-forge/collection": "^1.0.2", "wp-forge/wp-htaccess-manager": "^1.0", "wpscholar/url": "^1.2.2", - "newfold-labs/wp-module-features": "^1.2" + "newfold-labs/wp-module-features": "^1.3" }, "require-dev": { "newfold-labs/wp-php-standards": "^1.2.3" diff --git a/composer.lock b/composer.lock index 95e68d8..68bed83 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ffcfc5b4c6a227c1e28fc7c3e4515b41", + "content-hash": "3d72cd5876c8282d83e38fcae7d952cf", "packages": [ { "name": "doctrine/inflector", @@ -158,16 +158,16 @@ }, { "name": "newfold-labs/wp-module-features", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-features.git", - "reference": "e46032e09a14ab76e28ca20c276a76fa0c6a9023" + "reference": "e2eb88461048a77a8df59c381bd6fe36af9277f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-features/zipball/e46032e09a14ab76e28ca20c276a76fa0c6a9023", - "reference": "e46032e09a14ab76e28ca20c276a76fa0c6a9023", + "url": "https://api.github.com/repos/newfold-labs/wp-module-features/zipball/e2eb88461048a77a8df59c381bd6fe36af9277f3", + "reference": "e2eb88461048a77a8df59c381bd6fe36af9277f3", "shasum": "" }, "require": { @@ -208,10 +208,10 @@ ], "description": "A module for providing an interface for features.", "support": { - "source": "https://github.com/newfold-labs/wp-module-features/tree/1.2.0", + "source": "https://github.com/newfold-labs/wp-module-features/tree/1.3.0", "issues": "https://github.com/newfold-labs/wp-module-features/issues" }, - "time": "2024-05-20T16:52:34+00:00" + "time": "2024-05-21T21:05:48+00:00" }, { "name": "wp-forge/collection", From 6eeca8c6f52a09b8e384b7b62c72121c77d72c52 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 21 May 2024 17:20:02 -0400 Subject: [PATCH 29/29] lint --- bootstrap.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bootstrap.php b/bootstrap.php index 3ac636b..c4d16d8 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -3,12 +3,12 @@ namespace NewfoldLabs\WP\Module\Performance; if ( function_exists( 'add_filter' ) ) { - add_filter( - 'newfold/features/filter/register', - function( $features ) { - return array_merge( $features, array( PerformanceFeature::class ) ); - } - ); + add_filter( + 'newfold/features/filter/register', + function ( $features ) { + return array_merge( $features, array( PerformanceFeature::class ) ); + } + ); } new PerformanceFeatureHooks();