Skip to content

Commit

Permalink
Merge branch 'develop' into william/634/convert-text_justified-rule-t…
Browse files Browse the repository at this point in the history
…o-JS-check
  • Loading branch information
pattonwebz authored May 24, 2024
2 parents dca64de + 1c0619c commit 8af9ef6
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 49 deletions.
4 changes: 2 additions & 2 deletions accessibility-checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.2
* Version: 1.12.0
* Author: Equalize Digital
* Author URI: https://equalizedigital.com
* License: GPL-2.0+
Expand All @@ -35,7 +35,7 @@

// Current plugin version.
if ( ! defined( 'EDAC_VERSION' ) ) {
define( 'EDAC_VERSION', '1.11.2' );
define( 'EDAC_VERSION', '1.12.0' );
}

// Current database version.
Expand Down
34 changes: 34 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
Newer versions can be found in readme.txt.

= 1.9.3 =
* Updated: capability checks for the welcome page, dashboard widget, and admin notices

= 1.9.2 =
* Fixed: filtered rules are not passed to the frontend highlighter, avoiding 'null' state issues
* Updated: frontend highlighter buttons to be disabled until issues are confirmed
* Updated: frontend highlighter buttons to show only after we know there are issues to display
* Updated: frontend highlighter to not show buttons if none are returned

= 1.9.1 =
* Updated: `edac_include_rules_files to fire on init action to fix the `edac_filter_register_rules` filter timing

= 1.9.0 =
* Created: class that creates the accessibility statement on activation
* Removed: custom database query that checked for existing accessibility statement in exchange for the `get_page_by_path()` function
* Fixed: bug with trying to compare the simplified summary ordinal value and added fallback
* Removed: `wp_send_json_error()` from `simplified_summary` Ajax function when the simplified summary is empty
* Added: simplified summary grade*level, message, and icon logic to the `summary()` Ajax
* Fixed: issue with the submit button text showing as `Submit Query` in Firefox.
* Updated: missing transcript rule to skip certain types of links
* Added: missing UTM parameters to the welcome page URLs.
* Removed: legacy system information code
* Removed: cbschuld/browser.php composer package
* Added: class structure for site health
* Added: site health health information for free, pro, and audit history plugins
* Added: update database class
* Removed: `edac_before_page_render` functions from the main file
* Added: frontend validate class
* Added: frontend validate unit tests
* Removed: unused new window warning meta update functions
* Fixed: front end highlight focus issue
* Added: summary generator class to replace the `edac_summary()` function
* Deprecated: `edac_summary()` function

= 1.8.1 =
* Fixed: false positives on the incorrect heading order rule
* Added: fallback to determine ordinal when php intl extension is not installed
Expand Down
29 changes: 20 additions & 9 deletions includes/classes/class-rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ function () use ( $ns, $version ) {
);
}



/**
* REST handler that saves to the DB a list of js rule violations for a post.
*
Expand Down Expand Up @@ -194,11 +192,18 @@ public function set_post_scan_results( $request ) {

//phpcs:ignore Generic.Commenting.Todo.TaskFound
// TODO: setup a rules class for loading/filtering rules.
$rules = edac_register_rules();
$js_rule_ids = [];
$rules = edac_register_rules();
$js_rule_ids = [];
$combined_rule_ids = [];
foreach ( $rules as $rule ) {
if ( array_key_exists( 'ruleset', $rule ) && 'js' === $rule['ruleset'] ) {
$js_rule_ids[] = $rule['slug'];

if ( array_key_exists( 'combines', $rule ) && ! empty( $rule['combines'] ) ) {
foreach ( $rule['combines'] as $combine_rule_id ) {
$combined_rule_ids[ $combine_rule_id ] = $rule['slug'];
}
}
}
}

Expand Down Expand Up @@ -226,7 +231,9 @@ public function set_post_scan_results( $request ) {
foreach ( $violations as $violation ) {
$rule_id = $violation['ruleId'];

if ( in_array( $rule_id, $js_rule_ids, true ) ) {
$actual_rule_id = array_key_exists( $rule_id, $combined_rule_ids ) ? $combined_rule_ids[ $rule_id ] : $rule_id;

if ( in_array( $actual_rule_id, $js_rule_ids, true ) ) {

// This rule is one that we've included in our js ruleset.

Expand All @@ -236,7 +243,7 @@ public function set_post_scan_results( $request ) {
//phpcs:ignore Generic.Commenting.Todo.TaskFound
// TODO: setup a rules class for loading/filtering rules.
foreach ( $rules as $rule ) {
if ( $rule['slug'] === $rule_id ) {
if ( $rule['slug'] === $actual_rule_id ) {
$impact = $rule['rule_type']; // if we are defining the rule_type in php rules config, use that instead of the js rule's impact setting.
}
}
Expand All @@ -255,9 +262,9 @@ public function set_post_scan_results( $request ) {
* @param string $rule_id The rule ID.
* @param string $type The type of validation which is always 'js' in this path.
*/
do_action( 'edac_before_rule', $post_id, $rule_id, 'js' );
do_action( 'edac_before_rule', $post_id, $actual_rule_id, 'js' );

( new Insert_Rule_Data() )->insert( $post, $rule_id, $impact, $html );
( new Insert_Rule_Data() )->insert( $post, $actual_rule_id, $impact, $html );

/**
* Fires after a rule is run against the content.
Expand All @@ -270,7 +277,7 @@ public function set_post_scan_results( $request ) {
* @param string $rule_id The rule ID.
* @param string $type The type of validation which is always 'js' in this path.
*/
do_action( 'edac_after_rule', $post_id, $rule_id, 'js' );
do_action( 'edac_after_rule', $post_id, $actual_rule_id, 'js' );

}
}
Expand All @@ -297,6 +304,10 @@ public function set_post_scan_results( $request ) {
// store a record of this scan in the post's meta.
update_post_meta( $post_id, '_edac_post_checked_js', time() );

if ( true === $request['isFailure'] ) {
update_post_meta( $post_id, '_edac_post_checked_js_failure', time() );
}

return new \WP_REST_Response(
[
'success' => true,
Expand Down
9 changes: 9 additions & 0 deletions includes/rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,4 +415,13 @@
'<code>&lt;a&gt;</code>'
),
],
[
'title' => esc_html__( 'Zooming and scaling is disabled', 'accessibility-checker' ),
'info_url' => 'https://a11ychecker.com/help###',
'slug' => 'meta_viewport',
'rule_type' => 'error',
'summary' => esc_html__( 'Zooming is disabled via viewport meta tag that includes `user-scalable=no` or a `maximum-scale` value of less than 2. This limits low-vision users that want to increase text sizes, zoom into the page or who use a magnifier.', 'accessibility-checker' ),
'ruleset' => 'js',
'combines' => [ 'meta-viewport' ],
],
];
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "accessibility-checker",
"version": "1.11.2",
"version": "1.12.0",
"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+",
Expand Down
43 changes: 7 additions & 36 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
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.2
Tested up to: 6.5.3
Stable tag: 1.12.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -171,6 +171,11 @@ No, Accessibility Checker runs completely on your server and does not require yo

== Changelog ==

= 1.12.0 =
* Fixed: Use the last generation time in summary widgets rather than last completed scan time
* Improved: More accessible panels in the editor
* Improved: Filter and action docs added/improved

= 1.11.2
* Fixed: Avoid displaying `0th` for readability score
* Removed: Some custom WP Playground detection code
Expand Down Expand Up @@ -208,39 +213,5 @@ No, Accessibility Checker runs completely on your server and does not require yo
* Created: Class to handle data purging and cleanup
* Deprecated: `edac_delete_post`, `edac_delete_post_meta`, `edac_delete_cpt_posts` functions

= 1.9.3 =
* Updated: capability checks for the welcome page, dashboard widget, and admin notices

= 1.9.2 =
* Fixed: filtered rules are not passed to the frontend highlighter, avoiding 'null' state issues
* Updated: frontend highlighter buttons to be disabled until issues are confirmed
* Updated: frontend highlighter buttons to show only after we know there are issues to display
* Updated: frontend highlighter to not show buttons if none are returned

= 1.9.1 =
* Updated: `edac_include_rules_files to fire on init action to fix the `edac_filter_register_rules` filter timing

