From c541eaf2b4e7ad26b1bb87fb76f7099b39292339 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Sun, 4 Aug 2024 11:43:31 +0200 Subject: [PATCH 1/9] updated documentation for readme --- .../Plugin_Repo/Plugin_Readme_Check.php | 74 +++++++++++++------ 1 file changed, 50 insertions(+), 24 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php index f759b1a68..50c88d93e 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php @@ -181,11 +181,14 @@ private function check_headers( Check_Result $result, string $readme_file, Parse $result, sprintf( /* translators: %s: plugin header tag */ - __( 'The "%s" field is missing.', 'plugin-check' ), + __( 'Your readme is either missing or incomplete.The "%s" field is missing. Your readme has to have headers as well as a proper description and documentation as to how it works and how one can use it.', 'plugin-check' ), $field['label'] ), 'missing_readme_header', - $readme_file + $readme_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#incomplete-readme' ); } } @@ -214,9 +217,12 @@ private function check_default_text( Check_Result $result, string $readme_file, ) { $this->add_result_warning_for_file( $result, - __( 'The readme appears to contain default text.', 'plugin-check' ), + __( 'The readme appears to contain default text. This means your readme has to have headers as well as a proper description and documentation as to how it works and how one can use it.', 'plugin-check' ), 'default_readme_text', - $readme_file + $readme_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#incomplete-readme' ); } } @@ -239,9 +245,12 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( empty( $license ) ) { $this->add_result_error_for_file( $result, - __( 'Your plugin has no license declared. Please update your readme with a GPLv2 (or later) compatible license.', 'plugin-check' ), + __( 'Your plugin has no license declared. Please update your readme with a GPLv2 (or later) compatible license. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), 'no_license', - $readme_file + $readme_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#no-gpl-compatible-license-declared' ); return; @@ -253,9 +262,12 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( ! preg_match( '/^([a-z0-9\-\+\.]+)(\sor\s([a-z0-9\-\+\.]+))*$/i', $license ) ) { $this->add_result_warning_for_file( $result, - __( 'Your plugin has an invalid license declared. Please update your readme with a valid SPDX license identifier.', 'plugin-check' ), + __( 'Your plugin has an invalid license declared. Please update your readme with a valid SPDX license identifier.', 'plugin-check' ), 'invalid_license', - $readme_file + $readme_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#no-gpl-compatible-license-declared' ); } @@ -264,9 +276,12 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( ! $has_license ) { $this->add_result_error_for_file( $result, - __( 'Your plugin has no license declared in Plugin Header. Please update your plugin header with a GPLv2 (or later) compatible license.', 'plugin-check' ), + __( 'Your plugin has no license declared in Plugin Header. Please update your plugin header with a GPLv2 (or later) compatible license. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), 'no_license', - $plugin_main_file + $plugin_main_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#no-gpl-compatible-license-declared' ); } else { $plugin_license = $this->normalize_licenses( $matches_license[1] ); @@ -276,9 +291,12 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( ! empty( $plugin_license ) && ! preg_match( '/GPL|GNU|MIT|FreeBSD|New BSD|BSD-3-Clause|BSD 3 Clause|OpenLDAP|Expat/im', $plugin_license ) ) { $this->add_result_error_for_file( $result, - __( 'Your plugin has an invalid license declared in Plugin Header. Please update your readme with a valid GPL license identifier.', 'plugin-check' ), + __( 'Your plugin has an invalid license declared in Plugin Header. Please update your readme with a valid GPL license identifier. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), 'invalid_license', - $plugin_main_file + $plugin_main_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#no-gpl-compatible-license-declared' ); } @@ -286,9 +304,12 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( ! empty( $plugin_license ) && ! empty( $license ) && $license !== $plugin_license ) { $this->add_result_warning_for_file( $result, - __( 'Your plugin has a different license declared in the readme file and plugin header. Please update your readme with a valid GPL license identifier.', 'plugin-check' ), + __( 'Your plugin has a different license declared in the readme file and plugin header. Please update your readme with a valid GPL license identifier.', 'plugin-check' ), 'license_mismatch', - $readme_file + $readme_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#declared-license-mismatched' ); } } @@ -351,13 +372,12 @@ private function check_stable_tag( Check_Result $result, string $readme_file, Pa if ( empty( $stable_tag ) ) { $this->add_result_error_for_file( $result, - sprintf( - /* translators: %s: plugin header tag */ - __( 'The "%s" field is missing.', 'plugin-check' ), - 'Stable Tag' - ), + __( 'Incorrect Stable TagYour Stable Tag is meant to be the stable version of your plugin, not of WordPress. For your plugin to be properly downloaded from WordPress.org, those values need to be the same. If they’re out of sync, your users won’t get the right version of your code.', 'plugin-check' ), 'no_stable_tag', - $readme_file + $readme_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#incorrect-stable-tag' ); return; @@ -366,9 +386,12 @@ private function check_stable_tag( Check_Result $result, string $readme_file, Pa if ( 'trunk' === $stable_tag ) { $this->add_result_error_for_file( $result, - __( "It's recommended not to use 'Stable Tag: trunk'.", 'plugin-check' ), + __( "Incorrect Stable TagIt's recommended not to use 'Stable Tag: trunk'. Your Stable Tag is meant to be the stable version of your plugin, not of WordPress. For your plugin to be properly downloaded from WordPress.org, those values need to be the same. If they’re out of sync, your users won’t get the right version of your code.", 'plugin-check' ), 'trunk_stable_tag', - $readme_file + $readme_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#incorrect-stable-tag' ); } @@ -381,9 +404,12 @@ private function check_stable_tag( Check_Result $result, string $readme_file, Pa ) { $this->add_result_error_for_file( $result, - __( 'The Stable Tag in your readme file does not match the version in your main plugin file.', 'plugin-check' ), + __( 'The Stable Tag in your readme file does not match the version in your main plugin file.Your Stable Tag is meant to be the stable version of your plugin, not of WordPress. For your plugin to be properly downloaded from WordPress.org, those values need to be the same. If they’re out of sync, your users won’t get the right version of your code.', 'plugin-check' ), 'stable_tag_mismatch', - $readme_file + $readme_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#incorrect-stable-tag' ); } } From cd2a6438dde18e1edf4f3671b997b3e2c111d9ec Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Sun, 4 Aug 2024 16:32:59 +0200 Subject: [PATCH 2/9] description --- .../Plugin_Repo/Plugin_Updater_Check.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Updater_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Updater_Check.php index 37ee50ca5..18c443bde 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Updater_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Updater_Check.php @@ -114,9 +114,12 @@ protected function look_for_update_uri_header( Check_Result $result ) { if ( ! empty( $plugin_header['UpdateURI'] ) ) { $this->add_result_error_for_file( $result, - __( 'Plugin Updater detected. Use of the Update URI header is not helpful in plugins hosted on WordPress.org.', 'plugin-check' ), + __( 'Including An Update Checker / Changing Updates functionalityPlugin Updater detected. Use of the Update URI header is not allowed in plugins hosted on WordPress.org.', 'plugin-check' ), 'plugin_updater_detected', - $plugin_main_file + $plugin_main_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#update-checker' ); } } @@ -139,11 +142,14 @@ protected function look_for_updater_file( Check_Result $result, array $php_files $result, sprintf( /* translators: %s: The match updater file name. */ - __( 'Plugin Updater detected. These are not permitted in WordPress.org hosted plugins. Detected: %s', 'plugin-check' ), + __( 'Plugin Updater detected. These are not permitted in WordPress.org hosted plugins. Detected: %s', 'plugin-check' ), basename( $file ) ), 'plugin_updater_detected', - $file + $file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#update-checker' ); } } @@ -175,8 +181,8 @@ protected function look_for_plugin_updaters( Check_Result $result, array $php_fi $this->add_result_error_for_file( $result, sprintf( - /* translators: %s: The match updater string. */ - __( 'Plugin Updater detected. These are not permitted in WordPress.org hosted plugins. Detected: %s', 'plugin-check' ), + /* translators: %s: The match updater file name. */ + __( 'Plugin Updater detected. These are not permitted in WordPress.org hosted plugins. Detected: %s', 'plugin-check' ), esc_attr( $matches[0] ) ), 'plugin_updater_detected', From af11d69c4a55ee1e45a4d1eaffc060483a8f342b Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Tue, 6 Aug 2024 12:56:54 +0200 Subject: [PATCH 3/9] added br --- .../Plugin_Repo/Plugin_Readme_Check.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php index 50c88d93e..9ad80d55d 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php @@ -181,7 +181,7 @@ private function check_headers( Check_Result $result, string $readme_file, Parse $result, sprintf( /* translators: %s: plugin header tag */ - __( 'Your readme is either missing or incomplete.The "%s" field is missing. Your readme has to have headers as well as a proper description and documentation as to how it works and how one can use it.', 'plugin-check' ), + __( 'Your readme is either missing or incomplete.
The "%s" field is missing. Your readme has to have headers as well as a proper description and documentation as to how it works and how one can use it.', 'plugin-check' ), $field['label'] ), 'missing_readme_header', @@ -217,7 +217,7 @@ private function check_default_text( Check_Result $result, string $readme_file, ) { $this->add_result_warning_for_file( $result, - __( 'The readme appears to contain default text. This means your readme has to have headers as well as a proper description and documentation as to how it works and how one can use it.', 'plugin-check' ), + __( 'The readme appears to contain default text.
This means your readme has to have headers as well as a proper description and documentation as to how it works and how one can use it.', 'plugin-check' ), 'default_readme_text', $readme_file, 0, @@ -245,7 +245,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( empty( $license ) ) { $this->add_result_error_for_file( $result, - __( 'Your plugin has no license declared. Please update your readme with a GPLv2 (or later) compatible license. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), + __( 'Your plugin has no license declared.
Please update your readme with a GPLv2 (or later) compatible license. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), 'no_license', $readme_file, 0, @@ -262,7 +262,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( ! preg_match( '/^([a-z0-9\-\+\.]+)(\sor\s([a-z0-9\-\+\.]+))*$/i', $license ) ) { $this->add_result_warning_for_file( $result, - __( 'Your plugin has an invalid license declared. Please update your readme with a valid SPDX license identifier.', 'plugin-check' ), + __( 'Your plugin has an invalid license declared.
Please update your readme with a valid SPDX license identifier.', 'plugin-check' ), 'invalid_license', $readme_file, 0, @@ -276,7 +276,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( ! $has_license ) { $this->add_result_error_for_file( $result, - __( 'Your plugin has no license declared in Plugin Header. Please update your plugin header with a GPLv2 (or later) compatible license. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), + __( 'Your plugin has no license declared in Plugin Header.
Please update your plugin header with a GPLv2 (or later) compatible license. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), 'no_license', $plugin_main_file, 0, @@ -291,7 +291,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( ! empty( $plugin_license ) && ! preg_match( '/GPL|GNU|MIT|FreeBSD|New BSD|BSD-3-Clause|BSD 3 Clause|OpenLDAP|Expat/im', $plugin_license ) ) { $this->add_result_error_for_file( $result, - __( 'Your plugin has an invalid license declared in Plugin Header. Please update your readme with a valid GPL license identifier. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), + __( 'Your plugin has an invalid license declared in Plugin Header.
Please update your readme with a valid GPL license identifier. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), 'invalid_license', $plugin_main_file, 0, @@ -304,7 +304,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( ! empty( $plugin_license ) && ! empty( $license ) && $license !== $plugin_license ) { $this->add_result_warning_for_file( $result, - __( 'Your plugin has a different license declared in the readme file and plugin header. Please update your readme with a valid GPL license identifier.', 'plugin-check' ), + __( 'Your plugin has a different license declared in the readme file and plugin header.
Please update your readme with a valid GPL license identifier.', 'plugin-check' ), 'license_mismatch', $readme_file, 0, @@ -372,7 +372,7 @@ private function check_stable_tag( Check_Result $result, string $readme_file, Pa if ( empty( $stable_tag ) ) { $this->add_result_error_for_file( $result, - __( 'Incorrect Stable TagYour Stable Tag is meant to be the stable version of your plugin, not of WordPress. For your plugin to be properly downloaded from WordPress.org, those values need to be the same. If they’re out of sync, your users won’t get the right version of your code.', 'plugin-check' ), + __( 'Incorrect Stable Tag
Your Stable Tag is meant to be the stable version of your plugin, not of WordPress. For your plugin to be properly downloaded from WordPress.org, those values need to be the same. If they’re out of sync, your users won’t get the right version of your code.', 'plugin-check' ), 'no_stable_tag', $readme_file, 0, @@ -386,7 +386,7 @@ private function check_stable_tag( Check_Result $result, string $readme_file, Pa if ( 'trunk' === $stable_tag ) { $this->add_result_error_for_file( $result, - __( "Incorrect Stable TagIt's recommended not to use 'Stable Tag: trunk'. Your Stable Tag is meant to be the stable version of your plugin, not of WordPress. For your plugin to be properly downloaded from WordPress.org, those values need to be the same. If they’re out of sync, your users won’t get the right version of your code.", 'plugin-check' ), + __( "Incorrect Stable Tag
It's recommended not to use 'Stable Tag: trunk'. Your Stable Tag is meant to be the stable version of your plugin, not of WordPress. For your plugin to be properly downloaded from WordPress.org, those values need to be the same. If they’re out of sync, your users won’t get the right version of your code.", 'plugin-check' ), 'trunk_stable_tag', $readme_file, 0, @@ -404,7 +404,7 @@ private function check_stable_tag( Check_Result $result, string $readme_file, Pa ) { $this->add_result_error_for_file( $result, - __( 'The Stable Tag in your readme file does not match the version in your main plugin file.Your Stable Tag is meant to be the stable version of your plugin, not of WordPress. For your plugin to be properly downloaded from WordPress.org, those values need to be the same. If they’re out of sync, your users won’t get the right version of your code.', 'plugin-check' ), + __( 'The Stable Tag in your readme file does not match the version in your main plugin file.
Your Stable Tag is meant to be the stable version of your plugin, not of WordPress. For your plugin to be properly downloaded from WordPress.org, those values need to be the same. If they’re out of sync, your users won’t get the right version of your code.', 'plugin-check' ), 'stable_tag_mismatch', $readme_file, 0, From 550c2d9cc8ae3c400bdab32da249a9bdb82032fc Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Tue, 6 Aug 2024 13:00:37 +0200 Subject: [PATCH 4/9] added link --- .../Plugin_Repo/Plugin_Readme_Check.php | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php index 9ad80d55d..08262da56 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php @@ -110,21 +110,33 @@ protected function check_files( Check_Result $result, array $files ) { */ private function check_name( Check_Result $result, string $readme_file, Parser $parser ) { if ( isset( $parser->warnings['invalid_plugin_name_header'] ) && false === $parser->name ) { - $message = sprintf( - /* translators: %s: Example plugin name header */ - __( 'Plugin name header in your readme is missing or invalid. Please update your readme with a valid plugin name header. Eg: "%s"', 'plugin-check' ), - '=== Example Name ===' + $this->add_result_error_for_file( + $result, + sprintf( + /* translators: %s: Example plugin name header */ + __( 'Plugin name header in your readme is missing or invalid. Please update your readme with a valid plugin name header. Eg: "%s"', 'plugin-check' ), + '=== Example Name ===' + ), + 'invalid_plugin_name', + $readme_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#incomplete-readme' ); - - $this->add_result_error_for_file( $result, $message, 'invalid_plugin_name', $readme_file ); } elseif ( empty( $parser->name ) ) { - $message = sprintf( - /* translators: %s: Example plugin name header */ - __( 'We cannot find a plugin name in your readme. Please update your readme with a valid plugin name header. Eg: "%s"', 'plugin-check' ), - '=== Example Name ===' + $this->add_result_error_for_file( + $result, + sprintf( + /* translators: %s: Example plugin name header */ + __( 'We cannot find a plugin name in your readme. Please update your readme with a valid plugin name header. Eg: "%s"', 'plugin-check' ), + '=== Example Name ===' + ), + 'empty_plugin_name', + $readme_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#incomplete-readme' ); - - $this->add_result_error_for_file( $result, $message, 'empty_plugin_name', $readme_file ); } } From 74255dddafbdb00a3281222f909db40969cd20cf Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Tue, 6 Aug 2024 13:07:20 +0200 Subject: [PATCH 5/9] added links --- .../Checks/Plugin_Repo/Code_Obfuscation_Check.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Code_Obfuscation_Check.php b/includes/Checker/Checks/Plugin_Repo/Code_Obfuscation_Check.php index b4f3dfed6..efb20176c 100644 --- a/includes/Checker/Checks/Plugin_Repo/Code_Obfuscation_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Code_Obfuscation_Check.php @@ -105,7 +105,10 @@ protected function look_for_zendguard( Check_Result $result, array $php_files ) __( 'Zend Guard', 'plugin-check' ) ), 'obfuscated_code_detected', - $obfuscated_file + $obfuscated_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#gpl-no-publicly-documented-resource' ); } } @@ -129,7 +132,10 @@ protected function look_for_sourceguardian( Check_Result $result, array $php_fil __( 'Source Guardian', 'plugin-check' ) ), 'obfuscated_code_detected', - $obfuscated_file + $obfuscated_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#gpl-no-publicly-documented-resource' ); } } @@ -153,7 +159,10 @@ protected function look_for_ioncube( Check_Result $result, array $php_files ) { __( 'ionCube', 'plugin-check' ) ), 'obfuscated_code_detected', - $obfuscated_file + $obfuscated_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#gpl-no-publicly-documented-resource' ); } } From 75cfb7e743fb4aa11ce9795df17c77dd652be234 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Tue, 6 Aug 2024 13:48:24 +0200 Subject: [PATCH 6/9] fixed spaces --- .../Checks/Plugin_Repo/Plugin_Readme_Check.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php index 08262da56..b842f139a 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php @@ -229,7 +229,7 @@ private function check_default_text( Check_Result $result, string $readme_file, ) { $this->add_result_warning_for_file( $result, - __( 'The readme appears to contain default text.
This means your readme has to have headers as well as a proper description and documentation as to how it works and how one can use it.', 'plugin-check' ), + __( 'The readme appears to contain default text.
This means your readme has to have headers as well as a proper description and documentation as to how it works and how one can use it.', 'plugin-check' ), 'default_readme_text', $readme_file, 0, @@ -257,7 +257,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( empty( $license ) ) { $this->add_result_error_for_file( $result, - __( 'Your plugin has no license declared.
Please update your readme with a GPLv2 (or later) compatible license. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), + __( 'Your plugin has no license declared.
Please update your readme with a GPLv2 (or later) compatible license. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), 'no_license', $readme_file, 0, @@ -274,7 +274,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( ! preg_match( '/^([a-z0-9\-\+\.]+)(\sor\s([a-z0-9\-\+\.]+))*$/i', $license ) ) { $this->add_result_warning_for_file( $result, - __( 'Your plugin has an invalid license declared.
Please update your readme with a valid SPDX license identifier.', 'plugin-check' ), + __( 'Your plugin has an invalid license declared.
Please update your readme with a valid SPDX license identifier.', 'plugin-check' ), 'invalid_license', $readme_file, 0, @@ -288,7 +288,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( ! $has_license ) { $this->add_result_error_for_file( $result, - __( 'Your plugin has no license declared in Plugin Header.
Please update your plugin header with a GPLv2 (or later) compatible license. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), + __( 'Your plugin has no license declared in Plugin Header.
Please update your plugin header with a GPLv2 (or later) compatible license. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), 'no_license', $plugin_main_file, 0, @@ -303,7 +303,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( ! empty( $plugin_license ) && ! preg_match( '/GPL|GNU|MIT|FreeBSD|New BSD|BSD-3-Clause|BSD 3 Clause|OpenLDAP|Expat/im', $plugin_license ) ) { $this->add_result_error_for_file( $result, - __( 'Your plugin has an invalid license declared in Plugin Header.
Please update your readme with a valid GPL license identifier. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), + __( 'Your plugin has an invalid license declared in Plugin Header.
Please update your readme with a valid GPL license identifier. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), 'invalid_license', $plugin_main_file, 0, @@ -316,7 +316,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( ! empty( $plugin_license ) && ! empty( $license ) && $license !== $plugin_license ) { $this->add_result_warning_for_file( $result, - __( 'Your plugin has a different license declared in the readme file and plugin header.
Please update your readme with a valid GPL license identifier.', 'plugin-check' ), + __( 'Your plugin has a different license declared in the readme file and plugin header.
Please update your readme with a valid GPL license identifier.', 'plugin-check' ), 'license_mismatch', $readme_file, 0, From 2109e21ea681f84de1821b4ade560fc46b06bb64 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Tue, 6 Aug 2024 23:35:55 +0200 Subject: [PATCH 7/9] updated description --- .../Checks/Plugin_Repo/No_Unfiltered_Uploads_Check.php | 7 +++++-- .../Checker/Checks/Plugin_Repo/Plugin_Updater_Check.php | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/No_Unfiltered_Uploads_Check.php b/includes/Checker/Checks/Plugin_Repo/No_Unfiltered_Uploads_Check.php index 54ded04f1..849be004f 100644 --- a/includes/Checker/Checks/Plugin_Repo/No_Unfiltered_Uploads_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/No_Unfiltered_Uploads_Check.php @@ -52,11 +52,14 @@ protected function check_files( Check_Result $result, array $files ) { $result, sprintf( /* translators: %s: ALLOW_UNFILTERED_UPLOADS */ - __( '%s is not permitted.', 'plugin-check' ), + __( '%s is not permitted.
Setting this constant to true will allow the user to upload any type of file (including PHP and other executables), creating serious potential security risks', 'plugin-check' ), 'ALLOW_UNFILTERED_UPLOADS' ), 'allow_unfiltered_uploads_detected', - $file + $file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#files-unfiltered-uploads' ); } } diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Updater_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Updater_Check.php index 18c443bde..951a80f22 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Updater_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Updater_Check.php @@ -182,7 +182,7 @@ protected function look_for_plugin_updaters( Check_Result $result, array $php_fi $result, sprintf( /* translators: %s: The match updater file name. */ - __( 'Plugin Updater detected. These are not permitted in WordPress.org hosted plugins. Detected: %s', 'plugin-check' ), + __( 'Plugin Updater detected.
These are not permitted in WordPress.org hosted plugins. Detected: %s', 'plugin-check' ), esc_attr( $matches[0] ) ), 'plugin_updater_detected', @@ -216,11 +216,14 @@ protected function look_for_updater_routines( Check_Result $result, array $php_f $result, sprintf( /* translators: %s: The match file name. */ - __( 'Detected code which may be altering WordPress update routines. Detected: %s', 'plugin-check' ), + __( 'Plugin Updater detected.
Detected code which may be altering WordPress update routines. Detected: %s', 'plugin-check' ), esc_html( $matches[0] ) ), 'update_modification_detected', - $updater_file + $updater_file, + 0, + 0, + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#update-checker' ); } } From b82b9779b139bf4c9569efaa242fba6af79388b2 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Wed, 7 Aug 2024 16:06:38 +0545 Subject: [PATCH 8/9] Fix lint issues and typos --- .../Checks/Plugin_Repo/Code_Obfuscation_Check.php | 6 +++--- .../Checks/Plugin_Repo/No_Unfiltered_Uploads_Check.php | 2 +- .../Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php | 10 +++++----- .../Checks/Plugin_Repo/Plugin_Updater_Check.php | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Code_Obfuscation_Check.php b/includes/Checker/Checks/Plugin_Repo/Code_Obfuscation_Check.php index 448d1e101..a581a7b59 100644 --- a/includes/Checker/Checks/Plugin_Repo/Code_Obfuscation_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Code_Obfuscation_Check.php @@ -110,7 +110,7 @@ protected function look_for_zendguard( Check_Result $result, array $php_files ) $file['file'], $file['line'], $file['column'], - 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#gpl-no-publicly-documented-resource' + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#gpl-no-publicly-documented-resource' ); } } @@ -140,7 +140,7 @@ protected function look_for_sourceguardian( Check_Result $result, array $php_fil $file['file'], $file['line'], $file['column'], - 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#gpl-no-publicly-documented-resource' + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#gpl-no-publicly-documented-resource' ); } } @@ -170,7 +170,7 @@ protected function look_for_ioncube( Check_Result $result, array $php_files ) { $file['file'], $file['line'], $file['column'], - 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#gpl-no-publicly-documented-resource' + 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#gpl-no-publicly-documented-resource' ); } } diff --git a/includes/Checker/Checks/Plugin_Repo/No_Unfiltered_Uploads_Check.php b/includes/Checker/Checks/Plugin_Repo/No_Unfiltered_Uploads_Check.php index 849be004f..7357eb4c3 100644 --- a/includes/Checker/Checks/Plugin_Repo/No_Unfiltered_Uploads_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/No_Unfiltered_Uploads_Check.php @@ -52,7 +52,7 @@ protected function check_files( Check_Result $result, array $files ) { $result, sprintf( /* translators: %s: ALLOW_UNFILTERED_UPLOADS */ - __( '%s is not permitted.
Setting this constant to true will allow the user to upload any type of file (including PHP and other executables), creating serious potential security risks', 'plugin-check' ), + __( '%s is not permitted.
Setting this constant to true will allow the user to upload any type of file (including PHP and other executables), creating serious potential security risks.', 'plugin-check' ), 'ALLOW_UNFILTERED_UPLOADS' ), 'allow_unfiltered_uploads_detected', diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php index b842f139a..fa688feee 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php @@ -257,7 +257,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( empty( $license ) ) { $this->add_result_error_for_file( $result, - __( 'Your plugin has no license declared.
Please update your readme with a GPLv2 (or later) compatible license. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), + __( 'Your plugin has no license declared.
Please update your readme with a GPLv2 (or later) compatible license. It is necessary to declare the license of this plugin. You can do this by using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), 'no_license', $readme_file, 0, @@ -288,7 +288,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( ! $has_license ) { $this->add_result_error_for_file( $result, - __( 'Your plugin has no license declared in Plugin Header.
Please update your plugin header with a GPLv2 (or later) compatible license. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), + __( 'Your plugin has no license declared in Plugin Header.
Please update your plugin header with a GPLv2 (or later) compatible license. It is necessary to declare the license of this plugin. You can do this by using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), 'no_license', $plugin_main_file, 0, @@ -303,7 +303,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse if ( ! empty( $plugin_license ) && ! preg_match( '/GPL|GNU|MIT|FreeBSD|New BSD|BSD-3-Clause|BSD 3 Clause|OpenLDAP|Expat/im', $plugin_license ) ) { $this->add_result_error_for_file( $result, - __( 'Your plugin has an invalid license declared in Plugin Header.
Please update your readme with a valid GPL license identifier. It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), + __( 'Your plugin has an invalid license declared in Plugin Header.
Please update your readme with a valid GPL license identifier. It is necessary to declare the license of this plugin. You can do this by using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ), 'invalid_license', $plugin_main_file, 0, @@ -384,7 +384,7 @@ private function check_stable_tag( Check_Result $result, string $readme_file, Pa if ( empty( $stable_tag ) ) { $this->add_result_error_for_file( $result, - __( 'Incorrect Stable Tag
Your Stable Tag is meant to be the stable version of your plugin, not of WordPress. For your plugin to be properly downloaded from WordPress.org, those values need to be the same. If they’re out of sync, your users won’t get the right version of your code.', 'plugin-check' ), + __( 'Incorrect Stable Tag.
Your Stable Tag is meant to be the stable version of your plugin, not of WordPress. For your plugin to be properly downloaded from WordPress.org, those values need to be the same. If they’re out of sync, your users won’t get the right version of your code.', 'plugin-check' ), 'no_stable_tag', $readme_file, 0, @@ -398,7 +398,7 @@ private function check_stable_tag( Check_Result $result, string $readme_file, Pa if ( 'trunk' === $stable_tag ) { $this->add_result_error_for_file( $result, - __( "Incorrect Stable Tag
It's recommended not to use 'Stable Tag: trunk'. Your Stable Tag is meant to be the stable version of your plugin, not of WordPress. For your plugin to be properly downloaded from WordPress.org, those values need to be the same. If they’re out of sync, your users won’t get the right version of your code.", 'plugin-check' ), + __( "Incorrect Stable Tag.
It's recommended not to use 'Stable Tag: trunk'. Your Stable Tag is meant to be the stable version of your plugin, not of WordPress. For your plugin to be properly downloaded from WordPress.org, those values need to be the same. If they’re out of sync, your users won’t get the right version of your code.", 'plugin-check' ), 'trunk_stable_tag', $readme_file, 0, diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Updater_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Updater_Check.php index 951a80f22..38dccf51a 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Updater_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Updater_Check.php @@ -114,7 +114,7 @@ protected function look_for_update_uri_header( Check_Result $result ) { if ( ! empty( $plugin_header['UpdateURI'] ) ) { $this->add_result_error_for_file( $result, - __( 'Including An Update Checker / Changing Updates functionalityPlugin Updater detected. Use of the Update URI header is not allowed in plugins hosted on WordPress.org.', 'plugin-check' ), + __( 'Including An Update Checker / Changing Updates functionality.
Plugin Updater detected. Use of the Update URI header is not allowed in plugins hosted on WordPress.org.', 'plugin-check' ), 'plugin_updater_detected', $plugin_main_file, 0, @@ -142,7 +142,7 @@ protected function look_for_updater_file( Check_Result $result, array $php_files $result, sprintf( /* translators: %s: The match updater file name. */ - __( 'Plugin Updater detected. These are not permitted in WordPress.org hosted plugins. Detected: %s', 'plugin-check' ), + __( 'Plugin Updater detected.
These are not permitted in WordPress.org hosted plugins. Detected: %s', 'plugin-check' ), basename( $file ) ), 'plugin_updater_detected', From 8c0becfda6b36afd3b20b4e5a86359d35346cb8e Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Wed, 7 Aug 2024 16:12:48 +0545 Subject: [PATCH 9/9] Strip tags for warnings also --- includes/CLI/Plugin_Check_Command.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/CLI/Plugin_Check_Command.php b/includes/CLI/Plugin_Check_Command.php index 1e0575b5d..8b79518c1 100644 --- a/includes/CLI/Plugin_Check_Command.php +++ b/includes/CLI/Plugin_Check_Command.php @@ -540,6 +540,9 @@ private function flatten_file_results( $file_errors, $file_warnings ) { foreach ( $line_warnings as $column => $column_warnings ) { foreach ( $column_warnings as $column_warning ) { + $column_warning['message'] = str_replace( '
', "\n", $column_warning['message'] ); + $column_warning['message'] = wp_strip_all_tags( $column_warning['message'] ); + $file_results[] = array_merge( $column_warning, array(