@@ -72,21 +72,21 @@ Please see [WooCommerce Stubs](https://github.com/php-stubs/woocommerce-stubs)
72
72
- Write clean OOP code: 1 class per file, no other code in class files outside ` class Name { ... } `
73
73
- Structure your code: uniform class names (WPCS or PSR-4), keep classes in a separate directory ` inc/ `
74
74
- Add proper PHPDoc blocks to classes, properties, methods, functions
75
- - Handle these only in your [ main plugin file] ( https://github.com/kingkero/wordpress-demoplugin/blob/master/wordpress-demoplugin.php ) ,
76
- another [ main plugin file] ( https://github.com/pryley/site-reviews/blob/v5.0.1/site-reviews.php ) example
75
+ - Handle these only in your [ main plugin file] ( https://github.com/kingkero/wordpress-demoplugin/blob/master/wordpress-demoplugin.php ) .
76
+ Here is another [ main plugin file] ( https://github.com/pryley/site-reviews/blob/v5.0.1/site-reviews.php ) example.
77
77
- Define constants, e.g. ` MYPLUGIN_PATH `
78
78
- Call ` register_activation_hook() ` , ` register_deactivation_hook() ` , ` register_uninstall_hook() `
79
- - Class autoloading
79
+ - Load class autoloader
80
80
- Load translations
81
81
- Support WP-CLI
82
82
- Decide [ what to load] ( https://github.com/szepeviktor/Toolkit4WP/blob/master/src/Is.php#L64-L73 )
83
83
- Start your plugin in a hook (` plugins_loaded ` ) - without direct execution
84
84
- Avoid using core constants, use core functions or ` MYPLUGIN_PATH `
85
85
- Avoid bad parts of PHP
86
- - functions: eval, extract, compact, list
86
+ - functions: ` eval ` , ` extract ` , ` compact ` , ` list `
87
87
- [ type juggling] ( https://www.php.net/manual/en/language.types.type-juggling.php ) : ` $a = '15'; if ($a) ... `
88
- - If you need robust code try avoiding all kinds of type casting (e.g. ` if ` needs a boolean),
88
+ - If you need robust code try avoiding all kinds of type juggling (e.g. ` if ` needs a boolean),
89
89
see [ Variable handling functions] ( https://www.php.net/manual/en/ref.var.php )
90
- - If you are not bound by PHP 5.x consider following
90
+ - If you are not bound by PHP 5 consider following
91
91
[ Neutron Standard] ( https://github.com/Automattic/phpcs-neutron-standard )
92
92
- Do not enable ` exit_error ` in ` WP_CLI::launch ` or ` WP_CLI::runcommand ` to keep your code testable
0 commit comments