Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v1.10.1 #552

Merged
merged 43 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
be8416b
Short-circuit edac_save_post() when post_status is trash
pattonwebz Mar 15, 2024
f592a3a
Make a new class for the editor metabox
pattonwebz Mar 18, 2024
952d9af
Add an `init_hooks` to metabox class and add 2 actions before and aft…
pattonwebz Mar 18, 2024
0f6eff8
Remove the old meta-boxes functions and flagthem deprecated
pattonwebz Mar 18, 2024
c95e2be
Use Dependency Injection to register the editor metabox inside the Ad…
pattonwebz Mar 18, 2024
481da0b
Merge branch 'develop' into william/467/make-meta-boxes-functions-int…
pattonwebz Mar 18, 2024
9265064
Merge pull request #537 from equalizedigital/william/467/make-meta-bo…
pattonwebz Mar 18, 2024
66bc854
Merge pull request #536 from equalizedigital/william/535/moving-posts…
pattonwebz Mar 18, 2024
a871aa1
Merge pull request #541 from equalizedigital/release/v1.10.0
pattonwebz Mar 20, 2024
5f92eed
Add asset dir for test with animated and static webp and gif
pattonwebz Mar 25, 2024
84be3bd
Add constant to test that points to new asset dir
pattonwebz Mar 25, 2024
61e9fc9
Add some helpers to try add scheme to file urls missing them and vali…
pattonwebz Mar 25, 2024
eaa47ca
Add a helper to make opening files as binary live in a single place o…
pattonwebz Mar 25, 2024
e8a58b9
Add tests for the new helper functions
pattonwebz Mar 25, 2024
b6f7a9e
Swap to new helper to open file as binary and avoid duplicate code
pattonwebz Mar 25, 2024
365cb5b
Update some comments in the img_animated_gif file
pattonwebz Mar 25, 2024
e8c5ccd
Add some tests that test the full edac_rule_img_animated_gif rule
pattonwebz Mar 25, 2024
aaaf705
Satisfy missing parenthesis rule CS check introduced in WPCS 3.1.0
pattonwebz Mar 25, 2024
e5539c6
Improve readability of some of the conditions that had new clarifying…
pattonwebz Mar 25, 2024
30b6f7c
Bump wpcs to 3.1 or above
pattonwebz Mar 25, 2024
2a5b3b4
Revert "Bump wpcs to 3.1 or above"
pattonwebz Mar 25, 2024
3e1055a
Merge pull request #547 from equalizedigital/william/546/fix-missing-…
pattonwebz Mar 25, 2024
57bf0f3
Merge branch 'develop' into william/544/animage_image_check_causes_er…
pattonwebz Mar 25, 2024
959955a
Make sure to check that we are operating on an array before accessing it
pattonwebz Mar 25, 2024
16e6b41
Default value for density_data must be an array, not a string
pattonwebz Mar 25, 2024
8a311aa
Make the density calculation sum easier to quickly scan
pattonwebz Mar 25, 2024
223e040
Add a catch to remap any non-array values to [0,0] for compatibility …
pattonwebz Mar 25, 2024
ac74b38
Remove the just added catch as it's not needed and makes this more co…
pattonwebz Mar 25, 2024
eaff86b
Add a test to validate the bug is fixed
pattonwebz Mar 25, 2024
b6e1573
Add some extra test assertions to cover a new capability that I will add
pattonwebz Mar 26, 2024
7e8da4b
Use site scheme as default and support non-relative non-protocol-rela…
pattonwebz Mar 26, 2024
1179f66
Merge pull request #549 from equalizedigital/william/548/density-data…
pattonwebz Mar 26, 2024
138a847
Add a 'rules' group the the ImgAnimatedGifTest.php class
pattonwebz Mar 26, 2024
8c85464
Restore a checking clause before modifying the url and make it more r…
pattonwebz Mar 26, 2024
98ea77d
Restore a checking clause before modifying the url and make it more r…
pattonwebz Mar 26, 2024
8d09f47
Merge remote-tracking branch 'origin/william/544/animage_image_check_…
pattonwebz Mar 26, 2024
8e16089
Merge pull request #545 from equalizedigital/william/544/animage_imag…
pattonwebz Mar 26, 2024
f8927e4
fixed - strict comarison preventing misssing form label form returnin…
SteveJonesDev Mar 26, 2024
4b37736
Merge pull request #551 from equalizedigital/steve/543/missing-form-l…
SteveJonesDev Mar 26, 2024
ff73ab5
Bump version 1.10.0 -> 1.10.1 and add changelog
pattonwebz Mar 26, 2024
4fd03c2
Move something that didn't release in the last version to this releas…
pattonwebz Mar 26, 2024
7abc5b9
Update changelog
pattonwebz Mar 26, 2024
37915b9
Update stable tag in readme.txt 1.10.0 -> 1.10.1
pattonwebz Mar 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 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.10.0
* Version: 1.10.1
* Author: Equalize Digital
* Author URI: https://equalizedigital.com
* License: GPL-2.0+
Expand Down Expand Up @@ -41,7 +41,7 @@

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

