diff --git a/.eslintignore b/.eslintignore
index 83d9057..62866db 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -9,3 +9,9 @@ cypress
node_modules
vendor
google-fonts.js
+
+# Bundled third-party frontend libraries.
+src/js/frontend/idle-timer.js
+src/js/frontend/jquery.blockUI.js
+src/js/frontend/jquery.waypoints.js
+src/js/frontend/jsuri.js
diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml
new file mode 100644
index 0000000..3d0439d
--- /dev/null
+++ b/.github/workflows/code-quality.yml
@@ -0,0 +1,63 @@
+name: Code Quality
+
+on:
+ pull_request:
+ branches: [main]
+ push:
+ branches: [main]
+ workflow_dispatch:
+
+concurrency:
+ group: code-quality-${{ github.ref }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+
+jobs:
+ eslint:
+ name: ESLint
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ persist-credentials: false
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: 22
+ cache: npm
+
+ - name: Install dependencies
+ run: npm ci
+
+ - name: Run ESLint
+ run: npm run lint:js
+
+ php-quality:
+ name: PHPCS + PHPStan
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ persist-credentials: false
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '8.2'
+ tools: composer:v2
+
+ - name: Install dependencies
+ run: composer install --prefer-dist --no-progress
+
+ - name: Run PHPCS
+ run: composer phpcs
+
+ - name: Run PHPStan
+ run: composer phpstan -- --error-format=github
diff --git a/composer.json b/composer.json
index 0a225f9..35c0303 100644
--- a/composer.json
+++ b/composer.json
@@ -3,6 +3,18 @@
"description": "Post comments without a reload.",
"type": "project",
"license": "GPL",
+ "require": {
+ "php": ">=7.2"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^1.0",
+ "phpcompatibility/phpcompatibility-wp": "^2.1",
+ "php-stubs/wordpress-stubs": "^6.5",
+ "phpstan/phpstan": "^2.0",
+ "squizlabs/php_codesniffer": "^3.7",
+ "szepeviktor/phpstan-wordpress": "^2.0",
+ "wp-coding-standards/wpcs": "^3.0"
+ },
"authors": [
{
"name": "Ronald Huereca",
@@ -10,12 +22,26 @@
}
],
"minimum-stability": "dev",
+ "prefer-stable": true,
"config": {
+ "allow-plugins": {
+ "dealerdirect/phpcodesniffer-composer-installer": true
+ },
+ "sort-packages": true,
"vendor-dir": "lib"
},
- "autoload": {
+ "autoload": {
"psr-4": {
"DLXPlugins\\WPAC\\": "php/"
}
+ },
+ "scripts": {
+ "phpcs": "phpcs",
+ "phpcbf": "phpcbf",
+ "phpstan": "phpstan analyse --memory-limit=1G",
+ "lint": [
+ "@phpcs",
+ "@phpstan"
+ ]
}
}
diff --git a/composer.lock b/composer.lock
index 466998a..4bae7f8 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,15 +4,826 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "bdb7ddd18cc9ff79f7bc26293519a2fc",
+ "content-hash": "3529bf4c1a2cd9edad60d27c6a0d6a9b",
"packages": [],
- "packages-dev": [],
+ "packages-dev": [
+ {
+ "name": "dealerdirect/phpcodesniffer-composer-installer",
+ "version": "v1.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCSStandards/composer-installer.git",
+ "reference": "963f0c67bffde0eac41b56be71ac0e8ba132f0bd"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/963f0c67bffde0eac41b56be71ac0e8ba132f0bd",
+ "reference": "963f0c67bffde0eac41b56be71ac0e8ba132f0bd",
+ "shasum": ""
+ },
+ "require": {
+ "composer-plugin-api": "^2.2",
+ "php": ">=5.4",
+ "squizlabs/php_codesniffer": "^3.1.0 || ^4.0"
+ },
+ "require-dev": {
+ "composer/composer": "^2.2",
+ "ext-json": "*",
+ "ext-zip": "*",
+ "php-parallel-lint/php-parallel-lint": "^1.4.0",
+ "phpcompatibility/php-compatibility": "^9.0 || ^10.0.0@dev",
+ "yoast/phpunit-polyfills": "^1.0"
+ },
+ "type": "composer-plugin",
+ "extra": {
+ "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
+ },
+ "autoload": {
+ "psr-4": {
+ "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Franck Nijhof",
+ "email": "opensource@frenck.dev",
+ "homepage": "https://frenck.dev",
+ "role": "Open source developer"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors"
+ }
+ ],
+ "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
+ "keywords": [
+ "PHPCodeSniffer",
+ "PHP_CodeSniffer",
+ "code quality",
+ "codesniffer",
+ "composer",
+ "installer",
+ "phpcbf",
+ "phpcs",
+ "plugin",
+ "qa",
+ "quality",
+ "standard",
+ "standards",
+ "style guide",
+ "stylecheck",
+ "tests"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCSStandards/composer-installer/issues",
+ "security": "https://github.com/PHPCSStandards/composer-installer/security/policy",
+ "source": "https://github.com/PHPCSStandards/composer-installer"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/PHPCSStandards",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/jrfnl",
+ "type": "github"
+ },
+ {
+ "url": "https://opencollective.com/php_codesniffer",
+ "type": "open_collective"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/phpcsstandards",
+ "type": "thanks_dev"
+ }
+ ],
+ "time": "2026-05-06T08:26:05+00:00"
+ },
+ {
+ "name": "php-stubs/wordpress-stubs",
+ "version": "v6.9.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-stubs/wordpress-stubs.git",
+ "reference": "90a9412826b9944f93b10bf41d795b5fe68abcd5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/90a9412826b9944f93b10bf41d795b5fe68abcd5",
+ "reference": "90a9412826b9944f93b10bf41d795b5fe68abcd5",
+ "shasum": ""
+ },
+ "conflict": {
+ "phpdocumentor/reflection-docblock": "5.6.1"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^1.0",
+ "nikic/php-parser": "^5.5",
+ "php": "^7.4 || ^8.0",
+ "php-stubs/generator": "^0.8.6",
+ "phpdocumentor/reflection-docblock": "^6.0",
+ "phpstan/phpstan": "^2.1",
+ "phpunit/phpunit": "^9.5",
+ "symfony/polyfill-php80": "*",
+ "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.1.1",
+ "wp-coding-standards/wpcs": "3.1.0 as 2.3.0"
+ },
+ "suggest": {
+ "paragonie/sodium_compat": "Pure PHP implementation of libsodium",
+ "symfony/polyfill-php80": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
+ "szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan"
+ },
+ "type": "library",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "WordPress function and class declaration stubs for static analysis.",
+ "homepage": "https://github.com/php-stubs/wordpress-stubs",
+ "keywords": [
+ "PHPStan",
+ "static analysis",
+ "wordpress"
+ ],
+ "support": {
+ "issues": "https://github.com/php-stubs/wordpress-stubs/issues",
+ "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.9.4"
+ },
+ "time": "2026-05-01T20:36:01+00:00"
+ },
+ {
+ "name": "phpcompatibility/php-compatibility",
+ "version": "9.3.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
+ "reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
+ "reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3",
+ "squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
+ },
+ "conflict": {
+ "squizlabs/php_codesniffer": "2.6.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
+ },
+ "suggest": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
+ },
+ "type": "phpcodesniffer-standard",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Wim Godden",
+ "homepage": "https://github.com/wimg",
+ "role": "lead"
+ },
+ {
+ "name": "Juliette Reinders Folmer",
+ "homepage": "https://github.com/jrfnl",
+ "role": "lead"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
+ }
+ ],
+ "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
+ "homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
+ "keywords": [
+ "compatibility",
+ "phpcs",
+ "standards"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
+ "source": "https://github.com/PHPCompatibility/PHPCompatibility"
+ },
+ "time": "2019-12-27T09:44:58+00:00"
+ },
+ {
+ "name": "phpcompatibility/phpcompatibility-paragonie",
+ "version": "1.3.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
+ "reference": "244d7b04fc4bc2117c15f5abe23eb933b5f02bbf"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/244d7b04fc4bc2117c15f5abe23eb933b5f02bbf",
+ "reference": "244d7b04fc4bc2117c15f5abe23eb933b5f02bbf",
+ "shasum": ""
+ },
+ "require": {
+ "phpcompatibility/php-compatibility": "^9.0"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^1.0",
+ "paragonie/random_compat": "dev-master",
+ "paragonie/sodium_compat": "dev-master"
+ },
+ "suggest": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
+ },
+ "type": "phpcodesniffer-standard",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Wim Godden",
+ "role": "lead"
+ },
+ {
+ "name": "Juliette Reinders Folmer",
+ "role": "lead"
+ }
+ ],
+ "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
+ "homepage": "http://phpcompatibility.com/",
+ "keywords": [
+ "compatibility",
+ "paragonie",
+ "phpcs",
+ "polyfill",
+ "standards",
+ "static analysis"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues",
+ "security": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/security/policy",
+ "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/PHPCompatibility",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/jrfnl",
+ "type": "github"
+ },
+ {
+ "url": "https://opencollective.com/php_codesniffer",
+ "type": "open_collective"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/phpcompatibility",
+ "type": "thanks_dev"
+ }
+ ],
+ "time": "2025-09-19T17:43:28+00:00"
+ },
+ {
+ "name": "phpcompatibility/phpcompatibility-wp",
+ "version": "2.1.8",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
+ "reference": "7c8d18b4d90dac9e86b0869a608fa09158e168fa"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/7c8d18b4d90dac9e86b0869a608fa09158e168fa",
+ "reference": "7c8d18b4d90dac9e86b0869a608fa09158e168fa",
+ "shasum": ""
+ },
+ "require": {
+ "phpcompatibility/php-compatibility": "^9.0",
+ "phpcompatibility/phpcompatibility-paragonie": "^1.0",
+ "squizlabs/php_codesniffer": "^3.3"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^1.0"
+ },
+ "suggest": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
+ },
+ "type": "phpcodesniffer-standard",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Wim Godden",
+ "role": "lead"
+ },
+ {
+ "name": "Juliette Reinders Folmer",
+ "role": "lead"
+ }
+ ],
+ "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
+ "homepage": "http://phpcompatibility.com/",
+ "keywords": [
+ "compatibility",
+ "phpcs",
+ "standards",
+ "static analysis",
+ "wordpress"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues",
+ "security": "https://github.com/PHPCompatibility/PHPCompatibilityWP/security/policy",
+ "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/PHPCompatibility",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/jrfnl",
+ "type": "github"
+ },
+ {
+ "url": "https://opencollective.com/php_codesniffer",
+ "type": "open_collective"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/phpcompatibility",
+ "type": "thanks_dev"
+ }
+ ],
+ "time": "2025-10-18T00:05:59+00:00"
+ },
+ {
+ "name": "phpcsstandards/phpcsextra",
+ "version": "1.5.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCSStandards/PHPCSExtra.git",
+ "reference": "39467533fdb742446d68c1d10ac33d625ee0311c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/39467533fdb742446d68c1d10ac33d625ee0311c",
+ "reference": "39467533fdb742446d68c1d10ac33d625ee0311c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4",
+ "phpcsstandards/phpcsutils": "^1.2.3",
+ "squizlabs/php_codesniffer": "^3.13.5 || ^4.0.1"
+ },
+ "require-dev": {
+ "php-parallel-lint/php-console-highlighter": "^1.0",
+ "php-parallel-lint/php-parallel-lint": "^1.4.0",
+ "phpcsstandards/phpcsdevcs": "^1.2.0",
+ "phpcsstandards/phpcsdevtools": "^1.2.1",
+ "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4"
+ },
+ "type": "phpcodesniffer-standard",
+ "extra": {
+ "branch-alias": {
+ "dev-stable": "1.x-dev",
+ "dev-develop": "1.x-dev"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Juliette Reinders Folmer",
+ "homepage": "https://github.com/jrfnl",
+ "role": "lead"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors"
+ }
+ ],
+ "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.",
+ "keywords": [
+ "PHP_CodeSniffer",
+ "phpcbf",
+ "phpcodesniffer-standard",
+ "phpcs",
+ "standards",
+ "static analysis"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues",
+ "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy",
+ "source": "https://github.com/PHPCSStandards/PHPCSExtra"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/PHPCSStandards",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/jrfnl",
+ "type": "github"
+ },
+ {
+ "url": "https://opencollective.com/php_codesniffer",
+ "type": "open_collective"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/phpcsstandards",
+ "type": "thanks_dev"
+ }
+ ],
+ "time": "2026-07-27T11:13:17+00:00"
+ },
+ {
+ "name": "phpcsstandards/phpcsutils",
+ "version": "1.2.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCSStandards/PHPCSUtils.git",
+ "reference": "5f35d9408c54d7b529501f3c688b6eae562aea1f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/5f35d9408c54d7b529501f3c688b6eae562aea1f",
+ "reference": "5f35d9408c54d7b529501f3c688b6eae562aea1f",
+ "shasum": ""
+ },
+ "require": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0",
+ "php": ">=5.4",
+ "squizlabs/php_codesniffer": "^3.13.5 || ^4.0.1"
+ },
+ "require-dev": {
+ "ext-filter": "*",
+ "php-parallel-lint/php-console-highlighter": "^1.0",
+ "php-parallel-lint/php-parallel-lint": "^1.4.0",
+ "phpcsstandards/phpcsdevcs": "^1.2.0",
+ "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0 || ^3.0.0"
+ },
+ "type": "phpcodesniffer-standard",
+ "extra": {
+ "branch-alias": {
+ "dev-stable": "1.x-dev",
+ "dev-develop": "1.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "PHPCSUtils/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Juliette Reinders Folmer",
+ "homepage": "https://github.com/jrfnl",
+ "role": "lead"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors"
+ }
+ ],
+ "description": "A suite of utility functions for use with PHP_CodeSniffer",
+ "homepage": "https://phpcsutils.com/",
+ "keywords": [
+ "PHP_CodeSniffer",
+ "phpcbf",
+ "phpcodesniffer-standard",
+ "phpcs",
+ "phpcs3",
+ "phpcs4",
+ "standards",
+ "static analysis",
+ "tokens",
+ "utility"
+ ],
+ "support": {
+ "docs": "https://phpcsutils.com/",
+ "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues",
+ "security": "https://github.com/PHPCSStandards/PHPCSUtils/security/policy",
+ "source": "https://github.com/PHPCSStandards/PHPCSUtils"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/PHPCSStandards",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/jrfnl",
+ "type": "github"
+ },
+ {
+ "url": "https://opencollective.com/php_codesniffer",
+ "type": "open_collective"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/phpcsstandards",
+ "type": "thanks_dev"
+ }
+ ],
+ "time": "2026-07-27T10:28:41+00:00"
+ },
+ {
+ "name": "phpstan/phpstan",
+ "version": "2.2.14",
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9c672e7a8e791dfc3d30e55f683e73fc0b63a3ac",
+ "reference": "9c672e7a8e791dfc3d30e55f683e73fc0b63a3ac",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.4|^8.0"
+ },
+ "conflict": {
+ "phpstan/phpstan-shim": "*"
+ },
+ "bin": [
+ "phpstan",
+ "phpstan.phar"
+ ],
+ "type": "library",
+ "autoload": {
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Ondřej Mirtes"
+ },
+ {
+ "name": "Markus Staab"
+ },
+ {
+ "name": "Vincent Langlet"
+ }
+ ],
+ "description": "PHPStan - PHP Static Analysis Tool",
+ "keywords": [
+ "dev",
+ "static analysis"
+ ],
+ "support": {
+ "docs": "https://phpstan.org/user-guide/getting-started",
+ "forum": "https://github.com/phpstan/phpstan/discussions",
+ "issues": "https://github.com/phpstan/phpstan/issues",
+ "security": "https://github.com/phpstan/phpstan/security/policy",
+ "source": "https://github.com/phpstan/phpstan-src"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/ondrejmirtes",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/phpstan",
+ "type": "github"
+ }
+ ],
+ "time": "2026-09-12T21:39:33+00:00"
+ },
+ {
+ "name": "squizlabs/php_codesniffer",
+ "version": "3.13.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
+ "reference": "4c378e1a528ea066890fc2397cbdd2f94eb2fc91"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/4c378e1a528ea066890fc2397cbdd2f94eb2fc91",
+ "reference": "4c378e1a528ea066890fc2397cbdd2f94eb2fc91",
+ "shasum": ""
+ },
+ "require": {
+ "ext-simplexml": "*",
+ "ext-tokenizer": "*",
+ "ext-xmlwriter": "*",
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4"
+ },
+ "bin": [
+ "bin/phpcbf",
+ "bin/phpcs"
+ ],
+ "type": "library",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Greg Sherwood",
+ "role": "Former lead"
+ },
+ {
+ "name": "Juliette Reinders Folmer",
+ "role": "Current lead"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors"
+ }
+ ],
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
+ "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer",
+ "keywords": [
+ "phpcs",
+ "standards",
+ "static analysis"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues",
+ "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy",
+ "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer",
+ "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/PHPCSStandards",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/jrfnl",
+ "type": "github"
+ },
+ {
+ "url": "https://opencollective.com/php_codesniffer",
+ "type": "open_collective"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/phpcsstandards",
+ "type": "thanks_dev"
+ }
+ ],
+ "time": "2026-08-06T00:17:32+00:00"
+ },
+ {
+ "name": "szepeviktor/phpstan-wordpress",
+ "version": "v2.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/szepeviktor/phpstan-wordpress.git",
+ "reference": "84577e2ea1e4c2a95537fe5ea2ac8e18f4ceab1a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/84577e2ea1e4c2a95537fe5ea2ac8e18f4ceab1a",
+ "reference": "84577e2ea1e4c2a95537fe5ea2ac8e18f4ceab1a",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.4 || ^8.0",
+ "php-stubs/wordpress-stubs": ">=6.6.2",
+ "phpstan/phpstan": "^2.0"
+ },
+ "require-dev": {
+ "composer/composer": "^2.1.14",
+ "composer/semver": "^3.4",
+ "dealerdirect/phpcodesniffer-composer-installer": "^1.0",
+ "php-parallel-lint/php-parallel-lint": "^1.1",
+ "phpstan/phpstan-strict-rules": "^2.0",
+ "phpunit/phpunit": "^9.0",
+ "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.0",
+ "wp-coding-standards/wpcs": "3.1.0 as 2.3.0"
+ },
+ "suggest": {
+ "swissspidy/phpstan-no-private": "Detect usage of internal core functions, classes and methods"
+ },
+ "type": "phpstan-extension",
+ "extra": {
+ "phpstan": {
+ "includes": [
+ "extension.neon"
+ ]
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "SzepeViktor\\PHPStan\\WordPress\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "WordPress extensions for PHPStan",
+ "keywords": [
+ "PHPStan",
+ "code analyse",
+ "code analysis",
+ "static analysis",
+ "wordpress"
+ ],
+ "support": {
+ "issues": "https://github.com/szepeviktor/phpstan-wordpress/issues",
+ "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v2.0.4"
+ },
+ "time": "2026-05-22T16:22:09+00:00"
+ },
+ {
+ "name": "wp-coding-standards/wpcs",
+ "version": "3.4.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/WordPress/WordPress-Coding-Standards.git",
+ "reference": "ec2ff942335f33683a5957a85d138753876a05cf"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/ec2ff942335f33683a5957a85d138753876a05cf",
+ "reference": "ec2ff942335f33683a5957a85d138753876a05cf",
+ "shasum": ""
+ },
+ "require": {
+ "ext-filter": "*",
+ "ext-libxml": "*",
+ "ext-tokenizer": "*",
+ "ext-xmlreader": "*",
+ "php": ">=7.2",
+ "phpcsstandards/phpcsextra": "^1.5.1",
+ "phpcsstandards/phpcsutils": "^1.2.3",
+ "squizlabs/php_codesniffer": "^3.13.5"
+ },
+ "require-dev": {
+ "php-parallel-lint/php-console-highlighter": "^1.0.0",
+ "php-parallel-lint/php-parallel-lint": "^1.4.0",
+ "phpcompatibility/php-compatibility": "^10.0.0@dev",
+ "phpcsstandards/phpcsdevtools": "^1.2.0",
+ "phpunit/phpunit": "^8.0 || ^9.0"
+ },
+ "suggest": {
+ "ext-iconv": "For improved results",
+ "ext-mbstring": "For improved results"
+ },
+ "type": "phpcodesniffer-standard",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors"
+ }
+ ],
+ "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
+ "keywords": [
+ "phpcs",
+ "standards",
+ "static analysis",
+ "wordpress"
+ ],
+ "support": {
+ "issues": "https://github.com/WordPress/WordPress-Coding-Standards/issues",
+ "source": "https://github.com/WordPress/WordPress-Coding-Standards",
+ "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki"
+ },
+ "funding": [
+ {
+ "url": "https://opencollective.com/php_codesniffer",
+ "type": "custom"
+ }
+ ],
+ "time": "2026-07-27T11:53:23+00:00"
+ }
+ ],
"aliases": [],
"minimum-stability": "dev",
- "stability-flags": [],
- "prefer-stable": false,
+ "stability-flags": {},
+ "prefer-stable": true,
"prefer-lowest": false,
- "platform": [],
- "platform-dev": [],
- "plugin-api-version": "2.3.0"
+ "platform": {
+ "php": ">=7.2"
+ },
+ "platform-dev": {},
+ "plugin-api-version": "2.9.0"
}
diff --git a/functions.php b/functions.php
index 6172ad0..10a29b6 100644
--- a/functions.php
+++ b/functions.php
@@ -525,7 +525,7 @@ function wpac_the_content( $content ) {
add_filter( 'the_content', 'wpac_the_content', PHP_INT_MAX );
function wpac_is_ajax_request() {
- return isset( $_SERVER['HTTP_X_WPAC_REQUEST'] ) && $_SERVER['HTTP_X_WPAC_REQUEST'];
+ return isset( $_SERVER['HTTP_X_WPAC_REQUEST'] ) && (bool) sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_WPAC_REQUEST'] ) );
}
function wpac_comments_template_query_args_filter( $comments ) {
diff --git a/package.json b/package.json
index 7522d12..9a1dfd6 100644
--- a/package.json
+++ b/package.json
@@ -7,6 +7,9 @@
"start": "webpack --watch --env mode=development",
"dev": "webpack --mode development --env mode=development",
"build": "webpack --mode production --env mode=production",
+ "lint": "npm run lint:js",
+ "lint:js": "eslint src/js/frontend --ext .js --report-unused-disable-directives",
+ "lint:js:fix": "npm run lint:js -- --fix",
"i18n:pot": "wp i18n make-pot . languages/wp-ajaxify-comments.pot --slug=wp-ajaxify-comments --domain=wp-ajaxify-comments --headers='{\"Report-Msgid-Bugs-To\":\"https://github.com/Ultimate-Multisite/wp-ajaxify-comments/issues\"}'"
},
"repository": {
diff --git a/php/Menu_Helper.php b/php/Menu_Helper.php
index c3e4a02..ba19721 100644
--- a/php/Menu_Helper.php
+++ b/php/Menu_Helper.php
@@ -338,7 +338,7 @@ public function enqueue_menu_helper_scripts_styles() {
/**
* Add the admin bar menu.
*
- * @param WP_Admin_Bar $admin_bar Admin bar reference.
+ * @param \WP_Admin_Bar $admin_bar Admin bar reference.
*/
public function admin_bar_menu( $admin_bar ) {
// Only load on singular and page types.
@@ -608,7 +608,7 @@ public function admin_bar_menu( $admin_bar ) {
/**
* Add a back to post option in the admin bar.
*
- * @param WP_Admin_Bar $admin_bar Admin bar reference.
+ * @param \WP_Admin_Bar $admin_bar Admin bar reference.
*/
public function admin_bar_menu_back_to_post( $admin_bar ) {
// Only load on singular and page types.
@@ -637,7 +637,7 @@ public function admin_bar_menu_back_to_post( $admin_bar ) {
/**
* Add option group for preview overlays.
*
- * @param WP_Admin_Bar $admin_bar Admin bar reference.
+ * @param \WP_Admin_Bar $admin_bar Admin bar reference.
*/
public function admin_bar_menu_preview_overlay( $admin_bar ) {
// Only load on singular and page types.
@@ -666,7 +666,7 @@ public function admin_bar_menu_preview_overlay( $admin_bar ) {
'id' => 'wpac-menu-helper-preview-overlay-label',
'parent' => 'wpac-menu-helper',
'title' => '' . __( 'Overlay Preview', 'wp-ajaxify-comments' ) . '',
- 'href' => false,
+ 'href' => '',
)
);
diff --git a/php/Options.php b/php/Options.php
index 407c6cc..a560d7d 100644
--- a/php/Options.php
+++ b/php/Options.php
@@ -172,7 +172,7 @@ public static function get_options( $force = false, $skip_migrate = false ) {
*/
$options = apply_filters(
'dlxplugins/ajaxify/comments/options/parsed',
- $options,
+ $options
);
self::$options = $options;
return $options;
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 0000000..a33beb9
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,35 @@
+
+
+ PHP_CodeSniffer rules for the Ajaxify Comments WordPress plugin.
+
+ wp-ajaxify-comments.php
+ functions.php
+ php
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
new file mode 100644
index 0000000..2dbd8ee
--- /dev/null
+++ b/phpstan-baseline.neon
@@ -0,0 +1,337 @@
+parameters:
+ ignoreErrors:
+ -
+ message: '#^Constant AUTH_KEY not found\.$#'
+ identifier: constant.notFound
+ count: 1
+ path: functions.php
+
+ -
+ message: '#^Constant AUTH_SALT not found\.$#'
+ identifier: constant.notFound
+ count: 1
+ path: functions.php
+
+ -
+ message: '#^Constant LOGGED_IN_KEY not found\.$#'
+ identifier: constant.notFound
+ count: 1
+ path: functions.php
+
+ -
+ message: '#^Constant LOGGED_IN_SALT not found\.$#'
+ identifier: constant.notFound
+ count: 1
+ path: functions.php
+
+ -
+ message: '#^Constant NONCE_KEY not found\.$#'
+ identifier: constant.notFound
+ count: 1
+ path: functions.php
+
+ -
+ message: '#^Constant NONCE_SALT not found\.$#'
+ identifier: constant.notFound
+ count: 2
+ path: functions.php
+
+ -
+ message: '#^Constant SECURE_AUTH_SALT not found\.$#'
+ identifier: constant.notFound
+ count: 1
+ path: functions.php
+
+ -
+ message: '#^Negated boolean expression is always true\.$#'
+ identifier: booleanNot.alwaysTrue
+ count: 1
+ path: functions.php
+
+ -
+ message: '#^One or more @param tags has an invalid name or invalid syntax\.$#'
+ identifier: phpDoc.parseError
+ count: 1
+ path: functions.php
+
+ -
+ message: '#^PHPDoc tag @param has invalid value \(bool Whether to force scripts on all pages\.\)\: Unexpected token "Whether", expected variable at offset 63 on line 4$#'
+ identifier: phpDoc.parseError
+ count: 1
+ path: functions.php
+
+ -
+ message: '#^Parameter \#1 \$text of function esc_html expects string, float given\.$#'
+ identifier: argument.type
+ count: 3
+ path: functions.php
+
+ -
+ message: '#^Parameter \#2 \$fallback_url of function wp_validate_redirect expects string, false given\.$#'
+ identifier: argument.type
+ count: 1
+ path: functions.php
+
+ -
+ message: '#^Parameter \#4 \$ver of function wp_enqueue_script expects bool\|string\|null, float given\.$#'
+ identifier: argument.type
+ count: 5
+ path: functions.php
+
+ -
+ message: '#^Parameter \#4 \$ver of function wp_enqueue_style expects bool\|string\|null, float given\.$#'
+ identifier: argument.type
+ count: 2
+ path: functions.php
+
+ -
+ message: '#^Action callback returns array but should not return anything\.$#'
+ identifier: return.void
+ count: 1
+ path: php/Admin/Init.php
+
+ -
+ message: '#^Cannot access property \$download_link on array\|object\.$#'
+ identifier: property.nonObject
+ count: 1
+ path: php/Admin/Init.php
+
+ -
+ message: '#^Cannot access property \$name on array\|object\.$#'
+ identifier: property.nonObject
+ count: 1
+ path: php/Admin/Init.php
+
+ -
+ message: '#^If condition is always true\.$#'
+ identifier: if.alwaysTrue
+ count: 1
+ path: php/Admin/Init.php
+
+ -
+ message: '#^Parameter \#4 \$ver of function wp_enqueue_style expects bool\|string\|null, float given\.$#'
+ identifier: argument.type
+ count: 1
+ path: php/Admin/Init.php
+
+ -
+ message: '#^Static property DLXPlugins\\WPAC\\Admin\\Init\:\:\$slug is never read, only written\.$#'
+ identifier: property.onlyWritten
+ count: 1
+ path: php/Admin/Init.php
+
+ -
+ message: '#^Static property DLXPlugins\\WPAC\\Admin\\Init\:\:\$url is never read, only written\.$#'
+ identifier: property.onlyWritten
+ count: 1
+ path: php/Admin/Init.php
+
+ -
+ message: '#^Expected 0 @param tags, found 1\.$#'
+ identifier: paramTag.count
+ count: 1
+ path: php/Admin/Settings.php
+
+ -
+ message: '#^Expected 2 @param tags, found 3\.$#'
+ identifier: paramTag.count
+ count: 1
+ path: php/Admin/Settings.php
+
+ -
+ message: '#^One or more @param tags has an invalid name or invalid syntax\.$#'
+ identifier: phpDoc.parseError
+ count: 1
+ path: php/Admin/Settings.php
+
+ -
+ message: '#^PHPDoc tag @param has invalid value \(array Associative array of tabs\.\)\: Unexpected token "Associative", expected variable at offset 157 on line 8$#'
+ identifier: phpDoc.parseError
+ count: 1
+ path: php/Admin/Settings.php
+
+ -
+ message: '#^PHPDoc tag @param has invalid value \(string Sub Tab\)\: Unexpected token "Sub", expected variable at offset 228 on line 10$#'
+ identifier: phpDoc.parseError
+ count: 1
+ path: php/Admin/Settings.php
+
+ -
+ message: '#^PHPDoc tag @param has invalid value \(string Tab\)\: Unexpected token "Tab", expected variable at offset 204 on line 9$#'
+ identifier: phpDoc.parseError
+ count: 1
+ path: php/Admin/Settings.php
+
+ -
+ message: '#^Property WP_Screen\:\:\$base \(string\) in isset\(\) is not nullable\.$#'
+ identifier: isset.property
+ count: 1
+ path: php/Admin/Settings.php
+
+ -
+ message: '#^Variable \$sub_tab_html_array in empty\(\) always exists and is not falsy\.$#'
+ identifier: empty.variable
+ count: 1
+ path: php/Admin/Settings.php
+
+ -
+ message: '#^Variable \$sub_tabs in empty\(\) always exists and is not falsy\.$#'
+ identifier: empty.variable
+ count: 1
+ path: php/Admin/Settings.php
+
+ -
+ message: '#^Variable \$tabs in empty\(\) always exists and is not falsy\.$#'
+ identifier: empty.variable
+ count: 1
+ path: php/Admin/Settings.php
+
+ -
+ message: '#^Callback expects 1\-2 parameters, \$accepted_args is set to 3\.$#'
+ identifier: arguments.count
+ count: 1
+ path: php/Admin/Tabs/Advanced.php
+
+ -
+ message: '#^Callback expects 1\-2 parameters, \$accepted_args is set to 3\.$#'
+ identifier: arguments.count
+ count: 1
+ path: php/Admin/Tabs/Appearance.php
+
+ -
+ message: '#^Function remove_filter invoked with 4 parameters, 2\-3 required\.$#'
+ identifier: arguments.count
+ count: 1
+ path: php/Admin/Tabs/Appearance.php
+
+ -
+ message: '#^Parameter \#4 \$ver of function wp_enqueue_script expects bool\|string\|null, float given\.$#'
+ identifier: argument.type
+ count: 1
+ path: php/Admin/Tabs/Appearance.php
+
+ -
+ message: '#^Callback expects 1\-2 parameters, \$accepted_args is set to 3\.$#'
+ identifier: arguments.count
+ count: 1
+ path: php/Admin/Tabs/Callbacks.php
+
+ -
+ message: '#^Callback expects 1\-2 parameters, \$accepted_args is set to 3\.$#'
+ identifier: arguments.count
+ count: 1
+ path: php/Admin/Tabs/Integrations.php
+
+ -
+ message: '#^Callback expects 1\-2 parameters, \$accepted_args is set to 3\.$#'
+ identifier: arguments.count
+ count: 1
+ path: php/Admin/Tabs/Labels.php
+
+ -
+ message: '#^Callback expects 1\-2 parameters, \$accepted_args is set to 3\.$#'
+ identifier: arguments.count
+ count: 1
+ path: php/Admin/Tabs/Lazy_Load.php
+
+ -
+ message: '#^Function remove_filter invoked with 4 parameters, 2\-3 required\.$#'
+ identifier: arguments.count
+ count: 1
+ path: php/Admin/Tabs/Lazy_Load.php
+
+ -
+ message: '#^Parameter \#4 \$ver of function wp_enqueue_style expects bool\|string\|null, float given\.$#'
+ identifier: argument.type
+ count: 1
+ path: php/Admin/Tabs/Lazy_Load.php
+
+ -
+ message: '#^Callback expects 1\-2 parameters, \$accepted_args is set to 3\.$#'
+ identifier: arguments.count
+ count: 1
+ path: php/Admin/Tabs/Main.php
+
+ -
+ message: '#^Callback expects 1\-2 parameters, \$accepted_args is set to 3\.$#'
+ identifier: arguments.count
+ count: 1
+ path: php/Admin/Tabs/Pagination.php
+
+ -
+ message: '#^Function remove_filter invoked with 4 parameters, 2\-3 required\.$#'
+ identifier: arguments.count
+ count: 1
+ path: php/Admin/Tabs/Pagination.php
+
+ -
+ message: '#^Parameter \#4 \$ver of function wp_enqueue_script expects bool\|string\|null, float given\.$#'
+ identifier: argument.type
+ count: 1
+ path: php/Admin/Tabs/Pagination.php
+
+ -
+ message: '#^Callback expects 1\-2 parameters, \$accepted_args is set to 3\.$#'
+ identifier: arguments.count
+ count: 1
+ path: php/Admin/Tabs/Selectors.php
+
+ -
+ message: '#^Callback expects 1\-2 parameters, \$accepted_args is set to 3\.$#'
+ identifier: arguments.count
+ count: 1
+ path: php/Admin/Tabs/Support.php
+
+ -
+ message: '#^Method DLXPlugins\\WPAC\\Functions\:\:get_plugin_version\(\) should return float but returns string\.$#'
+ identifier: return.type
+ count: 1
+ path: php/Functions.php
+
+ -
+ message: '#^Method DLXPlugins\\WPAC\\Functions\:\:is_multisite\(\) should return true but returns false\.$#'
+ identifier: return.type
+ count: 2
+ path: php/Functions.php
+
+ -
+ message: '#^PHPDoc tag @param references unknown parameter\: \$type$#'
+ identifier: parameter.notFound
+ count: 2
+ path: php/Functions.php
+
+ -
+ message: '#^Parameter \#1 \$postarr of function wp_update_post expects array\{ID\?\: int, post_author\?\: int, post_date\?\: string, post_date_gmt\?\: string, post_content\?\: string, post_content_filtered\?\: string, post_title\?\: string, post_excerpt\?\: string, \.\.\.\}, WP_Post given\.$#'
+ identifier: argument.type
+ count: 4
+ path: php/Menu_Helper.php
+
+ -
+ message: '#^Parameter \#4 \$ver of function wp_enqueue_script expects bool\|string\|null, float given\.$#'
+ identifier: argument.type
+ count: 1
+ path: php/Menu_Helper.php
+
+ -
+ message: '#^Parameter \#4 \$ver of function wp_enqueue_style expects bool\|string\|null, float given\.$#'
+ identifier: argument.type
+ count: 1
+ path: php/Menu_Helper.php
+
+ -
+ message: '#^Unreachable statement \- code above always terminates\.$#'
+ identifier: deadCode.unreachable
+ count: 2
+ path: php/Menu_Helper.php
+
+ -
+ message: '#^PHPDoc tag @var has invalid value \(\[type\]\)\: Unexpected token "\[", expected type at offset 48 on line 4$#'
+ identifier: phpDoc.parseError
+ count: 1
+ path: php/Options.php
+
+ -
+ message: '#^Function DLXPlugins\\WPAC\\can_redirect_on_activation\(\) should return true but returns false\.$#'
+ identifier: return.type
+ count: 5
+ path: wp-ajaxify-comments.php
diff --git a/phpstan.neon b/phpstan.neon
new file mode 100644
index 0000000..16b5976
--- /dev/null
+++ b/phpstan.neon
@@ -0,0 +1,13 @@
+includes:
+ - lib/szepeviktor/phpstan-wordpress/extension.neon
+ - phpstan-baseline.neon
+
+parameters:
+ level: 5
+ paths:
+ - wp-ajaxify-comments.php
+ - functions.php
+ - php
+ bootstrapFiles:
+ - lib/autoload.php
+ treatPhpDocTypesAsCertain: false
diff --git a/src/js/frontend/idle-timer.js b/src/js/frontend/idle-timer.js
index b02b7da..52fcae6 100644
--- a/src/js/frontend/idle-timer.js
+++ b/src/js/frontend/idle-timer.js
@@ -327,4 +327,4 @@
return this;
};
-})(jQuery);
\ No newline at end of file
+})(jQuery);
diff --git a/src/js/frontend/menu-helper.js b/src/js/frontend/menu-helper.js
index 6bbea34..da82344 100644
--- a/src/js/frontend/menu-helper.js
+++ b/src/js/frontend/menu-helper.js
@@ -48,7 +48,7 @@ document.addEventListener( 'DOMContentLoaded', function() {
response.json().then( ( data ) => {
const dataResponse = data.data;
if ( data.success ) {
- const preCheckSuccessModal = Swal.fire( {
+ Swal.fire( {
titleText: dataResponse.title,
text: dataResponse.message,
icon: 'success',
@@ -124,9 +124,9 @@ document.addEventListener( 'DOMContentLoaded', function() {
iconHtml: '',
didOpen: () => {
Swal.showLoading();
-
+
const selectorList = [];
-
+
// Find the comments container. todo - make filterable.
const commentContainerSelectors = [
'.wp-block-comments', /* Block themes */
@@ -137,7 +137,7 @@ document.addEventListener( 'DOMContentLoaded', function() {
'#comment-wrap', /* Divi */
'.et_pb_comments_module', /* Divi */
];
-
+
// Loop through each of the comment selectors.
// Find children and make sure its a comment.
// Make sure selected element is a comment list.
@@ -149,33 +149,33 @@ document.addEventListener( 'DOMContentLoaded', function() {
const commentElement = document.querySelector( commentSelector );
if ( commentElement ) {
const commentElementTagName = commentElement.tagName.toLowerCase();
-
+
// Check to see if container has children. If not, skip.
if ( commentElement.children.length <= 0 ) {
return;
}
-
+
// If element is a heading, bail.
if ( headingsArr.includes( commentElementTagName ) ) {
return;
}
-
+
// If the element is UL or OL, bail.
if ( 'ul' === commentElementTagName || 'ol' === commentElementTagName ) {
return;
}
-
+
// Check to see if children contain UL or OL. If so, we've found the container.
const ULs = commentElement.querySelector( 'ul' );
const OLs = commentElement.querySelector( 'ol' );
if ( null === ULs && null === OLs ) {
return;
}
-
+
if ( null !== ULs || null !== OLs ) {
foundCommentContainer = true;
}
-
+
// If we still haven't found the comment container, check that is has #respond or a form element.
if ( ! foundCommentContainer ) {
const respondOrForm = commentElement.querySelectorAll( '#respond, form, .comment-respond' );
@@ -198,10 +198,10 @@ document.addEventListener( 'DOMContentLoaded', function() {
if ( ! foundCommentContainer ) {
return;
}
-
+
// We've likely found the comment list. This is a valid container.
foundCommentContainer = true;
-
+
selectorList.push( {
selector: commentSelector,
tagName: commentElementTagName,
@@ -210,7 +210,7 @@ document.addEventListener( 'DOMContentLoaded', function() {
} );
}
} );
-
+
// Now check to see if we can find the comment list.
let foundCommentList = false;
const commentListSelectors = [
@@ -230,13 +230,13 @@ document.addEventListener( 'DOMContentLoaded', function() {
const commentListElement = document.querySelector( commentListSelector );
if ( commentListElement ) {
const commentListElementTagName = commentListElement.tagName.toLowerCase();
-
+
// If child contains LI, or `.comment`, then we've found the comment list.
const commentListItems = commentListElement.querySelectorAll( 'li, .comment' );
if ( null !== commentListItems && commentListItems.length > 0 ) {
foundCommentList = true;
}
-
+
if ( 'ul' === commentListElementTagName || 'ol' === commentListElementTagName ) {
foundCommentList = true;
}
@@ -250,7 +250,7 @@ document.addEventListener( 'DOMContentLoaded', function() {
}
}
} );
-
+
// Now let's get the comment form.
let foundCommentForm = false;
const commentFormSelectors = [
@@ -278,7 +278,7 @@ document.addEventListener( 'DOMContentLoaded', function() {
}
}
} );
-
+
// Get the respond textarea.
let foundRespondContainer = false;
const respondContainerSelectors = [
@@ -301,7 +301,7 @@ document.addEventListener( 'DOMContentLoaded', function() {
foundRespondContainer = true;
}
} );
-
+
// Get the comment text textarea.
let foundCommentTextarea = false;
const commentTextareaSelectors = [
@@ -327,7 +327,7 @@ document.addEventListener( 'DOMContentLoaded', function() {
}
}
} );
-
+
// Get the comment submit button.
let foundCommentSubmit = false;
const commentSubmitSelectors = [
@@ -357,11 +357,11 @@ document.addEventListener( 'DOMContentLoaded', function() {
}
}
} );
-
+
// Check to see if we found all the selectors.
if ( selectorList.length < 6 ) {
- WPAC._Debug("error", "We didn't find all the selectors. Selector List: ", selectorList );
-
+ WPAC._Debug( 'error', "We didn't find all the selectors. Selector List: ", selectorList );
+
Swal.fire( {
titleText: __( 'Unable to Find All Selectors', 'wp-ajaxify-comments' ),
html: __( 'We were unable to find all the required selectors. Please contact support and tell them what theme you are using. Make sure Lazy Loading is disabled.', 'wp-ajaxify-comments' ),
@@ -488,7 +488,7 @@ document.addEventListener( 'DOMContentLoaded', function() {
}
},
} );
- } catch( error ) {
+ } catch ( error ) {
Swal.fire( {
titleText: __( 'Unable to Find All Selectors', 'wp-ajaxify-comments' ),
html: __( 'We were unable to find all the required selectors. Please contact support and tell them what theme you are using. Make sure Lazy Loading is disabled.', 'wp-ajaxify-comments' ),
@@ -508,7 +508,6 @@ document.addEventListener( 'DOMContentLoaded', function() {
}
} );
}
-
};
// Open comments.
@@ -749,4 +748,3 @@ document.addEventListener( 'DOMContentLoaded', function() {
} );
}
} );
-