• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

equalizedigital / accessibility-checker / 17297832630

28 Aug 2025 01:47PM UTC coverage: 59.256% (-1.6%) from 60.808%
17297832630

push

github

web-flow
Merge pull request #1171 from equalizedigital/william/pro-169-filter-post-types-at-save-time

Add initial support for handling of virtual posts

47 of 252 new or added lines in 13 files covered. (18.65%)

2 existing lines in 1 file now uncovered.

4123 of 6958 relevant lines covered (59.26%)

3.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/admin/class-ajax.php
1
<?php
2
/**
3
 * Class file for admin notices
4
 *
5
 * @package Accessibility_Checker
6
 */
7

8
namespace EDAC\Admin;
9

10
use EDAC\Admin\OptIn\Email_Opt_In;
11
use EDAC\Inc\Summary_Generator;
12
use EqualizeDigital\AccessibilityChecker\Admin\AdminPage\FixesPage;
13
use EqualizeDigital\AccessibilityChecker\Fixes\FixesManager;
14

15
/**
16
 * Class that handles ajax requests.
17
 */
18
class Ajax {
19

20
        /**
21
         * Constructor function for the class.
22
         */
23
        public function __construct() {
24
        }
×
25

26
        /**
27
         * Initialize hooks.
28
         *
29
         * @return void
30
         */
31
        public function init_hooks() {
32
                add_action( 'wp_ajax_edac_summary_ajax', [ $this, 'summary' ] );
×
33
                add_action( 'wp_ajax_edac_details_ajax', [ $this, 'details' ] );
×
34
                add_action( 'wp_ajax_edac_readability_ajax', [ $this, 'readability' ] );
×
35
                add_action( 'wp_ajax_edac_insert_ignore_data', [ $this, 'add_ignore' ] );
×
36
                add_action( 'wp_ajax_edac_update_simplified_summary', [ $this, 'simplified_summary' ] );
×
37
                add_action( 'wp_ajax_edac_dismiss_welcome_cta_ajax', [ $this, 'dismiss_welcome_cta' ] );
×
38
                add_action( 'wp_ajax_edac_dismiss_dashboard_cta_ajax', [ $this, 'dismiss_dashboard_cta' ] );
×
39
                ( new Email_Opt_In() )->register_ajax_handlers();
×
40
        }
41

42
        /**
43
         * Summary Ajax
44
         *
45
         * @return void
46
         *
47
         *  - '-1' means that nonce could not be varified
48
         *  - '-2' means that the post ID was not specified
49
         *  - '-3' means that there isn't any summary data to return
50
         */
51
        public function summary() {
52

53
                // nonce security.
54
                if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_REQUEST['nonce'] ) ), 'ajax-nonce' ) ) {
×
55

56
                        $error = new \WP_Error( '-1', __( 'Permission Denied', 'accessibility-checker' ) );
×
57
                        wp_send_json_error( $error );
×
58

59
                }
60

61
                if ( ! isset( $_REQUEST['post_id'] ) ) {
×
62

63
                        $error = new \WP_Error( '-2', __( 'The post ID was not set', 'accessibility-checker' ) );
×
64
                        wp_send_json_error( $error );
×
65

66
                }
67

68
                $html            = [];
×
69
                $html['content'] = '';
×
70

71

72
                $post_id                   = (int) $_REQUEST['post_id'];
×
73
                $summary                   = ( new Summary_Generator( $post_id ) )->generate_summary();
×
74
                $simplified_summary_text   = '';
×
75
                $simplified_summary_prompt = get_option( 'edac_simplified_summary_prompt' );
×
76
                $simplified_summary        = get_post_meta( $post_id, '_edac_simplified_summary', true ) ? get_post_meta( $post_id, '_edac_simplified_summary', true ) : '';
×
77

78
                $simplified_summary_grade = 0;
×
79
                if ( class_exists( 'DaveChild\TextStatistics\TextStatistics' ) ) {
×
80
                        $text_statistics          = new \DaveChild\TextStatistics\TextStatistics();
×
81
                        $simplified_summary_grade = (int) floor( $text_statistics->fleschKincaidGradeLevel( $simplified_summary ) );
×
82
                }
83
                $simplified_summary_grade_failed = ( $simplified_summary_grade > 9 ) ? true : false;
×
84

85
                $simplified_summary_text = esc_html__( 'A Simplified summary has not been included for this content.', 'accessibility-checker' );
×
86
                if ( 'none' !== $simplified_summary_prompt ) {
×
87
                        if ( $summary['content_grade'] <= 9 ) {
×
88
                                $simplified_summary_text = esc_html__( 'Your content has a reading level at or below 9th grade and does not require a simplified summary.', 'accessibility-checker' );
×
89
                        } elseif ( $summary['simplified_summary'] ) {
×
90
                                if ( $simplified_summary_grade_failed ) {
×
91
                                        $simplified_summary_text = esc_html__( 'The reading level of the simplified summary is too high.', 'accessibility-checker' );
×
92
                                } else {
93
                                        $simplified_summary_text = esc_html__( 'A simplified summary has been included for this content.', 'accessibility-checker' );
×
94
                                }
95
                        }
96
                }
97

98
                $html['content'] .= '<ul class="edac-summary-grid">';
×
99

100
                        $html['content'] .= '<li class="edac-summary-total" aria-label="' . $summary['passed_tests'] . '% Passed Tests">';
×
101

102
                                $html['content'] .= '<div class="edac-summary-total-progress-circle ' . ( ( $summary['passed_tests'] > 50 ) ? ' over50' : '' ) . '">
×
103
                                        <div class="edac-summary-total-progress-circle-label">
104
                                                <div class="edac-panel-number">' . $summary['passed_tests'] . '%</div>
×
105
                                                <div class="edac-panel-number-label">Passed Tests<sup><a href="#edac-summary-disclaimer" aria-label="About passed tests.">*</a></sup></div>
106
                                        </div>
107
                                        <div class="left-half-clipper">
108
                                                <div class="first50-bar"></div>
109
                                                <div class="value-bar" style="transform: rotate(' . $summary['passed_tests'] * 3.6 . 'deg);"></div>
×
110
                                        </div>
111
                                </div>';
