From d0330891bbe4fa47e0d418515c49f120a00b683b Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 12 Jan 2024 12:08:24 -0600 Subject: [PATCH 01/14] lint fix --- accessibility-checker.php | 2 +- includes/options-page.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/accessibility-checker.php b/accessibility-checker.php index 1412c965..d05d9bc4 100644 --- a/accessibility-checker.php +++ b/accessibility-checker.php @@ -835,7 +835,7 @@ function edac_summary_ajax() { // password check. if ( - !( + ! ( EDAC_KEY_VALID === true && edac_check_plugin_active( 'accessibility-checker-pro/accessibility-checker-pro.php' ) ) && diff --git a/includes/options-page.php b/includes/options-page.php index 970d19e8..f350759d 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -80,7 +80,6 @@ function edac_display_options_page() { // force edac_auth_type to reset in case user updates auth options. delete_transient( 'edac_auth_type' ); - } /** From 034feb00b476f725d2e5378d51e0a0b96db4ccf0 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Wed, 17 Jan 2024 12:53:07 -0500 Subject: [PATCH 02/14] updated - readme and version --- README.txt | 6 +++++- accessibility-checker.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.txt b/README.txt index 022e6e7d..edaafa86 100644 --- a/README.txt +++ b/README.txt @@ -3,7 +3,7 @@ Contributors: equalizedigital, alh0319, stevejonesdev Tags: accessibility, accessible, wcag, ada, WP accessibility, section 508, aoda, a11y, audit, readability, content analysis Requires at least: 6.2 Tested up to: 6.4.2 -Stable tag: 1.7.0 +Stable tag: 1.7.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -171,6 +171,10 @@ No, Accessibility Checker runs completely on your server and does not require yo == Changelog == += 1.7.1 = +* Fixes: classic editor save conflict +* Fixes: password protection message displaying repeatedly + = 1.7.0 = * Added: Architecture for JavaScript-based checks for better code analysis * Updated: Color contrast check now uses axe-core rule for improved accuracy diff --git a/accessibility-checker.php b/accessibility-checker.php index d05d9bc4..059304e7 100644 --- a/accessibility-checker.php +++ b/accessibility-checker.php @@ -10,7 +10,7 @@ * Plugin Name: Accessibility Checker * Plugin URI: https://a11ychecker.com * Description: Audit and check your website for accessibility before you hit publish. In-post accessibility scanner and guidance. - * Version: 1.7.0 + * Version: 1.7.1 * Author: Equalize Digital * Author URI: https://equalizedigital.com * License: GPL-2.0+ @@ -45,7 +45,7 @@ // Current plugin version. if ( ! defined( 'EDAC_VERSION' ) ) { - define( 'EDAC_VERSION', '1.7.0' ); + define( 'EDAC_VERSION', '1.7.1' ); } // Current database version. From f0a0343ee7eaeecba157460b51c8a2fb864d720a Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 19 Jan 2024 13:02:43 -0600 Subject: [PATCH 03/14] Hotfix - Removes unreliable checks for determining if site is password protected - Removes js-based password protected warnings --- accessibility-checker.php | 9 ++--- includes/classes/class-helpers.php | 37 -------------------- includes/enqueue-scripts.php | 2 +- src/editorApp/index.js | 56 ++++-------------------------- 4 files changed, 10 insertions(+), 94 deletions(-) diff --git a/accessibility-checker.php b/accessibility-checker.php index 059304e7..9960a36a 100644 --- a/accessibility-checker.php +++ b/accessibility-checker.php @@ -834,13 +834,8 @@ function edac_summary_ajax() { $html['content'] = ''; // password check. - if ( - ! ( - EDAC_KEY_VALID === true && - edac_check_plugin_active( 'accessibility-checker-pro/accessibility-checker-pro.php' ) - ) && - \EDAC\Helpers::is_basic_auth() - ) { + $is_pasword_protected = (bool) get_option( 'edac_password_protected', false ); + if ( $is_pasword_protected ) { $admin_notices = new \EDAC\Admin_Notices(); $notice_text = $admin_notices->edac_password_protected_notice_text(); $html['password_protected'] = $notice_text; diff --git a/includes/classes/class-helpers.php b/includes/classes/class-helpers.php index ff51651d..4fc780a8 100644 --- a/includes/classes/class-helpers.php +++ b/includes/classes/class-helpers.php @@ -207,41 +207,4 @@ public static function is_domain_loopback( $domain ) { return false; } - - /** - * Determine if this site is using basic auth. - * - * @return boolean - */ - public static function is_basic_auth() { - - $key = 'edac_auth_type'; - - $status = get_transient( $key ); - - $status = false; - - if ( false === $status ) { - - //phpcs:disable WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get - $response = wp_remote_get( home_url() ); - if ( ! is_wp_error( $response ) ) { - $code = wp_remote_retrieve_response_code( $response ); - - if ( 401 === $code || 403 === $code ) { - $status = 'basic'; - } - } - - // cache results for up to 30 seconds. - set_transient( $key, $status, 30 ); - - } - - if ( 'basic' === $status ) { - return true; - } - - return false; - } } diff --git a/includes/enqueue-scripts.php b/includes/enqueue-scripts.php index 5510b3d6..bd3798d1 100644 --- a/includes/enqueue-scripts.php +++ b/includes/enqueue-scripts.php @@ -84,11 +84,11 @@ function edac_admin_enqueue_scripts() { 'postID' => $post_id, 'edacUrl' => esc_url_raw( get_site_url() ), 'edacHeaders' => $headers, - 'basicAuth' => true === $pro ? false : EDAC\Helpers::is_basic_auth(), 'edacApiUrl' => esc_url_raw( rest_url() . 'accessibility-checker/v1' ), 'baseurl' => plugin_dir_url( __DIR__ ), 'active' => $active, 'pro' => $pro, + 'hasAuth' => (bool) get_option( 'edac_password_protected', false ), 'debug' => $debug, 'scanUrl' => get_preview_post_link( $post_id, diff --git a/src/editorApp/index.js b/src/editorApp/index.js index 1d30bb4f..8a9dc965 100644 --- a/src/editorApp/index.js +++ b/src/editorApp/index.js @@ -8,63 +8,21 @@ window.addEventListener('DOMContentLoaded', () => { const SCANNABLE_POST_TYPE = edac_editor_app.active; - if (SCANNABLE_POST_TYPE && settings.JS_SCAN_ENABLED) { + if (SCANNABLE_POST_TYPE) { - if (edac_editor_app.pro === '1' || edac_editor_app.basicAuth !== '1') { + if (edac_editor_app.pro !== '1' && edac_editor_app.hasAuth === '1') { + return; + } + + if (settings.JS_SCAN_ENABLED ){ + setTimeout(function () { initCheckPage(); }, 250); // Allow page load to fire before init, otherwise we'll have to wait for iframe to load. - } else { - - - //Listen for dispatches from the wp data store so we can trap the update/publish event - let saving = false; - let autosaving = false; - - - if (wp.data !== undefined && wp.data.subscribe !== undefined) { - wp.data.subscribe(() => { - - - if (wp.data.select('core/editor').isAutosavingPost()) { - autosaving = true; - } - - // Rescan the page if user saves post - if (wp.data.select('core/editor').isSavingPost()) { - - saving = true; - } else { - if (saving) { - saving = false; - - if (edac_editor_app.pro !== '1' || edac_editor_app.basicAuth === '1') { - showNotice({ - msg: 'Whoops! It looks like your website is currently password protected. The free version of Accessibility Checker can only scan live websites. To scan this website for accessibility problems either remove the password protection or follow the link below to upgrade to Accessibility Checker Pro.', - type: 'warning', - url: 'https://equalizedigital.com/accessibility-checker/pricing/', - label: 'Upgrade', - closeOthers: true - }); - - } - - } - } - - }); - - } else { - debug("Gutenberg is not enabled."); - } - - - } - } From 26f18d99762812bf8a556fe68b8ea2201d25d20c Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 19 Jan 2024 16:03:02 -0600 Subject: [PATCH 04/14] Bugfix - Fixes: PHP Deprecated: Automatic conversion of false to array is deprecated in /var/www/html/wp-content/plugins/accessibility-checker/includes/classes/class-scans-stats.php on line 440 --- includes/classes/class-scans-stats.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/classes/class-scans-stats.php b/includes/classes/class-scans-stats.php index 6050b8be..58df6953 100644 --- a/includes/classes/class-scans-stats.php +++ b/includes/classes/class-scans-stats.php @@ -437,7 +437,7 @@ public function issues_summary_by_post_type( $post_type ) { $data['cache_id'] = $transient_name; $data['cached_at'] = time(); $data['expires_at'] = time() + $this->cache_time; - $cache['cache_hit'] = false; + $data['cache_hit'] = false; set_transient( $transient_name, $data, $this->cache_time ); From e782ad0aa79648a0ff1f4a90ae7587883ec009ea Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 19 Jan 2024 16:06:30 -0600 Subject: [PATCH 05/14] lintfix --- includes/classes/class-scans-stats.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/includes/classes/class-scans-stats.php b/includes/classes/class-scans-stats.php index 58df6953..29a7578d 100644 --- a/includes/classes/class-scans-stats.php +++ b/includes/classes/class-scans-stats.php @@ -17,6 +17,7 @@ */ class Scans_Stats { + /** * Number of seconds to return results from cache. * @@ -189,7 +190,7 @@ function ( $item ) { ); if ( $rule_query->count() ) { - ++$data['rules_failed']; + ++$data['rules_failed']; } } $data['rules_passed'] = $this->rule_count - $data['rules_failed']; @@ -247,9 +248,9 @@ function ( $item ) { - if ( $data['posts_scanned'] > 0 && - ! empty( Settings::get_scannable_post_types() ) && - ! empty( Settings::get_scannable_post_statuses() ) + if ( $data['posts_scanned'] > 0 + && ! empty( Settings::get_scannable_post_types() ) + && ! empty( Settings::get_scannable_post_statuses() ) ) { $sql = "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} @@ -262,7 +263,7 @@ function ( $item ) { Settings::get_scannable_post_statuses() ) . ')'; - // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Using direct query for adding data to database, caching not required for one time operation. + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Using direct query for adding data to database, caching not required for one time operation. $data['posts_without_issues'] = $wpdb->get_var( $sql ); $data['avg_issues_per_post'] = round( ( $data['warnings'] + $data['errors'] ) / $data['posts_scanned'], 2 ); @@ -364,7 +365,7 @@ function ( $item ) { /** * Gets issues summary information about a post type * - * @param string $post_type post type. + * @param string $post_type post type. * @return array . */ public function issues_summary_by_post_type( $post_type ) { @@ -437,7 +438,7 @@ public function issues_summary_by_post_type( $post_type ) { $data['cache_id'] = $transient_name; $data['cached_at'] = time(); $data['expires_at'] = time() + $this->cache_time; - $data['cache_hit'] = false; + $data['cache_hit'] = false; set_transient( $transient_name, $data, $this->cache_time ); From a7190679b9f51e779d399d75f3ed4467b5bb1991 Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 22 Jan 2024 08:52:12 -0600 Subject: [PATCH 06/14] Bugfix - remove forcing auth header --- src/editorApp/checkPage.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/editorApp/checkPage.js b/src/editorApp/checkPage.js index d9f807e0..fe1efb46 100644 --- a/src/editorApp/checkPage.js +++ b/src/editorApp/checkPage.js @@ -5,21 +5,11 @@ import { showNotice } from './../common/helpers'; const API_URL = edac_editor_app.edacApiUrl; - -let HEADERS; -if (typeof (edacpFullSiteScanApp) === 'undefined') { - HEADERS = edac_editor_app.edacHeaders; -} else { - HEADERS = edacpFullSiteScanApp.edacpHeaders; -} - - const postData = async (url = "", data = {}) => { return await fetch(url, { method: "POST", - headers: HEADERS, body: JSON.stringify(data), }).then((res) => { return res.json(); @@ -33,7 +23,6 @@ const getData = async (url = "") => { return await fetch(url, { method: "GET", - headers: HEADERS }).then((res) => { return res.json(); }).catch(() => { From 8353c9043a6d6c11ee885d5caead285b8ba8c042 Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 22 Jan 2024 14:34:37 -0600 Subject: [PATCH 07/14] wip --- accessibility-checker.php | 6 +- composer.json | 9 +- composer.lock | 144 +++++++++++++++++++++++------ includes/classes/class-helpers.php | 36 -------- includes/enqueue-scripts.php | 25 ++--- includes/options-page.php | 3 - includes/validate.php | 9 +- package-lock.json | 2 +- src/admin/index.js | 6 +- src/editorApp/checkPage.js | 19 +--- src/editorApp/index.js | 52 +---------- update-composer-config.php | 2 +- 12 files changed, 146 insertions(+), 167 deletions(-) diff --git a/accessibility-checker.php b/accessibility-checker.php index d05d9bc4..e81f9e5b 100644 --- a/accessibility-checker.php +++ b/accessibility-checker.php @@ -835,11 +835,7 @@ function edac_summary_ajax() { // password check. if ( - ! ( - EDAC_KEY_VALID === true && - edac_check_plugin_active( 'accessibility-checker-pro/accessibility-checker-pro.php' ) - ) && - \EDAC\Helpers::is_basic_auth() + get_option( 'edac_password_protected', false ) ) { $admin_notices = new \EDAC\Admin_Notices(); $notice_text = $admin_notices->edac_password_protected_notice_text(); diff --git a/composer.json b/composer.json index 46075532..2460e9fd 100644 --- a/composer.json +++ b/composer.json @@ -25,15 +25,16 @@ "prefer-stable": true, "repositories": [ { - "type": "vcs", - "url": "https://github.com/equalizedigital/accessibility-checker-wp-env" + "type": "vcs", + "url": "https://github.com/equalizedigital/accessibility-checker-wp-env" } - ], + ], "require-dev": { "automattic/vipwpcs": "^3", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", "phpcompatibility/php-compatibility": "*", - "php-parallel-lint/php-parallel-lint": "^1.3" + "php-parallel-lint/php-parallel-lint": "^1.3", + "equalizedigital/accessibility-checker-wp-env": "*" }, "require": { "cbschuld/browser.php": "^1.9", diff --git a/composer.lock b/composer.lock index 968efaa2..f3511e2a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "981cc16881daa866df30c80aec17e34a", + "content-hash": "36328aa3065e60c85418e6198e600470", "packages": [ { "name": "cbschuld/browser.php", @@ -398,6 +398,37 @@ }, "time": "2022-02-04T12:51:07+00:00" }, + { + "name": "equalizedigital/accessibility-checker-wp-env", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/equalizedigital/accessibility-checker-wp-env.git", + "reference": "fd3a97365c258749692fbb900b90e9129deb4a15" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/equalizedigital/accessibility-checker-wp-env/zipball/fd3a97365c258749692fbb900b90e9129deb4a15", + "reference": "fd3a97365c258749692fbb900b90e9129deb4a15", + "shasum": "" + }, + "type": "library", + "license": [ + "GPLv2 or later" + ], + "authors": [ + { + "name": "Matt Boone", + "email": "matt@boone.dev" + } + ], + "description": "This package is a customized version of wp-env used for development and testing of Accessibility Checker, Accessibility Checker Pro and Accessibility Checker Audit History.", + "support": { + "source": "https://github.com/equalizedigital/accessibility-checker-wp-env/tree/v1.0.0", + "issues": "https://github.com/equalizedigital/accessibility-checker-wp-env/issues" + }, + "time": "2023-10-23T23:58:23+00:00" + }, { "name": "php-parallel-lint/php-parallel-lint", "version": "v1.3.2", @@ -519,29 +550,29 @@ }, { "name": "phpcsstandards/phpcsextra", - "version": "1.1.2", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", - "reference": "746c3190ba8eb2f212087c947ba75f4f5b9a58d5" + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/746c3190ba8eb2f212087c947ba75f4f5b9a58d5", - "reference": "746c3190ba8eb2f212087c947ba75f4f5b9a58d5", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", "shasum": "" }, "require": { "php": ">=5.4", - "phpcsstandards/phpcsutils": "^1.0.8", - "squizlabs/php_codesniffer": "^3.7.1" + "phpcsstandards/phpcsutils": "^1.0.9", + "squizlabs/php_codesniffer": "^3.8.0" }, "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcsstandards/phpcsdevcs": "^1.1.6", "phpcsstandards/phpcsdevtools": "^1.2.1", - "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "type": "phpcodesniffer-standard", "extra": { @@ -576,35 +607,50 @@ ], "support": { "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy", "source": "https://github.com/PHPCSStandards/PHPCSExtra" }, - "time": "2023-09-20T22:06:18+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2023-12-08T16:49:07+00:00" }, { "name": "phpcsstandards/phpcsutils", - "version": "1.0.8", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", - "reference": "69465cab9d12454e5e7767b9041af0cd8cd13be7" + "reference": "908247bc65010c7b7541a9551e002db12e9dae70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/69465cab9d12454e5e7767b9041af0cd8cd13be7", - "reference": "69465cab9d12454e5e7767b9041af0cd8cd13be7", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/908247bc65010c7b7541a9551e002db12e9dae70", + "reference": "908247bc65010c7b7541a9551e002db12e9dae70", "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.7.1 || 4.0.x-dev@dev" + "squizlabs/php_codesniffer": "^3.8.0 || 4.0.x-dev@dev" }, "require-dev": { "ext-filter": "*", "php-parallel-lint/php-console-highlighter": "^1.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcsstandards/phpcsdevcs": "^1.1.6", - "yoast/phpunit-polyfills": "^1.0.5 || ^2.0.0" + "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0" }, "type": "phpcodesniffer-standard", "extra": { @@ -649,9 +695,24 @@ "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" }, - "time": "2023-07-16T21:39:41+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2023-12-08T14:50:00+00:00" }, { "name": "sirbrillig/phpcs-variable-analysis", @@ -713,16 +774,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.2", + "version": "3.8.1", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", + "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", "shasum": "" }, "require": { @@ -732,11 +793,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -751,22 +812,45 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "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/squizlabs/PHP_CodeSniffer", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", "standards", "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "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" }, - "time": "2023-02-22T23:07:41+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-01-11T20:47:48+00:00" }, { "name": "wp-coding-standards/wpcs", diff --git a/includes/classes/class-helpers.php b/includes/classes/class-helpers.php index ff51651d..f886fa14 100644 --- a/includes/classes/class-helpers.php +++ b/includes/classes/class-helpers.php @@ -208,40 +208,4 @@ public static function is_domain_loopback( $domain ) { return false; } - /** - * Determine if this site is using basic auth. - * - * @return boolean - */ - public static function is_basic_auth() { - - $key = 'edac_auth_type'; - - $status = get_transient( $key ); - - $status = false; - - if ( false === $status ) { - - //phpcs:disable WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get - $response = wp_remote_get( home_url() ); - if ( ! is_wp_error( $response ) ) { - $code = wp_remote_retrieve_response_code( $response ); - - if ( 401 === $code || 403 === $code ) { - $status = 'basic'; - } - } - - // cache results for up to 30 seconds. - set_transient( $key, $status, 30 ); - - } - - if ( 'basic' === $status ) { - return true; - } - - return false; - } } diff --git a/includes/enqueue-scripts.php b/includes/enqueue-scripts.php index 5510b3d6..bade233f 100644 --- a/includes/enqueue-scripts.php +++ b/includes/enqueue-scripts.php @@ -57,12 +57,6 @@ function edac_admin_enqueue_scripts() { $active = false; } - $headers = array( - 'Content-Type' => 'application/json', - 'X-WP-Nonce' => wp_create_nonce( 'wp_rest' ), - 'Authorization' => 'None', - - ); $pro = edac_check_plugin_active( 'accessibility-checker-pro/accessibility-checker-pro.php' ) && EDAC_KEY_VALID; @@ -81,16 +75,15 @@ function edac_admin_enqueue_scripts() { 'edac-editor-app', 'edac_editor_app', array( - 'postID' => $post_id, - 'edacUrl' => esc_url_raw( get_site_url() ), - 'edacHeaders' => $headers, - 'basicAuth' => true === $pro ? false : EDAC\Helpers::is_basic_auth(), - 'edacApiUrl' => esc_url_raw( rest_url() . 'accessibility-checker/v1' ), - 'baseurl' => plugin_dir_url( __DIR__ ), - 'active' => $active, - 'pro' => $pro, - 'debug' => $debug, - 'scanUrl' => get_preview_post_link( + 'postID' => $post_id, + 'edacUrl' => esc_url_raw( get_site_url() ), + 'edacApiUrl' => esc_url_raw( rest_url() . 'accessibility-checker/v1' ), + 'baseurl' => plugin_dir_url( __DIR__ ), + 'active' => $active, + 'pro' => $pro, + 'authOk' => get_option( 'edac_password_protected', false ), + 'debug' => $debug, + 'scanUrl' => get_preview_post_link( $post_id, array( 'edac_pageScanner' => 1 ) ), diff --git a/includes/options-page.php b/includes/options-page.php index f350759d..d7d7400d 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -77,9 +77,6 @@ function edac_display_welcome_page() { */ function edac_display_options_page() { include_once plugin_dir_path( __DIR__ ) . 'partials/settings-page.php'; - - // force edac_auth_type to reset in case user updates auth options. - delete_transient( 'edac_auth_type' ); } /** diff --git a/includes/validate.php b/includes/validate.php index 80948df9..b06abee1 100644 --- a/includes/validate.php +++ b/includes/validate.php @@ -111,8 +111,10 @@ function edac_validate( $post_ID, $post, $action ) { $content = edac_get_content( $post ); do_action( 'edac_after_get_content', $post_ID, $content, $action ); + // TODO: + error_log( $content['html'] ); + if ( ! $content['html'] ) { - delete_transient( 'edac_auth_type' ); add_option( 'edac_password_protected', true ); return; } else { @@ -357,9 +359,8 @@ function edac_get_content( $post ) { // will not be followed, so $content['html] will be false. $merged_context_opts = array_merge( $default_context_opts, $context_opts ); $context = stream_context_create( $merged_context_opts ); - - $dom = file_get_html( $url, false, $context ); - $content['html'] = edac_remove_elements( + $dom = file_get_html( $url, false, $context ); + $content['html'] = edac_remove_elements( $dom, array( '#wpadminbar', // wp admin bar. diff --git a/package-lock.json b/package-lock.json index 8f157270..672937b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@floating-ui/dom": "^1.2.9", "@wordpress/env": "*", "@wordpress/scripts": "^26.5.0", - "axe-core": "^4.7.2", + "axe-core": "^4.8.2", "babel-loader": "^9.1.2", "clean-webpack-plugin": "^4.0.0", "css-loader": "^6.8.1", diff --git a/src/admin/index.js b/src/admin/index.js index 92a34f6e..80fa8c63 100644 --- a/src/admin/index.js +++ b/src/admin/index.js @@ -840,7 +840,8 @@ const getData = async (url = "", data = {}) => { const response = await fetch(url, { method: "GET", headers: { - 'X-WP-Nonce': edac_script_vars.restNonce + 'X-WP-Nonce': edac_script_vars.restNonce, + 'Content-Type': 'application/json' } }); return response.json(); @@ -854,7 +855,8 @@ const postData = async (url = "", data = {}) => { const response = await fetch(url, { method: "POST", headers: { - 'X-WP-Nonce': edac_script_vars.restNonce + 'X-WP-Nonce': edac_script_vars.restNonce, + 'Content-Type': 'application/json' }, body: JSON.stringify(data), }); diff --git a/src/editorApp/checkPage.js b/src/editorApp/checkPage.js index fe1efb46..50ff8127 100644 --- a/src/editorApp/checkPage.js +++ b/src/editorApp/checkPage.js @@ -1,8 +1,6 @@ import { info, debug } from './helpers'; import { showNotice } from './../common/helpers'; - - const API_URL = edac_editor_app.edacApiUrl; const postData = async (url = "", data = {}) => { @@ -10,6 +8,10 @@ const postData = async (url = "", data = {}) => { return await fetch(url, { method: "POST", + headers: { + 'X-WP-Nonce': edac_script_vars.restNonce, + 'Content-Type': 'application/json' + }, body: JSON.stringify(data), }).then((res) => { return res.json(); @@ -19,19 +21,6 @@ const postData = async (url = "", data = {}) => { } -const getData = async (url = "") => { - - return await fetch(url, { - method: "GET", - }).then((res) => { - return res.json(); - }).catch(() => { - return {}; - }); - -} - - const saveScanResults = (postId, violations) => { diff --git a/src/editorApp/index.js b/src/editorApp/index.js index 1d30bb4f..37c20fa3 100644 --- a/src/editorApp/index.js +++ b/src/editorApp/index.js @@ -1,7 +1,5 @@ import { settings } from './settings'; import { init as initCheckPage } from './checkPage'; -import { showNotice } from './../common/helpers'; - window.addEventListener('DOMContentLoaded', () => { @@ -10,58 +8,12 @@ window.addEventListener('DOMContentLoaded', () => { if (SCANNABLE_POST_TYPE && settings.JS_SCAN_ENABLED) { - if (edac_editor_app.pro === '1' || edac_editor_app.basicAuth !== '1') { + if (edac_editor_app.authOk === '1' ) { setTimeout(function () { initCheckPage(); }, 250); // Allow page load to fire before init, otherwise we'll have to wait for iframe to load. - - } else { - - - //Listen for dispatches from the wp data store so we can trap the update/publish event - let saving = false; - let autosaving = false; - - - if (wp.data !== undefined && wp.data.subscribe !== undefined) { - wp.data.subscribe(() => { - - - if (wp.data.select('core/editor').isAutosavingPost()) { - autosaving = true; - } - - // Rescan the page if user saves post - if (wp.data.select('core/editor').isSavingPost()) { - - saving = true; - } else { - if (saving) { - saving = false; - - if (edac_editor_app.pro !== '1' || edac_editor_app.basicAuth === '1') { - showNotice({ - msg: 'Whoops! It looks like your website is currently password protected. The free version of Accessibility Checker can only scan live websites. To scan this website for accessibility problems either remove the password protection or follow the link below to upgrade to Accessibility Checker Pro.', - type: 'warning', - url: 'https://equalizedigital.com/accessibility-checker/pricing/', - label: 'Upgrade', - closeOthers: true - }); - - } - - } - } - - }); - - } else { - debug("Gutenberg is not enabled."); - } - - - + } diff --git a/update-composer-config.php b/update-composer-config.php index ddafbd83..1fe7076a 100644 --- a/update-composer-config.php +++ b/update-composer-config.php @@ -18,7 +18,7 @@ } else { // Not running in GitHub Actions, assuming local environment. // Add your local specific packages. - $composer_config['require-dev']['equalizedigital/accessibility-checker-wp-env'] = '1.0.0'; + $composer_config['require-dev']['equalizedigital/accessibility-checker-wp-env'] = '*'; } file_put_contents( $composer_json_path, json_encode( $composer_config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) ); From 92ee9e28ca3eee70eab7e6de2015484ad8754de5 Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 22 Jan 2024 16:09:52 -0600 Subject: [PATCH 08/14] wip --- includes/enqueue-scripts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/enqueue-scripts.php b/includes/enqueue-scripts.php index bade233f..6e5be813 100644 --- a/includes/enqueue-scripts.php +++ b/includes/enqueue-scripts.php @@ -81,7 +81,7 @@ function edac_admin_enqueue_scripts() { 'baseurl' => plugin_dir_url( __DIR__ ), 'active' => $active, 'pro' => $pro, - 'authOk' => get_option( 'edac_password_protected', false ), + 'authOk' => false === get_option( 'edac_password_protected', false ), 'debug' => $debug, 'scanUrl' => get_preview_post_link( $post_id, From 99ecef698d9f6f1767ea83d52eefbb26cd851f91 Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 22 Jan 2024 23:33:43 -0600 Subject: [PATCH 09/14] Update - Update version change to force newest version of editorApp.bundle.js - Cast boolean option to boolean out of an abundance of caution --- accessibility-checker.php | 6 +++--- includes/enqueue-scripts.php | 2 +- includes/validate.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/accessibility-checker.php b/accessibility-checker.php index be3085f2..b223e2c0 100644 --- a/accessibility-checker.php +++ b/accessibility-checker.php @@ -10,7 +10,7 @@ * Plugin Name: Accessibility Checker * Plugin URI: https://a11ychecker.com * Description: Audit and check your website for accessibility before you hit publish. In-post accessibility scanner and guidance. - * Version: 1.7.1 + * Version: 1.7.1-beta.7 * Author: Equalize Digital * Author URI: https://equalizedigital.com * License: GPL-2.0+ @@ -45,7 +45,7 @@ // Current plugin version. if ( ! defined( 'EDAC_VERSION' ) ) { - define( 'EDAC_VERSION', '1.7.1' ); + define( 'EDAC_VERSION', '1.7.1-beta.7' ); } // Current database version. @@ -835,7 +835,7 @@ function edac_summary_ajax() { // password check. if ( - get_option( 'edac_password_protected', false ) + (bool) get_option( 'edac_password_protected', false ) ) { $admin_notices = new \EDAC\Admin_Notices(); $notice_text = $admin_notices->edac_password_protected_notice_text(); diff --git a/includes/enqueue-scripts.php b/includes/enqueue-scripts.php index 6e5be813..d52857ae 100644 --- a/includes/enqueue-scripts.php +++ b/includes/enqueue-scripts.php @@ -81,7 +81,7 @@ function edac_admin_enqueue_scripts() { 'baseurl' => plugin_dir_url( __DIR__ ), 'active' => $active, 'pro' => $pro, - 'authOk' => false === get_option( 'edac_password_protected', false ), + 'authOk' => false === (bool) get_option( 'edac_password_protected', false ), 'debug' => $debug, 'scanUrl' => get_preview_post_link( $post_id, diff --git a/includes/validate.php b/includes/validate.php index b077ec2c..4cb9d1f7 100644 --- a/includes/validate.php +++ b/includes/validate.php @@ -112,10 +112,10 @@ function edac_validate( $post_ID, $post, $action ) { do_action( 'edac_after_get_content', $post_ID, $content, $action ); if ( ! $content['html'] ) { - add_option( 'edac_password_protected', true ); + update_option( 'edac_password_protected', true ); return; } else { - delete_option( 'edac_password_protected' ); + update_option( 'edac_password_protected', false ); } // set record check flag on previous error records. From d04244a7ae77263b01bab6a106e0040065eb4126 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Tue, 23 Jan 2024 10:41:02 -0500 Subject: [PATCH 10/14] update - version --- accessibility-checker.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accessibility-checker.php b/accessibility-checker.php index b223e2c0..2c5bfbee 100644 --- a/accessibility-checker.php +++ b/accessibility-checker.php @@ -10,7 +10,7 @@ * Plugin Name: Accessibility Checker * Plugin URI: https://a11ychecker.com * Description: Audit and check your website for accessibility before you hit publish. In-post accessibility scanner and guidance. - * Version: 1.7.1-beta.7 + * Version: 1.7.1 * Author: Equalize Digital * Author URI: https://equalizedigital.com * License: GPL-2.0+ @@ -45,7 +45,7 @@ // Current plugin version. if ( ! defined( 'EDAC_VERSION' ) ) { - define( 'EDAC_VERSION', '1.7.1-beta.7' ); + define( 'EDAC_VERSION', '1.7.1' ); } // Current database version. From d6a80405f7a50d3f93545f3a755f5a2ba6fffb05 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Tue, 23 Jan 2024 10:47:28 -0500 Subject: [PATCH 11/14] fixed - appCssUrl to prevent 404 --- includes/enqueue-scripts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/enqueue-scripts.php b/includes/enqueue-scripts.php index d52857ae..5f181188 100644 --- a/includes/enqueue-scripts.php +++ b/includes/enqueue-scripts.php @@ -154,7 +154,7 @@ function edac_enqueue_scripts() { 'edacUrl' => esc_url_raw( get_site_url() ), 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'loggedIn' => is_user_logged_in(), - 'appCssUrl' => plugin_dir_url( __DIR__ ) . 'build/css/frontendHighlighterApp.css?ver=' . EDAC_VERSION, + 'appCssUrl' => EDAC_PLUGIN_URL . 'build/css/frontendHighlighterApp.css?ver=' . EDAC_VERSION, ) ); From e14739941026b6aae51c677df3d62d46cd20c0d2 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Tue, 23 Jan 2024 10:59:58 -0500 Subject: [PATCH 12/14] removed - debug function call #455 --- src/frontendHighlighterApp/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/frontendHighlighterApp/index.js b/src/frontendHighlighterApp/index.js index 7cceca2b..ec34298c 100644 --- a/src/frontendHighlighterApp/index.js +++ b/src/frontendHighlighterApp/index.js @@ -698,8 +698,6 @@ class AccessibilityCheckerHighlight { If not, then we assume the css has been combined, so we manually add it to the document. */ if( ! document.querySelector('#edac-app-css') ){ - debug('css is combined, so adding app.css to page.'); - var link = document.createElement('link'); link.rel = 'stylesheet'; link.id = 'edac-app-css'; From 8e7ec186b78b7168a63185f3819c176afad9b4f1 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Tue, 23 Jan 2024 13:15:22 -0500 Subject: [PATCH 13/14] updated - readme --- README.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.txt b/README.txt index edaafa86..826840cd 100644 --- a/README.txt +++ b/README.txt @@ -172,8 +172,9 @@ No, Accessibility Checker runs completely on your server and does not require yo == Changelog == = 1.7.1 = -* Fixes: classic editor save conflict -* Fixes: password protection message displaying repeatedly +* Fixed: classic editor save conflict +* Fixed: password protection message displaying repeatedly +* Fixed: frontend highlighting asset url and debug error = 1.7.0 = * Added: Architecture for JavaScript-based checks for better code analysis From b824c977de2aafcd42c4a26249c68678a7341a43 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Tue, 23 Jan 2024 13:16:10 -0500 Subject: [PATCH 14/14] updated - composer --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index f3511e2a..fe3eef0c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "36328aa3065e60c85418e6198e600470", + "content-hash": "08eec440286165ad4abf980b171ce491", "packages": [ { "name": "cbschuld/browser.php", @@ -400,16 +400,16 @@ }, { "name": "equalizedigital/accessibility-checker-wp-env", - "version": "v1.0.0", + "version": "v1.0.5", "source": { "type": "git", "url": "https://github.com/equalizedigital/accessibility-checker-wp-env.git", - "reference": "fd3a97365c258749692fbb900b90e9129deb4a15" + "reference": "abb9403cbcb5d5edeefe005f19bd6f697b195048" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/equalizedigital/accessibility-checker-wp-env/zipball/fd3a97365c258749692fbb900b90e9129deb4a15", - "reference": "fd3a97365c258749692fbb900b90e9129deb4a15", + "url": "https://api.github.com/repos/equalizedigital/accessibility-checker-wp-env/zipball/abb9403cbcb5d5edeefe005f19bd6f697b195048", + "reference": "abb9403cbcb5d5edeefe005f19bd6f697b195048", "shasum": "" }, "type": "library", @@ -424,10 +424,10 @@ ], "description": "This package is a customized version of wp-env used for development and testing of Accessibility Checker, Accessibility Checker Pro and Accessibility Checker Audit History.", "support": { - "source": "https://github.com/equalizedigital/accessibility-checker-wp-env/tree/v1.0.0", + "source": "https://github.com/equalizedigital/accessibility-checker-wp-env/tree/v1.0.5", "issues": "https://github.com/equalizedigital/accessibility-checker-wp-env/issues" }, - "time": "2023-10-23T23:58:23+00:00" + "time": "2024-01-16T19:47:48+00:00" }, { "name": "php-parallel-lint/php-parallel-lint",