Kontrola wtyczek (PCP)

Opis

Plugin Check is a tool for testing whether your plugin meets the required standards for the WordPress.org plugin directory. With this plugin you will be able to run most of the checks used for new submissions, and check if your plugin meets the requirements.

Additionally, the tool flags violations or concerns around plugin development best practices, from basic requirements like correct usage of internationalization functions to accessibility, performance, and security best practices.

The checks can be run either using the WP Admin user interface or WP-CLI:

  • To check a plugin using WP Admin, please navigate to the Tools > Plugin Check menu. You need to be able to manage plugins on your site in order to access that screen.
  • To check a plugin using WP-CLI, please use the wp plugin check command. For example, to check the „Hello Dolly” plugin: wp plugin check hello.php
    • Note that by default when using WP-CLI, only static checks can be executed. In order to also include runtime checks, a workaround is currently necessary using the --require argument of WP-CLI, to manually load the cli.php file within the plugin checker directory before WordPress is loaded. For example: wp plugin check hello.php --require=./wp-content/plugins/plugin-check/cli.php
    • You could use arbitrary path or URL to check a plugin. For example, to check a plugin from a URL: wp plugin check https://example.com/plugin.zip or to check a plugin from a path: wp plugin check /path/to/plugin

The checks are grouped into several categories, so that you can customize which kinds of checks you would like to run on a plugin.

Pamiętaj, że wtyczka nie zastępuje jeszcze ręcznego procesu weryfikacji, ale może pomóc przyspieszyć proces zatwierdzania wtyczki do repozytorium wtyczek WordPress.org, a także pozwoli uniknąć niektórych typowych błędów.

Even if you do not intend to host your plugin in the WordPress.org directory, you are encouraged to use Plugin Check so that your plugin follows the base requirements and best practices for WordPress plugins.

Instalacja

Installation from within WordPress

  1. Visit Plugins > Add New.
  2. Search for Plugin Check.
  3. Install and activate the Plugin Check plugin.

Manual installation

  1. Upload the entire plugin-check folder to the /wp-content/plugins/ directory.
  2. Visit Plugins.
  3. Activate the Plugin Check plugin.

Najczęściej zadawane pytania

Czy mogę pomóc w tworzeniu wtyczki?

Rozwój wtyczki jest obsługiwany przez GitHub, wszelkie problemy lub pull requesty proszę zgłaszać w repozytorium githuba.

What if the plugin reports something that’s correct as an „error” or „warning”?

We strive to write a plugin in a way that minimizes false positives but if you find one, please report it in the GitHub repo. For certain false positives, such as those detected by PHPCodeSniffer, you may be able to annotate the code to ignore the specific problem for a specific line.

Dlaczego oznacza coś jako złe?

Nie oznacza to „złych” rzeczy jako takich. Sprawdzanie wtyczek zostało zaprojektowane jako niedoskonały sposób testowania zgodności z wytycznymi dotyczącymi przeglądu wtyczek. Nie wszystkie wtyczki muszą być zgodne z tymi wytycznymi. Celem narzędzia sprawdzającego jest zapewnienie, że wtyczki przesłane do centralnego repozytorium wtyczek WordPress.org spełniają najnowsze standardy wtyczek WordPress i będą działać w wielu różnych witrynach.

Wiele witryn korzysta z własnych wtyczek i jest to całkowicie w porządku. Ale wtyczki, które są przeznaczone do użytku na wielu różnych rodzajach witryn przez społeczeństwo, muszą osiągnąć pewien minimalny poziom, aby zapewnić prawidłowe funkcjonowanie w wielu różnych środowiskach. Wytyczne Plugin Review zostały stworzone z myślą o tym celu.

Proces sprawdzania wtyczek nie jest doskonały i nigdy nie będzie. Jest to tylko narzędzie pomagające autorom wtyczek lub każdemu, kto chce zwiększyć możliwości swojej wtyczki. Wszystkie wtyczki przesłane do WordPress.org są ręcznie sprawdzane przez zespół ekspertów. Automatyczny tester wtyczek ma być jedynie użytecznym narzędziem, a nie absolutnym systemem pomiaru.

Does a plugin need to pass all checks to be approved in the WordPress.org plugin directory?

To be approved in the WordPress.org plugin directory, a plugin must typically pass all checks in the „Plugin repo” category. Other checks are additional and may not be required to pass.

In any case, passing the checks in this tool likely helps to achieve a smooth plugin review process, but is no guarantee that a plugin will be approved in the WordPress.org plugin directory.

Recenzje

