From f8b5de7c0dea3f68e55fcb7fca1b48bbc511da61 Mon Sep 17 00:00:00 2001 From: Krzysztof Dyszczyk <krzysiek@wpdesk.net> Date: Tue, 7 Feb 2023 13:58:21 +0000 Subject: [PATCH] Revert "Merge branch 'feat/lang' into 'master'" This reverts merge request !33 --- .editorconfig | 78 +++------------------------------- .gitignore | 14 ------ .gitlab/issue_templates/Bug.md | 32 ++++++++++++++ CHANGELOG.md | 8 +--- composer.json | 73 ++++++++++++++----------------- lang/pl_PL.po | 38 ----------------- src/Plugin/AbstractPlugin.php | 47 ++++++-------------- 7 files changed, 83 insertions(+), 207 deletions(-) create mode 100644 .gitlab/issue_templates/Bug.md delete mode 100644 lang/pl_PL.po diff --git a/.editorconfig b/.editorconfig index a8487df..d8c5892 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,8 +4,6 @@ # WordPress Coding Standards # https://make.wordpress.org/core/handbook/coding-standards/ -# Configuration for PhpStorm - root = true [*] @@ -14,76 +12,10 @@ end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true indent_style = tab -indent_size = 4 -tab_width = 4 -ij_continuation_indent_size = 4 - -[{*.scss,*.css}] -ij_scss_enforce_quotes_on_format = true -ij_scss_hex_color_long_format = true -ij_scss_hex_color_lower_case = true - -[{*.cjs,*.js}] -ij_javascript_do_while_brace_force = always -ij_javascript_if_brace_force = always -ij_javascript_import_sort_module_name = true -ij_javascript_reformat_c_style_comments = true -ij_javascript_space_after_unary_not = true -ij_javascript_space_before_unary_not = true -ij_javascript_spaces_within_array_initializer_brackets = true -ij_javascript_spaces_within_brackets = true -ij_javascript_spaces_within_catch_parentheses = true -ij_javascript_spaces_within_for_parentheses = true -ij_javascript_spaces_within_if_parentheses = true -ij_javascript_spaces_within_imports = true -ij_javascript_spaces_within_interpolation_expressions = true -ij_javascript_spaces_within_method_call_parentheses = true -ij_javascript_spaces_within_method_parentheses = true -ij_javascript_spaces_within_object_literal_braces = true -ij_javascript_spaces_within_parentheses = true -ij_javascript_spaces_within_switch_parentheses = true -ij_javascript_spaces_within_while_parentheses = true -ij_javascript_while_brace_force = always -[{*.ctp,*.hphp,*.inc,*.module,*.php,*.php4,*.php5,*.phtml}] -ij_php_align_assignments = true -ij_php_align_class_constants = true -ij_php_align_key_value_pairs = true -ij_php_align_phpdoc_comments = true -ij_php_align_phpdoc_param_names = true -ij_php_class_brace_style = end_of_line -ij_php_comma_after_last_array_element = true -ij_php_else_if_style = combine -ij_php_force_short_declaration_array_style = true -ij_php_getters_setters_naming_style = snake_case -ij_php_if_brace_force = always -ij_php_lower_case_boolean_const = true -ij_php_lower_case_null_const = true -ij_php_method_brace_style = end_of_line -ij_php_phpdoc_blank_line_before_tags = true -ij_php_phpdoc_blank_lines_around_parameters = true -ij_php_phpdoc_keep_blank_lines = false -ij_php_phpdoc_wrap_long_lines = true -ij_php_space_after_type_cast = true -ij_php_space_after_unary_not = true -ij_php_space_before_unary_not = true -ij_php_spaces_around_var_within_brackets = true -ij_php_spaces_within_array_initializer_braces = true -ij_php_spaces_within_catch_parentheses = true -ij_php_spaces_within_for_parentheses = true -ij_php_spaces_within_if_parentheses = true -ij_php_spaces_within_method_call_parentheses = true -ij_php_spaces_within_method_parentheses = true -ij_php_spaces_within_parentheses = true -ij_php_spaces_within_switch_parentheses = true -ij_php_spaces_within_while_parentheses = true -ij_php_ternary_operation_signs_on_next_line = true -ij_php_variable_naming_style = snake_case +[*.yml] +indent_style = space +indent_size = 2 -[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}] -ij_html_add_new_line_before_tags = div,p,a -ij_html_align_attributes = false -ij_html_do_not_indent_children_of_tags = html,thead,tbody,tfoot -ij_html_new_line_after_last_attribute = when multiline -ij_html_space_inside_empty_tag = true -ij_html_uniform_ident = true +[*.md] +trim_trailing_whitespace = false \ No newline at end of file diff --git a/.gitignore b/.gitignore index 773e4ea..30babff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,3 @@ -/.gitlab/ -/tmp_artifacts/ /vendor/ -/vendor_prefixed/ -/.webpack/node_modules/ -/.webpack/v8-compile-cache-0/ .idea -build-coverage -.DS_Store -.commit -lang/wpdesk-wp-builder-pl_PL.po -wpdesk-wp-builder-pl_PL.po -lang/wpdesk-wp-builder-pl_PL.mo -wpdesk-wp-builder-pl_PL.mo -assets/css/admin.css.map composer.lock -.phpcs-cache diff --git a/.gitlab/issue_templates/Bug.md b/.gitlab/issue_templates/Bug.md new file mode 100644 index 0000000..fb98b9e --- /dev/null +++ b/.gitlab/issue_templates/Bug.md @@ -0,0 +1,32 @@ +### Select WooCommerce version e.g: [x] 2.6 +<!--- Select the WooCommerce version on which the error occurred --> + +- [ ] [2.6](http://woo26.tests.wpdesk.org) +- [ ] [2.7](http://woo27.tests.wpdesk.org) +- [ ] [3.0](http://woo30.tests.wpdesk.org) +- [ ] [3.1](http://woo31.tests.wpdesk.org) +- [ ] [3.2](http://woo32.tests.wpdesk.org) +- [ ] [3.3](http://woo33.tests.wpdesk.org) +- [ ] [3.4](http://woo34.tests.wpdesk.org) +- [ ] [Stable](https://stable.wpdesk.org/) + +### Select PHP version e.g: [x] 5.6 +<!--- Select the PHP version on which the error occurred --> + +- [ ] 5.3 +- [ ] 5.5 +- [ ] 5.6 +- [ ] 7.1 +- [ ] 7.2 + +## Steps to Reproduce +<!--- Provide a link to a live example, or an unambiguous set of steps to --> + +1. +2. + + +## Expected Behavior +<!--- Tell what should happen --> + +1. \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ffcafe..5e63a15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,4 @@ -## [2.1.0] - 2022-12-15 -### Added -- plugin path -- plugin lang -- scripts version - -## [2.0.0] - 2021-01-07 +## [2.0.0] - 2021-00-07 ### Added - plugin shops in WPDesk_Plugin_Info diff --git a/composer.json b/composer.json index 4886956..426d7d1 100644 --- a/composer.json +++ b/composer.json @@ -1,44 +1,33 @@ { - "name": "wpdesk/wp-builder", - "authors": [ - { - "name": "Krzysiek", - "email": "krzysiek@wpdesk.pl" - } - ], - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "<7", - "wp-coding-standards/wpcs": "^0.14.1", - "squizlabs/php_codesniffer": "^3.0.2", - "mockery/mockery": "*", - "10up/wp_mock": "*", - "wimg/php-compatibility": "^8" - }, - "autoload": { - "psr-4": { - "WPDesk\\PluginBuilder\\": "src/" - }, - "classmap": [ - "src/Plugin/WithoutNamespace" - ] - }, - "autoload-dev": { - }, - "extra": { - "text-domain": "wpdesk-wp-builder", - "translations-folder": "lang", - "po-files": { - "pl_PL": "pl_PL.po" - } - }, - "scripts": { - "phpcs": "phpcs", - "phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never", - "phpunit-unit-fast": "phpunit --configuration phpunit-unit.xml --no-coverage", - "phpunit-integration": "phpunit --configuration phpunit-integration.xml --coverage-text --colors=never", - "phpunit-integration-fast": "phpunit --configuration phpunit-integration.xml --no-coverage" - } + "name": "wpdesk/wp-builder", + "authors": [ + { + "name": "Krzysiek", + "email": "krzysiek@wpdesk.pl" + } + ], + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "<7", + "wp-coding-standards/wpcs": "^0.14.1", + "squizlabs/php_codesniffer": "^3.0.2", + "mockery/mockery": "*", + "10up/wp_mock": "*", + "wimg/php-compatibility": "^8" + }, + "autoload": { + "psr-4": {"WPDesk\\PluginBuilder\\": "src/"}, + "classmap": ["src/Plugin/WithoutNamespace"] + }, + "autoload-dev": { + }, + "scripts": { + "phpcs": "phpcs", + "phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never", + "phpunit-unit-fast": "phpunit --configuration phpunit-unit.xml --no-coverage", + "phpunit-integration": "phpunit --configuration phpunit-integration.xml --coverage-text --colors=never", + "phpunit-integration-fast": "phpunit --configuration phpunit-integration.xml --no-coverage" + } } diff --git a/lang/pl_PL.po b/lang/pl_PL.po deleted file mode 100644 index d841808..0000000 --- a/lang/pl_PL.po +++ /dev/null @@ -1,38 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: Flexible Invoices Advanced Filters 1.0.0\n" -"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/flexible-invoices-" -"advanced-filters\n" -"POT-Creation-Date: 2022-11-05 10:34+0100\n" -"PO-Revision-Date: 2022-11-05 10:34+0100\n" -"Last-Translator: \n" -"Language-Team: \n" -"Language: pl_PL\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\n" -"X-Generator: Poedit 3.2.1\n" -"X-Domain: flexible-invoices-filters\n" -"X-Poedit-Basepath: ..\n" -"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" -"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;" -"\"\n" -"X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-SearchPath-0: .\n" -"X-Poedit-SearchPathExcluded-0: vendor_prefixed\n" -"X-Poedit-SearchPathExcluded-1: vendor\n" -"X-Poedit-SearchPathExcluded-2: tests\n" - -#: src/Plugin/AbstractPlugin.php:201 -msgid "Support" -msgstr "Wsparcie" - -#: src/Plugin/AbstractPlugin.php:207 -msgid "Docs" -msgstr "Dokumentacja" - -#: src/Plugin/AbstractPlugin.php:214 -msgid "Settings" -msgstr "Ustawienia" diff --git a/src/Plugin/AbstractPlugin.php b/src/Plugin/AbstractPlugin.php index dfb1eff..61c1569 100644 --- a/src/Plugin/AbstractPlugin.php +++ b/src/Plugin/AbstractPlugin.php @@ -4,7 +4,10 @@ namespace WPDesk\PluginBuilder\Plugin; /** * Base plugin with most basic functionalities used by every WPDesk plugin. + * + * * Known issues: + * * The class name is too generic but can't be changed as it would introduce a major incompatibility for most of the plugins. * The $plugin_url, $docs_url and most other fields should be removed as they only litter the place but for compatibility reasons we can't do it right now. * Hook methods should be moved to external classes but for compatibility reasons we can't do it right now. @@ -70,12 +73,14 @@ abstract class AbstractPlugin extends SlimPlugin { * * @return void * @deprecated Just use __construct to initialize plugin internal state. + * */ public function init_base_variables() { } /** * Initializes plugin external state. + * * The plugin internal state is initialized in the constructor and the plugin should be internally consistent after creation. * The external state includes hooks execution, communication with other plugins, integration with WC etc. * @@ -121,15 +126,6 @@ abstract class AbstractPlugin extends SlimPlugin { return esc_url( trailingslashit( $this->plugin_url ) ); } - /** - * Returns plugin path. - * - * @return string - */ - public function get_plugin_path() { - return trailingslashit( $this->plugin_info->get_plugin_dir() ); - } - /** * Returns plugin absolute URL to dir with front end assets. * @@ -142,6 +138,7 @@ abstract class AbstractPlugin extends SlimPlugin { /** * @return $this * @deprecated For backward compatibility. + * */ public function get_plugin() { return $this; @@ -156,9 +153,11 @@ abstract class AbstractPlugin extends SlimPlugin { add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] ); add_action( 'wp_enqueue_scripts', [ $this, 'wp_enqueue_scripts' ] ); add_action( 'plugins_loaded', [ $this, 'load_plugin_text_domain' ] ); - add_filter( 'plugin_action_links_' . plugin_basename( $this->get_plugin_file_path() ), [ $this, 'links_filter' ] ); + add_filter( 'plugin_action_links_' . plugin_basename( $this->get_plugin_file_path() ), [ + $this, + 'links_filter' + ] ); } - /** * Initialize plugin test domain. This is a hook function. Do not execute directly. * @@ -171,11 +170,9 @@ abstract class AbstractPlugin extends SlimPlugin { /** * Append JS scripts in the WordPress admin panel. This is a hook function. Do not execute directly. * - * @param string $hook_suffix The current admin page passed from WordPress filter. - * * @return void */ - public function admin_enqueue_scripts( $hook_suffix = '' ) { + public function admin_enqueue_scripts() { } /** @@ -186,22 +183,6 @@ abstract class AbstractPlugin extends SlimPlugin { public function wp_enqueue_scripts() { } - /** - * @param string $prefix - * - * @return string - */ - public function get_scripts_version( $prefix = '' ) { - return $prefix . $this->plugin_info->get_version(); - } - - /** - * @return int - */ - public function get_random_script_version() { - return time(); - } - /** * Initialize plugin admin links. This is a hook function. Do not execute directly. * @@ -217,20 +198,20 @@ abstract class AbstractPlugin extends SlimPlugin { } $plugin_links = [ - '<a target="_blank" href="' . $support_link . '">' . esc_html__( 'Support', $this->get_text_domain() ) . '</a>', + '<a target="_blank" href="' . $support_link . '">' . __( 'Support', $this->get_text_domain() ) . '</a>', ]; $links = array_merge( $plugin_links, $links ); if ( $this->docs_url ) { $plugin_links = [ - '<a target="_blank" href="' . $this->docs_url . '">' . esc_html__( 'Docs', $this->get_text_domain() ) . '</a>', + '<a target="_blank" href="' . $this->docs_url . '">' . __( 'Docs', $this->get_text_domain() ) . '</a>', ]; $links = array_merge( $plugin_links, $links ); } if ( $this->settings_url ) { $plugin_links = [ - '<a href="' . $this->settings_url . '">' . esc_html__( 'Settings', $this->get_text_domain() ) . '</a>', + '<a href="' . $this->settings_url . '">' . __( 'Settings', $this->get_text_domain() ) . '</a>', ]; $links = array_merge( $plugin_links, $links ); } -- GitLab