From 386b7a1c6d0d1c51d8450522550f69c4f711f9b2 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Thu, 30 May 2024 14:12:03 -0400 Subject: [PATCH 1/8] updated - link_blank rule allowed phrases --- includes/rules/link_blank.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/includes/rules/link_blank.php b/includes/rules/link_blank.php index 06fe962a..7902e954 100644 --- a/includes/rules/link_blank.php +++ b/includes/rules/link_blank.php @@ -91,15 +91,11 @@ function edac_check_link_blank_text( $text ) { $text = strtolower( $text ); - // phrases. $allowed_phrases = [ - __( 'opens a new window', 'accessibility-checker' ), - __( 'opens a new tab', 'accessibility-checker' ), - __( 'opens new window', 'accessibility-checker' ), - __( 'opens new tab', 'accessibility-checker' ), + __( 'new window', 'accessibility-checker' ), + __( 'new tab', 'accessibility-checker' ), ]; - // check if text contains any of the allowed phrases. foreach ( $allowed_phrases as $allowed_phrase ) { if ( strpos( $text, $allowed_phrase ) !== false ) { return true; From 28e4f203c3b88d58bd344a94bb8908520af59698 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Thu, 30 May 2024 14:54:31 -0400 Subject: [PATCH 2/8] removed - purge file --- includes/purge.php | 72 ---------------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 includes/purge.php diff --git a/includes/purge.php b/includes/purge.php deleted file mode 100644 index c76bee9e..00000000 --- a/includes/purge.php +++ /dev/null @@ -1,72 +0,0 @@ -prefix . 'accessibility_checker'; - - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Safe variable used for table name, caching not required for one time operation. - $wpdb->query( $wpdb->prepare( 'DELETE FROM %i WHERE postid = %d and siteid = %d', $table_name, $post_id, $site_id ) ); - - edac_delete_post_meta( $post_id ); -} - -/** - * Delete post meta - * - * @param int $post_id ID of the post. - * @return void - */ -function edac_delete_post_meta( $post_id ) { - - if ( ! $post_id ) { - return; - } - - $post_meta = get_post_meta( $post_id ); - if ( $post_meta ) { - foreach ( $post_meta as $key => $value ) { - if ( substr( $key, 0, 5 ) === '_edac' || substr( $key, 0, 6 ) === '_edacp' ) { - delete_post_meta( $post_id, $key ); - } - } - } -} - -/** - * Purge issues by post type - * - * @param string $post_type Post Type. - * @return void - */ -function edac_delete_cpt_posts( $post_type ) { - - if ( ! $post_type ) { - return; - } - - global $wpdb; - $site_id = get_current_blog_id(); - - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Safe variable used for table name, caching not required for one time operation. - return $wpdb->query( - $wpdb->prepare( - "DELETE T1,T2 from $wpdb->postmeta as T1 JOIN %i as T2 ON t1.post_id = T2.postid WHERE t1.meta_key like %s and T2.siteid=%d and T2.type=%s", - edac_get_valid_table_name( $wpdb->prefix . 'accessibility_checker' ), - '_edac%', - $site_id, - $post_type - ) - ); -} From 19ecff02d2b459d044c04af80dcd064344f6e76d Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Tue, 4 Jun 2024 19:23:44 +0100 Subject: [PATCH 3/8] Only consider possible heading if the tag wraps the entire text content --- src/pageScanner/checks/paragraph-styled-as-header.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pageScanner/checks/paragraph-styled-as-header.js b/src/pageScanner/checks/paragraph-styled-as-header.js index f7187d91..ce510392 100644 --- a/src/pageScanner/checks/paragraph-styled-as-header.js +++ b/src/pageScanner/checks/paragraph-styled-as-header.js @@ -40,9 +40,15 @@ export default { const fontStyle = style.getPropertyValue( 'font-style' ); const isItalic = [ 'italic', 'oblique' ].includes( fontStyle ); - const hasBoldOrItalicTag = node.querySelector( 'b, strong, i, em' ) !== null; - - if ( isBold || isItalic || hasBoldOrItalicTag ) { + let wrappedByBoldOrItalicTag = false; + const boldOrItalicTags = node.querySelectorAll( 'b, strong, i, em' ); + boldOrItalicTags.forEach( ( tag ) => { + if ( tag.textContent === node.textContent ) { + wrappedByBoldOrItalicTag = true; + } + } ); + + if ( isBold || isItalic || wrappedByBoldOrItalicTag ) { return true; } From 5aa836dae0ec4918f7dba49591016629c3a7ca43 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Wed, 5 Jun 2024 15:21:26 +0100 Subject: [PATCH 4/8] Don't operate on JS rules when doing rulecheck for php ruleset --- includes/validate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/validate.php b/includes/validate.php index 78dd12be..84b53c15 100644 --- a/includes/validate.php +++ b/includes/validate.php @@ -255,7 +255,7 @@ function edac_remove_corrected_posts( $post_ID, $type, $pre = 1, $ruleset = 'php foreach ( $rules as $rule ) { if ( 'js' === $ruleset && isset( $rule['ruleset'] ) && 'js' === $rule['ruleset'] ) { $rule_slugs[] = $rule['slug']; - } elseif ( 'js' !== $ruleset ) { + } elseif ( 'js' !== $ruleset && ( ! isset( $rule['ruleset'] ) || 'js' !== $rule['ruleset'] ) ) { $rule_slugs[] = $rule['slug']; } } From 11955dcaa413130e17bc7ba0638df5102e7a07e2 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Wed, 5 Jun 2024 17:54:22 +0100 Subject: [PATCH 5/8] Try to make the loop and rule grouping clearer in edac_remove_corrected_posts --- includes/validate.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/includes/validate.php b/includes/validate.php index 84b53c15..c4d2aea2 100644 --- a/includes/validate.php +++ b/includes/validate.php @@ -250,16 +250,19 @@ function edac_validate( $post_ID, $post, $action ) { function edac_remove_corrected_posts( $post_ID, $type, $pre = 1, $ruleset = 'php' ) { global $wpdb; - $rules = edac_register_rules(); - $rule_slugs = []; + $rules = edac_register_rules(); + $js_rule_slugs = []; + $php_rule_slugs = []; + // Separate the JS rules and the PHP rules. foreach ( $rules as $rule ) { - if ( 'js' === $ruleset && isset( $rule['ruleset'] ) && 'js' === $rule['ruleset'] ) { - $rule_slugs[] = $rule['slug']; - } elseif ( 'js' !== $ruleset && ( ! isset( $rule['ruleset'] ) || 'js' !== $rule['ruleset'] ) ) { - $rule_slugs[] = $rule['slug']; + if ( isset( $rule['ruleset'] ) && 'js' === $rule['ruleset'] ) { + $js_rule_slugs[] = $rule['slug']; + } else { + $php_rule_slugs[] = $rule['slug']; } } - + // Operate only on the slugs for the ruleset we are checking in this call. + $rule_slugs = 'js' === $ruleset ? $js_rule_slugs : $php_rule_slugs; if ( 0 === count( $rule_slugs ) ) { return; } From 5efcab2852451d1ad9cb891a886f207f2e7fac40 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Thu, 6 Jun 2024 14:46:19 +0100 Subject: [PATCH 6/8] Bump version 1.13.0 -> 1.13.1 --- accessibility-checker.php | 4 ++-- package.json | 2 +- readme.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/accessibility-checker.php b/accessibility-checker.php index 6f0cc531..401b7276 100755 --- 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.13.0 + * Version: 1.13.1 * Author: Equalize Digital * Author URI: https://equalizedigital.com * License: GPL-2.0+ @@ -35,7 +35,7 @@ // Current plugin version. if ( ! defined( 'EDAC_VERSION' ) ) { - define( 'EDAC_VERSION', '1.13.0' ); + define( 'EDAC_VERSION', '1.13.1' ); } // Current database version. diff --git a/package.json b/package.json index effdd0ae..6cdc3a8b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "accessibility-checker", - "version": "1.13.0", + "version": "1.13.1", "description": "Audit and check your website for accessibility before you hit publish. In-post accessibility scanner and guidance.", "author": "Equalize Digital", "license": "GPL-2.0+", diff --git a/readme.txt b/readme.txt index b679385d..67465478 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: equalizedigital, alh0319, stevejonesdev Tags: accessibility, accessible, wcag, ada, WP accessibility Requires at least: 6.2 Tested up to: 6.5.3 -Stable tag: 1.13.0 +Stable tag: 1.13.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html From d8c7e74c2f2017111a05ea3925d1575697ce92c8 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Thu, 6 Jun 2024 14:51:50 +0100 Subject: [PATCH 7/8] Add changelog for 1.13.1 --- readme.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/readme.txt b/readme.txt index 67465478..ba468fba 100644 --- a/readme.txt +++ b/readme.txt @@ -171,6 +171,11 @@ No, Accessibility Checker runs completely on your server and does not require yo == Changelog == += 1.13.1 = +* Enhancement: Make the new window warning detection less rigid +* Fixed: Avoid flagging possible headings when the entire text is not wrapped +* Fixed: Allow JS checked rules to retain ignored state between scans + = 1.13.0 = * Added: Meta Viewport zoom-able and scale-able check * Added: Empty Paragraph warning From c9273049a41df12ee9c7336b921c111477a28801 Mon Sep 17 00:00:00 2001 From: William Patton Date: Thu, 6 Jun 2024 16:00:03 +0100 Subject: [PATCH 8/8] Update the tested up to value: 6.5.3 -> 6.5.4 Co-authored-by: Steve Jones --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index ba468fba..98a25206 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: equalizedigital, alh0319, stevejonesdev Tags: accessibility, accessible, wcag, ada, WP accessibility Requires at least: 6.2 -Tested up to: 6.5.3 +Tested up to: 6.5.4 Stable tag: 1.13.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html