×
112

113
                                $html['content'] .= '<div class="edac-summary-total-mobile">
×
114
                                        <div class="edac-panel-number">' . $summary['passed_tests'] . '%</div>
×
115
                                        <div class="edac-panel-number-label">Passed Tests<sup><a href="#edac-summary-disclaimer" aria-label="About passed tests.">*</a></sup></div>
116
                                        <div class="edac-summary-total-mobile-bar"><span style="width:' . ( $summary['passed_tests'] ) . '%;"></span></div>
×
117
                                </div>';
×
118

119
                        $html['content'] .= '</li>';
×
120

121
                        // if this is a virtual page, we don't show the readability section.
NEW
122
                        $is_virtual_page = edac_is_virtual_page( $post_id );
×
123

124
                        $html['content'] .= '
×
125
                                ' . edac_generate_summary_stat(
×
126
                                'edac-summary-errors',
×
127
                                $summary['errors'],
×
128
                                /* translators: %s: Number of errors */
129
                                        sprintf( _n( '%s Error', '%s Errors', $summary['errors'], 'accessibility-checker' ), $summary['errors'] )
×
130
                        ) . '
×
131
                                ' . edac_generate_summary_stat(
×
132
                                'edac-summary-contrast',
×
133
                                $summary['contrast_errors'],
×
134
                                /* translators: %s: Number of contrast errors */
135
                                        sprintf( _n( '%s Contrast Error', '%s Contrast Errors', $summary['contrast_errors'], 'accessibility-checker' ), $summary['contrast_errors'] )
×
136
                        ) . '
×
137
                                ' . edac_generate_summary_stat(
×
138
                                'edac-summary-warnings',
×
139
                                $summary['warnings'],
×
140
                                /* translators: %s: Number of warnings */
141
                                        sprintf( _n( '%s Warning', '%s Warnings', $summary['warnings'], 'accessibility-checker' ), $summary['warnings'] )
×
142
                        ) . '
×
143
                                ' . edac_generate_summary_stat(
×
144
                                'edac-summary-ignored',
×
145
                                $summary['ignored'],
×
146
                                /* translators: %s: Number of ignored items */
147
                                        sprintf( _n( '%s Ignored Item', '%s Ignored Items', $summary['ignored'], 'accessibility-checker' ), $summary['ignored'] )
×
148
                        ) . '
×
149

150
                </ul>
NEW
151
                <div class="edac-summary-readability" ' . ( $is_virtual_page ? 'style="display: none;"' : '' ) . '>
×
152
                        <div class="edac-summary-readability-level">
153
                                <div><img src="' . EDAC_PLUGIN_URL . 'assets/images/readability-icon-navy.png" alt="" width="54"></div>
×
154
                                <div class="edac-panel-number' . ( ( (int) $summary['content_grade'] <= 9 || 'none' === $simplified_summary_prompt ) ? ' passed-text-color' : ' failed-text-color' ) . '">
×
155
                                        ' . $summary['readability'] . '
×
156
                                </div>
157
                                <div class="edac-panel-number-label' . ( ( (int) $summary['readability'] <= 9 || 'none' === $simplified_summary_prompt ) ? ' passed-text-color' : ' failed-text-color' ) . '">Reading <br />Level</div>
×
158
                        </div>
159
                        <div class="edac-summary-readability-summary">
160
                                <div class="edac-summary-readability-summary-icon' . ( ( ( 'none' === $simplified_summary_prompt || $summary['simplified_summary'] || (int) $summary['content_grade'] <= 9 ) && ! $simplified_summary_grade_failed ) ? ' active' : '' ) . '"></div>
×
161
                                <div class="edac-summary-readability-summary-text' . ( ( ( 'none' === $simplified_summary_prompt || $summary['simplified_summary'] || (int) $summary['content_grade'] <= 9 ) && ! $simplified_summary_grade_failed ) ? ' active' : '' ) . '">' . $simplified_summary_text . '</div>
×
162
                        </div>
163
                </div>
164
                ';
×
165

166
                $html['content'] .= '<div class="edac-summary-disclaimer" id="edac-summary-disclaimer"><small>' . PHP_EOL;
×
167
                $html['content'] .= sprintf(
×
168
                        '* True accessibility requires manual testing in addition to automated scans. %1$sLearn how to manually test for accessibility%2$s.',
×
169
                        '<a href="' . esc_url(
×
170
                                edac_generate_link_type(
×
171
                                        [
×
172
                                                'utm_campaign' => 'dashboard-widget',
×
173
                                                'utm_content'  => 'how-to-manually-check',
×
174
                                        ],
×
175
                                        'help',
×
176
                                        [ 'help_id' => 4280 ]
×
177
                                )
×
178
                        ) . '">',
×
179
                        '</a>'
×
180
                ) . PHP_EOL;
×
181
                $html['content'] .= '</small></div>' . PHP_EOL;
×
182

183
                if ( ! $html ) {
×
184

185
                        $error = new \WP_Error( '-3', __( 'No summary to return', 'accessibility-checker' ) );
×
186
                        wp_send_json_error( $error );
×
187

188
                }
189

190
                wp_send_json_success( wp_json_encode( $html ) );
×
191
        }
192

193
        /**
194
         * Details Ajax
195
         *
196
         * @return void
197
         *
198
         *  - '-1' means that nonce could not be varified
199
         *  - '-2' means that the post ID was not specified
200
         *  - '-3' means that the table name is not valid
201
         *  - '-4' means that there isn't any details to return
202
         */
203
        public function details() {
204

205
                // nonce security.
206
                if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_REQUEST['nonce'] ) ), 'ajax-nonce' ) ) {
×
207

208
                        $error = new \WP_Error( '-1', __( 'Permission Denied', 'accessibility-checker' ) );
×
209
                        wp_send_json_error( $error );
×
210

211
                }
212

213
                if ( ! isset( $_REQUEST['post_id'] ) ) {
×
214

215
                        $error = new \WP_Error( '-2', __( 'The post ID was not set', 'accessibility-checker' ) );
×
216
                        wp_send_json_error( $error );
×
217

218
                }
219

220
                $html = '';
×
221
                global $wpdb;
