From 54eb79132386e7f110726bc724ebbd6492e991f1 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Tue, 5 Aug 2025 18:40:46 +0100 Subject: [PATCH 01/61] Filter the post types at save time [PRO-169] --- includes/classes/class-rest-api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/classes/class-rest-api.php b/includes/classes/class-rest-api.php index 0186c850d..17f786f3f 100644 --- a/includes/classes/class-rest-api.php +++ b/includes/classes/class-rest-api.php @@ -297,7 +297,7 @@ public function set_post_scan_results( $request ) { } $post_type = get_post_type( $post ); - $post_types = Helpers::get_option_as_array( 'edac_post_types' ); + $post_types = apply_filters( 'edacp_fill_site_scan_scannable_post_types', Helpers::get_option_as_array( 'edac_post_types' ) ); if ( empty( $post_types ) || ! in_array( $post_type, $post_types, true ) ) { return new \WP_REST_Response( [ 'message' => 'The post type is not set to be scanned.' ], 400 ); From d9439d5cfc7f5eec207c3374bfebc000ae25f118 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Wed, 6 Aug 2025 13:21:03 +0100 Subject: [PATCH 02/61] Show metabox on the virtual post [PRO-169] --- admin/class-meta-boxes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/class-meta-boxes.php b/admin/class-meta-boxes.php index 727ef1925..77572e10b 100644 --- a/admin/class-meta-boxes.php +++ b/admin/class-meta-boxes.php @@ -31,7 +31,7 @@ public function init_hooks(): void { * @return void */ public function register_meta_boxes(): void { - $post_types = get_option( 'edac_post_types' ); + $post_types = apply_filters( 'edacp_fill_site_scan_scannable_post_types', get_option( 'edac_post_types' ) ); if ( $post_types ) { foreach ( $post_types as $post_type ) { add_meta_box( From 99cbbdebc18af35d4aa2717be0c9ab2385b30549 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Wed, 6 Aug 2025 17:05:07 +0100 Subject: [PATCH 03/61] Add filter for customizable post view link in AJAX response This change allows the post view link to be modified via a filter, enhancing flexibility in how links are generated. [PRO-169] --- admin/class-ajax.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/admin/class-ajax.php b/admin/class-ajax.php index 5ea0bb5ba..c4c234d01 100644 --- a/admin/class-ajax.php +++ b/admin/class-ajax.php @@ -488,12 +488,17 @@ function ( $a, $b ) { if ( ! isset( $rule['viewable'] ) || $rule['viewable'] ) { + $post_view_link = apply_filters( + 'edac_details_post_view_link', + $postid + ); + $url = add_query_arg( [ 'edac' => $id, 'edac_nonce' => wp_create_nonce( 'edac_highlight' ), ], - get_the_permalink( $postid ) + is_string( $post_view_link ) ? $post_view_link : get_the_permalink( $postid ) ); // Translators: %d is the issue ID. From c45b2f58edb1c0e8b8378afb390ea2de16066b71 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Mon, 11 Aug 2025 23:39:56 +0100 Subject: [PATCH 04/61] Refactor post ID retrieval to use a filter for enhanced flexibility [PRO-169] --- includes/classes/class-enqueue-frontend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/classes/class-enqueue-frontend.php b/includes/classes/class-enqueue-frontend.php index 60931d338..6afa10489 100644 --- a/includes/classes/class-enqueue-frontend.php +++ b/includes/classes/class-enqueue-frontend.php @@ -50,7 +50,7 @@ public static function maybe_enqueue_frontend_highlighter() { // Don't load on the frontend if we don't have a post to work with. global $post; - $post_id = is_object( $post ) ? $post->ID : null; + $post_id = apply_filters( 'edac_filter_frontend_highlight_post_id', is_object( $post ) ? $post->ID : null ); if ( null === $post_id ) { return; From 6e5703f423b6fce2a555d547cb059571bc5329ca Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Tue, 12 Aug 2025 15:24:33 +0100 Subject: [PATCH 05/61] Refactor filter name for virtual page links Updated the filter name from 'edac_details_post_view_link' to 'edac_get_origin_url_for_virtual_page' for better clarity and consistency. [PRO-169] --- admin/class-ajax.php | 2 +- includes/helper-functions.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/admin/class-ajax.php b/admin/class-ajax.php index c4c234d01..4a5792ec7 100644 --- a/admin/class-ajax.php +++ b/admin/class-ajax.php @@ -489,7 +489,7 @@ function ( $a, $b ) { if ( ! isset( $rule['viewable'] ) || $rule['viewable'] ) { $post_view_link = apply_filters( - 'edac_details_post_view_link', + 'edac_get_origin_url_for_virtual_page', $postid ); diff --git a/includes/helper-functions.php b/includes/helper-functions.php index e547fabf1..bfafec681 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -770,12 +770,17 @@ function edac_generate_landmark_link( $landmark, $landmark_selector, $post_id, $ // If we have both landmark and selector, create a link. if ( ! empty( $landmark_selector ) ) { + $link = apply_filters( + 'edac_get_origin_url_for_virtual_page', + $post_id + ); + $landmark_url = add_query_arg( [ 'edac_landmark' => base64_encode( $landmark_selector ), 'edac_nonce' => wp_create_nonce( 'edac_highlight' ), ], - get_the_permalink( $post_id ) + is_string( $link ) ? $link : get_the_permalink( $post_id ) ); // translators: %s is the landmark type (e.g., "Header", "Navigation", "Main"). From d983812ccd0ac1d54eda64db9f66c7926a4b8dc2 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Tue, 12 Aug 2025 16:27:54 +0100 Subject: [PATCH 06/61] Hide readability section for virtual pages with display:none [PRO-169] --- admin/class-ajax.php | 7 +++++-- partials/custom-meta-box.php | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/admin/class-ajax.php b/admin/class-ajax.php index 4a5792ec7..f56f5a08b 100644 --- a/admin/class-ajax.php +++ b/admin/class-ajax.php @@ -118,6 +118,9 @@ public function summary() { $html['content'] .= ''; + // if this is a virtual page, we don't show the readability section. + $is_virtual_page = ( 'edac_virtual_page' === get_post_type( $post_id ) ); + $html['content'] .= ' ' . edac_generate_summary_stat( 'edac-summary-errors', @@ -145,7 +148,7 @@ public function summary() { ) . ' -
+
@@ -479,7 +482,7 @@ function ( $a, $b ) { $landmark = isset( $row['landmark'] ) ? $row['landmark'] : ''; $landmark_selector = isset( $row['landmark_selector'] ) ? $row['landmark_selector'] : ''; - + $html .= edac_generate_landmark_link( $landmark, $landmark_selector, $postid ); $html .= '
'; diff --git a/partials/custom-meta-box.php b/partials/custom-meta-box.php index 9d0df6ff9..485838908 100644 --- a/partials/custom-meta-box.php +++ b/partials/custom-meta-box.php @@ -5,6 +5,9 @@ * @package Accessibility_Checker */ +// get the post type of the current editor page. +$is_virtual_page = ( get_post_type( get_the_ID() ) === 'edac_virtual_page' ); + ?>

@@ -31,7 +34,7 @@ class="active" -
  • +
  • >
  • '; // if this is a virtual page, we don't show the readability section. - $is_virtual_page = ( 'edac_virtual_page' === get_post_type( $post_id ) ); + $is_virtual_page = edac_is_virtual_page( $post_id ); $html['content'] .= ' ' . edac_generate_summary_stat( diff --git a/includes/helper-functions.php b/includes/helper-functions.php index bfafec681..42c8d77fe 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -801,3 +801,22 @@ function edac_generate_landmark_link( $landmark, $landmark_selector, $post_id, $ // If we only have landmark text, return it formatted. return $landmark; } + +/** + * Check if a post is a virtual page. + * + * This function checks if a post is a virtual page using the pro plugin's + * VirtualPageType constant. + * + * @param int $post_id The post ID to check. + * @return bool True if the post is a virtual page, false otherwise. + */ +function edac_is_virtual_page( $post_id ) { + if ( class_exists( '\EqualizeDigital\AccessibilityCheckerPro\VirtualContent\VirtualPageType' ) ) { + $post_type = get_post_type( $post_id ); + $pro_post_type = \EqualizeDigital\AccessibilityCheckerPro\VirtualContent\VirtualPageType::POST_TYPE; + return $pro_post_type === $post_type; + } + + return false; +} diff --git a/partials/custom-meta-box.php b/partials/custom-meta-box.php index 485838908..ced37cfef 100644 --- a/partials/custom-meta-box.php +++ b/partials/custom-meta-box.php @@ -6,7 +6,7 @@ */ // get the post type of the current editor page. -$is_virtual_page = ( get_post_type( get_the_ID() ) === 'edac_virtual_page' ); +$is_virtual_page = edac_is_virtual_page( get_the_ID() ); ?>
    From 0873d1ef73ab5b65ddf91eac1e4ae50f74d31a8b Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Mon, 18 Aug 2025 19:58:33 +0100 Subject: [PATCH 12/61] Fire an action before clearing cpt issues edac_before_delete_cpt_posts [PRO-169] --- admin/class-purge-post-data.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/admin/class-purge-post-data.php b/admin/class-purge-post-data.php index 4c48f5f4c..8569316c3 100755 --- a/admin/class-purge-post-data.php +++ b/admin/class-purge-post-data.php @@ -82,6 +82,15 @@ public static function delete_cpt_posts( string $post_type ) { global $wpdb; + /** + * Fires before deleting posts of a specific post type. + * + * @since 1.31.0 + * + * @param string $post_type Post Type. + */ + do_action( 'edac_before_delete_cpt_posts', $post_type ); + // 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( From e345aed22413e1c98919bc28ef3bb9b50d8ffe40 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Mon, 18 Aug 2025 15:39:05 -0400 Subject: [PATCH 13/61] added: unit tests for edac_is_virtual_page function to enhance coverage --- .../helper-functions/IsVirtualPageTest.php | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 tests/phpunit/helper-functions/IsVirtualPageTest.php diff --git a/tests/phpunit/helper-functions/IsVirtualPageTest.php b/tests/phpunit/helper-functions/IsVirtualPageTest.php new file mode 100644 index 000000000..bbd8f4db2 --- /dev/null +++ b/tests/phpunit/helper-functions/IsVirtualPageTest.php @@ -0,0 +1,102 @@ +factory()->post->create( [ 'post_type' => 'post' ] ); + + $this->assertFalse( edac_is_virtual_page( $post_id ) ); + } + + /** + * Test edac_is_virtual_page with different post types. + * + * @dataProvider post_types_data + * + * @param string $post_type The post type to test. + * @param bool $expected The expected result. + */ + public function test_edac_is_virtual_page_with_post_types( $post_type, $expected ) { + // Create the mock pro plugin class. + $this->create_mock_pro_class(); + + // Register the custom post type for testing. + if ( 'edac_virtual_item' === $post_type ) { + register_post_type( + $post_type, + [ + 'public' => false, + 'supports' => [ 'title' ], + ] + ); + } + + // Create post with the specified post type. + $post_id = $this->factory()->post->create( [ 'post_type' => $post_type ] ); + + $this->assertSame( $expected, edac_is_virtual_page( $post_id ) ); + } + + /** + * Test edac_is_virtual_page with invalid post IDs. + * + * @dataProvider invalid_post_ids_data + * + * @param mixed $post_id The post ID to test. + */ + public function test_edac_is_virtual_page_with_invalid_post_ids( $post_id ) { + $this->assertFalse( edac_is_virtual_page( $post_id ) ); + } + + /** + * Data provider for test_edac_is_virtual_page_with_post_types. + */ + public function post_types_data() { + return [ + 'virtual item post type' => [ 'edac_virtual_item', true ], + 'regular post' => [ 'post', false ], + 'page' => [ 'page', false ], + ]; + } + + /** + * Data provider for test_edac_is_virtual_page_with_invalid_post_ids. + */ + public function invalid_post_ids_data() { + return [ + 'non-existent post ID' => [ 999999 ], + 'zero post ID' => [ 0 ], + 'negative post ID' => [ -1 ], + 'non-numeric string' => [ 'not-a-number' ], + ]; + } + + /** + * Helper method to create mock pro plugin class. + */ + private function create_mock_pro_class() { + if ( ! class_exists( '\EqualizeDigital\AccessibilityCheckerPro\VirtualContent\VirtualPageType' ) ) { + // phpcs:ignore Squiz.PHP.Eval.Discouraged + eval( + ' + namespace EqualizeDigital\\AccessibilityCheckerPro\\VirtualContent; + class VirtualPageType { + const POST_TYPE = "edac_virtual_item"; + } + ' + ); + } + } +} From f2bd12e01e6f3f9370357dd82f0dd6d429c99a9f Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Wed, 20 Aug 2025 20:55:35 +0100 Subject: [PATCH 14/61] Allow scannable posts to cover virtual posts [PRO-169] --- admin/class-enqueue-admin.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/admin/class-enqueue-admin.php b/admin/class-enqueue-admin.php index a946fb9a0..0ef1e68df 100644 --- a/admin/class-enqueue-admin.php +++ b/admin/class-enqueue-admin.php @@ -48,7 +48,7 @@ public static function enqueue_styles() { public static function maybe_enqueue_admin_and_editor_app_scripts() { global $pagenow; - $post_types = get_option( 'edac_post_types' ); + $post_types = apply_filters( 'edacp_full_site_scan_scannable_post_types', get_option( 'edac_post_types' ) ); $current_post_type = get_post_type(); $page = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : null; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- display only. $enabled_pages = apply_filters( @@ -93,7 +93,7 @@ public static function maybe_enqueue_admin_and_editor_app_scripts() { if ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) { // Is this posttype setup to be checked? - $post_types = get_option( 'edac_post_types' ); + $post_types = apply_filters( 'edacp_full_site_scan_scannable_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 ) ); @@ -112,9 +112,16 @@ public static function maybe_enqueue_admin_and_editor_app_scripts() { if ( (int) get_option( 'page_on_front' ) === $post_id || (int) get_option( 'page_for_posts' ) === $post_id ) { $scan_url = add_query_arg( 'edac_pageScanner', 1, get_permalink( $post_id ) ); } else { - $scan_url = get_preview_post_link( - $post_id, - [ 'edac_pageScanner' => 1 ] + $post_view_link = apply_filters( + 'edac_get_origin_url_for_virtual_page', + $post_id + ); + + $scan_url = add_query_arg( + [ + 'edac_pageScanner' => 1, + ], + is_string( $post_view_link ) ? $post_view_link : get_preview_post_link( $post_id ) ); } From bc4bc75befc45ae01be1a9509133f41d157e8849 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Wed, 20 Aug 2025 20:56:27 +0100 Subject: [PATCH 15/61] Fix a badly named filter name [PRO-169] --- admin/class-meta-boxes.php | 2 +- includes/classes/class-rest-api.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/admin/class-meta-boxes.php b/admin/class-meta-boxes.php index 77572e10b..e434b098c 100644 --- a/admin/class-meta-boxes.php +++ b/admin/class-meta-boxes.php @@ -31,7 +31,7 @@ public function init_hooks(): void { * @return void */ public function register_meta_boxes(): void { - $post_types = apply_filters( 'edacp_fill_site_scan_scannable_post_types', get_option( 'edac_post_types' ) ); + $post_types = apply_filters( 'edacp_full_site_scan_scannable_post_types', get_option( 'edac_post_types' ) ); if ( $post_types ) { foreach ( $post_types as $post_type ) { add_meta_box( diff --git a/includes/classes/class-rest-api.php b/includes/classes/class-rest-api.php index 8be4eb023..14ec5c796 100644 --- a/includes/classes/class-rest-api.php +++ b/includes/classes/class-rest-api.php @@ -225,7 +225,7 @@ public function clear_issues_for_post( $request ) { } $post_type = get_post_type( $post ); - $post_types = apply_filters( 'edacp_fill_site_scan_scannable_post_types', Helpers::get_option_as_array( 'edac_post_types' ) ); + $post_types = apply_filters( 'edacp_full_site_scan_scannable_post_types', Helpers::get_option_as_array( 'edac_post_types' ) ); if ( empty( $post_types ) || ! in_array( $post_type, $post_types, true ) ) { return new \WP_REST_Response( [ 'message' => 'The post type is not set to be scanned.' ], 400 ); } @@ -297,7 +297,7 @@ public function set_post_scan_results( $request ) { } $post_type = get_post_type( $post ); - $post_types = apply_filters( 'edacp_fill_site_scan_scannable_post_types', Helpers::get_option_as_array( 'edac_post_types' ) ); + $post_types = apply_filters( 'edacp_full_site_scan_scannable_post_types', Helpers::get_option_as_array( 'edac_post_types' ) ); if ( empty( $post_types ) || ! in_array( $post_type, $post_types, true ) ) { return new \WP_REST_Response( [ 'message' => 'The post type is not set to be scanned.' ], 400 ); From 0c5ff01e77adf6d15ff6fba71889aeed443a88fd Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Thu, 21 Aug 2025 15:35:48 +0100 Subject: [PATCH 16/61] Refactor to use Settings::get_scannable_post_types() for post type retrieval Updated multiple files to replace direct calls to get_option('edac_post_types') with Settings::get_scannable_post_types() for consistency and maintainability. NOTE: if :bug: happen it was probably this change. [PRO-169] --- admin/class-enqueue-admin.php | 4 ++-- admin/class-meta-boxes.php | 2 +- admin/class-post-save.php | 2 +- includes/classes/class-enqueue-frontend.php | 4 +++- includes/classes/class-rest-api.php | 5 ++--- includes/helper-functions.php | 16 +++++++++------- includes/options-page.php | 3 ++- 7 files changed, 20 insertions(+), 16 deletions(-) diff --git a/admin/class-enqueue-admin.php b/admin/class-enqueue-admin.php index 0ef1e68df..66c2bad77 100644 --- a/admin/class-enqueue-admin.php +++ b/admin/class-enqueue-admin.php @@ -48,7 +48,7 @@ public static function enqueue_styles() { public static function maybe_enqueue_admin_and_editor_app_scripts() { global $pagenow; - $post_types = apply_filters( 'edacp_full_site_scan_scannable_post_types', get_option( 'edac_post_types' ) ); + $post_types = Settings::get_scannable_post_types(); $current_post_type = get_post_type(); $page = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : null; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- display only. $enabled_pages = apply_filters( @@ -93,7 +93,7 @@ public static function maybe_enqueue_admin_and_editor_app_scripts() { if ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) { // Is this posttype setup to be checked? - $post_types = apply_filters( 'edacp_full_site_scan_scannable_post_types', get_option( 'edac_post_types' ) ); + $post_types = Settings::get_scannable_post_types(); $current_post_type = get_post_type(); $active = ( is_array( $post_types ) && in_array( $current_post_type, $post_types, true ) ); diff --git a/admin/class-meta-boxes.php b/admin/class-meta-boxes.php index e434b098c..c1e0be41c 100644 --- a/admin/class-meta-boxes.php +++ b/admin/class-meta-boxes.php @@ -31,7 +31,7 @@ public function init_hooks(): void { * @return void */ public function register_meta_boxes(): void { - $post_types = apply_filters( 'edacp_full_site_scan_scannable_post_types', get_option( 'edac_post_types' ) ); + $post_types = Settings::get_scannable_post_types(); if ( $post_types ) { foreach ( $post_types as $post_type ) { add_meta_box( diff --git a/admin/class-post-save.php b/admin/class-post-save.php index 36cf268ca..71d872d6b 100644 --- a/admin/class-post-save.php +++ b/admin/class-post-save.php @@ -35,7 +35,7 @@ class Post_Save { */ public static function delete_issue_data_on_post_trashing( $post_ID, $post, $update ) { // check post type. - $post_types = get_option( 'edac_post_types' ); + $post_types = Settings::get_scannable_post_types(); if ( is_array( $post_types ) && ! in_array( $post->post_type, $post_types, true ) ) { return; } diff --git a/includes/classes/class-enqueue-frontend.php b/includes/classes/class-enqueue-frontend.php index 6afa10489..0e8b70b82 100644 --- a/includes/classes/class-enqueue-frontend.php +++ b/includes/classes/class-enqueue-frontend.php @@ -7,6 +7,8 @@ namespace EDAC\Inc; +use EDAC\Admin\Settings; + /** * Class that initializes and handles enqueueing styles and scripts for the frontend. */ @@ -82,7 +84,7 @@ public static function maybe_enqueue_frontend_highlighter() { // Don't load if this pagetype is not setup to be scanned. - $post_types = get_option( 'edac_post_types' ); + $post_types = Settings::get_scannable_post_types(); $current_post_type = get_post_type(); $active = ( is_array( $post_types ) && in_array( $current_post_type, $post_types, true ) ); diff --git a/includes/classes/class-rest-api.php b/includes/classes/class-rest-api.php index 14ec5c796..48f07679f 100644 --- a/includes/classes/class-rest-api.php +++ b/includes/classes/class-rest-api.php @@ -7,7 +7,6 @@ namespace EDAC\Inc; -use EDAC\Admin\Helpers; use EDAC\Admin\Insert_Rule_Data; use EDAC\Admin\Scans_Stats; use EDAC\Admin\Settings; @@ -225,7 +224,7 @@ public function clear_issues_for_post( $request ) { } $post_type = get_post_type( $post ); - $post_types = apply_filters( 'edacp_full_site_scan_scannable_post_types', Helpers::get_option_as_array( 'edac_post_types' ) ); + $post_types = Settings::get_scannable_post_types(); if ( empty( $post_types ) || ! in_array( $post_type, $post_types, true ) ) { return new \WP_REST_Response( [ 'message' => 'The post type is not set to be scanned.' ], 400 ); } @@ -297,7 +296,7 @@ public function set_post_scan_results( $request ) { } $post_type = get_post_type( $post ); - $post_types = apply_filters( 'edacp_full_site_scan_scannable_post_types', Helpers::get_option_as_array( 'edac_post_types' ) ); + $post_types = Settings::get_scannable_post_types(); if ( empty( $post_types ) || ! in_array( $post_type, $post_types, true ) ) { return new \WP_REST_Response( [ 'message' => 'The post type is not set to be scanned.' ], 400 ); diff --git a/includes/helper-functions.php b/includes/helper-functions.php index 417399dac..338ed02b5 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -5,6 +5,8 @@ * @package Accessibility_Checker */ +use EDAC\Admin\Settings; + /** * Compare strings * @@ -411,7 +413,7 @@ function edac_get_posts_count() { $output = []; - $post_types = get_option( 'edac_post_types' ); + $post_types = Settings::get_scannable_post_types(); if ( $post_types ) { foreach ( $post_types as $post_type ) { @@ -770,7 +772,7 @@ function edac_generate_landmark_link( $landmark, $landmark_selector, $post_id, $ } $landmark = ucwords( $landmark ); $landmark = esc_html( $landmark ); - + // If we have both landmark and selector, create a link. if ( ! empty( $landmark_selector ) ) { $link = apply_filters( @@ -785,12 +787,12 @@ function edac_generate_landmark_link( $landmark, $landmark_selector, $post_id, $ ], is_string( $link ) ? $link : get_the_permalink( $post_id ) ); - + // translators: %s is the landmark type (e.g., "Header", "Navigation", "Main"). $landmark_aria_label = sprintf( __( 'View %s landmark on website, opens a new window', 'accessibility-checker' ), $landmark ); - + $target_attr = $target_blank ? ' target="_blank"' : ''; - + return sprintf( '%s', esc_url( $landmark_url ), @@ -800,7 +802,7 @@ function edac_generate_landmark_link( $landmark, $landmark_selector, $post_id, $ $landmark ); } - + // If we only have landmark text, return it formatted. return $landmark; } @@ -820,6 +822,6 @@ function edac_is_virtual_page( $post_id ) { $pro_post_type = \EqualizeDigital\AccessibilityCheckerPro\VirtualContent\VirtualPageType::POST_TYPE; return $pro_post_type === $post_type; } - + return false; } diff --git a/includes/options-page.php b/includes/options-page.php index 98a04e07f..c6620cbac 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -6,6 +6,7 @@ */ use EDAC\Admin\Purge_Post_Data; +use EDAC\Admin\Settings; use EDAC\Inc\Accessibility_Statement; use EqualizeDigital\AccessibilityChecker\Admin\AdminPage\FixesPage; @@ -506,7 +507,7 @@ function edac_sanitize_post_types( $selected_post_types ) { } // clear cached stats if selected posts types change. - if ( get_option( 'edac_post_types' ) !== $selected_post_types ) { + if ( Settings::get_scannable_post_types() !== $selected_post_types ) { $scan_stats = new \EDAC\Admin\Scans_Stats(); $scan_stats->clear_cache(); From e4310cab8d3204c24b8c01fc03cc4c5bd9673855 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Thu, 21 Aug 2025 18:08:36 +0100 Subject: [PATCH 17/61] Don't output archive as a scannable post type in settings or visible in the scanner counts [PRO-269] --- includes/helper-functions.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/includes/helper-functions.php b/includes/helper-functions.php index 338ed02b5..b60a1d82a 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -164,10 +164,7 @@ function edac_custom_post_types() { $output = 'names'; // names or objects, note names is the default. $operator = 'and'; // Options 'and' or 'or'. - return array_merge( - get_post_types( $args, $output, $operator ), - [ 'edac_virtual_page' => 'Archives' ] - ); + return get_post_types( $args, $output, $operator ); } /** From 15e42871cee382ff1304b8ff7383610f88ca11ae Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Thu, 21 Aug 2025 21:02:36 +0100 Subject: [PATCH 18/61] Add a flag to skip over filtering in virtual post type to the scannables This is useful to skip over adding it at certain places like where they count CPTs [PRO-169] --- admin/class-settings.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/admin/class-settings.php b/admin/class-settings.php index 7bb2b11f6..2e5385c74 100644 --- a/admin/class-settings.php +++ b/admin/class-settings.php @@ -35,16 +35,17 @@ public static function get_scannable_post_statuses() { /** * Gets a list of post types that are scannable. * + * @param bool $skip_filtering Whether to skip filtering when passing through alternative settings class. + * * @return array */ - public static function get_scannable_post_types() { - + public static function get_scannable_post_types( $skip_filtering = false ) { if ( class_exists( 'EqualizeDigital\AccessibilityCheckerPro\Admin\Settings' ) && method_exists( 'EqualizeDigital\AccessibilityCheckerPro\Admin\Settings', 'get_scannable_post_types' ) ) { - return \EqualizeDigital\AccessibilityCheckerPro\Admin\Settings::get_scannable_post_types(); + return \EqualizeDigital\AccessibilityCheckerPro\Admin\Settings::get_scannable_post_types( $skip_filtering ); } $post_types = Helpers::get_option_as_array( 'edac_post_types' ); From 0942007a6bb8686d851e947981667d8b5ece4c06 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Thu, 21 Aug 2025 21:04:16 +0100 Subject: [PATCH 19/61] Skip the filtering when getting scannable_post_types in 2 places [PRO-169] --- admin/class-scans-stats.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/class-scans-stats.php b/admin/class-scans-stats.php index 02ca7f26a..d2bd08182 100644 --- a/admin/class-scans-stats.php +++ b/admin/class-scans-stats.php @@ -143,7 +143,7 @@ public function summary( $skip_cache = false ) { $data['scannable_posts_count'] = (int) $scannable_posts_count; $data['rule_count'] = (int) $this->rule_count; $data['tests_count'] = (int) $tests_count; - $data['scannable_post_types_count'] = (int) count( Settings::get_scannable_post_types() ); + $data['scannable_post_types_count'] = (int) count( Settings::get_scannable_post_types( true ) ); $post_types = get_post_types( [ From 8b7c4001c91f70dbf71f49f77c5a11679b275634 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Fri, 22 Aug 2025 00:10:32 +0100 Subject: [PATCH 20/61] Refactor virtual page references to use VirtualItem Updated class names and references from VirtualPage to VirtualItem across multiple files to align with new naming conventions. [PRO-169] --- includes/helper-functions.php | 4 ++-- tests/phpunit/helper-functions/IsVirtualPageTest.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/helper-functions.php b/includes/helper-functions.php index b60a1d82a..bd467bc99 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -814,9 +814,9 @@ function edac_generate_landmark_link( $landmark, $landmark_selector, $post_id, $ * @return bool True if the post is a virtual page, false otherwise. */ function edac_is_virtual_page( $post_id ) { - if ( class_exists( '\EqualizeDigital\AccessibilityCheckerPro\VirtualContent\VirtualPageType' ) ) { + if ( class_exists( '\EqualizeDigital\AccessibilityCheckerPro\VirtualContent\VirtualItemType' ) ) { $post_type = get_post_type( $post_id ); - $pro_post_type = \EqualizeDigital\AccessibilityCheckerPro\VirtualContent\VirtualPageType::POST_TYPE; + $pro_post_type = \EqualizeDigital\AccessibilityCheckerPro\VirtualContent\VirtualItemType::POST_TYPE; return $pro_post_type === $post_type; } diff --git a/tests/phpunit/helper-functions/IsVirtualPageTest.php b/tests/phpunit/helper-functions/IsVirtualPageTest.php index bbd8f4db2..b07755858 100644 --- a/tests/phpunit/helper-functions/IsVirtualPageTest.php +++ b/tests/phpunit/helper-functions/IsVirtualPageTest.php @@ -39,7 +39,7 @@ public function test_edac_is_virtual_page_with_post_types( $post_type, $expected [ 'public' => false, 'supports' => [ 'title' ], - ] + ] ); } @@ -87,7 +87,7 @@ public function invalid_post_ids_data() { * Helper method to create mock pro plugin class. */ private function create_mock_pro_class() { - if ( ! class_exists( '\EqualizeDigital\AccessibilityCheckerPro\VirtualContent\VirtualPageType' ) ) { + if ( ! class_exists( '\EqualizeDigital\AccessibilityCheckerPro\VirtualContent\VirtualItemType' ) ) { // phpcs:ignore Squiz.PHP.Eval.Discouraged eval( ' @@ -95,7 +95,7 @@ private function create_mock_pro_class() { class VirtualPageType { const POST_TYPE = "edac_virtual_item"; } - ' + ' ); } } From 1479e49a82c99fab7cb29303a33533d1f22b7d46 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Fri, 22 Aug 2025 00:20:43 +0100 Subject: [PATCH 21/61] Refactor virtual content namespace and class references Updated the namespace for VirtualItemType and adjusted class references across multiple files to ensure consistency and proper functionality. [PRO-169] --- includes/helper-functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/helper-functions.php b/includes/helper-functions.php index bd467bc99..a8e6030f1 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -814,9 +814,9 @@ function edac_generate_landmark_link( $landmark, $landmark_selector, $post_id, $ * @return bool True if the post is a virtual page, false otherwise. */ function edac_is_virtual_page( $post_id ) { - if ( class_exists( '\EqualizeDigital\AccessibilityCheckerPro\VirtualContent\VirtualItemType' ) ) { + if ( class_exists( '\EqualizeDigital\AccessibilityCheckerPro\VirtualContent\PostType\VirtualItemType' ) ) { $post_type = get_post_type( $post_id ); - $pro_post_type = \EqualizeDigital\AccessibilityCheckerPro\VirtualContent\VirtualItemType::POST_TYPE; + $pro_post_type = \EqualizeDigital\AccessibilityCheckerPro\VirtualContent\PostType\VirtualItemType::POST_TYPE; return $pro_post_type === $post_type; } From b42c504acb05ecfa48b808600c9478b28cea4792 Mon Sep 17 00:00:00 2001 From: William Patton Date: Mon, 25 Aug 2025 11:09:06 +0100 Subject: [PATCH 22/61] Add system settings section to options page and move the delete settings checkbox there --- includes/options-page.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/options-page.php b/includes/options-page.php index 98a04e07f..f411c9677 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -122,6 +122,13 @@ function edac_register_setting() { 'edac_settings' ); + add_settings_section( + 'edac_system', + __( 'System Settings', 'accessibility-checker' ), + 'edac_system_cb', + 'edac_settings' + ); + // Add fields. add_settings_field( 'edac_post_types', @@ -137,7 +144,7 @@ function edac_register_setting() { __( 'Delete Data', 'accessibility-checker' ), 'edac_delete_data_cb', 'edac_settings', - 'edac_general', + 'edac_system', [ 'label_for' => 'edac_delete_data' ] ); From cc29ba6cb521bf8e5f7015f1f0f8956efe0d2160 Mon Sep 17 00:00:00 2001 From: William Patton Date: Mon, 25 Aug 2025 11:48:22 +0100 Subject: [PATCH 23/61] Add helper to check if Pro version of the plugin is active and in use --- includes/helper-functions.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/includes/helper-functions.php b/includes/helper-functions.php index e547fabf1..0485bc522 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -796,3 +796,12 @@ function edac_generate_landmark_link( $landmark, $landmark_selector, $post_id, $ // If we only have landmark text, return it formatted. return $landmark; } + +/** + * Check if the Pro version of the plugin is active. + * + * @return bool True if Pro version is active, false otherwise. + */ +function edac_is_pro() { + return defined( 'EDACP_KEY_VALID' ) && EDAC_KEY_VALID; +} From b926db8aedcfed0ca36740639442d8641d4025d9 Mon Sep 17 00:00:00 2001 From: William Patton Date: Mon, 25 Aug 2025 12:29:42 +0100 Subject: [PATCH 24/61] Genericize the pro upsell bubble name, classes and markers --- admin/class-enqueue-admin.php | 10 +++++----- src/admin/index.js | 7 +++++-- src/common/sass/_fix-settings.scss | 2 +- .../pro-callout.js => common/settings-pro-callout.js} | 10 +++++----- 4 files changed, 16 insertions(+), 13 deletions(-) rename src/{admin/fixes-page/pro-callout.js => common/settings-pro-callout.js} (68%) diff --git a/admin/class-enqueue-admin.php b/admin/class-enqueue-admin.php index 821e867fc..b8b877d97 100644 --- a/admin/class-enqueue-admin.php +++ b/admin/class-enqueue-admin.php @@ -82,11 +82,11 @@ public static function maybe_enqueue_admin_and_editor_app_scripts() { 'edac', 'edac_script_vars', [ - 'postID' => $post_id, - 'nonce' => wp_create_nonce( 'ajax-nonce' ), - 'edacApiUrl' => esc_url_raw( rest_url() . 'accessibility-checker/v1' ), - 'restNonce' => wp_create_nonce( 'wp_rest' ), - 'fixesProUrl' => esc_url_raw( edac_generate_link_type( [ 'utm-content', '__fix__' ] ) ), + 'postID' => $post_id, + 'nonce' => wp_create_nonce( 'ajax-nonce' ), + 'edacApiUrl' => esc_url_raw( rest_url() . 'accessibility-checker/v1' ), + 'restNonce' => wp_create_nonce( 'wp_rest' ), + 'proUrl' => esc_url_raw( edac_generate_link_type( [ 'utm-content', '__name__' ] ) ), ] ); diff --git a/src/admin/index.js b/src/admin/index.js index 5a43eda61..7eb9b5a58 100644 --- a/src/admin/index.js +++ b/src/admin/index.js @@ -6,7 +6,7 @@ import { } from './summary/summary-tab-input-event-handlers'; import { initFixesInputStateHandler } from './fixes-page/conditional-disable-settings'; import { initRequiredSetup } from './fixes-page/conditional-required-settings'; -import { inlineFixesProUpsell } from './fixes-page/pro-callout'; +import { inlineSettingsProUpsell } from '../common/settings-pro-callout'; // eslint-disable-next-line camelcase const edacScriptVars = edac_script_vars; @@ -18,7 +18,10 @@ const edacScriptVars = edac_script_vars; if ( document.getElementById( 'edac-fixes-page' ) ) { initFixesInputStateHandler(); initRequiredSetup(); - inlineFixesProUpsell(); + } + + if ( document.querySelector( '.wrap.edac-settings' ) ) { + inlineSettingsProUpsell(); } // Accessibility Statement disable diff --git a/src/common/sass/_fix-settings.scss b/src/common/sass/_fix-settings.scss index da54f7e82..df9bf86e3 100644 --- a/src/common/sass/_fix-settings.scss +++ b/src/common/sass/_fix-settings.scss @@ -245,7 +245,7 @@ body.edac-fixes-modal--open { } } -.edac-fix--upsell-link { +.edac-setting--upsell-link { font-weight: 600; background: #f3cd1e; border-radius: 18px; diff --git a/src/admin/fixes-page/pro-callout.js b/src/common/settings-pro-callout.js similarity index 68% rename from src/admin/fixes-page/pro-callout.js rename to src/common/settings-pro-callout.js index ce578483f..bba99360a 100644 --- a/src/admin/fixes-page/pro-callout.js +++ b/src/common/settings-pro-callout.js @@ -1,18 +1,18 @@ import { __ } from '@wordpress/i18n'; -export const inlineFixesProUpsell = () => { +export const inlineSettingsProUpsell = () => { // find elements with 'edac-fix--upsell' class - const upsellElements = document.querySelectorAll( '.edac-fix--upsell' ); + const upsellElements = document.querySelectorAll( '.edac-fix--upsell, .edac-setting--upsell' ); // loop through each element upsellElements.forEach( ( element ) => { // create a link with the upsell url const upsellLink = document.createElement( 'a' ); - const url = window.edac_script_vars?.fixesProUrl || 'https://equalizedigital.com/accessibility-checker/pricing/'; - upsellLink.href = url.replace( '__fix__', element.querySelector( 'input' )?.getAttribute( 'name' ) ); + const url = window.edac_script_vars?.proUrl || 'https://equalizedigital.com/accessibility-checker/pricing/'; + upsellLink.href = url.replace( '__name__', element.querySelector( 'input' )?.getAttribute( 'name' ) ); upsellLink.target = '_blank'; upsellLink.rel = 'noopener noreferrer'; upsellLink.textContent = __( 'Get Pro' ); - upsellLink.classList.add( 'edac-fix--upsell-link' ); + upsellLink.classList.add( 'edac-setting--upsell-link' ); upsellLink.setAttribute( 'aria-label', __( 'Get Pro to unlock this feature, opens in a new window.', 'accessibility-checker' ) ); const tableHead = element.closest( 'tr' )?.querySelector( 'th' ); From f2c626e6051594a80d7d3893197a3854cffd0114 Mon Sep 17 00:00:00 2001 From: William Patton Date: Mon, 25 Aug 2025 12:40:01 +0100 Subject: [PATCH 25/61] Update 'General Settings' to 'Scan Settings' on options page --- includes/options-page.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/options-page.php b/includes/options-page.php index f411c9677..160064146 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -96,7 +96,7 @@ function edac_register_setting() { // Add sections. add_settings_section( 'edac_general', - __( 'General Settings', 'accessibility-checker' ), + __( 'Scan Settings', 'accessibility-checker' ), 'edac_general_cb', 'edac_settings' ); From 7b2fe61c4bb5e5bfb2d187e8b729609840635558 Mon Sep 17 00:00:00 2001 From: William Patton Date: Mon, 25 Aug 2025 12:51:59 +0100 Subject: [PATCH 26/61] Include some pro setting upsells here with nulling sanitizer callbacks --- includes/options-page.php | 158 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) diff --git a/includes/options-page.php b/includes/options-page.php index 160064146..f8c9d84e3 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -139,6 +139,33 @@ function edac_register_setting() { [ 'label_for' => 'edac_post_types' ] ); + add_settings_field( + 'edac_scan_speed', + __( 'Scan Speed', 'accessibility-checker' ), + 'edac_scan_speed_cb', + 'edac_settings', + 'edac_general', + [ 'label_for' => 'edac_scan_speed' ] + ); + + add_settings_field( + 'edac_enable_archive_scanning', + __( 'Enable Archive Scanning', 'accessibility-checker' ), + 'edac_enable_archive_scanning_cb', + 'edac_settings', + 'edac_general', + [ 'label_for' => 'edac_enable_archive_scanning' ] + ); + + add_settings_field( + 'edac_scan_all_taxonomy_terms', + __( 'Scan All Taxonomy Terms', 'accessibility-checker' ), + 'edac_scan_all_taxonomy_terms_cb', + 'edac_settings', + 'edac_general', + [ 'label_for' => 'edac_scan_all_taxonomy_terms' ] + ); + add_settings_field( 'edac_delete_data', __( 'Delete Data', 'accessibility-checker' ), @@ -214,6 +241,9 @@ function edac_register_setting() { // Register settings. register_setting( 'edac_settings', 'edac_post_types', 'edac_sanitize_post_types' ); + register_setting( 'edac_settings', 'edac_scan_speed', 'edac_sanitize_scan_speed' ); + register_setting( 'edac_settings', 'edac_enable_archive_scanning', 'edac_sanitize_enable_archive_scanning' ); + register_setting( 'edac_settings', 'edac_scan_all_taxonomy_terms', 'edac_sanitize_scan_all_taxonomy_terms' ); register_setting( 'edac_settings', 'edac_delete_data', 'edac_sanitize_checkbox' ); register_setting( 'edac_settings', @@ -310,6 +340,134 @@ function edac_footer_accessibility_statement_cb() { echo '

    '; } +/** + * Render the text for the system settings section + */ +function edac_system_cb() { + echo '

    '; + esc_html_e( 'Configure system-level settings for the Accessibility Checker plugin.', 'accessibility-checker' ); + echo '

    '; +} + +/** + * Render the dropdown input field for scan speed option + */ +function edac_scan_speed_cb() { + + $full_site_scan_speed = (int) get_option( 'edacp_full_site_scan_speed', 1000 ); + + $speed_values = [ + '250' => __( 'Fast', 'accessibility-checker' ), + '1000' => __( 'Normal', 'accessibility-checker' ), + '5000' => __( 'Slow', 'accessibility-checker' ), + '30000' => __( 'Slowest', 'accessibility-checker' ), + ]; + + ?> +
    > + +
    +

    + +

    + +
    > + +
    +

    + +

    + +
    > + +
    +

    + +

    + Date: Mon, 25 Aug 2025 13:57:18 +0100 Subject: [PATCH 27/61] Fix pro upsell tagging with utm-content --- admin/class-enqueue-admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/class-enqueue-admin.php b/admin/class-enqueue-admin.php index b8b877d97..a7f661a58 100644 --- a/admin/class-enqueue-admin.php +++ b/admin/class-enqueue-admin.php @@ -86,7 +86,7 @@ public static function maybe_enqueue_admin_and_editor_app_scripts() { 'nonce' => wp_create_nonce( 'ajax-nonce' ), 'edacApiUrl' => esc_url_raw( rest_url() . 'accessibility-checker/v1' ), 'restNonce' => wp_create_nonce( 'wp_rest' ), - 'proUrl' => esc_url_raw( edac_generate_link_type( [ 'utm-content', '__name__' ] ) ), + 'proUrl' => esc_url_raw( edac_generate_link_type( [ 'utm-content' => '__name__' ] ) ), ] ); From 6cd7e6cfa81bea1487e9c65809116c3bf524d4fe Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Mon, 25 Aug 2025 20:39:00 +0100 Subject: [PATCH 28/61] Rename scan speed settings for consistency and back compatibility Updated the scan speed settings to use a consistent prefix and added a new registration for the full site scan speed option. --- includes/options-page.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/includes/options-page.php b/includes/options-page.php index f8c9d84e3..060bd3c3f 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -140,12 +140,12 @@ function edac_register_setting() { ); add_settings_field( - 'edac_scan_speed', + 'edacp_full_site_scan_speed', __( 'Scan Speed', 'accessibility-checker' ), - 'edac_scan_speed_cb', + 'edac_full_site_scan_speed_cb', 'edac_settings', 'edac_general', - [ 'label_for' => 'edac_scan_speed' ] + [ 'label_for' => 'edac_full_site_scan_speed' ] ); add_settings_field( @@ -241,7 +241,6 @@ function edac_register_setting() { // Register settings. register_setting( 'edac_settings', 'edac_post_types', 'edac_sanitize_post_types' ); - register_setting( 'edac_settings', 'edac_scan_speed', 'edac_sanitize_scan_speed' ); register_setting( 'edac_settings', 'edac_enable_archive_scanning', 'edac_sanitize_enable_archive_scanning' ); register_setting( 'edac_settings', 'edac_scan_all_taxonomy_terms', 'edac_sanitize_scan_all_taxonomy_terms' ); register_setting( 'edac_settings', 'edac_delete_data', 'edac_sanitize_checkbox' ); @@ -268,6 +267,7 @@ function edac_register_setting() { register_setting( 'edac_settings', 'edac_accessibility_policy_page', 'edac_sanitize_accessibility_policy_page' ); register_setting( 'edac_settings', 'edac_frontend_highlighter_position', 'edac_sanitize_frontend_highlighter_position' ); + register_setting( 'edac_settings', 'edacp_full_site_scan_speed', 'edac_sanitize_scan_speed' ); } /** @@ -350,9 +350,11 @@ function edac_system_cb() { } /** - * Render the dropdown input field for scan speed option + * Render the dropdown input field for scan speed option. + * + * Note: this setting is purposefully using edacp as prefix for back compat reasons. */ -function edac_scan_speed_cb() { +function edac_full_site_scan_speed_cb() { $full_site_scan_speed = (int) get_option( 'edacp_full_site_scan_speed', 1000 ); @@ -442,8 +444,10 @@ function edac_scan_all_taxonomy_terms_cb() { * @return string */ function edac_sanitize_scan_speed( $speed ) { - // This is a Pro-only feature, don't save any values. - return get_option( 'edac_scan_speed', $speed ); + if ( in_array( $speed, [ '250', '1000', '5000', '30000' ], true ) ) { + return $speed; + } + return '1000'; } /** From 7cf16c93ae5d788651f094cc63526c0e3299d630 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Mon, 25 Aug 2025 20:41:38 +0100 Subject: [PATCH 29/61] Add settings fields for ignoring user roles and simplified summary heading This update introduces new settings fields to allow users to ignore specific user roles and to customize the heading for the simplified summary. --- includes/options-page.php | 103 +++++++++++++++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 2 deletions(-) diff --git a/includes/options-page.php b/includes/options-page.php index 060bd3c3f..d264ee8ff 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -166,6 +166,15 @@ function edac_register_setting() { [ 'label_for' => 'edac_scan_all_taxonomy_terms' ] ); + add_settings_field( + 'edacp_ignore_user_roles', + __( 'Ignore Permissions', 'accessibility-checker' ), + 'edac_ignore_user_roles_cb', + 'edac_settings', + 'edac_general', + [ 'label_for' => 'edac_ignore_user_roles' ] + ); + add_settings_field( 'edac_delete_data', __( 'Delete Data', 'accessibility-checker' ), @@ -193,6 +202,15 @@ function edac_register_setting() { [ 'label_for' => 'edac_simplified_summary_position' ] ); + add_settings_field( + 'edacp_simplified_summary_heading', + __( 'Simplified Summary Heading', 'accessibility-checker' ), + 'edac_simplified_summary_heading_cb', + 'edac_settings', + 'edac_simplified_summary', + [ 'label_for' => 'edacp_simplified_summary_heading' ] + ); + add_settings_field( 'edac_add_footer_accessibility_statement', __( 'Add Footer Accessibility Statement', 'accessibility-checker' ), @@ -241,8 +259,7 @@ function edac_register_setting() { // Register settings. register_setting( 'edac_settings', 'edac_post_types', 'edac_sanitize_post_types' ); - register_setting( 'edac_settings', 'edac_enable_archive_scanning', 'edac_sanitize_enable_archive_scanning' ); - register_setting( 'edac_settings', 'edac_scan_all_taxonomy_terms', 'edac_sanitize_scan_all_taxonomy_terms' ); + register_setting( 'edac_settings', 'edac_delete_data', 'edac_sanitize_checkbox' ); register_setting( 'edac_settings', @@ -267,7 +284,11 @@ function edac_register_setting() { register_setting( 'edac_settings', 'edac_accessibility_policy_page', 'edac_sanitize_accessibility_policy_page' ); register_setting( 'edac_settings', 'edac_frontend_highlighter_position', 'edac_sanitize_frontend_highlighter_position' ); + + // Upsell settings - these are using edacp prefix for backwards compatibility. register_setting( 'edac_settings', 'edacp_full_site_scan_speed', 'edac_sanitize_scan_speed' ); + register_setting( 'edac_settings', 'edacp_ignore_user_roles', 'edac_sanitize_ignore_user_roles' ); + register_setting( 'edac_settings', 'edacp_simplified_summary_heading', 'sanitize_text_field' ); } /** @@ -793,3 +814,81 @@ function edac_delete_data_cb() { function edac_sanitize_checkbox( $input ) { return ( isset( $input ) && '1' === $input ) ? 1 : 0; } + +/** + * Render the input field for simplified summary heading. + * + * @return void + */ +function edac_simplified_summary_heading_cb() { + // phpcs:ignore Universal.Operators.DisallowShortTernary.Found -- ternary is more readable here. + $simplified_summary_heading = get_option( 'edacp_simplified_summary_heading' ) ?: __( 'Simplified Summary', 'accessibility-checker' ); + ?> + + type="text" + name="edacp_simplified_summary_heading" + id="edacp_simplified_summary_heading" + value="" + + > + roles; + + ?> +
    > + + $role ) : ?> + +
    + + +
    +

    + +

    + roles ); + + if ( $selected_roles ) { + foreach ( $selected_roles as $key => $selected_role ) { + if ( ! in_array( $selected_role, (array) $roles, true ) ) { + unset( $selected_roles[ $key ] ); + } + } + } + + return $selected_roles; +} From 2841157d0f3ba157f79356a245c828123f1d078e Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Mon, 25 Aug 2025 20:43:05 +0100 Subject: [PATCH 30/61] Update some names of scan settings to be edacp for consistency with where they are needed --- includes/options-page.php | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/includes/options-page.php b/includes/options-page.php index d264ee8ff..8833d0d0f 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -149,7 +149,7 @@ function edac_register_setting() { ); add_settings_field( - 'edac_enable_archive_scanning', + 'edacp_enable_archive_scanning', __( 'Enable Archive Scanning', 'accessibility-checker' ), 'edac_enable_archive_scanning_cb', 'edac_settings', @@ -158,7 +158,7 @@ function edac_register_setting() { ); add_settings_field( - 'edac_scan_all_taxonomy_terms', + 'edacp_scan_all_taxonomy_terms', __( 'Scan All Taxonomy Terms', 'accessibility-checker' ), 'edac_scan_all_taxonomy_terms_cb', 'edac_settings', @@ -256,7 +256,6 @@ function edac_register_setting() { [ 'label_for' => 'edac_frontend_highlighter_position' ] ); - // Register settings. register_setting( 'edac_settings', 'edac_post_types', 'edac_sanitize_post_types' ); @@ -287,6 +286,8 @@ function edac_register_setting() { // Upsell settings - these are using edacp prefix for backwards compatibility. register_setting( 'edac_settings', 'edacp_full_site_scan_speed', 'edac_sanitize_scan_speed' ); + register_setting( 'edac_settings', 'edacp_enable_archive_scanning', 'edac_sanitize_checkbox' ); + register_setting( 'edac_settings', 'edacp_scan_all_taxonomy_terms', 'edac_sanitize_checkbox' ); register_setting( 'edac_settings', 'edacp_ignore_user_roles', 'edac_sanitize_ignore_user_roles' ); register_setting( 'edac_settings', 'edacp_simplified_summary_heading', 'sanitize_text_field' ); } @@ -404,21 +405,23 @@ function edac_full_site_scan_speed_cb() { } /** - * Render the checkbox for enable archives scanning + * Render the checkbox for enable archives scanning. + * + * Note: this setting is purposefully using edacp as prefix. * * @return void */ function edac_enable_archive_scanning_cb() { - $enable_archives = get_option( 'edacp_enable_archives_scanning', false ); + $enable_archives = get_option( 'edacp_enable_archive_scanning', false ); ?>
    >

    From 0e4b108b992e347964fd4d86cb222549c008d6b4 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Tue, 26 Aug 2025 14:20:14 +0100 Subject: [PATCH 46/61] Add some initial defaults for saving values on some settings when not pro --- includes/options-page.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/options-page.php b/includes/options-page.php index 5f774254d..9d2afa096 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -831,7 +831,7 @@ function edac_sanitize_pro_scan_speed( $input ) { if ( edac_is_pro() ) { return edac_sanitize_scan_speed( $input ); } - return get_option( 'edacp_full_site_scan_speed', $input ); + return get_option( 'edacp_full_site_scan_speed', '1000' ); } /** @@ -845,7 +845,7 @@ function edac_sanitize_pro_checkbox( $input, $option_name ) { if ( edac_is_pro() ) { return edac_sanitize_checkbox( $input ); } - return get_option( $option_name, $input ); + return get_option( $option_name, 0 ); } /** @@ -879,7 +879,7 @@ function edac_sanitize_pro_ignore_roles( $input ) { return edac_sanitize_ignore_user_roles( $input ); } - return get_option( 'edacp_ignore_user_roles', $input ); + return get_option( 'edacp_ignore_user_roles', [ 'administrator' ] ); } /** @@ -892,7 +892,7 @@ function edac_sanitize_pro_summary_heading( $input ) { if ( edac_is_pro() ) { return sanitize_text_field( $input ); } - return get_option( 'edacp_simplified_summary_heading', $input ); + return get_option( 'edacp_simplified_summary_heading', esc_html__( 'Simplified Summary', 'accessibility-checker' ) ); } /** From 7622b19cbf237bb9d024be25ed06af3a961b6006 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Tue, 26 Aug 2025 14:23:21 +0100 Subject: [PATCH 47/61] Handle possible array name keys in bubble upsell link generation --- src/common/settings-pro-callout.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/settings-pro-callout.js b/src/common/settings-pro-callout.js index fd7b44a16..1c86366d0 100644 --- a/src/common/settings-pro-callout.js +++ b/src/common/settings-pro-callout.js @@ -9,11 +9,12 @@ export const inlineSettingsProUpsell = () => { // create a link with the upsell url const upsellLink = document.createElement( 'a' ); const urlTemplate = window.edac_script_vars?.proUrl || 'https://equalizedigital.com/accessibility-checker/pricing/'; - const settingName = + const settingNameRaw = element.querySelector( 'input, select, textarea' )?.getAttribute( 'name' ) || element.dataset?.setting || element.id || 'setting'; + const settingName = String( settingNameRaw ).replace( /\[\]$/, '' ); upsellLink.href = urlTemplate.includes( '__name__' ) ? urlTemplate.replace( '__name__', encodeURIComponent( settingName ) ) : urlTemplate; From 800271c4d2d39dfd459175762737bd69eacb3c1c Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Tue, 26 Aug 2025 14:48:58 +0100 Subject: [PATCH 48/61] Update mock class in test to reflect the current path and name in pro --- tests/phpunit/helper-functions/IsVirtualPageTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/helper-functions/IsVirtualPageTest.php b/tests/phpunit/helper-functions/IsVirtualPageTest.php index b07755858..599214b3b 100644 --- a/tests/phpunit/helper-functions/IsVirtualPageTest.php +++ b/tests/phpunit/helper-functions/IsVirtualPageTest.php @@ -87,12 +87,12 @@ public function invalid_post_ids_data() { * Helper method to create mock pro plugin class. */ private function create_mock_pro_class() { - if ( ! class_exists( '\EqualizeDigital\AccessibilityCheckerPro\VirtualContent\VirtualItemType' ) ) { + if ( ! class_exists( '\EqualizeDigital\AccessibilityCheckerPro\VirtualContent\PostType\VirtualItemType' ) ) { // phpcs:ignore Squiz.PHP.Eval.Discouraged eval( ' - namespace EqualizeDigital\\AccessibilityCheckerPro\\VirtualContent; - class VirtualPageType { + namespace EqualizeDigital\\AccessibilityCheckerPro\\VirtualContent\\PostType; + class VirtualItemType { const POST_TYPE = "edac_virtual_item"; } ' From f4bf0b21263b83795f42d9213300689294fb42a2 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Tue, 26 Aug 2025 17:49:50 +0100 Subject: [PATCH 49/61] Refactor post type change detection to compare sorted arrays The previous comparison was an order compare not a set compare. Pre-sorting them ensures the same order so it's a real compare. [PRO-169] --- includes/options-page.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/options-page.php b/includes/options-page.php index c0a8d5cc9..c0a634852 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -700,7 +700,8 @@ function edac_sanitize_post_types( $selected_post_types ) { } // clear cached stats if selected posts types change. - if ( Settings::get_scannable_post_types() !== $selected_post_types ) { + $previous = Settings::get_scannable_post_types(); + if ( sort( $previous ) !== sort( $selected_post_types ) ) { $scan_stats = new \EDAC\Admin\Scans_Stats(); $scan_stats->clear_cache(); From 9d1d6afa70d6012496ea5d8dea8cb380387b2ce3 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Tue, 26 Aug 2025 19:06:15 +0100 Subject: [PATCH 50/61] Add a Permission section for ignore permissions setting [PRO-169] --- includes/options-page.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/includes/options-page.php b/includes/options-page.php index c0a634852..28bde7bb7 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -112,6 +112,13 @@ function edac_register_setting() { 'edac_settings' ); + add_settings_section( + 'edac_permissions', + __( 'Permissions', 'accessibility-checker' ), + 'edac_permissions_section_cb', + 'edac_settings' + ); + add_settings_section( 'edac_simplified_summary', __( 'Simplified Summary Settings', 'accessibility-checker' ), @@ -182,7 +189,7 @@ function edac_register_setting() { __( 'Ignore Permissions', 'accessibility-checker' ), 'edac_ignore_user_roles_cb', 'edac_settings', - 'edac_general', + 'edac_permissions', [ 'label_for' => 'edac_ignore_user_roles' ] ); @@ -988,3 +995,14 @@ function edac_sanitize_ignore_user_roles( $selected_roles ) { return $selected_roles; } + +/** + * Render the text for the permissions section + */ +function edac_permissions_section_cb() { + ?> +

    + +

    + Date: Tue, 26 Aug 2025 19:08:53 +0100 Subject: [PATCH 51/61] Update documentation for virtual page check to use VirtualItemType:POST_TYPE constant [PRO-169] --- includes/helper-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/helper-functions.php b/includes/helper-functions.php index dcb0aaa53..0088b2830 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -808,7 +808,7 @@ function edac_generate_landmark_link( $landmark, $landmark_selector, $post_id, $ * Check if a post is a virtual page. * * This function checks if a post is a virtual page using the pro plugin's - * VirtualPageType constant. + * VirtualItemType:POST_TYPE constant. * * @param int $post_id The post ID to check. * @return bool True if the post is a virtual page, false otherwise. From 8a4c68684e5634b457ae05d0f67f02c939605ad6 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Tue, 26 Aug 2025 19:13:09 +0100 Subject: [PATCH 52/61] Add back in the old upsell bubble class for back compat [PRO-169] --- src/common/sass/_fix-settings.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/sass/_fix-settings.scss b/src/common/sass/_fix-settings.scss index df9bf86e3..3b719d640 100644 --- a/src/common/sass/_fix-settings.scss +++ b/src/common/sass/_fix-settings.scss @@ -245,6 +245,7 @@ body.edac-fixes-modal--open { } } +.edac-fix--upsell-link, .edac-setting--upsell-link { font-weight: 600; background: #f3cd1e; From 819c1c1fb737c42dcd3c6bb8e2e7e09a811d7161 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Tue, 26 Aug 2025 20:50:50 +0100 Subject: [PATCH 53/61] Update the scan settings messaging [PRO-232] --- includes/options-page.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/includes/options-page.php b/includes/options-page.php index 28bde7bb7..5b8f57380 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -316,11 +316,7 @@ function edac_register_setting() { function edac_general_cb() { echo '

    '; - printf( - /* translators: %1$s: link to the plugin documentation website. */ - esc_html__( 'Use the settings below to configure Accessibility Checker. Additional information about each setting can be found in the %1$s.', 'accessibility-checker' ), - '' . esc_html__( 'plugin documentation', 'accessibility-checker' ) . '' - ); + esc_html_e( 'Configure the types of content that should be checked for accessibility issues.', 'accessibility-checker' ); if ( EDAC_KEY_VALID === false ) { printf( From d99c4cabb5b7d0ffd0ef0c72dcb5445433e3f1f1 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Tue, 26 Aug 2025 20:55:02 +0100 Subject: [PATCH 54/61] Use a more direct comparison for types before and after setting save [PRO-169] --- includes/options-page.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/options-page.php b/includes/options-page.php index 5b8f57380..758d9383c 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -703,8 +703,11 @@ function edac_sanitize_post_types( $selected_post_types ) { } // clear cached stats if selected posts types change. - $previous = Settings::get_scannable_post_types(); - if ( sort( $previous ) !== sort( $selected_post_types ) ) { + $prev = array_values( array_unique( (array) Settings::get_scannable_post_types() ) ); + $next = array_values( array_unique( (array) $selected_post_types ) ); + sort( $prev ); + sort( $next ); + if ( $prev !== $next ) { $scan_stats = new \EDAC\Admin\Scans_Stats(); $scan_stats->clear_cache(); From 0a3b14b8244ed477cada47663fb6fa38c6741804 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Tue, 26 Aug 2025 20:55:47 +0100 Subject: [PATCH 55/61] Update messaging for settings permission section [PRO-169] --- includes/options-page.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/options-page.php b/includes/options-page.php index 758d9383c..f31e8b79b 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -1001,7 +1001,7 @@ function edac_sanitize_ignore_user_roles( $selected_roles ) { function edac_permissions_section_cb() { ?>

    - +

    Date: Wed, 27 Aug 2025 13:03:58 +0100 Subject: [PATCH 56/61] Do 'edac_pro_setting_saving_checkbox' when saving archive scan setting [PRO-169] --- includes/options-page.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/includes/options-page.php b/includes/options-page.php index f31e8b79b..428e38cb1 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -851,6 +851,16 @@ function edac_sanitize_pro_scan_speed( $input ) { */ function edac_sanitize_pro_checkbox( $input, $option_name ) { if ( edac_is_pro() ) { + /** + * Filter to run before saving a pro checkbox setting. + * + * @since 1.31.0 + * + * @param string $option_name The option name being saved. + * @param mixed $input The input value. + * @return void + */ + do_action( 'edac_pro_setting_saving_checkbox', $option_name, $input ); return edac_sanitize_checkbox( $input ); } return get_option( $option_name, 0 ); From a61432c5399b965540d5a6baf2f415518034d77e Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Wed, 27 Aug 2025 13:10:04 +0100 Subject: [PATCH 57/61] Remove an unused sanitizer wrapper [PRO-169] --- includes/options-page.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/includes/options-page.php b/includes/options-page.php index 428e38cb1..f0a940bac 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -812,23 +812,6 @@ function edac_delete_data_cb() { Date: Wed, 27 Aug 2025 13:11:36 +0100 Subject: [PATCH 58/61] Refactor scan stats handling to improve clarity Updated the way scannable post types are retrieved and cached, simplifying the instantiation of the Scans_Stats class. [PRO-169] --- includes/options-page.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/options-page.php b/includes/options-page.php index f0a940bac..9fda99be0 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -6,6 +6,7 @@ */ use EDAC\Admin\Purge_Post_Data; +use EDAC\Admin\Scans_Stats; use EDAC\Admin\Settings; use EDAC\Inc\Accessibility_Statement; use EqualizeDigital\AccessibilityChecker\Admin\AdminPage\FixesPage; @@ -703,12 +704,12 @@ function edac_sanitize_post_types( $selected_post_types ) { } // clear cached stats if selected posts types change. - $prev = array_values( array_unique( (array) Settings::get_scannable_post_types() ) ); + $prev = array_values( array_unique( Settings::get_scannable_post_types() ) ); $next = array_values( array_unique( (array) $selected_post_types ) ); sort( $prev ); sort( $next ); if ( $prev !== $next ) { - $scan_stats = new \EDAC\Admin\Scans_Stats(); + $scan_stats = new Scans_Stats(); $scan_stats->clear_cache(); // EDACP\Scans is the old namespace, kept for back compat but should be removed after a few releases. From 57cce49ba7cec8d57793205fad26143eaa18eec1 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Wed, 27 Aug 2025 13:50:50 +0100 Subject: [PATCH 59/61] Use edac_is_pro helper instead of direct constant check [PRO-169] --- includes/options-page.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/options-page.php b/includes/options-page.php index 9fda99be0..df417c71a 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -319,7 +319,7 @@ function edac_general_cb() { esc_html_e( 'Configure the types of content that should be checked for accessibility issues.', 'accessibility-checker' ); - if ( EDAC_KEY_VALID === false ) { + if ( ! edac_is_pro() ) { printf( /* translators: %1$s: link to the "Accessibility Checker Pro" website. */ ' ' . esc_html__( 'More features and email support is available with %1$s.', 'accessibility-checker' ), From 4fc19253b476e4ac38033c0c8cb334bdcc514816 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Wed, 27 Aug 2025 13:57:26 +0100 Subject: [PATCH 60/61] Make comment more clear [PRO-169] --- includes/options-page.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/options-page.php b/includes/options-page.php index df417c71a..a4f511308 100644 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -76,7 +76,7 @@ function edac_add_options_page() { $fixes_page->add_page(); // Deregister the pro setting registration - this is added for backwards compatibility for users - // that don't update pro. Added here in 1.31.0 and removed from pro in 1.16.0. + // that don't update pro. Added here in 1.31.0 and released with pro 1.16.0. add_action( 'admin_init', function () { From e2dca0b25fd533e887bec4f1ead59e414b2f2d85 Mon Sep 17 00:00:00 2001 From: pattonwebz Date: Wed, 27 Aug 2025 15:01:24 +0100 Subject: [PATCH 61/61] Make edac_get_origin_url_for_virtual_page accept string as first param This makes the pattern of sending string and returning string more clear, the id is still passed through as well to get the virtual url for it If no virtual url is found the original string is passed back, the original string is usually a permalink [PRO-169] --- admin/class-ajax.php | 3 ++- admin/class-enqueue-admin.php | 3 ++- includes/helper-functions.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/admin/class-ajax.php b/admin/class-ajax.php index c455cb60a..b1ab06748 100644 --- a/admin/class-ajax.php +++ b/admin/class-ajax.php @@ -493,6 +493,7 @@ function ( $a, $b ) { $post_view_link = apply_filters( 'edac_get_origin_url_for_virtual_page', + get_the_permalink( $postid ), $postid ); @@ -501,7 +502,7 @@ function ( $a, $b ) { 'edac' => $id, 'edac_nonce' => wp_create_nonce( 'edac_highlight' ), ], - is_string( $post_view_link ) ? $post_view_link : get_the_permalink( $postid ) + $post_view_link ); // Translators: %d is the issue ID. diff --git a/admin/class-enqueue-admin.php b/admin/class-enqueue-admin.php index f6b26cb16..32197dd00 100644 --- a/admin/class-enqueue-admin.php +++ b/admin/class-enqueue-admin.php @@ -114,6 +114,7 @@ public static function maybe_enqueue_admin_and_editor_app_scripts() { } else { $post_view_link = apply_filters( 'edac_get_origin_url_for_virtual_page', + get_preview_post_link( $post_id ), $post_id ); @@ -121,7 +122,7 @@ public static function maybe_enqueue_admin_and_editor_app_scripts() { [ 'edac_pageScanner' => 1, ], - is_string( $post_view_link ) ? $post_view_link : get_preview_post_link( $post_id ) + $post_view_link ); } diff --git a/includes/helper-functions.php b/includes/helper-functions.php index 0088b2830..85237460e 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -774,6 +774,7 @@ function edac_generate_landmark_link( $landmark, $landmark_selector, $post_id, $ if ( ! empty( $landmark_selector ) ) { $link = apply_filters( 'edac_get_origin_url_for_virtual_page', + get_the_permalink( $post_id ), $post_id ); @@ -782,7 +783,7 @@ function edac_generate_landmark_link( $landmark, $landmark_selector, $post_id, $ 'edac_landmark' => base64_encode( $landmark_selector ), 'edac_nonce' => wp_create_nonce( 'edac_highlight' ), ], - is_string( $link ) ? $link : get_the_permalink( $post_id ) + $link ); // translators: %s is the landmark type (e.g., "Header", "Navigation", "Main").