From 240261e50611106e94190a7f6152304b9526d46f Mon Sep 17 00:00:00 2001 From: Theo <328805+theodesp@users.noreply.github.com> Date: Thu, 23 Jan 2025 10:24:13 +0000 Subject: [PATCH 1/4] chore: update plugin php min version to 7.4 --- plugins/faustwp/.phpcs.xml.dist | 2 +- plugins/faustwp/composer.json | 3 ++- plugins/faustwp/faustwp.php | 2 +- plugins/faustwp/readme.txt | 42 ++++++++++++++++----------------- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/plugins/faustwp/.phpcs.xml.dist b/plugins/faustwp/.phpcs.xml.dist index d95fd23d7..fa349cb38 100644 --- a/plugins/faustwp/.phpcs.xml.dist +++ b/plugins/faustwp/.phpcs.xml.dist @@ -24,7 +24,7 @@ - + diff --git a/plugins/faustwp/composer.json b/plugins/faustwp/composer.json index c37a7dc20..ace8b773b 100644 --- a/plugins/faustwp/composer.json +++ b/plugins/faustwp/composer.json @@ -58,6 +58,7 @@ } }, "require": { - "symfony/process": "^6.4.14" + "symfony/process": "^6.4.14", + "php": "^7.4 || ^8.0" } } diff --git a/plugins/faustwp/faustwp.php b/plugins/faustwp/faustwp.php index 1cc18804f..df55e1099 100644 --- a/plugins/faustwp/faustwp.php +++ b/plugins/faustwp/faustwp.php @@ -10,7 +10,7 @@ * Text Domain: faustwp * Domain Path: /languages * Version: 1.6.0 - * Requires PHP: 7.2 + * Requires PHP: 7.4 * Requires at least: 5.7 * Update URI: false * diff --git a/plugins/faustwp/readme.txt b/plugins/faustwp/readme.txt index 4c4bd20fd..e55575f2a 100644 --- a/plugins/faustwp/readme.txt +++ b/plugins/faustwp/readme.txt @@ -4,7 +4,7 @@ Tags: faustjs, faust, headless, decoupled, composable-architecture Requires at least: 5.7 Tested up to: 6.6.1 Stable tag: 1.6.0 -Requires PHP: 7.2 +Requires PHP: 7.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -52,24 +52,24 @@ plugins/faustwp/.wordpress-org/screenshot-1.png plugins/faustwp/.wordpress-org/screenshot-2.png plugins/faustwp/.wordpress-org/screenshot-3.png -== Changelog == - -= 1.6.0 = - -### Minor Changes - -- 28f1f83: Added new filter `faustwp_public_redirect_status_code`, allowing WordPress plugins and themes to choose the [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) to use when generating redirects when the [enable public route redirects](https://faustjs.org/docs/faustwp/settings#enabling-public-route-redirects) setting is active. - -= 1.5.0 = - -### Minor Changes - -- 011cd931: - Added a custom PluginUpdater class to enable FaustWP plugin updates from an external API endpoint. - -= 1.4.1 = - -### Patch Changes - -- e80d80af: Tested up to WordPress v6.6.1 - +== Changelog == + += 1.6.0 = + +### Minor Changes + +- 28f1f83: Added new filter `faustwp_public_redirect_status_code`, allowing WordPress plugins and themes to choose the [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) to use when generating redirects when the [enable public route redirects](https://faustjs.org/docs/faustwp/settings#enabling-public-route-redirects) setting is active. + += 1.5.0 = + +### Minor Changes + +- 011cd931: - Added a custom PluginUpdater class to enable FaustWP plugin updates from an external API endpoint. + += 1.4.1 = + +### Patch Changes + +- e80d80af: Tested up to WordPress v6.6.1 + [View the full changelog](https://github.com/wpengine/faustjs/blob/canary/plugins/faustwp/CHANGELOG.md) \ No newline at end of file From 9e7d69a01b615a39e51cb9b90753654b130c5d36 Mon Sep 17 00:00:00 2001 From: Theo <328805+theodesp@users.noreply.github.com> Date: Thu, 23 Jan 2025 10:39:37 +0000 Subject: [PATCH 2/4] feat: add admin notices for min php version --- plugins/faustwp/faustwp.php | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/plugins/faustwp/faustwp.php b/plugins/faustwp/faustwp.php index df55e1099..e5479d8ef 100644 --- a/plugins/faustwp/faustwp.php +++ b/plugins/faustwp/faustwp.php @@ -29,6 +29,47 @@ define( 'FAUSTWP_PATH', plugin_basename( FAUSTWP_FILE ) ); define( 'FAUSTWP_SLUG', dirname( plugin_basename( FAUSTWP_FILE ) ) ); + +/** + * Get the minimum version of PHP required for this plugin. + * + * @return string Minimum version required. + */ +function faustwp_minimum_php_requirement() { + return '7.4'; +} + +/** + * Whether PHP installation meets the minimum requirements + * + * @return bool True if meets minimum requirements, false otherwise. + */ +function faustwp_meets_php_requirements() { + return version_compare( phpversion(), faustwp_minimum_php_requirement(), '>=' ); +} + +if ( ! faustwp_meets_php_requirements() ) { + add_action( + 'admin_notices', + function () { + ?> +
+