×
222
                $table_name = edac_get_valid_table_name( $wpdb->prefix . 'accessibility_checker' );
×
223
                $postid     = (int) $_REQUEST['post_id'];
×
224
                $siteid     = get_current_blog_id();
×
225

226
                // Send error if table name is not valid.
227
                if ( ! $table_name ) {
×
228

229
                        $error = new \WP_Error( '-3', __( 'Invalid table name', 'accessibility-checker' ) );
×
230
                        wp_send_json_error( $error );
×
231

232
                }
233

234
                $rules = edac_register_rules();
×
235
                if ( $rules ) {
×
236

237
                        // if ANWW is active remove link_blank for details meta box.
238
                        if ( defined( 'ANWW_VERSION' ) ) {
×
239
                                $rules = edac_remove_element_with_value( $rules, 'slug', 'link_blank' );
×
240
                        }
241

242
                        // separate rule types.
243
                        $passed_rules  = [];
×
244
                        $error_rules   = edac_remove_element_with_value( $rules, 'rule_type', 'warning' );
×
245
                        $warning_rules = edac_remove_element_with_value( $rules, 'rule_type', 'error' );
×
246

247
                        // add count, unset passed error rules and add passed rules to array.
248
                        if ( $error_rules ) {
×
249
                                foreach ( $error_rules as $key => $error_rule ) {
×
250
                                        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Using direct query for interacting with custom database, safe variable used for table name, caching not required for one time operation.
251
                                        $count = count( $wpdb->get_results( $wpdb->prepare( 'SELECT id, postid, object, ruletype, ignre, ignre_user, ignre_date, ignre_comment FROM %i where postid = %d and rule = %s and siteid = %d and ignre = %d', $table_name, $postid, $error_rule['slug'], $siteid, 0 ), ARRAY_A ) );
×
252
                                        if ( $count ) {
×
253
                                                $error_rules[ $key ]['count'] = $count;
×
254
                                        } else {
255
                                                $error_rule['count'] = 0;
×
256
                                                $passed_rules[]      = $error_rule;
×
257
                                                unset( $error_rules[ $key ] );
×
258
                                        }
259
                                }
260
                        }
261

262
                        // add count, unset passed warning rules and add passed rules to array.
263
                        if ( $warning_rules ) {
×
264
                                foreach ( $warning_rules as $key => $error_rule ) {
×
265
                                        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Using direct query for interacting with custom database, safe variable used for table name, caching not required for one time operation.
266
                                        $count = count( $wpdb->get_results( $wpdb->prepare( 'SELECT id, postid, object, ruletype, ignre, ignre_user, ignre_date, ignre_comment FROM %i where postid = %d and rule = %s and siteid = %d and ignre = %d', $table_name, $postid, $error_rule['slug'], $siteid, 0 ), ARRAY_A ) );
×
267
                                        if ( $count ) {
×
268
                                                $warning_rules[ $key ]['count'] = $count;
×
269
                                        } else {
270
                                                $error_rule['count'] = 0;
×
271
                                                $passed_rules[]      = $error_rule;
×
272
                                                unset( $warning_rules[ $key ] );
×
273
                                        }
274
                                }
275
                        }
276
                }
277

278
                // sort error rules by count.
279
                usort(
×
280
                        $error_rules,
×
281
                        function ( $a, $b ) {
×
282

283
                                return strcmp( $b['count'], $a['count'] );
×
284
                        }
×
285
                );
×
286

287
                // sort warning rules by count.
288
                usort(
×
289
                        $warning_rules,
×
290
                        function ( $a, $b ) {
×
291

292
                                return strcmp( $b['count'], $a['count'] );
×
293
                        }
×
294
                );
×
295

296
                // sort passed rules array by title.
297
                usort(
×
298
                        $passed_rules,
×
299
                        function ( $a, $b ) {
×
300

301
                                return strcmp( $b['title'], $a['title'] );
×
302
                        }
×
303
                );
×
304

305
                // merge rule arrays together.
306
                $rules = array_merge( $error_rules, $warning_rules, $passed_rules );
×
307

