{"id":219458,"date":"2022-12-16T14:20:00","date_gmt":"2022-12-16T11:20:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=219458"},"modified":"2022-12-16T14:21:25","modified_gmt":"2022-12-16T11:21:25","slug":"vidzhety-wordpress-refaktoring-chast-2","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/ru\/vidzhety-wordpress-refaktoring-chast-2\/","title":{"rendered":"\u0412\u0438\u0434\u0436\u0435\u0442\u044b WordPress: \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433, \u0447\u0430\u0441\u0442\u044c 2"},"content":{"rendered":"\n<p><strong><a href=\"https:\/\/wordpress.mediadoma.com\/ru\/vidzhety-wordpress-refaktoring-chast-1\/\" title=\"\u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430\">\u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430<\/a><\/strong> \u043c\u044b, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043a \u0442\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443, \u043a\u043e\u0433\u0434\u0430 \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0445 \u0432 \u043d\u0430\u0448\u0435\u0439 \u0441\u0440\u0435\u0434\u0435 IDE \u0438 \u043d\u0430\u0448\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u0434\u0430.<\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u043d\u0430 \u0434\u0432\u0430 \u043f\u043e\u0441\u0442\u0430:<\/p>\n<ul>\n<li>\u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0441\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430,<\/li>\n<li>\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b.<\/li>\n<\/ul>\n<p>\u0410 \u043f\u043e\u043a\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0434\u0430\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430, \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0441 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u043c\u0438.<\/p>\n<h2>\u0428\u0430\u0431\u043b\u043e\u043d \u0432\u0438\u0434\u0436\u0435\u0442\u0430 WordPress: \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433, \u0447\u0430\u0441\u0442\u044c 2<\/h2>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u044f \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0430\u0445\u043e\u0436\u0443\u0441\u044c \u0432 \u0432\u0435\u0442\u043a\u0435 <strong>\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/strong>, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0435\u0449\u0435 \u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0435\u0435 \u0441 \u043c\u0430\u0441\u0442\u0435\u0440\u043e\u043c. \u0418 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u043a\u043e\u0434\u0430 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/dce6bda0d104192a21cb06dc7d3ca23c#file-00-regex-results-txt\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/a><\/strong><\/p>\n<pre><code>Warning: Uncaught ErrorException: require_once(\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/vendor\/autoload.php): failed to open stream: No such file or directory in \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/php-cs-fixer:62\nStack trace:\n#0 \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/php-cs-fixer(62): {closure}(2, 'require_once(\/U...', '\/Users\/tommcfar...', 62, Array)\n#1 \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/php-cs-fixer(62): require_once()\n#2 {main}\n  thrown in \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/php-cs-fixer on line 62\n\nCall Stack:\n    0.0041     365448   1. {main}() \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/php-cs-fixer:0\n\nFatal error: main(): Failed opening required '\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/vendor\/autoload.php' (include_path='.:\/usr\/local\/Cellar\/php@7.1\/7.1.19\/share\/php@7.1\/pear') in \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/php-cs-fixer on line 62\n\nCall Stack:\n    0.0041     365448   1. {main}() \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/php-cs-fixer:0\n\nYou can fix all errors by running following commands:\n'\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/php-cs-fixer' '--allow-risky=yes' '--config=.php_cs.dist' '--using-cache=yes' '--verbose' 'fix'\nERROR: Ruleset \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/phpcs.xml is not valid\n\nRun \"phpcs --help\" for usage information\n\nWarning: require(\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/parallel-lint.php): failed to open stream: No such file or directory in \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/parallel-lint on line 4\n\nCall Stack:\n    0.0035     352864   1. {main}() \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/parallel-lint:0\n\nFatal error: require(): Failed opening required '\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/parallel-lint.php' (include_path='.:\/usr\/local\/Cellar\/php@7.1\/7.1.19\/share\/php@7.1\/pear') in \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/parallel-lint on line 4\n\nCall Stack:\n    0.0035     352864   1. {main}() \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/parallel-lint:0\n\nPHP Warning:  require(\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/parallel-lint.php): failed to open stream: No such file or directory in \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/parallel-lint on line 4\nPHP Stack trace:\nPHP   1. {main}() \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/parallel-lint:0\nPHP Fatal error:  require(): Failed opening required '\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/parallel-lint.php' (include_path='.:\/usr\/local\/Cellar\/php@7.1\/7.1.19\/share\/php@7.1\/pear') in \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/parallel-lint on line 4\nPHP Stack trace:\nPHP   1. {main}() \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/parallel-lint:0\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:33     The class Widget_Name has 12 public methods. Consider refactoring Widget_Name to keep number of public methods under 10.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:33     The class Widget_Name is not named in CamelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:33     The property$widget_slug is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:97     The method get_widget_slug is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:111    The variable$widget_string is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:111    The variable$before_widget is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:111    The variable$widget_string is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:111    The variable$widget_string is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:111    The variable$after_widget is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:111    The variable$widget_string is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:111    The variable$widget_string is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:111    Avoid unusedparameters such as '$instance'.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:131    Avoid unusedlocal variables such as '$before_widget'.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:137    Avoid unusedlocal variables such as '$after_widget'.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:149    The method flush_widget_cache is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:159    The parameter $new_instance is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:159    The parameter $old_instance is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:159    The variable$old_instance is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:159    Avoid unusedparameters such as '$new_instance'.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:195    The method widget_textdomain is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:207    The parameter $network_wide is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:207    Avoid unusedparameters such as '$network_wide'.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:216    The parameter $network_wide is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:216    Avoid unusedparameters such as '$network_wide'.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:223    The method register_admin_styles is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:232    The method register_admin_scripts is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:241    The method register_widget_styles is not named in camelCase.\n\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/src\/Plugin.php:250    The method register_widget_scripts is not named in camelCase.\n[FATAL] \/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/phpcs.xml: Premature end of data in tag ruleset line 2\n (77) on line 28,12<\/code><\/pre>\n<p>\u0418 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0432\u0441\u0435 \u044d\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430:<\/p>\n<pre><code>$ vendor\/bin\/grumphp run<\/code><\/pre>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u0444\u0430\u0439\u043b\u043e\u0432. \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u043f\u043b\u0430\u0433\u0438\u043d\u0430 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a <strong>Plugin.php<\/strong>) \u043d\u0430 \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<p>\u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u043b\u0430\u0433\u0438\u043d\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u043f\u043b\u0430\u0433\u0438\u043d\u0430. \u0418\u0442\u0430\u043a, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u043f\u043b\u0430\u0433\u0438\u043d\u0430.<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h3>\n<p>\u0412 \u043a\u043e\u0440\u043d\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <strong>wordpress-widget-boilerplate.php.<\/strong> \u0417\u0430\u0442\u0435\u043c <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/dce6bda0d104192a21cb06dc7d3ca23c#file-01-wordpress-widget-boilerplate-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043a \u043d\u0435\u043c\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435<\/a><\/strong> :<\/p>\n<pre><code>&lt;?php\n\/**\n * WordPress Widget Boilerplate\n *\n * The WordPress Widget Boilerplate is an organized, maintainable boilerplate for building widgets using WordPress best practices.\n *\n * @package   Widget_Name\n * @author    Your Name &lt;email@example.com&gt;\n * @license   GPL-2.0+\n * @link      http:\/\/example.com\n * @copyright 2018 Your Name or Company Name\n *\n * @wordpress-plugin\n * Plugin Name:       @TODO\n * Plugin URI:        @TODO\n * Description:       @TODO\n * Version:           1.0.0\n * Author:            @TODO\n * Author URI:        @TODO\n * Text Domain:       widget-name\n * License:           GPL-3.0+\n * License URI:       http:\/\/www.gnu.org\/licenses\/gpl-3.0.txt\n * Domain Path:       \/lang\n * GitHub Plugin URI: https:\/\/github.com\/&lt;owner&gt;\/&lt;repo&gt;\n *\/\n\n\/\/ Prevent this file from being called directly.\ndefined('WPINC') || die;\n\n\/\/ Include the autoloader.\nrequire_once __DIR__. '\/inc\/autoload.php';\n<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 \u0432\u044b\u0448\u0435; \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043f\u043b\u0430\u0433\u0438\u043d\u0430, \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0430\u0439\u043b\u0443, \u0430 \u0437\u0430\u0442\u0435\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0430\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 Composer.<\/p>\n<h3>\u041e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u043b\u0430\u0433\u0438\u043d<\/h3>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u043d\u043e, \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0430\u0439\u043b <strong>Plugin.php<\/strong> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/dce6bda0d104192a21cb06dc7d3ca23c#file-02-plugin-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/a><\/strong><\/p>\n<pre><code>&lt;?php\n\n\/\/ TODO: change 'Widget_Name' to the name of your plugin\nclass Widget_Name extends WP_Widget {\n\n    \/**\n     * @TODO - Rename \"widget-name\" to the name your your widget\n     *\n     * Unique identifier for your widget.\n     *\n     *\n     * The variable name is used as the text domain when internationalizing strings\n     * of text. Its value should match the Text Domain file header in the main\n     * widget file.\n     *\n     * @since    1.0.0\n     *\n     * @var      string\n     *\/\n    protected $widget_slug = 'widget-name';\n\n    \/*--------------------------------------------------*\/\n    \/* Constructor\n    \/*--------------------------------------------------*\/\n\n    \/**\n     * Specifies the classname and description, instantiates the widget,\n     * loads localization files, and includes necessary stylesheets and JavaScript.\n     *\/\n    public function __construct() {\n\n        \/\/ load plugin text domain\n        add_action( 'init', array( $this, 'widget_textdomain') );\n\n        \/\/ TODO: update description\n        parent::__construct(\n            $this-&gt;get_widget_slug(),\n            __( 'Widget Name', $this-&gt;get_widget_slug() ),\n            array(\n                'classname'  =&gt; $this-&gt;get_widget_slug().'-class',\n                'description' =&gt; __( 'Short description of the widget goes here.', $this-&gt;get_widget_slug())) );\n\n        \/\/ Register admin styles and scripts\n        add_action( 'admin_print_styles', array( $this, 'register_admin_styles') );\n        add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts') );\n\n        \/\/ Register site styles and scripts\n        add_action( 'wp_enqueue_scripts', array( $this, 'register_widget_styles') );\n        add_action( 'wp_enqueue_scripts', array( $this, 'register_widget_scripts') );\n\n        \/\/ Refreshing the widget's cached output with each new post\n        add_action( 'save_post',    array( $this, 'flush_widget_cache') );\n        add_action( 'deleted_post', array( $this, 'flush_widget_cache') );\n        add_action( 'switch_theme', array( $this, 'flush_widget_cache') );\n\n    } \/\/ end constructor\n\n    \/**\n     * Return the widget slug.\n     *\n     * @since    1.0.0\n     *\n     * @return    Plugin slug variable.\n     *\/\n    public function get_widget_slug() {\n        return $this-&gt;widget_slug;\n    }\n\n    \/*--------------------------------------------------*\/\n    \/* Widget API Functions\n    \/*--------------------------------------------------*\/\n\n    \/**\n     * Outputs the content of the widget.\n     *\n     * @param array args  The array of form elements\n     * @param array instance The current instance of the widget\n     *\/\n    public function widget( $args, $instance) {\n\n        \/\/ Check if there is a cached output\n        $cache = wp_cache_get( $this-&gt;get_widget_slug(), 'widget' );\n\n        if (!is_array( $cache)) $cache = array();\n\n        if (! isset ($args['widget_id'])) $args['widget_id'] = $this-&gt;id;\n\n        if (isset ($cache[ $args['widget_id'] ])) return print $cache[ $args['widget_id'] ];\n\n        \/\/ go on with your widget logic, put everything into a string and \u2026\n\n        extract( $args, EXTR_SKIP );\n\n        $widget_string = $before_widget;\n\n        \/\/ TODO: Here is where you manipulate your widget's values based on their input fields\n        ob_start();\n        include( plugin_dir_path( __FILE__ ). 'views\/widget.php' );\n        $widget_string .= ob_get_clean();\n        $widget_string .= $after_widget;\n\n        $cache[ $args['widget_id'] ] = $widget_string;\n\n        wp_cache_set( $this-&gt;get_widget_slug(), $cache, 'widget' );\n\n        print $widget_string;\n\n    } \/\/ end widget\n\n    public function flush_widget_cache()\n    {\n        wp_cache_delete( $this-&gt;get_widget_slug(), 'widget' );\n    }\n    \/**\n     * Processes the widget's options to be saved.\n     *\n     * @param array new_instance The new instance of values to be generated via the update.\n     * @param array old_instance The previous instance of values before the update.\n     *\/\n    public function update( $new_instance, $old_instance) {\n\n        $instance = $old_instance;\n\n        \/\/ TODO: Here is where you update your widget's old values with the new, incoming values\n\n        return $instance;\n\n    } \/\/ end update\n\n    \/**\n     * Generates the administration form for the widget.\n     *\n     * @param array instance The array of keys and values for the widget.\n     *\/\n    public function form( $instance) {\n\n        \/\/ TODO: Define default values for your variables\n        $instance = wp_parse_args(\n            (array) $instance\n        );\n\n        \/\/ TODO: Store the values of the widget in their own variable\n\n        \/\/ Display the admin form\n        include( plugin_dir_path(__FILE__). 'views\/admin.php' );\n\n    } \/\/ end form\n\n    \/*--------------------------------------------------*\/\n    \/* Public Functions\n    \/*--------------------------------------------------*\/\n\n    \/**\n     * Loads the Widget's text domain for localization and translation.\n     *\/\n    public function widget_textdomain() {\n\n        \/\/ TODO be sure to change 'widget-name' to the name of *your* plugin\n        load_plugin_textdomain( $this-&gt;get_widget_slug(), false, dirname( plugin_basename( __FILE__) ). 'lang\/' );\n\n    } \/\/ end widget_textdomain\n\n    \/**\n     * Fired when the plugin is activated.\n     *\n     * @param  boolean $network_wide True if WPMU superadmin uses \"Network Activate\" action, false if WPMU is disabled or plugin is activated on an individual blog.\n     *\/\n    public static function activate( $network_wide) {\n        \/\/ TODO define activation functionality here\n    } \/\/ end activate\n\n    \/**\n     * Fired when the plugin is deactivated.\n     *\n     * @param boolean $network_wide True if WPMU superadmin uses \"Network Activate\" action, false if WPMU is disabled or plugin is activated on an individual blog\n     *\/\n    public static function deactivate( $network_wide) {\n        \/\/ TODO define deactivation functionality here\n    } \/\/ end deactivate\n\n    \/**\n     * Registers and enqueues admin-specific styles.\n     *\/\n    public function register_admin_styles() {\n\n        wp_enqueue_style( $this-&gt;get_widget_slug().'-admin-styles', plugins_url( 'css\/admin.css', __FILE__) );\n\n    } \/\/ end register_admin_styles\n\n    \/**\n     * Registers and enqueues admin-specific JavaScript.\n     *\/\n    public function register_admin_scripts() {\n\n        wp_enqueue_script( $this-&gt;get_widget_slug().'-admin-script', plugins_url( 'js\/admin.js', __FILE__ ), array('jquery') );\n\n    } \/\/ end register_admin_scripts\n\n    \/**\n     * Registers and enqueues widget-specific styles.\n     *\/\n    public function register_widget_styles() {\n\n        wp_enqueue_style( $this-&gt;get_widget_slug().'-widget-styles', plugins_url( 'css\/widget.css', __FILE__) );\n\n    } \/\/ end register_widget_styles\n\n    \/**\n     * Registers and enqueues widget-specific scripts.\n     *\/\n    public function register_widget_scripts() {\n\n        wp_enqueue_script( $this-&gt;get_widget_slug().'-script', plugins_url( 'js\/widget.js', __FILE__ ), array('jquery') );\n\n    } \/\/ end register_widget_scripts\n\n} \/\/ end class\n\n\/\/ TODO: Remember to change 'Widget_Name' to match the class name definition\nadd_action( 'widgets_init', create_function( '', 'register_widget(\"Widget_Name\");') );\n\n\/\/ Hooks fired when the Widget is activated and deactivated\n\/\/ TODO: Remember to change 'Widget_Name' to match the class name definition\nregister_activation_hook( __FILE__, array( 'Widget_Name', 'activate') );\nregister_deactivation_hook( __FILE__, array( 'Widget_Name', 'deactivate') );\n<\/code><\/pre>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0435\u0449\u0435 \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b, \u043d\u043e \u043f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044d\u0442\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u043e\u0447\u0438\u0441\u0442\u043a\u0443 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b \u043e\u0442 \u0435\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435, \u043d\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0432 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u0432\u044b\u0432\u043e\u0434\u0443 GrumPHP. \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u0442\u0440\u043e\u043a\u0443, \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u044d\u0442\u043e\u0439:<\/p>\n<pre><code>You can fix all errors by running following commands:\n'\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/php-cs-fixer' '--allow-risky=yes' '--config=.php_cs.dist' '--using-cache=yes' '--verbose' 'fix'<\/code><\/pre>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u044d\u0442\u043e \u0432 \u0441\u0432\u043e\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b:<\/p>\n<pre><code>'\/Users\/tommcfarlin\/Dropbox\/Projects\/trunk\/wp-content\/plugins\/WordPress-Widget-Boilerplate\/vendor\/bin\/php-cs-fixer' '--allow-risky=yes' '--config=.php_cs.dist' '--using-cache=yes' '--verbose' 'fix'<\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044f, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0432\u044b\u0432\u043e\u0434\u0430<\/h4>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043a\u0430\u043a\u0443\u044e-\u043b\u0438\u0431\u043e \u043e\u0448\u0438\u0431\u043a\u0443 \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u044d\u0442\u043e, \u0432\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <strong>\u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430<\/strong> \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u0430\u0442\u0430\u043b\u043e\u0433. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0442\u0430\u043a, \u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u044d\u0442\u043e:<\/p>\n<pre><code>$ composer update<\/code><\/pre>\n<p>\u0418 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 \u0440\u0435\u0448\u0438\u0442 \u0432\u0430\u0448\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435:<\/p>\n<pre><code>$ rm -rf vendor\n$ composer update<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n<h3>\u041d\u0430\u0437\u0430\u0434 \u043a \u0432\u044b\u0432\u043e\u0434\u0443<\/h3>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0432\u044b\u0432\u043e\u0434:<\/p>\n<p><a href=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-161324-61e71fbbbfefa.png\" data-rel=\"lightbox\"><img decoding=\"async\" class=\"SDStudio-light-box-enable SDStudio-editor-tools-md-imp\" src=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-161324-61e71fbbbfefa.png\" alt=\"\u0412\u0438\u0434\u0436\u0435\u0442\u044b WordPress: \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433, \u0447\u0430\u0441\u0442\u044c 2\"><\/a><\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435:<\/p>\n<pre><code>$ vendor\/grumphp\/run<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u043c\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0421\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043b\u0438\u043d\u043d\u044b\u0439, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u0437\u0434\u0435\u0441\u044c, \u043d\u043e \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/dce6bda0d104192a21cb06dc7d3ca23c#file-03-coding-standards-txt\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:<\/a><\/strong><\/p>\n<pre><code>----------------------------------------------------------------------\nFOUND 9 ERRORS AFFECTING 8 LINES\n----------------------------------------------------------------------<\/code><\/pre>\n<p>\u0418 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u043c\u0438 PSR2. \u0418\u0442\u0430\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441.<\/p>\n<h3>\u0420\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0432\u0438\u0434\u0436\u0435\u0442\u0430<\/h3>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044f, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0432 Visual Studio Code, \u0432\u044b, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0432 \u0441\u0432\u043e\u0435\u0439 \u0441\u0440\u0435\u0434\u0435 IDE \u0438\u0437\u0440\u044f\u0434\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430.<\/p>\n<p><a href=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-161324-61e71fbfb62de.png\" data-rel=\"lightbox\"><img decoding=\"async\" class=\"SDStudio-light-box-enable SDStudio-editor-tools-md-imp\" src=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-161324-61e71fbfb62de.png\" alt=\"\u0412\u0438\u0434\u0436\u0435\u0442\u044b WordPress: \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433, \u0447\u0430\u0441\u0442\u044c 2\"><\/a><\/p>\n<p>\u042d\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c. \u0418\u0442\u0430\u043a, \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u043f\u0440\u043e\u0439\u0442\u0438 \u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0434. \u0422\u043e\u0433\u0434\u0430 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u043a\u043e\u0434\u043e\u043c \u0437\u0434\u0435\u0441\u044c (\u0431\u0435\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0440\u0430\u0434\u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438 \u043c\u0435\u0441\u0442\u0430).<\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044f, \u0447\u0442\u043e \u0432\u044b \u0432\u043d\u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0443 \u0432\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0447\u0442\u043e-\u0442\u043e <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/dce6bda0d104192a21cb06dc7d3ca23c#file-04-wordpress-widget-boilerplate-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:<\/a><\/strong><\/p>\n<pre><code>&lt;?php\n\nnamespace WordPressWidgetBoilerplate;\n\nclass Plugin extends WP_Widget\n{\n    protected $widgetSlug = 'widget-name';\n\n    public function __construct()\n    {\n        add_action('init', [$this, 'widgetTextdomain']);\n\n        parent::__construct(\n            $this-&gt;getWidgetSlug(),\n            __('Widget Name', $this-&gt;getWidgetSlug()),\n            [\n                'classname' =&gt; $this-&gt;getWidgetSlug().'-class',\n                'description' =&gt; __('Short description of the widget goes here.', $this-&gt;getWidgetSlug()),\n            ]\n        );\n\n        add_action('admin_print_styles', [$this, 'registerAdminStyles']);\n        add_action('admin_enqueue_scripts', [$this, 'registerAdminScripts']);\n\n        add_action('wp_enqueue_scripts', [$this, 'registerWidgetStyles']);\n        add_action('wp_enqueue_scripts', [$this, 'registerWidgetScripts']);\n\n        add_action('save_post', [$this, 'flushWidgetCache']);\n        add_action('deleted_post', [$this, 'flushWidgetCache']);\n        add_action('switch_theme', [$this, 'flushWidgetCache']);\n    }\n\n    public function getWidgetSlug()\n    {\n        return $this-&gt;widgetSlug;\n    }\n\n    public function widget($args, $instance)\n    {\n        \/\/ Check if there is a cached output\n        $cache = wp_cache_get($this-&gt;getWidgetSlug(), 'widget');\n\n        if (!is_array($cache)) {\n            $cache = [];\n        }\n\n        if (!isset($args['widget_id'])) {\n            $args['widget_id'] = $this-&gt;id;\n        }\n\n        if (isset($cache[$args['widget_id']])) {\n            return print $cache[$args['widget_id']];\n        }\n\n        extract($args, EXTR_SKIP);\n\n        $widgetString = $beforeWidget;\n\n        ob_start();\n        include plugin_dir_path(__FILE__).'views\/widget.php';\n        $widgetString .= ob_get_clean();\n        $widgetString .= $afterWidget;\n\n        $cache[$args['widget_id']] = $widgetString;\n\n        wp_cache_set($this-&gt;getWidgetSlug(), $cache, 'widget');\n\n        echo $widgetString;\n    }\n\n    public function flushWidgetCache()\n    {\n        wp_cache_delete($this-&gt;getWidgetSlug(), 'widget');\n    }\n\n    public function update($newInstance, $oldInstance)\n    {\n        $instance = $oldInstance;\n\n        \/\/ TODO: Here is where you update your widget's old values with the new, incoming values\n\n        return $instance;\n    }\n\n    public function form($instance)\n    {\n        \/\/ TODO: Define default values for your variables\n        $instance = wp_parse_args(\n            (array) $instance\n        );\n\n        \/\/ TODO: Store the values of the widget in their own variable\n\n        \/\/ Display the admin form\n        include plugin_dir_path(__FILE__).'views\/admin.php';\n    }\n\n    public function widgetTextdomain()\n    {\n        \/\/ TODO: be sure to change 'widget-name' to the name of *your* plugin\n        load_plugin_textdomain($this-&gt;getWidgetSlug(), false, dirname(plugin_basename(__FILE__)).'lang\/');\n    }\n\n    public static function activate($networkWide)\n    {\n        \/\/ TODO: define activation functionality here\n    }\n\n    public static function deactivate($networkWide)\n    {\n        \/\/ TODO:define deactivation functionality here\n    }\n\n    public function registerAdminStyles()\n    {\n        wp_enqueue_style($this-&gt;getWidgetSlug().'-admin-styles', plugins_url('css\/admin.css', __FILE__));\n    }\n\n    public function registerAdminScripts()\n    {\n        wp_enqueue_script($this-&gt;getWidgetSlug().'-admin-script', plugins_url('js\/admin.js', __FILE__), ['jquery']);\n    }\n\n    public function registerWidgetStyles()\n    {\n        wp_enqueue_style($this-&gt;getWidgetSlug().'-widget-styles', plugins_url('css\/widget.css', __FILE__));\n    }\n\n    public function registerWidgetScripts()\n    {\n        wp_enqueue_script($this-&gt;getWidgetSlug().'-script', plugins_url('js\/widget.js', __FILE__), ['jquery']);\n    }\n}\n<\/code><\/pre>\n<p>\u0415\u0449\u0435 \u0440\u0430\u0437 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435:<\/p>\n<pre><code>$ vendor\/bin\/grumphp run<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u043a\u0430\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0443 \u0432\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u0412\u044b \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0431\u0443\u0434\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043e\u0448\u0438\u0431\u043e\u043a, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438:<\/p>\n<blockquote>\n<p>\u0418\u0437\u0431\u0435\u0433\u0430\u0439\u0442\u0435 \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u2026<\/p>\n<\/blockquote>\n<p>\u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043a\u043e\u0434\u0430 \u043d\u0435 \u0445\u043e\u0442\u044f\u0442, \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f; \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u043c\u044b, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>\u0422\u0430\u043a \u0447\u0442\u043e, \u0441 \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u044c\u044e, \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f \u043e\u0431 \u044d\u0442\u043e\u043c. \u041c\u044b \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u044d\u0442\u0438\u043c, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0434\u0435\u0442 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<h2>\u0414\u043e \u041f\u0421\u0420<\/h2>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0431\u044b\u043b\u0430 \u043a\u0443\u043f\u043b\u0435\u043d\u0430 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u043c\u0438 PSR \u0438 \u0438\u043c\u0435\u0435\u0442 \u0441\u043e\u043b\u0438\u0434\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043b\u0435\u0434\u0438\u0442\u0435 \u0437\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u043c, \u0432\u0435\u0442\u043a\u0430 <strong><a href=\"https:\/\/github.com\/tommcfarlin\/WordPress-Widget-Boilerplate\/tree\/develop\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/a><\/strong> \u0431\u044b\u043b\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0440\u0430\u0437\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0435\u0435 \u0438 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u0434.<\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u043d\u0430\u0447\u043d\u0435\u043c \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u043a\u043e\u0434\u0430 \u0432 \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043c\u0430\u043d\u0435\u0440\u0435.<\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0437\u0430\u043f\u0438\u0441\u0438:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/tommcfarlin.com\" class=\"external external_icon\">tommcfarlin.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0434\u0430\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f WordPress Widget Boilerplate, \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0441\u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0441 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u043c\u0438.<\/p>\n","protected":false},"author":1,"featured_media":236238,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[809,870,900,726,850],"tags":[1171],"class_list":["post-219458","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php-ru","category-wordpress-ru","category-kod-2","category-rozrobnyk-ru","category-uchebniki-ru","tag-affiai-ru"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts\/219458","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/comments?post=219458"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts\/219458\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/media\/236238"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/media?parent=219458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/categories?post=219458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/tags?post=219458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}