+ +

+
+ Date: Thu, 23 Jan 2025 14:48:37 +0000 Subject: [PATCH 3/4] refactor: code review update --- plugins/faustwp/faustwp.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/faustwp/faustwp.php b/plugins/faustwp/faustwp.php index e5479d8ef..578bad83b 100644 --- a/plugins/faustwp/faustwp.php +++ b/plugins/faustwp/faustwp.php @@ -44,11 +44,11 @@ function faustwp_minimum_php_requirement() { * * @return bool True if meets minimum requirements, false otherwise. */ -function faustwp_meets_php_requirements() { +function is_php_version_compatible() { return version_compare( phpversion(), faustwp_minimum_php_requirement(), '>=' ); } -if ( ! faustwp_meets_php_requirements() ) { +if ( ! is_php_version_compatible() ) { add_action( 'admin_notices', function () { @@ -59,7 +59,7 @@ function () { printf( /* translators: %s: Minimum required PHP version */ esc_html__( 'FaustWP requires PHP version %s or later. Please upgrade PHP or disable the plugin.', 'faustwp' ), - esc_html( faustwp_meets_php_requirements() ) + esc_html( is_php_version_compatible() ) ); ?>

From 639acb6c60091bc9a1276c7e4237fa97f3b7b77b Mon Sep 17 00:00:00 2001 From: Theo <328805+theodesp@users.noreply.github.com> Date: Mon, 27 Jan 2025 12:44:24 +0000 Subject: [PATCH 4/4] refactor: use build-in is_php_version_compatible --- plugins/faustwp/faustwp.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/plugins/faustwp/faustwp.php b/plugins/faustwp/faustwp.php index 578bad83b..84bc51f26 100644 --- a/plugins/faustwp/faustwp.php +++ b/plugins/faustwp/faustwp.php @@ -39,16 +39,7 @@ function faustwp_minimum_php_requirement() { return '7.4'; } -/** - * Whether PHP installation meets the minimum requirements - * - * @return bool True if meets minimum requirements, false otherwise. - */ -function is_php_version_compatible() { - return version_compare( phpversion(), faustwp_minimum_php_requirement(), '>=' ); -} - -if ( ! is_php_version_compatible() ) { +if ( ! is_php_version_compatible( faustwp_minimum_php_requirement() ) ) { add_action( 'admin_notices', function () { @@ -59,7 +50,7 @@ function () { printf( /* translators: %s: Minimum required PHP version */ esc_html__( 'FaustWP requires PHP version %s or later. Please upgrade PHP or disable the plugin.', 'faustwp' ), - esc_html( is_php_version_compatible() ) + esc_html( faustwp_minimum_php_requirement() ) ); ?>