308
                if ( $rules ) {
×
309
                        /**
310
                         * Filters if a user can ignore issues.
311
                         *
312
                         * @since 1.4.0
313
                         *
314
                         * @allowed bool True if allowed, false if not
315
                         */
316
                        $ignore_permission = apply_filters( 'edac_ignore_permission', true );
×
317

318
                        foreach ( $rules as $rule ) {
×
319
                                // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Using direct query for interacting with custom database, safe variable used for table name, caching not required for one time operation.
320
                                $results        = $wpdb->get_results( $wpdb->prepare( 'SELECT id, postid, object, ruletype, ignre, ignre_user, ignre_date, ignre_comment, ignre_global, landmark, landmark_selector FROM %i where postid = %d and rule = %s and siteid = %d', $table_name, $postid, $rule['slug'], $siteid ), ARRAY_A );
×
321
                                $count_classes  = ( 'error' === $rule['rule_type'] ) ? ' edac-details-rule-count-error' : ' edac-details-rule-count-warning';
×
322
                                $count_classes .= ( 0 !== $rule['count'] ) ? ' active' : '';
×
323

324
                                $count_ignored = 0;
×
325
                                $ignores       = array_column( $results, 'ignre' );
×
326
                                if ( $ignores ) {
×
327
                                        foreach ( $ignores as $ignore ) {
×
328
                                                if ( true === (bool) $ignore ) {
×
329
                                                        ++$count_ignored;
×
330
                                                }
331
                                        }
332
                                }
333

334
                                // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Using direct query for interacting with custom database, safe variable used for table name, caching not required for one time operation.
335
                                $expand_rule = count( $wpdb->get_results( $wpdb->prepare( 'SELECT id FROM %i where postid = %d and rule = %s and siteid = %d', $table_name, $postid, $rule['slug'], $siteid ), ARRAY_A ) );
×
336

337
                                $tool_tip_link = edac_link_wrapper( $rule['info_url'], 'frontend-highlighter', $rule['slug'], false );
×
338

339
                                $html .= '<div class="edac-details-rule">';
×
340

341
                                $html .= '<div class="edac-details-rule-title">';
×
342

343
                                $html .= '<h3>';
×
344
                                $html .= '<span class="edac-details-rule-count' . $count_classes . '">' . $rule['count'] . '</span> ';
×
345
                                $html .= esc_html( $rule['title'] );
×
346
                                if ( $count_ignored > 0 ) {
×
347
                                        $html .= '<span class="edac-details-rule-count-ignore">' . $count_ignored . ' Ignored Items</span>';
×
348
                                }
349
                                $html .= '</h3>';
×
350
                                $html .= '<a href="' . $tool_tip_link . '" class="edac-details-rule-information" target="_blank" aria-label="Read documentation for ' . esc_html( $rule['title'] ) . '. ' . esc_attr__( 'Opens in a new window.', 'accessibility-checker' ) . '"><span class="dashicons dashicons-info"></span></a>';
×
351
                                $html .= ( $expand_rule ) ? '<button class="edac-details-rule-title-arrow" aria-expanded="false" aria-controls="edac-details-rule-records-' . $rule['slug'] . '" aria-label="Expand issues for ' . esc_html( $rule['title'] ) . '"><i class="dashicons dashicons-arrow-down-alt2"></i></button>' : '';
×
352

353
                                $html .= '</div>';
×
354

355
                                if ( $results ) {
×
356

357
                                        $html .= '<div id="edac-details-rule-records-' . $rule['slug'] . '" class="edac-details-rule-records">';
×
358

359
                                        $fixes_for_item = [];
×
360
                                        if ( isset( $rule['fixes'] ) && current_user_can( apply_filters( 'edac_filter_settings_capability', 'manage_options' ) ) ) {
×
361
                                                foreach ( $rule['fixes'] as $fix_slug ) {
×
362
                                                        $fixes_for_item[] = FixesManager::get_instance()->get_fix( $fix_slug );
×
363
                                                }
364

365
                                                $controls_id = 'edac-fix-modal-' . $rule['slug'] . '__' . implode( '__', $rule['fixes'] );
×
366
                                                ob_start();
×
367
                                                // NOTE: This is markup to be cloned into a thickbox modal. It gets cloned from the inner div.
368
                                                ?>
369
                                                <div style="display:none">
×
370
                                                        <div id="<?php echo esc_attr( $controls_id ); ?>" class="edac-details-fix-settings fix-settings--container">
×
371
                                                                <div class="setting-row fix-settings--container" data-fix="<?php echo esc_attr( $controls_id ); ?>">
×
372
                                                                        <?php
373
                                                                        printf(
×
374
                                                                                '<p class="modal-opening-message">%s <span class="hide-in-editor">%s</span></p>',
×
375
                                                                                esc_html__( 'These settings enable global fixes across your entire site.', 'accessibility-checker' ),
×
376
                                                                                esc_html__( 'Pages may need to be resaved or a full site scan run to see fixes reflected in reports.', 'accessibility-checker' )
×
377
                                                                        )
×
378
                                                                        ?>
×
379
                                                                        <div class="edac-fix-settings">
×
380
                                                                                <?php
381
                                                                                foreach ( $fixes_for_item as $index => $fix ) :
×
382
                                                                                        ?>
383
                                                                                        <div class="edac-fix-settings--fields">
×
384
                                                                                                <fieldset>
×
385
                                                                                                        <div class="title">
×
386
                                                                                                                <legend>
×
387
                                                                                                                        <h2 class="edac-fix-settings--title"><?php echo esc_html( $fix->get_nicename() ); ?></h2>
×
388
                                                                                                                </legend>
389
                                                                                                        </div>
390
                                                                                                        <?php
391
                                                                                                        foreach ( $fix->get_fields_array() as $name => $field ) {
×
392
                                                                                                                $field['name']     = $name;
×
393
                                                                                                                $field['location'] = 'details-panel';
×
394
                                                                                                                FixesPage::{$field['type']}( $field );
×
395
                                                                                                        }
396
                                                                                                        ?>
397
                                                                                                </fieldset>
×
398
                                                                                                <?php
×
399
                                                                                                // Output the save button only in the last group.
400
                                                                                                if ( count( $fixes_for_item ) === $index + 1 ) :
×
401
                                                                                                        ?>
402
                                                                                                        <div class="edac-fix-settings--action-row">
×
403
                                                                                                                <button role="button" class="button button-primary edac-fix-settings--button--save">
×
404
                                                                                                                        <?php esc_html_e( 'Save', 'accessibility-checker' ); ?>
×
405
                                                                                                                </button>
×
406
                                                                                                                <span class="edac-fix-settings--notice-slot" aria-live="polite" role="alert"></span>
×
407
                                                                                                        </div>
×
408
                                                                                                        <?php
×
409
                                                                                                endif;
410
                                                                                                ?>
411
                                                                                        </div>
×
412
                                                                                <?php endforeach; ?>
×
413
                                                                        </div>
×
414
                                                                </div>
×
415
                                                        </div>
×
416
                                                </div>
×
417
                                                <?php
×
418
                                                $html .= ob_get_clean();
×
419
                                        }
420

421

422

423
                                        $html .=
×
424
                                                '<div class="edac-details-rule-records-labels">
×
425
                                                        <div class="edac-details-rule-records-labels-label" aria-hidden="true">
426
                                                                ' . esc_html__( 'Affected Code', 'accessibility-checker' ) . '
×
427
                                                        </div>
428
                                                        <div class="edac-details-rule-records-labels-label" aria-hidden="true">
429
                                                                Image
430
                                                        </div>
431
                                                        <div class="edac-details-rule-records-labels-label" aria-hidden="true">
432
                                                                Landmark
433
                                                        </div>
434
                                                        <div class="edac-details-rule-records-labels-label" aria-hidden="true">
435
                                                                Actions
436
                                                        </div>
437
                                                </div>';
×
438

439
                                        foreach ( $results as $row ) {
×
440

441
                                                $id                      = (int) $row['id'];
×
442
                                                $ignore                  = (int) $row['ignre'];
×
443
                                                $ignore_class            = $ignore ? ' active' : '';
×
444
                                                $ignore_label            = $ignore ? 'Ignored' : 'Ignore';
×
445
                                                $ignore_user             = (int) $row['ignre_user'];
×
446
                                                $ignore_user_info        = get_userdata( $ignore_user );
×
447
                                                $ignore_username         = is_object( $ignore_user_info ) ? '<strong>Username:</strong> ' . $ignore_user_info->user_login : '';
×
448
                                                $ignore_date             = ( $row['ignre_date'] && '0000-00-00 00:00:00' !== $row['ignre_date'] ) ? '<strong>Date:</strong> ' . gmdate( 'F j, Y g:i a', strtotime( esc_html( $row['ignre_date'] ) ) ) : '';
×
449
                                                $ignore_comment          = esc_html( $row['ignre_comment'] );
×
450
                                                $ignore_action           = $ignore ? 'disable' : 'enable';
×
451
                                                $ignore_type             = $rule['rule_type'];
×
452
                                                $ignore_submit_label     = $ignore ? 'Stop Ignoring' : 'Ignore This ' . $ignore_type;
×
453
                                                $ignore_comment_disabled = $ignore ? 'disabled' : '';
×
454
                                                $ignore_global           = (int) $row['ignre_global'];
×
455

456
                                                // check for images and svgs in object code.
457
                                                $media      = edac_parse_html_for_media( $row['object'] );
×
458
                                                $object_img = $media['img'];
×
459
                                                $object_svg = $media['svg'];
×
460

461
                                                $html .= '<h4 class="screen-reader-text">Issue ID ' . $id . '</h4>';
×
462

463
                                                $html .= '<div id="edac-details-rule-records-record-' . $id . '" class="edac-details-rule-records-record">';
×
464

465
                                                $html .= '<div class="edac-details-rule-records-record-cell edac-details-rule-records-record-object">';
×
466

467
                                                $html .= '<code>' . esc_html( $row['object'] ) . '</code>';
×
468

469
                                                $html .= '</div>';
×
470

471
                                                $html .= '<div class="edac-details-rule-records-record-cell edac-details-rule-records-record-image">';
×
472

473
                                                if ( $object_img ) {
×
474
                                                        $html .= '<img src="' . $object_img . '" alt="image for issue ' . $id . '" />';
×
475
                                                } elseif ( $object_svg ) {
×
476
                                                        $html .= $object_svg;
×
477
                                                }
478

479
                                                $html .= '</div>';
×
480

481
                                                $html .= '<div class="edac-details-rule-records-record-cell edac-details-rule-records-record-landmark">';
×
482

483
                                                $landmark          = isset( $row['landmark'] ) ? $row['landmark'] : '';
×
484
                                                $landmark_selector = isset( $row['landmark_selector'] ) ? $row['landmark_selector'] : '';
×
485

486
                                                $html .= edac_generate_landmark_link( $landmark, $landmark_selector, $postid );
×
487

488
                                                $html .= '</div>';
×
489

490
                                                $html .= '<div class="edac-details-rule-records-record-cell edac-details-rule-records-record-actions">';
×
491

492
                                                if ( ! isset( $rule['viewable'] ) || $rule['viewable'] ) {
×
493

NEW
494
                                                        $post_view_link = apply_filters(
×
NEW
495
                                                                'edac_get_origin_url_for_virtual_page',
×
NEW
496
                                                                get_the_permalink( $postid ),
×
NEW
497
                                                                $postid
×
NEW
498
                                                        );
×
499

500
                                                        $url = add_query_arg(
×
501
                                                                [
×
502
                                                                        'edac'       => $id,
×
503
                                                                        'edac_nonce' => wp_create_nonce( 'edac_highlight' ),
×
504
                                                                ],
×
NEW
505
                                                                $post_view_link
×
506
                                                        );
×
507

508
                                                        // Translators: %d is the issue ID.
509
                                                        $aria_label = sprintf( __( 'View Issue ID %d on website, opens a new window', 'accessibility-checker' ), $id );
×
510
                                                        $html      .= '<a href="' . $url . '" class="edac-details-rule-records-record-actions-highlight-front" target="_blank" aria-label="' . esc_attr( $aria_label ) . '" ><span class="dashicons dashicons-welcome-view-site"></span>' . __( 'View on page', 'accessibility-checker' ) . '</a>';
×
511
                                                }
512

513
                                                if ( true === $ignore_permission ) {
×
514
                                                        $html .= '<button class="edac-details-rule-records-record-actions-ignore' . $ignore_class . '" aria-expanded="false" aria-controls="edac-details-rule-records-record-ignore-' . $row['id'] . '">' . EDAC_SVG_IGNORE_ICON . '<span class="edac-details-rule-records-record-actions-ignore-label">' . $ignore_label . '</span></button>';
×
515
                                                }
516

517
                                                if ( ! empty( $fixes_for_item ) ) {
×
518
                                                        $html .= sprintf(
×
519
                                                                '<button class="edac-details-rule-records-record-actions-fix"
×
520
                                                                        aria-haspopup="true"
521
                                                                        aria-controls="%1$s"
522
                                                                        aria-label="%2$s"
523
                                                                        type="button"
524
                                                                >
525
                                                                        <span class="dashicons dashicons-admin-tools"></span>
526
                                                                        %3$s
527
                                                                </button>',
×
528
                                                                esc_attr( $controls_id ),
×
529
                                                                esc_attr( __( 'Fix: ', 'accessibility-checker' ) . $fixes_for_item[0]->get_nicename() ),
×
530
                                                                esc_html__( 'Fix', 'accessibility-checker' )
×
531
                                                        );
×
532
                                                }
533

534
                                                $html .= '</div>';
×
535

536
                                                $html .= '<div id="edac-details-rule-records-record-ignore-' . $row['id'] . '" class="edac-details-rule-records-record-ignore">';
×
537

538
                                                $html .= '<div class="edac-details-rule-records-record-ignore-info">';
×
539
                                                $html .= '<span class="edac-details-rule-records-record-ignore-info-user">' . $ignore_username . '</span>';
×
540

541
                                                $html .= ' <span class="edac-details-rule-records-record-ignore-info-date">' . $ignore_date . '</span>';
×
542
                                                $html .= '</div>';
×
543

544
                                                $html .= ( true === $ignore_permission || ! empty( $ignore_comment ) ) ? '<label for="edac-details-rule-records-record-ignore-comment-' . $id . '">Comment</label><br>' : '';
×
545
                                                $html .= ( true === $ignore_permission || ! empty( $ignore_comment ) ) ? '<textarea rows="4" class="edac-details-rule-records-record-ignore-comment" id="edac-details-rule-records-record-ignore-comment-' . $id . '" ' . $ignore_comment_disabled . '>' . $ignore_comment . '</textarea>' : '';
×
546

547
                                                if ( $ignore_global ) {
×
548
                                                        $html .= ( true === $ignore_permission ) ? '<a href="' . admin_url( 'admin.php?page=accessibility_checker_ignored&tab=global' ) . '" class="edac-details-rule-records-record-ignore-global">Manage Globally Ignored</a>' : '';
×
549
                                                } else {
550
                                                        $html .= ( true === $ignore_permission ) ? '<button class="edac-details-rule-records-record-ignore-submit" data-id=' . $id . ' data-action=' . $ignore_action . ' data-type=' . $ignore_type . '>' . EDAC_SVG_IGNORE_ICON . ' <span class="edac-details-rule-records-record-ignore-submit-label">' . $ignore_submit_label . '<span></button>' : '';
×
551
                                                }
552

553
                                                $html .= ( false === $ignore_permission && false === $ignore ) ? __( 'Your user account doesn\'t have permission to ignore this issue.', 'accessibility-checker' ) : '';
×
554

555
                                                $html .= '</div>';
×
556

557
                                                $html .= '</div>';
×
558

559
                                        }
560

561
                                        $html .= '</div>';
×
562

563
                                }
564

565
                                $html .= '</div>';
×
566
                        }
567
                }