2025-02-25
This plugin is extremely helpful for developers and is indispensable for reviewing and refining code before release. Thank you to the WordPress team for developing such a truly useful plugin. I have a suggestion regarding the code inspection feature—it would be beneficial to integrate function call analysis. For example, when source code calls intermediary functions that handle nonce verification, sanitization, and other input validations within shared classes, it may result in false positives. This could potentially impact the efficiency of the plugin review process. Overall, this plugin is fantastic for me! Many thanks to the WordPress Team! Warm regards,
2025-01-19
I’m working on a Block plugin, for the first time in my life, with the intention to share it in the repo. As I’m walking uncharted territory, The PCP is a real blessing! Thank you, dear Review Team, for creating this.
2025-01-04
This plugin is excellent for catching common mistakes before submission. It significantly saves time by reducing the back-and-forth process. I used it for the first time, and I really liked how efficiently it worked.
2024-12-07 1 odpowiedź
This tool is a must for every WordPress plugin developer. You can use phpcs with WordPress standards and other useful tools, but this is an essential step to check your plugin, not only if your intention is to publish to WordPress public repo. Accomplish these standards is a must for everyone who works as plugin developer. Thanks, plugin team, for this powerful tool. Now our developer lives are easier.
2024-11-15
Run it on any plugin, including popular ones like Woo and you’ll see tons of nonsense „Error” messages about inescaped output. This doesn’t help anyone. These so-called error messages appear even for static text or well trusted data. Just a random example from Woo:The plugin reports „WordPress.Security.EscapeOutput.ExceptionNotEscaped” for this:throw new \Exception( sprintf( __( 'Could not find classname for order ID %d’, 'woocommerce’ ), $order_id ) );$order_id is already int, ensured by the function, and additionally %d ensures it cannot output anything dangerous. You have to either make this smart enough to find real issues or remove these nonsense messages entirely.How is this helping anyone?
Przeczytaj 24 recenzje

Kontrybutorzy i deweloperzy

„Kontrola wtyczek (PCP)” jest oprogramowaniem open source. Poniższe osoby miały wkład w rozwój wtyczki.

Zaangażowani

Wtyczka „Kontrola wtyczek (PCP)” została przetłumaczona na 15 języków. Podziękuj tłumaczom za ich wkład.

Przetłumacz wtyczkę “Kontrola wtyczek (PCP)” na swój język.

Interesuje cię rozwój wtyczki?

Przeglądaj kod, sprawdź repozytorium SVN lub czytaj dziennik rozwoju przez RSS.

Rejestr zmian

1.4.0

  • Enhancement – Allow ISC license in the License check.
  • Enhancement – Added check for use of settings with sanitization callback.
  • Enhancement – Added –ignore-codes in CLI to introduce a mechanism to ignore specific error codes.
  • Enhancement – New utils for fetching necessary version info details.
  • Enhancement – Added check for unsupported plugin name in plugin header field.
  • Enhancement – Segregate the severity of i18n checks. Make sure that is giving errors in the right context.
  • Enhancement – Provide more detailed information about checks when the README does not include a tested version or a list of contributors.
  • Enhancement – Added rules from WPCS to prevent issues with content being sent before headers and warn about the use of Call-time pass-by-reference.
  • Enhancement – Give more context in the error of check wrong named files.
  • Enhancement – Simplified PHPUnit setup. Now it does not depend of running inside a WordPress installation.
  • Enhancement – Added new check for restricted contributors.
  • Fix – Delete transients in unit tests to avoid false positives.
  • Fix – Incorrect Tested up to version comparison will make error for two major versions up.
  • Fix – Excluded the use of functions file_get_contents and file_put_contents in the check to prevent false positives.
  • Fix – Duplicated error message in the check for wrong named files.
  • Fix – Use of Json encode wasn’t firing the error message.
  • Fix – Change error type of NonEnqueuedImage in ImageFunctions sniff from ERROR to WARNING.

1.3.1

  • Enhancement – Add version utilities.
  • Fix – Escape error messages.
  • Fix – Renamed error type to ERROR_LOW_SEVERITY and WARNING_LOW_SEVERITY.
  • Fix – Fix PHPCS checks on unwritable filesystems.