= 1.9.0 =
* Created: class that creates the accessibility statement on activation
* Removed: custom database query that checked for existing accessibility statement in exchange for the `get_page_by_path()` function
* Fixed: bug with trying to compare the simplified summary ordinal value and added fallback
* Removed: `wp_send_json_error()` from `simplified_summary` Ajax function when the simplified summary is empty
* Added: simplified summary grade*level, message, and icon logic to the `summary()` Ajax
* Fixed: issue with the submit button text showing as `Submit Query` in Firefox.
* Updated: missing transcript rule to skip certain types of links
* Added: missing UTM parameters to the welcome page URLs.
* Removed: legacy system information code
* Removed: cbschuld/browser.php composer package
* Added: class structure for site health
* Added: site health health information for free, pro, and audit history plugins
* Added: update database class
* Removed: `edac_before_page_render` functions from the main file
* Added: frontend validate class
* Added: frontend validate unit tests
* Removed: unused new window warning meta update functions
* Fixed: front end highlight focus issue
* Added: summary generator class to replace the `edac_summary()` function
* Deprecated: `edac_summary()` function

Older versions can be found in the plugins `changelog.txt`.

3 changes: 2 additions & 1 deletion src/pageScanner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const scan = async (
reporter: 'raw',

rules: [
// customRule1,
//customRule1,
colorContrastFailure,
underlinedText,
textJustified,
Expand All @@ -60,6 +60,7 @@ const scan = async (
values: [
'color_contrast_failure',
'underlined_text',
'meta-viewport',
textJustified.id,
],
},
Expand Down

0 comments on commit 8af9ef6

Please sign in to comment.