568

569
                if ( ! $html ) {
×
570

571
                        $error = new \WP_Error( '-4', __( 'No details to return', 'accessibility-checker' ) );
×
572
                        wp_send_json_error( $error );
×
573

574
                }
575

576
                wp_send_json_success( wp_json_encode( $html ) );
×
577
        }
578

579
        /**
580
         * Readability Ajax
581
         *
582
         * @return void
583
         *
584
         *  - '-1' means that nonce could not be varified
585
         *  - '-2' means that the post ID was not specified
586
         *  - '-3' means that there isn't any readability data to return
587
         */
588
        public function readability() {
589

590
                // nonce security.
591
                if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_REQUEST['nonce'] ) ), 'ajax-nonce' ) ) {
×
592

593
                        $error = new \WP_Error( '-1', __( 'Permission Denied', 'accessibility-checker' ) );
×
594
                        wp_send_json_error( $error );
×
595

596
                }
597

598
                if ( ! isset( $_REQUEST['post_id'] ) ) {
×
599

600
                        $error = new \WP_Error( '-2', __( 'The post ID was not set', 'accessibility-checker' ) );
×
601
                        wp_send_json_error( $error );
×
602

603
                }
604

605
                $post_id                     = (int) $_REQUEST['post_id'];
×
606
                $html                        = '';