1.3.0

  • Enhancement – Update disallowed domains for Plugin URI check.
  • Enhancement – Added new checks for Plugin Header fields: missing plugin description, missing plugin version and invalid plugin version.
  • Enhancement – New check for validation of donate link in the readme file.
  • Enhancement – Increased severity for wrong Plugin Requires.
  • Enhancement – Added check Restrict parse_str() without second argument.
  • Enhancement – New check for Disallow usage of HEREDOC and NOWDOC.
  • Enhancement – Added acronyms allowed in Trademark checks.
  • Enhancement – Added option in CLI to add low severity errors and warnings.
  • Enhancement – Change error type for License check error codes.
  • Enhancement – Always use prefixed tables during runtime check requests.
  • Enhancement – Created a new class for checking licenses.
  • Enhancement – Added support for MPL-2.0 license.
  • Enhancement – Implement gherkin linter in GH action.
  • Enhancement – Update check for Contributors in markdown readme files.
  • Enhancement – CLI: Fix confusing runtime environment setup order.
  • Enhancement – Allow custom checks to provide installed_paths.
  • Enhancement – Improved the use of localhost URLs in the Plugin.
  • Enhancement – Documented checks in the plugin.
  • Enhancement – Increased severity for Code obfuscation checks.
  • Enhancement – Diffentiate between no existent readme and default readme file.
  • Enhancement – Encourage developers to use native functions for loading images in templates.
  • Enhancement – Added a check for not allowing include libraries already in WordPress core.
  • Enhancement – Warning for usage of query_posts() in favor of WP_Query.
  • Fix – Fix for the local environment is set up before testing.
  • Fix – Fix addon checks not being executed when running runtime checks.
  • Fix – Allow default as a text domain in the text domain check.
  • Fix – Allow GitHub URLs in the Plugin URI field.
  • Fix – Don’t flag Apache license. It’s allowed in the WordPress.org plugin repository.
  • Fix – Removes the path before the plugin, so it won’t affect to badly named files.

1.2.0

  • Enhancement – Added a check for badly used names in files.
  • Enhancement – Increased severity for BacktickOperator, DisallowShortOpenTag, DisallowAlternativePHPTags, RestrictedClasses, and RestrictedFunctions.
  • Enhancement – Added security checks to the Plugin repository category.
  • Enhancement – Allowed runtime-set in code sniffer checks.
  • Enhancement – Changed warnings to errors in plugin header checks.
  • Enhancement – Detect forbidden plugin headers such as repository URIs in the Directory.
  • Enhancement – Added a new check for development functions that are not allowed in final plugins.
  • Enhancement – Created new images and icons for the plugin.
  • Enhancement – Introduced a slug argument in the CLI.
  • Enhancement – Added a check for discouraged PHP functions.
  • Enhancement – Added validation for Contributors in the readme file.
  • Enhancement – Added a warning for mismatched plugin names in the plugin header and readme file.
  • Enhancement – Checked for validation of Plugin Header fields: Name, Plugin URI, Description, Author URI, Requires at least, Requires PHP, and Requires Plugins.
  • Enhancement – Added a warning if the „Tested up to” value in the readme file exceeds the released version of WordPress.
  • Fix – Display a success message if no errors or warnings are found.
  • Fix – Made table results responsive.
  • Fix – Prevent proceeding to the next check if the Stable Tag value is set to trunk.
  • Fix – Allow runtime initialization even when only add-on checks are requested.
  • Fix – Fixed an SPDX warning for the GPL version 3 license.
  • Fix – Prevent runtime checks in the CLI context when they cannot be used.

1.1.0

  • Feature – New Non_Blocking_Scripts_Check (non_blocking_scripts) runtime check to warn about enqueued scripts that use neither defer nor async.
  • Enhancement – Changed the namespace of included checks.
  • Enhancement – Introduced severity levels for all errors and warnings.
  • Enhancement – CLI: Support checking a plugin from a path or URL.
  • Enhancement – Added short descriptions and URLs for each check.
  • Enhancement – Improved messaging in check results.
  • Enhancement – Updated code obfuscation check with more accurate results.
  • Enhancement – Updated plugin review check to flag missing input sanitization (WordPress.Security.ValidatedSanitizedInput).
  • Fix – Improve readme checks to exclude invalid files.
  • Fix – Only show edit link if files are actually editable.

1.0.2

  • Feature – New Enqueued_Scripts_Scope_Check (enqueued_scripts_scope), Enqueued_Styles_Size_Check (enqueued_styles_size) and Enqueued_Resources_Check (enqueued_resources) performance checks.
  • Enhancement – Improved readme check and added a new wp_plugin_check_ignored_readme_warnings filter.
  • Enhancement – New wp_plugin_check_default_categories filter to change the categories which are selected by default.
  • Enhancement – New wp_plugin_check_ignore_files filter to allow ignoring specific files.
  • Fix – Correct detection of readme files in Windows by normalizing file paths.

1.0.1

  • Fix – Add missing test-content folder needed for runtime checks.
  • Fix – Do not send emails when setting up test environment.
  • Fix – Prevent PHP warning when the argv variable isn’t set.

