From 4043399842fb7766d4fc725dffafe429a86d0399 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Wed, 27 Nov 2024 12:24:14 +0545 Subject: [PATCH 1/3] Improve message for plugin_header_invalid_plugin_uri_domain check --- .../Checks/Plugin_Repo/Plugin_Header_Fields_Check.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php index 2471b8c60..31a73334f 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php @@ -114,19 +114,20 @@ public function run( Check_Result $result ) { '', 6 ); - } elseif ( str_contains( $plugin_header['PluginURI'], '//wordpress.org/' ) || str_contains( $plugin_header['PluginURI'], '//example.com/' ) ) { + } elseif ( preg_match( '/\/\/(WordPress\.org|example\.com)\//', $plugin_header['PluginURI'], $matches ) ) { $this->add_result_warning_for_file( $result, sprintf( - /* translators: %s: plugin header field */ - __( 'The "%s" header in the plugin file is not valid.', 'plugin-check' ), - esc_html( $labels['PluginURI'] ) + /* translators: 1: plugin header field, 2: domain */ + __( 'The "%1$s" header in the plugin file is not valid. Discouraged domain "%2$s" found. This is the home page of the plugin, which should be a unique URL, preferably on your own website. ', 'plugin-check' ), + esc_html( $labels['PluginURI'] ), + esc_html( $matches[1] ), ), 'plugin_header_invalid_plugin_uri_domain', $plugin_main_file, 0, 0, - '', + 'https://developer.wordpress.org/plugins/plugin-basics/header-requirements/#header-fields', 6 ); } From 4a8ac7e6856c61fa498161c69306c7487ca0175e Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Thu, 28 Nov 2024 10:54:10 +0545 Subject: [PATCH 2/3] Correct gramatical issue --- .../Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php index 31a73334f..0be641233 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php @@ -119,7 +119,7 @@ public function run( Check_Result $result ) { $result, sprintf( /* translators: 1: plugin header field, 2: domain */ - __( 'The "%1$s" header in the plugin file is not valid. Discouraged domain "%2$s" found. This is the home page of the plugin, which should be a unique URL, preferably on your own website. ', 'plugin-check' ), + __( 'The "%1$s" header in the plugin file is not valid. Discouraged domain "%2$s" found. This is the homepage of the plugin, which should be a unique URL, preferably on your own website. ', 'plugin-check' ), esc_html( $labels['PluginURI'] ), esc_html( $matches[1] ), ), From 2b0b423c4d09f600dad4e763cc7f9df2bad6bcab Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Fri, 29 Nov 2024 15:53:38 +0545 Subject: [PATCH 3/3] Update disallowed domains --- .../Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php index 0be641233..963ae91a1 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php @@ -114,7 +114,7 @@ public function run( Check_Result $result ) { '', 6 ); - } elseif ( preg_match( '/\/\/(WordPress\.org|example\.com)\//', $plugin_header['PluginURI'], $matches ) ) { + } elseif ( preg_match( '/\/\/(example\.com|example\.net|example\.org)\//', $plugin_header['PluginURI'], $matches ) ) { $this->add_result_warning_for_file( $result, sprintf(