×
607
                $simplified_summary          = get_post_meta( $post_id, '_edac_simplified_summary', true ) ? get_post_meta( $post_id, '_edac_simplified_summary', true ) : '';
×
608
                $simplified_summary_position = get_option( 'edac_simplified_summary_position', $default = false );
×
609
                $content_post                = get_post( $post_id );
×
610
                $content                     = $content_post->post_content;
×
611
                $content                     = apply_filters( 'the_content', $content );
×
612

613
                /**
614
                 * Filter the content used for reading grade readability analysis.
615
                 *
616
                 * @since 1.4.0
617
                 *
618
                 * @param string $content The content to be filtered.
619
                 * @param int    $post_id The post ID.
620
                 */
621
                $content = apply_filters( 'edac_filter_readability_content', $content, $post_id );
×
622
                $content = wp_filter_nohtml_kses( $content );
×
623
                $content = str_replace( ']]>', ']]&gt;', $content );
×
624

625
                // get readability metadata and determine if a simplified summary is required.
626
                $edac_summary           = get_post_meta( $post_id, '_edac_summary', true );
×
627
                $post_grade_readability = ( isset( $edac_summary['readability'] ) ) ? $edac_summary['readability'] : 0;
×
628
                $post_grade             = (int) filter_var( $post_grade_readability, FILTER_SANITIZE_NUMBER_INT );
×
629
                $post_grade_failed      = ( $post_grade < 9 ) ? false : true;
×
630

631
                $simplified_summary_grade = 0;
×
632
                if ( class_exists( 'DaveChild\TextStatistics\TextStatistics' ) ) {
×
633
                        $text_statistics          = new \DaveChild\TextStatistics\TextStatistics();
×
634
                        $simplified_summary_grade = (int) floor( $text_statistics->fleschKincaidGradeLevel( $simplified_summary ) );
×
635
                }
636

637
                $simplified_summary_grade_failed = ( $simplified_summary_grade > 9 ) ? true : false;
×
638
                $simplified_summary_prompt       = get_option( 'edac_simplified_summary_prompt' );
×
639

640
                $html .= '<ul class="edac-readability-list">';
×
641

642
                $html .= '<li class="edac-readability-list-item edac-readability-grade-level">
×
643
                <span class="edac-readability-list-item-icon dashicons ' . ( ( $post_grade_failed || 0 === $post_grade ) ? 'dashicons-no-alt' : 'dashicons-saved' ) . '"></span>
×
644
                <p class="edac-readability-list-item-title">Post Reading Grade Level: <strong class="' . ( ( $post_grade_failed || 0 === $post_grade ) ? 'failed-text-color' : 'passed-text-color' ) . '">' . ( ( 0 === $post_grade ) ? 'None' : $post_grade_readability ) . '</strong><br /></p>';
×
645
                if ( $post_grade_failed ) {
×
646
                        $html .= '<p class="edac-readability-list-item-description">Your post has a reading level higher than 9th grade. Web Content Accessibility Guidelines (WCAG) at the AAA level require a simplified summary of your post that is 9th grade or below.</p>';
×
647
                } elseif ( 0 === $post_grade ) {
×
648
                        $html .= '<p class="edac-readability-list-item-description">Your post does not contain enough content to calculate its reading level.</p>';
×
649
                } else {
650
                        $html .= '<p class="edac-readability-list-item-description">A simplified summary is not necessary when content reading level is 9th grade or below. Choose when to prompt for a simplified summary on the settings page.</p>';
×
651
                }
