Skip to content

Commit

Permalink
Merge pull request #330 from equalizedigital/release/v1.6.1
Browse files Browse the repository at this point in the history
Release/v1.6.1
  • Loading branch information
SteveJonesDev authored Sep 28, 2023
2 parents 930fa56 + e9ab84d commit 3e7eb71
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 26 deletions.
10 changes: 9 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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: 5.0.0
Tested up to: 6.3.1
Stable tag: 1.6.0
Stable tag: 1.6.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

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

== Changelog ==

= 1.6.1 =
Updated: passed percentage calculation
Updated: frontend highlighting disable styles to be compatible with optimization plugins
Fixed: average issue density percentage not accounting for site ID and ignores
Updated: body density to receive HTML rather than the dom object
Updated: empty link check logic
Added: minor coding standards improvements

= 1.6.0 =
Added: dashboard reports widget
Added: frontend highlighting page scan trigger
Expand Down
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.6.0
* Version: 1.6.1
* Author: Equalize Digital
* Author URI: https://equalizedigital.com
* License: GPL-2.0+
Expand Down Expand Up @@ -38,7 +38,7 @@

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

// Current database version.
Expand Down
32 changes: 28 additions & 4 deletions includes/classes/class-scans-stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function summary() {
$transient_name = $this->cache_name_prefix . '_summary';

$cache = get_transient( $transient_name );

if ( $this->cache_time && $cache ) {


Expand Down Expand Up @@ -167,11 +167,35 @@ public function summary() {

$data['is_truncated'] = $issues_query->has_truncated_results();
$data['posts_scanned'] = (int) $issues_query->distinct_posts_count();
$data['rules_failed'] = (int) $issues_query->distinct_count();
$data['rules_passed'] = (int) ( $tests_count - $data['rules_failed'] );
$data['rules_failed'] = 0;



// Get a count of rules that are not in the issues table.
$rule_slugs = array_map(
function ( $item ) {
return $item['slug'];
},
edac_register_rules()
);

foreach ( $rule_slugs as $rule_slug ) {
$rule_query = new \EDAC\Issues_Query(
array(
'rule_slugs' => array( $rule_slug ),
),
1,
Issues_Query::FLAG_INCLUDE_ALL_POST_TYPES
);

if ( $rule_query->count() ) {
++$data['rules_failed'];
}
}
$data['rules_passed'] = $this->rule_count - $data['rules_failed'];

if ( $data['posts_scanned'] > 0 && $tests_count > 0 ) {
$data['passed_percentage'] = round( ( $data['rules_passed'] / $tests_count ) * 100, 2 );
$data['passed_percentage'] = round( ( $data['rules_passed'] / $this->rule_count ) * 100, 2 );
} else {
$data['passed_percentage'] = 0;
}
Expand Down
37 changes: 18 additions & 19 deletions includes/enqueue-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ function edac_admin_enqueue_scripts() {
'edac',
'edac_script_vars',
array(
'postID' => $post_id,
'nonce' => wp_create_nonce( 'ajax-nonce' ),
'postID' => $post_id,
'nonce' => wp_create_nonce( 'ajax-nonce' ),
'edacApiUrl' => esc_url_raw( rest_url() . 'accessibility-checker/v1' ),
'restNonce' => wp_create_nonce( 'wp_rest' )
'restNonce' => wp_create_nonce( 'wp_rest' ),
)
);

Expand All @@ -61,7 +61,6 @@ function edac_admin_enqueue_scripts() {

}
}

}


Expand All @@ -80,12 +79,12 @@ function edac_enqueue_scripts( $mode = '' ) {
return;
}

$pro = edac_check_plugin_active( 'accessibility-checker-pro/accessibility-checker-pro.php' ) && EDAC_KEY_VALID === true;
$pro = edac_check_plugin_active( 'accessibility-checker-pro/accessibility-checker-pro.php' ) && EDAC_KEY_VALID === true;
$has_pending_scans = false;

$headers = array(
'Content-Type' => 'application/json',
'X-WP-Nonce' => wp_create_nonce( 'wp_rest' ),
'X-WP-Nonce' => wp_create_nonce( 'wp_rest' ),
);

if ( '' === $mode ) {
Expand All @@ -100,7 +99,7 @@ function edac_enqueue_scripts( $mode = '' ) {
if ( ( 'full-scan' === $mode && $pro )
||
( 'ui' === $mode || 'editor-scan' === $mode
&&
&&
$post_id && current_user_can( 'edit_post', $post_id ) )
) {

Expand Down Expand Up @@ -143,26 +142,26 @@ function edac_enqueue_scripts( $mode = '' ) {
'edac-app',
'edac_script_vars',
array(
'postID' => $post_id,
'nonce' => wp_create_nonce( 'ajax-nonce' ),
'edacUrl' => esc_url_raw( get_site_url() ),
'edacApiUrl' => esc_url_raw( rest_url() . 'accessibility-checker/v1' ),
'postID' => $post_id,
'nonce' => wp_create_nonce( 'ajax-nonce' ),
'edacUrl' => esc_url_raw( get_site_url() ),
'edacApiUrl' => esc_url_raw( rest_url() . 'accessibility-checker/v1' ),
'edacHeaders' => $headers,
'edacpApiUrl' => $pro ? esc_url_raw( rest_url() . 'accessibility-checker-pro/v1' ) : '',
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'loggedIn' => is_user_logged_in(),
'active' => $active,
'mode' => $mode,
'scanUrl' => get_preview_post_link(
'edacpApiUrl' => $pro ? esc_url_raw( rest_url() . 'accessibility-checker-pro/v1' ) : '',
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'loggedIn' => is_user_logged_in(),
'active' => $active,
'mode' => $mode,
'scanUrl' => get_preview_post_link(
$post_id,
array(
'edac-action' => 'js-scan',
'edac-action' => 'js-scan',
'edac-preview-nonce' => wp_create_nonce( 'edac-preview_nonce' ),
)
),
'appCssUrl' => plugin_dir_url( __DIR__ ) . 'build/css/app.css?ver=' . EDAC_VERSION,
)
);

}

}
19 changes: 19 additions & 0 deletions src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,25 @@ class AccessibilityCheckerHighlight {
* This function disables all styles on the page.
*/
disableStyles() {

/*
If the site compiles css into a combined file, our method for disabling styles will cause out app's css to break.
This checks if the app's css is loading into #edac-app-css as expected.
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';
link.type = 'text/css';
link.href = edac_script_vars.appCssUrl,
link.media = 'all';
document.head.appendChild(link);
}


this.originalCss = Array.from(document.head.querySelectorAll('style[type="text/css"], style, link[rel="stylesheet"]'));

var elementsWithStyle = document.querySelectorAll('*[style]:not([class^="edac"])');
Expand Down

0 comments on commit 3e7eb71

Please sign in to comment.