From bc2cecfdeea6ef162fb9cdc4016a15a70db48006 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Sat, 4 May 2024 16:38:02 -0400 Subject: [PATCH 01/14] fixed - img linked alt empty strict data comparison bug --- includes/rules/img_linked_alt_empty.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/rules/img_linked_alt_empty.php b/includes/rules/img_linked_alt_empty.php index 16d3c3d7..04b82505 100644 --- a/includes/rules/img_linked_alt_empty.php +++ b/includes/rules/img_linked_alt_empty.php @@ -21,7 +21,7 @@ function edac_rule_img_linked_alt_empty( $content, $post ) { // phpcs:ignore -- foreach ( $as as $a ) { // anchors with aria-label or title or valid node text. - if ( $a->getAttribute( 'aria-label' ) === '' && $a->getAttribute( 'title' ) === '' && strlen( $a->plaintext ) <= 5 ) { + if ( empty( $a->getAttribute( 'aria-label' ) ) && empty( $a->getAttribute( 'title' ) ) && strlen( $a->plaintext ) <= 5 ) { $images = $a->find( 'img' ); foreach ( $images as $image ) { From 6c95889fa8c6a4517a9a99c2aa1eb409cdcb893d Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Sat, 4 May 2024 18:17:47 -0400 Subject: [PATCH 02/14] fixed - img linked alt missing strict data comparison bug --- includes/rules/img_linked_alt_missing.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/rules/img_linked_alt_missing.php b/includes/rules/img_linked_alt_missing.php index 5984e357..dfbd8439 100644 --- a/includes/rules/img_linked_alt_missing.php +++ b/includes/rules/img_linked_alt_missing.php @@ -21,7 +21,7 @@ function edac_rule_img_linked_alt_missing( $content, $post ) { // phpcs:ignore - foreach ( $as as $a ) { // anchors with aria-label or title or valid node text. - if ( $a->getAttribute( 'aria-label' ) === '' && $a->getAttribute( 'title' ) === '' && strlen( $a->plaintext ) <= 5 ) { + if ( empty( $a->getAttribute( 'aria-label' ) ) && empty( $a->getAttribute( 'title' ) ) && strlen( $a->plaintext ) <= 5 ) { $images = $a->find( 'img' ); foreach ( $images as $image ) { From 727b6e9a31ac2f5d38bb89b1c6df5da9eeb1936f Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Sat, 4 May 2024 18:49:11 -0400 Subject: [PATCH 03/14] fixed - $edac_review_notice strict data comparison bug #601 --- admin/class-admin-notices.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/class-admin-notices.php b/admin/class-admin-notices.php index e5e3b1d0..0be6554f 100644 --- a/admin/class-admin-notices.php +++ b/admin/class-admin-notices.php @@ -266,7 +266,7 @@ public function edac_review_notice() { $edac_review_notice_reminder = get_transient( $transient ); // first time if notice has never been shown wait 14 days. - if ( false === $edac_review_notice_reminder && false === $edac_review_notice ) { + if ( false === $edac_review_notice_reminder && empty( $edac_review_notice ) ) { // if option isn't set and plugin has been active for more than 14 days show notice. This is for current users. if ( edac_days_active() > 14 ) { update_option( $option, 'play' ); From f4a7d2f6879f3a07dbc4284ec32ea715658b174e Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Sat, 4 May 2024 19:00:20 -0400 Subject: [PATCH 04/14] fixed - iframe_missing_title rule strict data comparison bug --- includes/rules/iframe_missing_title.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/rules/iframe_missing_title.php b/includes/rules/iframe_missing_title.php index e994b586..545fe0ad 100644 --- a/includes/rules/iframe_missing_title.php +++ b/includes/rules/iframe_missing_title.php @@ -19,7 +19,7 @@ function edac_rule_iframe_missing_title( $content, $post ) { // phpcs:ignore -- $errors = []; foreach ( $iframe_tags as $iframe ) { - if ( isset( $iframe ) && $iframe->getAttribute( 'title' ) === '' && $iframe->getAttribute( 'aria-label' ) === '' ) { + if ( isset( $iframe ) && empty( $iframe->getAttribute( 'title' ) ) && empty( $iframe->getAttribute( 'aria-label' ) ) ) { $iframecode = htmlspecialchars( $iframe->outertext ); From ae2272d532349751057332e978452ecc325a3fad Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Sat, 4 May 2024 19:52:06 -0400 Subject: [PATCH 05/14] fixed - empty_button.php rule strict data comparison bug --- includes/rules/empty_button.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/rules/empty_button.php b/includes/rules/empty_button.php index 14048a8e..8514362c 100644 --- a/includes/rules/empty_button.php +++ b/includes/rules/empty_button.php @@ -27,9 +27,9 @@ function edac_rule_empty_button( $content, $post ) { // phpcs:ignore -- $post is // check buttons. foreach ( $buttons as $button ) { if ( - str_ireplace( [ ' ', ' ', '-', '_' ], '', trim( $button->plaintext ) ) === '' - && $button->getAttribute( 'aria-label' ) === '' - && $button->getAttribute( 'title' ) === '' + empty( str_ireplace( [ ' ', ' ', '-', '_' ], '', trim( $button->plaintext ) ) ) + && empty( $button->getAttribute( 'aria-label' ) ) + && empty( $button->getAttribute( 'title' ) ) ) { $error_code = $button->outertext; @@ -39,13 +39,13 @@ function edac_rule_empty_button( $content, $post ) { // phpcs:ignore -- $post is if ( '' !== $error_code - && ( ! isset( $image[0] ) || trim( $image[0]->getAttribute( 'alt' ) ) === '' ) - && ( ! isset( $input[0] ) || trim( $input[0]->getAttribute( 'value' ) ) === '' ) + && ( ! isset( $image[0] ) || empty( trim( $image[0]->getAttribute( 'alt' ) ) ) ) + && ( ! isset( $input[0] ) || empty( trim( $input[0]->getAttribute( 'value' ) ) ) ) && ( ! isset( $i[0] ) || ( - ( trim( $i[0]->getAttribute( 'title' ) ) === '' ) && - ( trim( $i[0]->getAttribute( 'aria-label' ) ) === '' ) + ( empty( trim( $i[0]->getAttribute( 'title' ) ) ) ) && + ( empty( trim( $i[0]->getAttribute( 'aria-label' ) ) ) ) ) ) ) { @@ -56,7 +56,7 @@ function edac_rule_empty_button( $content, $post ) { // phpcs:ignore -- $post is // check inputs. foreach ( $inputs as $input ) { - if ( $input->getAttribute( 'value' ) === '' ) { + if ( empty( $input->getAttribute( 'value' ) ) ) { $errors[] = $input->outertext; } } From 3dc1a244541a38ef91d85c293e994d4b94f7e3d5 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Sat, 4 May 2024 20:32:59 -0400 Subject: [PATCH 06/14] fixed - empty_heading_tag rule strict data comparison bug --- includes/rules/empty_heading_tag.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/includes/rules/empty_heading_tag.php b/includes/rules/empty_heading_tag.php index a3c12bcf..327e9503 100644 --- a/includes/rules/empty_heading_tag.php +++ b/includes/rules/empty_heading_tag.php @@ -26,7 +26,15 @@ function edac_rule_empty_heading_tag( $content, $post ) { // phpcs:ignore -- $po $heading_code = $heading->outertext; - if ( ( str_ireplace( [ ' ', ' ', '-', '_' ], '', htmlentities( trim( $heading->plaintext ) ) ) === '' || str_ireplace( [ ' ', ' ', '-', '_' ], '', trim( $heading->plaintext ) ) === '' ) && ! preg_match( '#plaintext ) ) ) ) || + empty( str_ireplace( [ ' ', ' ', '-', '_' ], '', trim( $heading->plaintext ) ) ) + ) && + ! preg_match( + '# Date: Sat, 4 May 2024 20:44:16 -0400 Subject: [PATCH 07/14] updated - empty_heading_tag to consider aria-label attribute and improved code readability --- includes/rules/empty_heading_tag.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/rules/empty_heading_tag.php b/includes/rules/empty_heading_tag.php index 327e9503..0361436d 100644 --- a/includes/rules/empty_heading_tag.php +++ b/includes/rules/empty_heading_tag.php @@ -30,6 +30,7 @@ function edac_rule_empty_heading_tag( $content, $post ) { // phpcs:ignore -- $po empty( str_ireplace( [ ' ', ' ', '-', '_' ], '', htmlentities( trim( $heading->plaintext ) ) ) ) || empty( str_ireplace( [ ' ', ' ', '-', '_' ], '', trim( $heading->plaintext ) ) ) ) && + empty( $heading->getAttribute( 'aria-label' ) ) && ! preg_match( '# Date: Sat, 4 May 2024 20:59:48 -0400 Subject: [PATCH 08/14] fixed - empty_link rule strict data comparison bug --- includes/rules/empty_link.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/rules/empty_link.php b/includes/rules/empty_link.php index c4b632af..c2285f77 100644 --- a/includes/rules/empty_link.php +++ b/includes/rules/empty_link.php @@ -24,8 +24,8 @@ function edac_rule_empty_link( $content, $post ) { // phpcs:ignore -- $post is r if ( str_ireplace( [ ' ', ' ', '-', '_' ], '', trim( $link->plaintext ) ) === '' && $link->hasAttribute( 'href' ) - && $link->getAttribute( 'aria-label' ) === '' - && $link->getAttribute( 'title' ) === '' + && empty( $link->getAttribute( 'aria-label' ) ) + && empty( $link->getAttribute( 'title' ) ) ) { // This link does not have plaintext within the tag & @@ -45,7 +45,7 @@ function edac_rule_empty_link( $content, $post ) { // phpcs:ignore -- $post is r // does not have a name. $image = $link->find( 'img' ); - if ( ! $error && isset( $input[0] ) && trim( $image[0]->getAttribute( 'alt' ) ) === '' ) { + if ( ! $error && isset( $input[0] ) && empty( trim( $image[0]->getAttribute( 'alt' ) ) ) ) { // The first image inside the link does not have an alt. // Throw error. @@ -53,7 +53,7 @@ function edac_rule_empty_link( $content, $post ) { // phpcs:ignore -- $post is r } $input = $link->find( 'input' ); - if ( ! $error && isset( $input[0] ) && trim( $image[0]->getAttribute( 'value' ) ) === '' ) { + if ( ! $error && isset( $input[0] ) && empty( trim( $image[0]->getAttribute( 'value' ) ) ) ) { // The first input inside the link does not have a value. // Throw error. @@ -62,8 +62,8 @@ function edac_rule_empty_link( $content, $post ) { // phpcs:ignore -- $post is r $i = $link->find( 'i' ); if ( ! $error && isset( $input[0] ) && - trim( $i[0]->getAttribute( 'title' ) ) === '' && - trim( $i[0]->getAttribute( 'aria-label' ) ) === '' + empty( trim( $i[0]->getAttribute( 'title' ) ) ) && + empty( trim( $i[0]->getAttribute( 'aria-label' ) ) ) ) { // The first i inside the link does not have a title & From 40b84eaa3206aabccdcad711a2a6fda3e7981a2f Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Sat, 4 May 2024 21:06:50 -0400 Subject: [PATCH 09/14] updated - empty link with string cast --- includes/rules/empty_link.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/rules/empty_link.php b/includes/rules/empty_link.php index c2285f77..38bb151f 100644 --- a/includes/rules/empty_link.php +++ b/includes/rules/empty_link.php @@ -22,7 +22,7 @@ function edac_rule_empty_link( $content, $post ) { // phpcs:ignore -- $post is r $error = false; if ( - str_ireplace( [ ' ', ' ', '-', '_' ], '', trim( $link->plaintext ) ) === '' + (string) str_ireplace( [ ' ', ' ', '-', '_' ], '', trim( $link->plaintext ) ) === '' && $link->hasAttribute( 'href' ) && empty( $link->getAttribute( 'aria-label' ) ) && empty( $link->getAttribute( 'title' ) ) From a6860730ef264f572e2b734cee2b4a1a5c058c2d Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Sat, 4 May 2024 21:08:47 -0400 Subject: [PATCH 10/14] updated - img at empty string cast --- includes/rules/img_alt_empty.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/rules/img_alt_empty.php b/includes/rules/img_alt_empty.php index 72434862..c9d7cb47 100644 --- a/includes/rules/img_alt_empty.php +++ b/includes/rules/img_alt_empty.php @@ -27,13 +27,13 @@ function edac_rule_img_alt_empty( $content, $post ) { // phpcs:ignore -- $post i isset( $element ) && 'img' === $element->tag && $element->hasAttribute( 'alt' ) - && $element->getAttribute( 'alt' ) === '' + && (string) $element->getAttribute( 'alt' ) === '' && $element->getAttribute( 'role' ) !== 'presentation' ) || ( 'input' === $element->tag && $element->hasAttribute( 'alt' ) && $element->getAttribute( 'type' ) === 'image' - && $element->getAttribute( 'alt' ) === '' + && (string) $element->getAttribute( 'alt' ) === '' ) ) { From d4ebe9b5aaa5186e8a9ef1b0503ac8a4ab51e0d8 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Sat, 4 May 2024 21:09:56 -0400 Subject: [PATCH 11/14] updated - img_linked_alt_empty string cast --- includes/rules/img_linked_alt_empty.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/rules/img_linked_alt_empty.php b/includes/rules/img_linked_alt_empty.php index 04b82505..c9766aa5 100644 --- a/includes/rules/img_linked_alt_empty.php +++ b/includes/rules/img_linked_alt_empty.php @@ -28,7 +28,7 @@ function edac_rule_img_linked_alt_empty( $content, $post ) { // phpcs:ignore -- if ( isset( $image ) && $image->hasAttribute( 'alt' ) - && $image->getAttribute( 'alt' ) === '' + && (string) $image->getAttribute( 'alt' ) === '' && $image->getAttribute( 'role' ) !== 'presentation' ) { $image_code = $a; From f11b8ef558c35c547f3fa1caf2754b1b2bc6cfe5 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Sat, 4 May 2024 21:11:35 -0400 Subject: [PATCH 12/14] updated - long_description_invalid string cast --- includes/rules/long_description_invalid.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/rules/long_description_invalid.php b/includes/rules/long_description_invalid.php index ddbde10e..b1e14e2b 100644 --- a/includes/rules/long_description_invalid.php +++ b/includes/rules/long_description_invalid.php @@ -28,7 +28,7 @@ function edac_rule_long_description_invalid( $content, $post ) { // phpcs:ignore $file_parts = pathinfo( $longdesc ); $valid_url = filter_var( $longdesc, FILTER_VALIDATE_URL ); - if ( $image->getAttribute( 'longdesc' ) === '' + if ( (string) $image->getAttribute( 'longdesc' ) === '' || ! $valid_url || ! $file_parts['extension'] || ! $file_parts['filename'] From 34ffdffe93e3956230cbd98553692ab39651b4e3 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Sat, 4 May 2024 21:12:49 -0400 Subject: [PATCH 13/14] updated - missing_title string cast --- includes/rules/missing_title.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/rules/missing_title.php b/includes/rules/missing_title.php index 961bcc6c..fc4fd11f 100644 --- a/includes/rules/missing_title.php +++ b/includes/rules/missing_title.php @@ -22,7 +22,7 @@ function edac_rule_missing_title( $content, $post ) { return [ "Missing Title - Post ID: $post->ID" ]; } if ( ( ! isset( $title ) || '' === $title->innertext || '-' === $title->innertext ) - && ( ! isset( $meta_title ) || ( $meta_title->hasAttribute( 'content' ) && ( $meta_title->getAttribute( 'content' ) === '' || strlen( $meta_title->getAttribute( 'content' ) ) <= 1 ) ) ) + && ( ! isset( $meta_title ) || ( $meta_title->hasAttribute( 'content' ) && ( (string) $meta_title->getAttribute( 'content' ) === '' || strlen( $meta_title->getAttribute( 'content' ) ) <= 1 ) ) ) ) { return [ "Missing title tag or meta title tag - Post ID: $post->ID" ]; } From 4a9dd2e3e8558377b315197021535dd7549f2656 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Sat, 4 May 2024 21:34:50 -0400 Subject: [PATCH 14/14] updated - version and readme --- accessibility-checker.php | 4 ++-- readme.txt | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/accessibility-checker.php b/accessibility-checker.php index 9dbaf5d7..a69bb061 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.11.0 + * Version: 1.11.1 * Author: Equalize Digital * Author URI: https://equalizedigital.com * License: GPL-2.0+ @@ -41,7 +41,7 @@ // Current plugin version. if ( ! defined( 'EDAC_VERSION' ) ) { - define( 'EDAC_VERSION', '1.11.0' ); + define( 'EDAC_VERSION', '1.11.1' ); } // Current database version. diff --git a/readme.txt b/readme.txt index fd8c9f52..e50b1c9a 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.2 -Stable tag: 1.11.0 +Stable tag: 1.11.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -171,6 +171,11 @@ No, Accessibility Checker runs completely on your server and does not require yo == Changelog == ++ 1.11.1 = +* Fixed: type Casting on several rules +* Fixed: strict data comparison on several rules +* Updated: empty heading tag rule to consider aria-label + = 1.11.0 = * Updated: Tested up to WP 6.5.2 * Improved: Better detection of the underlined text rule for more accurate results