1.0.0

  • Feature – Complete overhaul of the plugin, its architecture, and all checks.
  • Feature – Added new WP-CLI commands for running checks and listing available options.
  • Enhancement – Added option to only run checks for a specific category.

0.2.3

  • Usprawnienie – yżycie wersji 3.8.0 biblioteki PHP_CodeSniffer, odchodząc od squizlabs/PHP_CodeSniffer na rzecz PHPCSStandards/PHP_CodeSniffer.
  • Poprawka – sprawdzenie czy wtyczka działa zgodnie z oczekiwaniami w środowisku WP playground, aby umożliwić recenzentom korzystanie z PCP. Podziękowania dla @tellyworth.
  • Poprawka – niezdefiniowany klucz tablicy „argv” podczas uruchamiania sprawdzania wtyczki w niektórych środowiskach. Podziękowania dla @afragen. #340.

0.2.2

  • Ulepszenie – włączono obsługę serwerów Windows.
  • Ulepszenie – unikaj bezpośredniego korzystania z PHP CLI, co umożliwia programistom wtyczek korzystanie z PCP w różnych nowych środowiskach.
  • Poprawka – usunięto zależności od funkcji shell_exec i exec, co umożliwia twórcom wtyczek korzystanie z PCP w różnych nowych środowiskach.
  • Poprawka – naprawiono problemom z ostrzeżeniem parsera Readme związanym z contributor_ignored podczas uruchamiania sprawdzania poza WP.org. Podziękowania dla @dev4press. #276.
  • Poprawka – usunięto dodatkową kropkę na końcu zdania dla ostrzeżenia phar. Podziękowania dla @pixolin. #275.

0.2.1

  • Dodano odnośnik „Wyświetl w edytorze kodu” pod każdym błędem lub ostrzeżeniem PHPCS. Props @EvanHerman, @westonruter, @felixarntz, @mukeshpanchal27 #262.
  • Poprawka – upewnij się, że readme.txt ma priorytet nad readme.md, gdy oba są obecne. Props @bordoni, @afragen #258.
  • Poprawka – upewnij się, że sprawdzanie PHPCS działa nawet wtedy, gdy plik binarny PHPCS nie jest wykonywalny. Props @bordoni, @shawn-digitalpoint, @mrfoxtalbot #254.
  • Poprawka – zmiany w Readme i literówki. Props @aaronjorbin. #261.
  • Poprawka – długie linie kodu ze sprawdzaniem PHPCS nie rozszerzają się już ponad rozmiar powiadomienia. Props @bordoni, @felixarntz. #263.
  • Poprawka – upewnij się, że mamy zgodność z PHP 7.2, usuń końcowy przecinek. Props @bordoni, @leoloso. #265.
  • Poprawka – uwzględnij wszystkie ciągi, które zostały pominięte w poprzedniej wersji. Props @bordoni, @pixolin. #270.

0.2.0

  • Funkcja – dodano modyfikację ścieżki binarnej PHP używanej przez wtyczkę za pomocą stałej PLUGIN_CHECK_PHP_BIN.
  • Funkcja – dołączono sprawdzanie użycia ALLOW_UNFILTERED_UPLOADS w dowolnych plikach PHP – Podziękowania dla EvanHermana at #45.
  • Funkcja – dodano sprawdzanie obecności plików aplikacji (.a, .bin, .bpk, .deploy, .dist, .distz, .dmg, .dms, .DS_Store, .dump, .elc, .exe, .iso, .lha, .lrf, .lzh, .o, .obj, .phar, .pkg, .sh, ’.so`) – Podziękowania dla EvanHermana at #43.
  • Funkcja – dodano sprawdzanie obecności pliku readme.txt lub readme.md – Podziękowanie dla EvanHermana na #42.
  • Poprawka – sprawdzenie, że parsowanie pliku readme jest włączone poprawnie, gdy obecny jest plik readme.md lub readme.txt. Podziękowania dla Bordoni #52.
  • Usprawnienie – wyłącz funkcje move_uploaded_file, passthru, proc_open – Podziękowania dla alexsanford w #50.
  • Ulepszenie – zmieniono typ wiadomości dotyczący korzystania z funkcji, które WordPress już zawiera, z ostrzeżenia na błąd. P{odziękowania dla Davidperezgar #18
  • Ulepszenie – zmień typ komunikatu dla nieprawidłowego użycia tagu Stable z Powiadomienie/Ostrzeżenie na Błąd. Podziękowania dla davidperezgar w #3.

[0.1] 2011-09-04

Oryginalna wersja narzędzia do sprawdzania wtyczek, a nie wydana wersja wtyczki, a dziennik zmian jest tutaj tylko do celów historycznych.