652
                $html .= '</li>';
×
653

654
                if ( $post_grade_failed ) {
×
655

656
                        if ( $simplified_summary && 'none' !== $simplified_summary_prompt ) {
×
657
                                $html .= '<li class="edac-readability-list-item edac-readability-summary-grade-level">
×
658
                                        <span class="edac-readability-list-item-icon dashicons ' . ( ( $simplified_summary_grade_failed ) ? 'dashicons-no-alt' : 'dashicons-saved' ) . '"></span>
×
659
                                        <p class="edac-readability-list-item-title">Simplified Summary Reading Grade Level: <strong class="' . ( ( $simplified_summary_grade_failed ) ? 'failed-text-color' : 'passed-text-color' ) . '">' . edac_ordinal( $simplified_summary_grade ) . '</strong></p>
×
660
                                        <p class="edac-readability-list-item-description">Your simplified summary has a reading level ' . ( ( $simplified_summary_grade_failed ) ? 'higher' : 'lower' ) . ' than 9th grade.</p>
×
661
                                </li>';
×
662
                        }
663

664
                        if ( 'none' === $simplified_summary_prompt ) {
×
665

666
                                $html .=
×
667
                                        '<li class="edac-readability-list-item edac-readability-summary-position">
×
668
                                        <span class="edac-readability-list-item-icon"><img src="' . plugin_dir_url( __FILE__ ) . 'assets/images/warning-icon-yellow.png" alt="" width="22"></span>
×
669
                                        <p class="edac-readability-list-item-title">Simplified summary is not being automatically inserted into the content.</p>
670
                                                <p class="edac-readability-list-item-description">Your Prompt for Simplified Summary is set to "never." If you would like the simplified summary to be displayed automatically, you can change this on the <a href="' . get_bloginfo( 'url' ) . '/wp-admin/admin.php?page=accessibility_checker_settings">settings page</a>.</p>
×
671
                                </li>';
×
672

673
                        } elseif ( 'none' !== $simplified_summary_position ) {
×
674

675
                                $html .=
×
676
                                        '<li class="edac-readability-list-item edac-readability-summary-position">
×
677
                                        <span class="edac-readability-list-item-icon dashicons dashicons-saved"></span>
678
                                        <p class="edac-readability-list-item-title">Simplified summary is being automatically inserted <strong>' . $simplified_summary_position . ' the content</strong>.</p>
×
679
                                                <p class="edac-readability-list-item-description">Set where the Simplified Summary is inserted into the content on the <a href="' . get_bloginfo( 'url' ) . '/wp-admin/admin.php?page=accessibility_checker_settings">settings page</a>.</p>
×
680
                                </li>';
×
681

682
                        } else {
683

684
                                $html .=
×
685
                                        '<li class="edac-readability-list-item edac-readability-summary-position">
×
686
                                        <span class="edac-readability-list-item-icon"><img src="' . plugin_dir_url( __FILE__ ) . 'assets/images/warning-icon-yellow.png" alt="" width="22"></span>
×
687
                                        <p class="edac-readability-list-item-title">Simplified summary is not being automatically inserted into the content.</p>
688
                                                <p class="edac-readability-list-item-description">Your Simplified Summary location is set to "manually" which requires a function be added to your page template. If you would like the simplified summary to be displayed automatically, you can change this on the <a href="' . get_bloginfo( 'url' ) . '/wp-admin/admin.php?page=accessibility_checker_settings">settings page</a>.</p>
×
689
                                </li>';
×
690

691
                        }
692
                }
693

694
                $html .= '</ul>';
×
695

696
                if ( ( $post_grade_failed || 'always' === $simplified_summary_prompt ) && ( 'none' !== $simplified_summary_prompt ) ) {
×
697
                        $html .=
×
698
                                '</form>
×
699
                        <form action="/" class="edac-readability-simplified-summary">
700
                                <label for="edac-readability-text">Simplified Summary</label>
701
                                <textarea name="" id="edac-readability-text" cols="30" rows="10">' . $simplified_summary . '</textarea>
×
702
                                <input type="submit" value="Submit">
703
                        </form>';
×
704
                }
705

706
                $html .= '<span class="dashicons dashicons-info"></span><a href="' . esc_url( edac_link_wrapper( 'https://a11ychecker.com/help3265', 'wordpress-general', 'content-analysis', false ) ) . '" target="_blank">Learn more about improving readability and simplified summary requirements</a>';
×
707

708
                if ( ! $html ) {
×
709

710
                        $error = new \WP_Error( '-3', __( 'No readability data to return', 'accessibility-checker' ) );
×
711
                        wp_send_json_error( $error );
×
712

713
                }
714

715
                wp_send_json_success( wp_json_encode( $html ) );
×
716
        }
717

718
        /**
719
         * Insert ignore data into database
720
         *
721
         * @return void
722
         *
723
         *  - '-1' means that nonce could not be varified
724
         *  - '-2' means that there isn't any ignore data to return
725
         */
726
        public function add_ignore() {
727

728
                // nonce security.
729
                if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ), 'ajax-nonce' ) ) {
×
730

731
                        $error = new \WP_Error( '-1', __( 'Permission Denied', 'accessibility-checker' ) );
×
732
                        wp_send_json_error( $error );
×
733

734
                }
735

736
                global $wpdb;
×
737
                $table_name            = $wpdb->prefix . 'accessibility_checker';
×
738
                                $raw_ids       = isset( $_REQUEST['ids'] ) ? (array) wp_unslash( $_REQUEST['ids'] ) : []; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitization handled below.
×
739
                $ids                   = array_map(
×
740
                        function ( $value ) {
×
741
                                return (int) $value;
×
742
                        },
×
743
                        $raw_ids
×
744
                ); // Sanitizing array elements to integers.
×
745
                                $action        = isset( $_REQUEST['ignore_action'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['ignore_action'] ) ) : '';
