From 83249d88ca2b99db61ca475da917fb5e86a922d9 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sun, 17 Mar 2024 11:55:14 +0100 Subject: [PATCH 1/4] chore: remove unused PHP 5.4 dependencies We support >= 7, so the 5.4 stuff is obsolete. Remove it. --- .github/workflows/tests.yml | 5 +---- composer-php-5-4.json | 43 ------------------------------------- 2 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 composer-php-5-4.json diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e7b91e45..dd315348 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,7 +5,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['7.3', '7.2', '5.4'] + php-versions: ['7.3', '7.2'] steps: - uses: actions/checkout@master - name: Setup PHP @@ -15,9 +15,6 @@ jobs: extensions: mbstring, intl ini-values: post_max_size=256M, short_open_tag=On tools: phpunit, composer - - name: Set COMPOSER environment variable for 5.4 - if: matrix.php-versions == '5.4' - run: echo "COMPOSER=composer-php-5-4.json" >> $GITHUB_ENV - name: Run tests run: | composer install diff --git a/composer-php-5-4.json b/composer-php-5-4.json deleted file mode 100644 index 89160d79..00000000 --- a/composer-php-5-4.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "pluginkollektiv/antispam-bee", - "description": "Antispam Bee blocks spam comments and trackbacks effectively and without captchas.", - "keywords": [ - "WordPress", - "antispam", - "honeypot" - ], - "homepage": "https://pluginkollektiv.github.io/antispam-bee/", - "authors": [ - { - "name": "pluginkollektiv", - "homepage": "https://github.com/pluginkollektiv", - "role": "Maintainer" - } - ], - "support": { - "issues": "https://github.com/pluginkollektiv/antispam-bee/issues", - "source": "https://github.com/pluginkollektiv/antispam-bee", - "docs": "https://github.com/pluginkollektiv/antispam-bee/blob/master/README.md" - }, - "type": "wordpress-plugin", - "license": "GPL-v2", - "require-dev": { - "phpunit/phpunit": "*", - "brain/monkey": "*" - }, - "config": { - "optimize-autoloader": true, - "platform": { - "php": "5.4" - } - }, - "autoload-dev": { - "classmap": [ - "antispam_bee.php", - "inc/" - ], - "psr-4": { - "AntispamBee\\Tests\\": "tests/" - } - } -} From 7fbe5d69fc6071decc944531e1370adb77f9e1f9 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sun, 17 Mar 2024 12:12:41 +0100 Subject: [PATCH 2/4] chore: remove unused Node dependencies --- .eslintrc | 20 ---------------- .github/workflows/tests.yml | 4 ---- .stylelintrc.json | 5 ---- package.json | 31 +----------------------- webpack.config.js | 48 ------------------------------------- 5 files changed, 1 insertion(+), 107 deletions(-) delete mode 100644 .eslintrc delete mode 100644 .stylelintrc.json delete mode 100644 webpack.config.js diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 6379d068..00000000 --- a/.eslintrc +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": [ - "plugin:@wordpress/eslint-plugin/recommended" - ], - "env": { - "browser": true - }, - "rules": { - "max-len": [ - "error", - { - "code": 160 - } - ], - "prettier/prettier": 0 - }, - "parserOptions": { - "requireConfigFile": false - } -} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dd315348..4e49f717 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -86,12 +86,8 @@ jobs: extensions: mbstring, intl ini-values: post_max_size=256M, short_open_tag=On tools: phpunit, composer - - uses: actions/setup-node@v2 - with: - node-version: '14' - name: Run code style checks for CSS, JavaScript and PHP run: | composer install - npm install composer lint-all composer cs diff --git a/.stylelintrc.json b/.stylelintrc.json deleted file mode 100644 index 829a7dcf..00000000 --- a/.stylelintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "@wordpress/stylelint-config", - "rules": { - } -} diff --git a/package.json b/package.json index d44971cd..5f32670d 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,5 @@ "version": "3.0.0", "description": "Antispam Bee blocks spam comments and trackbacks effectively and without captchas.", "author": "pluginkollektiv", - "license": "GPL-2.0-or-later", - "main": "build/index.js", - "scripts": { - "build": "wp-scripts build", - "check-engines": "wp-scripts check-engines", - "check-licenses": "wp-scripts check-licenses", - "format:js": "wp-scripts format-js", - "format:js:src": "wp-scripts format-js ./src", - "lint:css": "wp-scripts lint-style", - "lint:css:src": "wp-scripts lint-style 'src/**/*.css'", - "lint:js": "wp-scripts lint-js", - "lint:js:src": "wp-scripts lint-js ./src", - "lint:md:docs": "wp-scripts lint-md-docs", - "lint:md:js": "wp-scripts lint-md-js", - "lint:pkg-json": "wp-scripts lint-pkg-json", - "packages-update": "wp-scripts packages-update", - "postpackages-update": "npm run build", - "start": "wp-scripts start", - "test:e2e": "wp-scripts test-e2e", - "test:unit": "wp-scripts test-unit-js" - }, - "devDependencies": { - "@wordpress/scripts": "^18.1.0", - "classnames": "^2.3.1", - "svg-spritemap-webpack-plugin": "^4.3.3", - "url-loader": "^4.1.1" - }, - "dependencies": { - "raphael": "^2.3.0" - } + "license": "GPL-2.0-or-later" } diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index 53e74e8f..00000000 --- a/webpack.config.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * External dependencies - */ -const path = require( 'path' ); -const defaultConfig = require( '@wordpress/scripts/config/webpack.config' ); -const SVGSpritemapPlugin = require( 'svg-spritemap-webpack-plugin' ); - -/** - * Webpack config (Development mode) - * - * @see https://developer.wordpress.org/block-editor/packages/packages-scripts/#provide-your-own-webpack-config - */ -module.exports = { - ...defaultConfig, - entry: { - backend: path.resolve( process.cwd(), 'assets/src', 'backend.js' ), - }, - output: { - filename: '[name].js', - path: path.resolve( process.cwd(), 'assets/dist' ), - }, - module: { - rules: [ - ...defaultConfig.module.rules, - { - test: /\.svg$/, - use: [ '@svgr/webpack', 'url-loader' ], - }, - ], - }, - plugins: [ - ...defaultConfig.plugins, - - /** - * Generate an SVG sprite. - * - * @see https://github.com/cascornelissen/svg-spritemap-webpack-plugin - */ - new SVGSpritemapPlugin( 'assets/src/images/icons/**/*.svg', { - output: { - filename: 'images/icons/sprite.svg', - }, - sprite: { - prefix: 'antispam-bee-', - }, - } ), - ], -}; From 27de7b694b435a599b95b483f5c11f319dc98202 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sun, 17 Mar 2024 12:18:32 +0100 Subject: [PATCH 3/4] chore: fix code-style pipeline * remove "lint-all" which does not exist anymore * update WPCS to 3.0 * clean up GH action and update PHP version --- .github/workflows/tests.yml | 9 +++------ composer.json | 2 +- phpcs.xml | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4e49f717..b480c461 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -82,12 +82,9 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.2' - extensions: mbstring, intl - ini-values: post_max_size=256M, short_open_tag=On - tools: phpunit, composer + php-version: '8.2' + tools: composer - name: Run code style checks for CSS, JavaScript and PHP run: | - composer install - composer lint-all + composer install --ignore-platform-req=php composer cs diff --git a/composer.json b/composer.json index 5e671322..5867e99d 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,7 @@ "phpcompatibility/phpcompatibility-wp": "^2.1", "phpunit/phpunit": "^4", "wp-cli/wp-cli-bundle": "@stable", - "wp-coding-standards/wpcs": "^2.3" + "wp-coding-standards/wpcs": "^3.0" }, "autoload": { "psr-4": { diff --git a/phpcs.xml b/phpcs.xml index edec387e..c2fdc042 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -52,7 +52,7 @@ - + From e1a7c892880647907abf6016e963298de405de70 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sun, 17 Mar 2024 12:22:32 +0100 Subject: [PATCH 4/4] style: auto-fix some space, newline and indentation issues --- src/Admin/CommentsColumns.php | 16 +++--- src/Admin/DashboardWidgets.php | 24 ++++---- src/Admin/Fields/Field.php | 6 +- src/Admin/Section.php | 19 +++--- src/Admin/SettingsPage.php | 4 +- src/Admin/Tab.php | 4 +- src/GeneralOptions/Base.php | 2 - src/Handlers/Comment.php | 2 +- src/Handlers/PluginStateChangeHandler.php | 1 - src/Handlers/PluginUpdate.php | 70 +++++++++++------------ src/Handlers/PostProcessors.php | 6 +- src/Handlers/Reaction.php | 11 ++-- src/Handlers/Rules.php | 6 +- src/Helpers/ComponentsHelper.php | 2 +- src/Helpers/ContentTypeHelper.php | 4 +- src/Helpers/DebugMode.php | 34 +++++------ src/Helpers/Honeypot.php | 4 +- src/Helpers/InterfaceHelper.php | 2 +- src/Helpers/IpHelper.php | 1 - src/Helpers/LangHelper.php | 2 - src/Helpers/Sanitize.php | 4 +- src/Helpers/Settings.php | 26 ++++----- src/Helpers/SpamReasonTextHelper.php | 14 ++--- src/PostProcessors/Delete.php | 2 +- src/PostProcessors/DeleteForReasons.php | 2 +- src/PostProcessors/SendEmail.php | 3 +- src/PostProcessors/UpdateSpamCount.php | 1 - src/PostProcessors/UpdateSpamLog.php | 1 - src/Rules/ApprovedEmail.php | 2 +- src/Rules/Base.php | 4 +- src/Rules/CountrySpam.php | 4 +- src/Rules/DbSpam.php | 4 +- src/Rules/EmptyData.php | 10 ++-- src/Rules/Honeypot.php | 4 +- src/Rules/InvalidRequest.php | 2 +- src/Rules/LangSpam.php | 10 ++-- src/Rules/LinkbackFromMyself.php | 4 +- src/Rules/LinkbackPostTitleIsBlogName.php | 2 +- src/Rules/RegexpSpam.php | 4 +- src/Rules/TooFastSubmit.php | 10 ++-- 40 files changed, 165 insertions(+), 168 deletions(-) diff --git a/src/Admin/CommentsColumns.php b/src/Admin/CommentsColumns.php index 5a803662..146e34bf 100644 --- a/src/Admin/CommentsColumns.php +++ b/src/Admin/CommentsColumns.php @@ -71,7 +71,7 @@ public static function register_plugin_columns( $columns ) { /** * Display plugin column values on comments screen * - * @param string $column Currently selected column. + * @param string $column Currently selected column. * @param integer $comment_id Comment ID. * * @since 2.6.0 @@ -141,19 +141,19 @@ public static function filter_columns() { global $wpdb; ?> + for="filter-by-comment-spam-reason"> %s', - $unique_id, - time(), - $script - ); + '%s', + $unique_id, + time(), + $script + ); } ); }