// Current database version.
Expand Down Expand Up @@ -123,13 +123,11 @@
require_once plugin_dir_path( __FILE__ ) . 'includes/activation.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/deactivation.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/helper-functions.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/meta-boxes.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/options-page.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/validate.php';
/**
* Filters and Actions
*/
add_action( 'add_meta_boxes', 'edac_register_meta_boxes' );
add_action( 'admin_menu', 'edac_add_options_page' );
add_action( 'admin_init', 'edac_register_setting' );
add_action( 'admin_head', 'edac_post_on_load' );
Expand Down
22 changes: 18 additions & 4 deletions admin/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,29 @@
class Admin {

/**
* Class constructor.
* Meta boxes instance.
*
* @since 1.10.0
*
* @var Meta_Boxes
*/
public function __construct() {
private Meta_Boxes $meta_boxes;

/**
* Class constructor for injecting dependencies.
*
* @param Meta_Boxes|null $meta_boxes Meta boxes instance.
*/
public function __construct( Meta_Boxes $meta_boxes = null ) {
$this->meta_boxes = $meta_boxes;
}

/**
* Initialize.
*
* @return void
*/
public function init() {
public function init(): void {

$update_database = new Update_Database();
$update_database->init_hooks();
Expand All @@ -44,14 +56,16 @@ public function init() {
$site_health_info->init_hooks();

$this->init_ajax();

$this->meta_boxes->init_hooks();
}

/**
* Initialize ajax.
*
* @return void
*/
private function init_ajax() {
private function init_ajax(): void {
if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
return;
}
Expand Down
44 changes: 27 additions & 17 deletions admin/class-enqueue-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public static function enqueue() {
*/
public static function enqueue_styles() {
wp_enqueue_style( 'edac', plugin_dir_url( EDAC_PLUGIN_FILE ) . 'build/css/admin.css', array(), EDAC_VERSION, 'all' );
}
}

/**
* Enqueue the admin and editorApp scripts.
*
Expand All @@ -57,13 +57,23 @@ public static function maybe_enqueue_admin_and_editor_app_scripts() {
'accessibility_checker_ignored',
);

if ( is_array( $post_types ) && count( $post_types ) && ( in_array( $current_post_type, $post_types, true ) || in_array( $page, $enabled_pages, true ) ) || ( 'site-editor.php' !== $pagenow ) ) {
if (
(
is_array( $post_types ) &&
count( $post_types ) &&
(
in_array( $current_post_type, $post_types, true ) ||
in_array( $page, $enabled_pages, true )
)
) ||
'site-editor.php' !== $pagenow
) {

global $post;
$post_id = is_object( $post ) ? $post->ID : null;
wp_enqueue_script( 'edac', plugin_dir_url( EDAC_PLUGIN_FILE ) . 'build/admin.bundle.js', array( 'jquery' ), EDAC_VERSION, false );


wp_localize_script(
'edac',
'edac_script_vars',
Expand All @@ -74,26 +84,26 @@ public static function maybe_enqueue_admin_and_editor_app_scripts() {
'restNonce' => wp_create_nonce( 'wp_rest' ),
)
);


if ( 'post.php' === $pagenow ) {


// Is this posttype setup to be checked?
$post_types = get_option( 'edac_post_types' );
$current_post_type = get_post_type();
$active = ( is_array( $post_types ) && in_array( $current_post_type, $post_types, true ) );

$pro = is_plugin_active( 'accessibility-checker-pro/accessibility-checker-pro.php' ) && EDAC_KEY_VALID;

if ( EDAC_DEBUG || strpos( EDAC_VERSION, '-beta' ) !== false ) {
$debug = true;
} else {
$debug = false;
}

wp_enqueue_script( 'edac-editor-app', plugin_dir_url( EDAC_PLUGIN_FILE ) . 'build/editorApp.bundle.js', false, EDAC_VERSION, false );

wp_localize_script(
'edac-editor-app',
'edac_editor_app',
Expand All @@ -107,13 +117,13 @@ public static function maybe_enqueue_admin_and_editor_app_scripts() {
'authOk' => false === (bool) get_option( 'edac_password_protected', false ),
'debug' => $debug,
'scanUrl' => get_preview_post_link(
$post_id,
$post_id,
array( 'edac_pageScanner' => 1 )
),
)
);
}

}
}
}

Expand All @@ -125,13 +135,13 @@ public static function maybe_enqueue_admin_and_editor_app_scripts() {
public static function maybe_enqueue_email_opt_in_script() {

$page = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : null; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- display only.
if ( 'accessibility_checker' === $page
&& true !== (bool) get_user_meta( get_current_user_id(), 'edac_email_optin', true )
if ( 'accessibility_checker' === $page
&& true !== (bool) get_user_meta( get_current_user_id(), 'edac_email_optin', true )
) {

wp_enqueue_style( 'email-opt-in-form', plugin_dir_url( EDAC_PLUGIN_FILE ) . 'build/css/emailOptIn.css', false, EDAC_VERSION, 'all' );
wp_enqueue_script( 'email-opt-in-form', plugin_dir_url( EDAC_PLUGIN_FILE ) . 'build/emailOptIn.bundle.js', false, EDAC_VERSION, true );

wp_localize_script(
'email-opt-in-form',
'edac_email_opt_in_form',
Expand All @@ -140,7 +150,7 @@ public static function maybe_enqueue_email_opt_in_script() {
'ajaxurl' => admin_url( 'admin-ajax.php' ),
)
);

}
}
}
61 changes: 61 additions & 0 deletions admin/class-meta-boxes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php
/**
* Class for handling the editor meta box.
*
* @package Accessibility_Checker
*/

namespace EDAC\Admin;

/**
* Class Meta_Box
*
* Handles the editor meta box registration and rendering.
*/
class Meta_Boxes {

/**
* Initialize the hooks for the editor meta box.
*
* @return void
*/
public function init_hooks(): void {
add_action( 'add_meta_boxes', array( $this, 'register_meta_boxes' ) );
}

/**
* Register custom meta boxes for each post type.
*
* @since 1.10.0
*
* @return void
*/
public function register_meta_boxes(): void {
$post_types = get_option( 'edac_post_types' );
if ( $post_types ) {
foreach ( $post_types as $post_type ) {
add_meta_box(
'edac-meta-box',
__( 'Accessibility Checker', 'accessibility-checker' ),
array( $this, 'render' ),
$post_type,
'normal',
'high'
);
}
}
}

/**
* Render the custom meta box html.
*
* @since 1.10.0
*
* @return void
*/
public function render(): void {
do_action( 'edac_before_meta_box' );
include_once plugin_dir_path( __DIR__ ) . 'partials/custom-meta-box.php';
do_action( 'edac_after_meta_box' );
}
}
19 changes: 12 additions & 7 deletions includes/classes/class-enqueue-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,25 @@ public function __construct() {
public static function enqueue() {
self::maybe_enqueue_frontend_highlighter();
}

/**
* Enqueue the frontend highlighter.
*
* @return void
*/
public static function maybe_enqueue_frontend_highlighter() {

// This loads on all pages, so bail as early as possible. Do checks that don't require DB calls first.


// Don't load on admin pages in iframe that is running a pageScan.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( is_admin() || isset( $_GET['edac_pageScanner'] ) && '1' === $_GET['edac_pageScanner'] ) {
if (
is_admin() ||
(
isset( $_GET['edac_pageScanner'] ) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
'1' === $_GET['edac_pageScanner'] // phpcs:ignore WordPress.Security.NonceVerification.Recommended
)
) {
return;
}

Expand All @@ -55,17 +60,17 @@ public static function maybe_enqueue_frontend_highlighter() {
if ( is_customize_preview() || ! ( $post_id && current_user_can( 'edit_post', $post_id ) ) ) {
return;
}


// Don't load if this pagetype is not setup to be scanned.
$post_types = get_option( 'edac_post_types' );
$current_post_type = get_post_type();
$active = ( is_array( $post_types ) && in_array( $current_post_type, $post_types, true ) );


if ( $active ) {


wp_enqueue_style( 'edac-frontend-highlighter-app', plugin_dir_url( EDAC_PLUGIN_FILE ) . 'build/css/frontendHighlighterApp.css', false, EDAC_VERSION, 'all' );
wp_enqueue_script( 'edac-frontend-highlighter-app', plugin_dir_url( EDAC_PLUGIN_FILE ) . 'build/frontendHighlighterApp.bundle.js', false, EDAC_VERSION, false );

Expand Down
8 changes: 5 additions & 3 deletions includes/classes/class-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace EDAC\Inc;

use EDAC\Admin\Admin;
use EDAC\Admin\Meta_Boxes;

/**
* Main plugin functionality class.
Expand All @@ -19,7 +20,8 @@ class Plugin {
*/
public function __construct() {
if ( \is_admin() ) {
$admin = new Admin();
$meta_boxes = new Meta_Boxes();
$admin = new Admin( $meta_boxes );
$admin->init();
} else {
$this->init();
Expand All @@ -36,9 +38,9 @@ public function __construct() {
* @return void
*/
private function init() {

add_action( 'wp_enqueue_scripts', array( 'EDAC\Inc\Enqueue_Frontend', 'enqueue' ) );

$accessibility_statement = new Accessibility_Statement();
$accessibility_statement->init_hooks();

Expand Down
Loading
Loading