×
746
                                $type          = isset( $_REQUEST['ignore_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['ignore_type'] ) ) : '';
×
747
                $siteid                = get_current_blog_id();
×
748
                $ignre                 = ( 'enable' === $action ) ? 1 : 0;
×
749
                $ignre_user            = ( 'enable' === $action ) ? get_current_user_id() : null;
×
750
                $ignre_user_info       = ( 'enable' === $action ) ? get_userdata( $ignre_user ) : '';
×
751
                $ignre_username        = ( 'enable' === $action ) ? $ignre_user_info->user_login : '';
×
752
                $ignre_date            = ( 'enable' === $action ) ? gmdate( 'Y-m-d H:i:s' ) : null;
×
753
                $ignre_date_formatted  = ( 'enable' === $action ) ? gmdate( 'F j, Y g:i a', strtotime( $ignre_date ) ) : '';
×
754
                                $ignre_comment = ( 'enable' === $action && isset( $_REQUEST['comment'] ) ) ? sanitize_textarea_field( wp_unslash( $_REQUEST['comment'] ) ) : null;
×
755
                                $ignore_global = ( 'enable' === $action && isset( $_REQUEST['ignore_global'] ) ) ? sanitize_textarea_field( wp_unslash( $_REQUEST['ignore_global'] ) ) : 0;
×
756

757
                // If largeBatch is set and 'true', we need to perform an update using the 'object'
758
                // instead of IDs. It is a much less efficient query than by IDs - but many IDs run
759
                // into request size limits which caused this to not function at all.
760
                if ( isset( $_REQUEST['largeBatch'] ) && 'true' === $_REQUEST['largeBatch'] ) {
×
761
                        // Get the 'object' from the first id.
762
                        $first_id = $ids[0];
×
763
                        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- We need to get the latest value, not a cached value.
764
                        $object = $wpdb->get_var( $wpdb->prepare( 'SELECT object FROM %i WHERE id = %d', $table_name, $first_id ) );
×
765

766
                        if ( ! $object ) {
×
767
                                $error = new \WP_Error( '-2', __( 'No ignore data to return', 'accessibility-checker' ) );
×
768
                                wp_send_json_error( $error );
×
769
                        }
770
                        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Safe variable used for table name, caching not required for one time operation.
771
                        $wpdb->query( $wpdb->prepare( 'UPDATE %i SET ignre = %d, ignre_user = %d, ignre_date = %s, ignre_comment = %s, ignre_global = %d WHERE siteid = %d and object = %s', $table_name, $ignre, $ignre_user, $ignre_date, $ignre_comment, $ignore_global, $siteid, $object ) );
×
772
                } else {
773
                        // For small batches of IDs, we can just loop through.
774
                        foreach ( $ids as $id ) {
×
775
                                // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Safe variable used for table name, caching not required for one time operation.
776
                                $wpdb->query( $wpdb->prepare( 'UPDATE %i SET ignre = %d, ignre_user = %d, ignre_date = %s, ignre_comment = %s, ignre_global = %d WHERE siteid = %d and id = %d', $table_name, $ignre, $ignre_user, $ignre_date, $ignre_comment, $ignore_global, $siteid, $id ) );
×
777
                        }
778
                }
779

780
                $data = [
×
781
                        'ids'    => $ids,
×
782
                        'action' => $action,
×
783
                        'type'   => $type,
×
784
                        'user'   => $ignre_username,
×
785
                        'date'   => $ignre_date_formatted,
×
786
                ];
×
787

788
                if ( ! $data ) {
×
789

790
                        $error = new \WP_Error( '-2', __( 'No ignore data to return', 'accessibility-checker' ) );
×
791
                        wp_send_json_error( $error );
×
792

793
                }
794
                wp_send_json_success( wp_json_encode( $data ) );
×
795
        }
796

797
        /**
798
         * Update simplified summary
799
         *
800
         * @return void
801
         *
802
         *  - '-1' means that nonce could not be varified
803
         *  - '-2' means that the post ID was not specified
804
         *  - '-3' means that the summary was not specified
805
         */
806
        public function simplified_summary() {
807

808
                        // nonce security.
809
                if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_REQUEST['nonce'] ) ), 'ajax-nonce' ) ) {
×
810

811
                        $error = new \WP_Error( '-1', __( 'Permission Denied', 'accessibility-checker' ) );
×
812
                        wp_send_json_error( $error );
×
813

814
                }
815

816
                if ( ! isset( $_REQUEST['post_id'] ) ) {
×
817

818
                        $error = new \WP_Error( '-2', __( 'The post ID was not set', 'accessibility-checker' ) );
×
819
                        wp_send_json_error( $error );
×
820

821
                }
822

823
                if ( ! isset( $_REQUEST['summary'] ) ) {
×
824

825
                        $error = new \WP_Error( '-3', __( 'The summary was not set', 'accessibility-checker' ) );
×
826
                        wp_send_json_error( $error );
×
827

828
                }
829

830
                        $post_id = (int) $_REQUEST['post_id'];
×
831
                        update_post_meta(
×
832
                                $post_id,
×
833
                                '_edac_simplified_summary',
×
834
                                sanitize_text_field( wp_unslash( $_REQUEST['summary'] ) )
×
835
                        );
×
836

837
                $edac_simplified_summary = get_post_meta( $post_id, '_edac_simplified_summary', $single = true );
×
838
                $simplified_summary      = $edac_simplified_summary ? $edac_simplified_summary : '';
×
839

840
                wp_send_json_success( wp_json_encode( $simplified_summary ) );
×
841
        }
842

843
        /**
844
         * Handle AJAX request to dismiss Welcome CTA
845
         *
846
         * @return void
847
         */
848
        public function dismiss_welcome_cta() {
849

850
                update_user_meta( get_current_user_id(), 'edac_welcome_cta_dismissed', true );
×
851

852
                wp_send_json( 'success' );
×
853
        }
854

855
        /**
856
         * Handle AJAX request to dismiss dashboard CTA
857
         *
858
         * @return void
859
         */
860
        public function dismiss_dashboard_cta() {
861

862
                update_user_meta( get_current_user_id(), 'edac_dashboard_cta_dismissed', true );
×
863

864
                wp_send_json( 'success' );
×
865
        }
866
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc