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

equalizedigital / accessibility-checker / 16057813270

03 Jul 2025 06:21PM UTC coverage: 28.915% (-0.1%) from 29.05%
16057813270

push

github

web-flow
Merge pull request #1029 from equalizedigital/william/pro-165-urls-missing-utm-parameters-in-plugin

Update some links through the plugin to properly attribute them

32 of 160 new or added lines in 15 files covered. (20.0%)

18 existing lines in 5 files now uncovered.

1527 of 5281 relevant lines covered (28.91%)

1.66 hits per line

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

0.0
/includes/options-page.php
1
<?php
2
/**
3
 * Accessibility Checker plugin file.
4
 *
5
 * @package Accessibility_Checker
6
 */
7

8
use EDAC\Admin\Purge_Post_Data;
9
use EDAC\Inc\Accessibility_Statement;
10
use EqualizeDigital\AccessibilityChecker\Admin\AdminPage\FixesPage;
11

12
/**
13
 * Check if user can ignore or can manage options
14
 *
15
 * @return bool
16
 */
17
function edac_user_can_ignore() {
18

19
        if ( current_user_can( 'manage_options' ) ) {
×
20
                return true;
×
21
        }
22

23
        $user              = wp_get_current_user();
×
24
        $user_roles        = ( isset( $user->roles ) ) ? $user->roles : [];
×
25
        $ignore_user_roles = get_option( 'edacp_ignore_user_roles' );
×
26
        $interset          = ( $user_roles && $ignore_user_roles ) ? array_intersect( $user_roles, $ignore_user_roles ) : false;
×
27

28
        return ( $interset );
×
29
}
30

31
/**
32
 * Add an options page under the Settings submenu
33
 */
34
function edac_add_options_page() {
35

36
        // we don't want to show even the welcome page to subscribers.
37
        if ( ! current_user_can( 'edit_posts' ) ) {
×
38
                return;
×
39
        }
40

41
        add_menu_page(
×
42
                __( 'Welcome to Accessibility Checker', 'accessibility-checker' ),
×
43
                __( 'Accessibility Checker', 'accessibility-checker' ),
×
44
                'read',
×
45
                'accessibility_checker',
×
46
                'edac_display_welcome_page',
×
47
                'dashicons-universal-access-alt'
×
48
        );
×
49

50
        if ( ! edac_user_can_ignore() ) {
×
51
                return;
×
52
        }
53

54
        /**
55
         * Filter the capability required to access the settings page.
56
         *
57
         * @since 1.4.0
58
         *
59
         * @param string $settings_capability The capability required to access the settings page.
60
         */
61
        $settings_capability = apply_filters( 'edac_filter_settings_capability', 'manage_options' );
×
62

63
        add_submenu_page(
×
64
                'accessibility_checker',
×
65
                __( 'Accessibility Checker Settings', 'accessibility-checker' ),
×
66
                __( 'Settings', 'accessibility-checker' ),
×
67
                $settings_capability,
×
68
                'accessibility_checker_settings',
×
69
                'edac_display_options_page'
×
70
                // The submenu doesn't typically require a separate icon.
×
71
        );
×
72

73
        $fixes_page = new FixesPage( $settings_capability );
×
74
        $fixes_page->add_page();
×
75
}
76

77
/**
78
 * Render the welcome page for plugin
79
 */
80
function edac_display_welcome_page() {
81
        include_once plugin_dir_path( __DIR__ ) . 'partials/welcome-page.php';
×
82
}
83

84
/**
85
 * Render the options page for plugin
86
 */
87
function edac_display_options_page() {
88
        include_once plugin_dir_path( __DIR__ ) . 'partials/settings-page.php';
×
89
}
90

91
/**
92
 * Register settings
93
 */
94
function edac_register_setting() {
95

96
        // Add sections.
97
        add_settings_section(
×
98
                'edac_general',
×
99
                __( 'General Settings', 'accessibility-checker' ),
×
100
                'edac_general_cb',
×
101
                'edac_settings'
×
102
        );
×
103

104
        add_settings_section(
×
105
                'edac_simplified_summary',
×
106
                __( 'Simplified Summary Settings', 'accessibility-checker' ),
×
107
                'edac_simplified_summary_cb',
×
108
                'edac_settings'
×
109
        );
×
110

111
        add_settings_section(
×
112
                'edac_footer_accessibility_statement',
×
113
                __( 'Footer Accessibility Statement', 'accessibility-checker' ),
×
114
                'edac_footer_accessibility_statement_cb',
×
115
                'edac_settings'
×
116
        );
×
117

118
        add_settings_section(
×
119
                'edac_frontend_highlighter',
×
120
                __( 'Frontend Accessibility Checker', 'accessibility-checker' ),
×
121
                'edac_frontend_highlighter_section_cb',
×
122
                'edac_settings'
×
123
        );
×
124

125
        // Add fields.
126
        add_settings_field(
×
127
                'edac_post_types',
×
128
                __( 'Post Types To Be Checked', 'accessibility-checker' ),
×
129
                'edac_post_types_cb',
×
130
                'edac_settings',
×
131
                'edac_general',
×
132
                [ 'label_for' => 'edac_post_types' ]
×
133
        );
×
134

135
        add_settings_field(
×
136
                'edac_delete_data',
×
137
                __( 'Delete Data', 'accessibility-checker' ),
×
138
                'edac_delete_data_cb',
×
139
                'edac_settings',
×
140
                'edac_general',
×
141
                [ 'label_for' => 'edac_delete_data' ]
×
142
        );
×
143

144
        add_settings_field(
×
145
                'edac_simplified_summary_prompt',
×
146
                __( 'Prompt for Simplified Summary', 'accessibility-checker' ),
×
147
                'edac_simplified_summary_prompt_cb',
×
148
                'edac_settings',
×
149
                'edac_simplified_summary',
×
150
                [ 'label_for' => 'edac_simplified_summary_prompt' ]
×
151
        );
×
152

153
        add_settings_field(
×
154
                'edac_simplified_summary_position',
×
155
                __( 'Simplified Summary Position', 'accessibility-checker' ),
×
156
                'edac_simplified_summary_position_cb',
×
157
                'edac_settings',
×
158
                'edac_simplified_summary',
×
159
                [ 'label_for' => 'edac_simplified_summary_position' ]
×
160
        );
×
161

162
        add_settings_field(
×
163
                'edac_add_footer_accessibility_statement',
×
164
                __( 'Add Footer Accessibility Statement', 'accessibility-checker' ),
×
165
                'edac_add_footer_accessibility_statement_cb',
×
166
                'edac_settings',
×
167
                'edac_footer_accessibility_statement',
×
168
                [ 'label_for' => 'edac_add_footer_accessibility_statement' ]
×
169
        );
×
170

171
        add_settings_field(
×
172
                'edac_include_accessibility_statement_link',
×
173
                __( 'Include Link to Accessibility Policy', 'accessibility-checker' ),
×
174
                'edac_include_accessibility_statement_link_cb',
×
175
                'edac_settings',
×
176
                'edac_footer_accessibility_statement',
×
177
                [ 'label_for' => 'edac_include_accessibility_statement_link' ]
×
178
        );
×
179

180
        add_settings_field(
×
181
                'edac_accessibility_policy_page',
×
182
                __( 'Accessibility Policy page', 'accessibility-checker' ),
×
183
                'edac_accessibility_policy_page_cb',
×
184
                'edac_settings',
×
185
                'edac_footer_accessibility_statement',
×
186
                [ 'label_for' => 'edac_accessibility_policy_page' ]
×
187
        );
×
188

189
        add_settings_field(
×
190
                'edac_accessibility_statement_preview',
×
191
                __( 'Accessibility Statement Preview', 'accessibility-checker' ),
×
192
                'edac_accessibility_statement_preview_cb',
×
193
                'edac_settings',
×
194
                'edac_footer_accessibility_statement',
×
195
                [ 'label_for' => 'edac_accessibility_statement_preview' ]
×
196
        );
×
197

198
        add_settings_field(
×
199
                'edac_frontend_highlighter_position',
×
200
                __( 'Frontend Accessibility Checker Position', 'accessibility-checker' ),
×
201
                'edac_frontend_highlighter_position_cb',
×
202
                'edac_settings',
×
203
                'edac_frontend_highlighter',
×
204
                [ 'label_for' => 'edac_frontend_highlighter_position' ]
×
205
        );
×
206

207

208
        // Register settings.
209
        register_setting( 'edac_settings', 'edac_post_types', 'edac_sanitize_post_types' );
×
210
        register_setting( 'edac_settings', 'edac_delete_data', 'edac_sanitize_checkbox' );
×
211
        register_setting(
×
212
                'edac_settings',
×
213
                'edac_simplified_summary_prompt',
×
214
                [
×
215
                        'type'              => 'string',
×
216
                        'sanitize_callback' => 'edac_sanitize_simplified_summary_prompt',
×
217
                        'default'           => 'when required',
×
218
                ]
×
219
        );
×
220
        register_setting(
×
221
                'edac_settings',
×
222
                'edac_simplified_summary_position',
×
223
                [
×
224
                        'type'              => 'string',
×
225
                        'sanitize_callback' => 'edac_sanitize_simplified_summary_position',
×
226
                        'default'           => 'after',
×
227
                ]
×
228
        );
×
229
        register_setting( 'edac_settings', 'edac_add_footer_accessibility_statement', 'edac_sanitize_checkbox' );
×
230
        register_setting( 'edac_settings', 'edac_include_accessibility_statement_link', 'edac_sanitize_checkbox' );
×
231
        register_setting( 'edac_settings', 'edac_accessibility_policy_page', 'edac_sanitize_accessibility_policy_page' );
×
232

233
        register_setting( 'edac_settings', 'edac_frontend_highlighter_position', 'edac_sanitize_frontend_highlighter_position' );
×
234
}
235

236
/**
237
 * Render the text for the general section
238
 */
239
function edac_general_cb() {
240
        echo '<p>';
×
241

242
        printf(
×
243
                /* translators: %1$s: link to the plugin documentation website. */
244
                esc_html__( 'Use the settings below to configure Accessibility Checker. Additional information about each setting can be found in the %1$s.', 'accessibility-checker' ),
×
NEW
245
                '<a href="' . esc_url( edac_link_wrapper( 'https://a11ychecker.com/', 'settings-page', '', false ) ) . '" target="_blank" aria-label="' . esc_attr__( 'plugin documentation (opens in a new window)', 'accessibility-checker' ) . '">' . esc_html__( 'plugin documentation', 'accessibility-checker' ) . '</a>'
×
246
        );
×
247

248
        if ( EDAC_KEY_VALID === false ) {
×
249
                printf(
×
250
                        /* translators: %1$s: link to the "Accessibility Checker Pro" website. */
251
                        ' ' . esc_html__( 'More features and email support is available with %1$s.', 'accessibility-checker' ),
×
NEW
252
                        '<a href="' . esc_url(
×
NEW
253
                                edac_generate_link_type(
×
NEW
254
                                        [
×
NEW
255
                                                'utm_campaign' => 'settings-page',
×
NEW
256
                                                'utm_content'  => 'features-and-support',
×
NEW
257
                                        ]
×
NEW
258
                                )
×
NEW
259
                        ) . '" target="_blank" aria-label="' . esc_attr__( 'Accessibility Checker Pro (opens in a new window)', 'accessibility-checker' ) . '">' . esc_html__( 'Accessibility Checker Pro', 'accessibility-checker' ) . '</a>'
×
UNCOV
260
                );
×
261
        }
262

263
        echo '</p>';
×
264
}
265

266
/**
267
 * Render the copy used to explain the frontend highlighter section.
268
 *
269
 * @return void
270
 */
271
function edac_frontend_highlighter_section_cb() {
272
        echo '<p>';
×
273
        esc_html_e( 'Use the settings below to configure the frontend accessibility checker.', 'accessibility-checker' );
×
274
        echo '</p>';
×
275
}
276

277
/**
278
 * Render the text for the simplified summary section
279
 */
280
function edac_simplified_summary_cb() {
281
        printf(
×
282
                '<p>%1$s %2$s</p>',
×
283
                esc_html__( 'Web Content Accessibility Guidelines (WCAG) at the AAA level require any content with a reading level above 9th grade to have an alternative that is easier to read. Simplified summary text is added on the readability tab in the Accessibility Checker meta box on each post\'s or page\'s edit screen.', 'accessibility-checker' ),
×
NEW
284
                '<a href="' . esc_url(
×
NEW
285
                        edac_generate_link_type(
×
NEW
286
                                [
×
NEW
287
                                        'utm_campaign' => 'settings-page',
×
NEW
288
                                        'utm_content'  => 'features-and-support',
×
NEW
289
                                ],
×
NEW
290
                                'help',
×
NEW
291
                                [ 'help_id' => 3265 ]
×
NEW
292
                        )
×
NEW
293
                ) . '" target="_blank" aria-label="' . esc_attr__( 'Learn more about simplified summaries and readability requirements (opens in a new window)', 'accessibility-checker' ) . '">' . esc_html__( 'Learn more about simplified summaries and readability requirements.', 'accessibility-checker' ) . '</a>'
×
UNCOV
294
        );
×
295
}
296

297
/**
298
 * Render the text for the footer accessiblity statement section
299
 */
300
function edac_footer_accessibility_statement_cb() {
301
        echo '<p>';
×
302
        echo esc_html__( 'Are you thinking "Wow, this plugin is amazing" and is it helping you make your website more accessible? Share your efforts to make your website more accessible with your customers and let them know you\'re using Accessibility Checker to ensure all people can use your website. Add a small text-only link and statement in the footer of your website.', 'accessibility-checker' );
×
303
        echo '</p>';
×
304
}
305

306
/**
307
 * Render the radio input field for position option
308
 */
309
function edac_simplified_summary_position_cb() {
310
        $position = get_option( 'edac_simplified_summary_position' );
×
311
        ?>
312
                <fieldset>
×
313
                        <label>
×
314
                                <input type="radio" name="<?php echo 'edac_simplified_summary_position'; ?>" id="<?php echo 'edac_simplified_summary_position'; ?>" value="before" <?php checked( $position, 'before' ); ?>>
×
315
                                <?php esc_html_e( 'Before the content', 'accessibility-checker' ); ?>
×
316
                        </label>
×
317
                        <br>
×
318
                        <label>
×
319
                                <input type="radio" name="<?php echo 'edac_simplified_summary_position'; ?>" value="after" <?php checked( $position, 'after' ); ?>>
×
320
                                <?php esc_html_e( 'After the content', 'accessibility-checker' ); ?>
×
321
                        </label>
×
322
                        <br>
×
323
                        <label>
×
324
                                <input type="radio" name="<?php echo 'edac_simplified_summary_position'; ?>" value="none" <?php checked( $position, 'none' ); ?>>
×
325
                                <?php esc_html_e( 'Insert manually', 'accessibility-checker' ); ?>
×
326
                        </label>
×
327
                </fieldset>
×
328
                <div id="ac-simplified-summary-option-code">
×
329
                        <p><?php esc_html_e( 'Use this function to manually add the simplified summary to your theme within the loop.', 'accessibility-checker' ); ?></p>
×
330
                        <kbd>edac_get_simplified_summary();</kbd>
331
                        <p><?php esc_html_e( 'The function optionally accepts the post ID as a parameter.', 'accessibility-checker' ); ?><p>
×
332
                        <kbd>edac_get_simplified_summary($post);</kbd>
333
                </div>
334
                <p class="edac-description"><?php echo esc_html__( 'Set where you would like simplified summaries to appear in relation to your content if filled in.', 'accessibility-checker' ); ?></p>
×
335
        <?php
336
}
337

338
/**
339
 * Renders radio inputs for the frontend highlighter position option.
340
 *
341
 * @return void
342
 */
343
function edac_frontend_highlighter_position_cb() {
344
        $position = get_option( 'edac_frontend_highlighter_position', 'right' );
×
345
        ?>
346
                <fieldset>
×
347
                        <label>
×
348
                                <input type="radio" name="edac_frontend_highlighter_position" value="right" <?php checked( $position, 'right' ); ?>>
×
349
                                <?php esc_html_e( 'Bottom Right Corner (default)', 'accessibility-checker' ); ?>
×
350
                        </label>
×
351
                        <br>
×
352
                        <label>
×
353
                                <input type="radio" name="edac_frontend_highlighter_position" value="left" <?php checked( $position, 'left' ); ?>>
×
354
                                <?php esc_html_e( 'Bottom Left Corner', 'accessibility-checker' ); ?>
×
355
                        </label>
×
356
                        <br>
×
357
                </fieldset>
×
358
                <p class="edac-description"><?php echo esc_html__( 'Set where you would like the frontend accessibility checker to appear on the page.', 'accessibility-checker' ); ?></p>
×
359
        <?php
360
}
361

362
/**
363
 * Sanitize the text position value before being saved to database
364
 *
365
 * @param array $position Position value.
366
 *
367
 * @return string
368
 */
369
function edac_sanitize_simplified_summary_position( $position ) {
370
        if ( in_array( $position, [ 'before', 'after', 'none' ], true ) ) {
×
371
                return $position;
×
372
        }
373
}
374

375
/**
376
 * Sanitize the frontend highlighter position value before being saved to database.
377
 *
378
 * @param string $position the position to save. Can only be 'right' or 'left'.
379
 *
380
 * @return string
381
 */
382
function edac_sanitize_frontend_highlighter_position( string $position ): string {
383
        if ( in_array( $position, [ 'right', 'left' ], true ) ) {
×
384
                return $position;
×
385
        }
386
        return 'right';
×
387
}
388

389
/**
390
 * Render the radio input field for position option
391
 */
392
function edac_simplified_summary_prompt_cb() {
393
        $prompt = get_option( 'edac_simplified_summary_prompt' );
×
394
        ?>
395
                <fieldset>
×
396
                        <label>
×
397
                                <input type="radio" name="<?php echo 'edac_simplified_summary_prompt'; ?>" id="<?php echo 'edac_simplified_summary_prompt'; ?>" value="when required" <?php checked( $prompt, 'when required' ); ?>>
×
398
                                <?php esc_html_e( 'When Required', 'accessibility-checker' ); ?>
×
399
                        </label>
×
400
                        <br>
×
401
                        <label>
×
402
                                <input type="radio" name="<?php echo 'edac_simplified_summary_prompt'; ?>" value="always" <?php checked( $prompt, 'always' ); ?>>
×
403
                                <?php esc_html_e( 'Always', 'accessibility-checker' ); ?>
×
404
                        </label>
×
405
                        <br>
×
406
                        <label>
×
407
                                <input type="radio" name="<?php echo 'edac_simplified_summary_prompt'; ?>" value="none" <?php checked( $prompt, 'none' ); ?>>
×
408
                                <?php esc_html_e( 'Never', 'accessibility-checker' ); ?>
×
409
                        </label>
×
410
                </fieldset>
×
411
                <p class="edac-description"><?php echo esc_html__( 'Should Accessibility Checker only ask for a simplified summary when the reading level of your post or page is above 9th grade, always ask for it regardless of reading level, or never ask for it regardless of reading level?', 'accessibility-checker' ); ?></p>
×
412
        <?php
413
}
414

415
/**
416
 * Sanitize the text position value before being saved to database
417
 *
418
 * @param array $prompt The text.
419
 *
420
 * @return string
421
 */
422
function edac_sanitize_simplified_summary_prompt( $prompt ) {
423
        if ( in_array( $prompt, [ 'when required', 'always', 'none' ], true ) ) {
×
424
                return $prompt;
×
425
        }
426
}
427

428
/**
429
 * Render the checkbox input field for post_types option
430
 */
431
function edac_post_types_cb() {
432

433
        $selected_post_types = get_option( 'edac_post_types' ) ? get_option( 'edac_post_types' ) : [];
×
434
        $post_types          = edac_post_types();
×
435
        $custom_post_types   = edac_custom_post_types();
×
436
        $all_post_types      = ( is_array( $post_types ) && is_array( $custom_post_types ) ) ? array_merge( $post_types, $custom_post_types ) : [];
×
437
        ?>
438
                <fieldset>
×
439
                        <?php
×
440
                        if ( $all_post_types ) {
×
441
                                foreach ( $all_post_types as $post_type ) {
×
442
                                        $disabled = in_array( $post_type, $post_types, true ) ? '' : 'disabled';
×
443
                                        ?>
444
                                        <label>
×
445
                                                <input type="checkbox" name="<?php echo 'edac_post_types[]'; ?>" value="<?php echo esc_attr( $post_type ); ?>"
×
446
                                                                                                                                <?php
447
                                                                                                                                checked( in_array( $post_type, $selected_post_types, true ), 1 );
×
448
                                                                                                                                echo esc_attr( $disabled );
×
449
                                                                                                                                ?>
450
                                                >
×
451
                                                <?php echo esc_html( $post_type ); ?>
×
452
                                        </label>
×
453
                                        <br>
×
454
                                        <?php
×
455
                                }
456
                        }
457
                        ?>
458
                </fieldset>
×
459
                <?php if ( EDAC_KEY_VALID === false ) { ?>
×
460
                        <p class="edac-description">
×
461
                                <?php
×
462
                                echo esc_html__( 'To check content other than posts and pages, please ', 'accessibility-checker' );
×
463
                                ?>
NEW
464
                                <a href="<?php edac_link_wrapper( 'https://my.equalizedigital.com/', 'settings-page' ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html__( 'upgrade to pro', 'accessibility-checker' ); ?></a>
×
465
                                <?php esc_html_e( ' (opens in a new window)', 'accessibility-checker' ); ?>
×
466
                        </p>
×
467
                <?php } else { ?>
×
468
                        <p class="edac-description">
×
469
                                <?php
×
470
                                esc_html_e( 'Choose which post types should be checked during a scan. Please note, removing a previously selected post type will remove its scanned information and any custom ignored warnings that have been setup.', 'accessibility-checker' );
×
471
                                ?>
472
                        </p>
×
473
                        <?php
×
474
                }
475
}
476

477
/**
478
 * Sanitize the post type value before being saved to database
479
 *
480
 * @param array $selected_post_types Post types to sanitize.
481
 * @return array
482
 */
483
function edac_sanitize_post_types( $selected_post_types ) {
484

485
        $post_types = edac_post_types();
×
486

487
        if ( $selected_post_types ) {
×
488
                foreach ( $selected_post_types as $key => $post_type ) {
×
489
                        if ( ! in_array( $post_type, $post_types, true ) ) {
×
490
                                unset( $selected_post_types[ $key ] );
×
491
                        }
492
                }
493
        }
494

495
        // get unselected post types.
496
        $unselected_post_types = $post_types;
×
497
        if ( $selected_post_types ) {
×
498
                $unselected_post_types = array_diff( $post_types, $selected_post_types );
×
499
        }
500

501
        // delete unselected post type issues.
502
        if ( $unselected_post_types ) {
×
503
                foreach ( $unselected_post_types as $unselected_post_type ) {
×
504
                        Purge_Post_Data::delete_cpt_posts( $unselected_post_type );
×
505
                }
506
        }
507

508
        // clear cached stats if selected posts types change.
509
        if ( get_option( 'edac_post_types' ) !== $selected_post_types ) {
×
510
                $scan_stats = new \EDAC\Admin\Scans_Stats();
×
511
                $scan_stats->clear_cache();
×
512

513
                // EDACP\Scans is the old namespace, kept for back compat but should be removed after a few releases.
514
                if ( class_exists( '\EDACP\Scans' ) || class_exists( '\EqualizeDigital\AccessibilityCheckerPro\Admin\Scans' ) ) {
×
515
                        delete_option( 'edacp_fullscan_completed_at' );
×
516
                }
517
        }
518

519
        return $selected_post_types;
×
520
}
521

522
/**
523
 * Render the checkbox input field for add footer accessibility statement option
524
 */
525
function edac_add_footer_accessibility_statement_cb() {
526

527
        $option = get_option( 'edac_add_footer_accessibility_statement' ) ? get_option( 'edac_add_footer_accessibility_statement' ) : false;
×
528

529
        ?>
530
        <fieldset>
×
531
                <label>
×
532
                        <input type="checkbox" name="edac_add_footer_accessibility_statement" value="1" <?php checked( $option, 1 ); ?>>
×
533
                        <?php esc_html_e( 'Add Footer Accessibility Statement', 'accessibility-checker' ); ?>
×
534
                </label>
×
535
        </fieldset>
×
536
        <?php
×
537
}
538

539
/**
540
 * Render the checkbox input field for add footer accessibility statement option
541
 */
542
function edac_include_accessibility_statement_link_cb() {
543

544
        $option   = get_option( 'edac_include_accessibility_statement_link' ) ? get_option( 'edac_include_accessibility_statement_link' ) : false;
×
545
        $disabled = get_option( 'edac_add_footer_accessibility_statement' ) ? get_option( 'edac_add_footer_accessibility_statement' ) : false;
×
546

547
        ?>
548
        <fieldset>
×
549
                <label>
×
550
                        <input type="checkbox" name="<?php echo 'edac_include_accessibility_statement_link'; ?>" value="<?php echo '1'; ?>"
×
551
                                                                                                        <?php
552
                                                                                                        checked( $option, 1 );
×
553
                                                                                                        disabled( $disabled, false );
×
554
                                                                                                        ?>
555
                        >
×
556
                        <?php esc_html_e( 'Include Link to Accessibility Policy', 'accessibility-checker' ); ?>
×
557
                </label>
×
558
        </fieldset>
×
559
        <?php
×
560
}
561

562
/**
563
 * Render the select field for accessibility policy page option
564
 */
565
function edac_accessibility_policy_page_cb() {
566

567
        $policy_page = get_option( 'edac_accessibility_policy_page' );
×
568
        $policy_page = is_numeric( $policy_page ) ? get_page_link( $policy_page ) : $policy_page;
×
569
        ?>
570

571
        <input style="width: 100%;" type="text" name="edac_accessibility_policy_page" id="edac_accessibility_policy_page" value="<?php echo esc_attr( $policy_page ); ?>">
×
572

573
        <?php
574
}
575

576
/**
577
 * Sanitize accessibility policy page values before being saved to database
578
 *
579
 * @param string $page Page to sanitize.
580
 * @return string
581
 */
582
function edac_sanitize_accessibility_policy_page( $page ) {
583
        if ( $page ) {
×
584
                return esc_url( $page );
×
585
        }
586
}
587

588
/**
589
 * Render the accessibility statement preview
590
 */
591
function edac_accessibility_statement_preview_cb() {
592
        echo wp_kses_post(
×
593
                ( new Accessibility_Statement() )->get_accessibility_statement()
×
594
        );
×
595
}
596

597
/**
598
 * Render the checkbox input field for delete data option
599
 */
600
function edac_delete_data_cb() {
601

602
        $option = get_option( 'edac_delete_data' ) ? get_option( 'edac_delete_data' ) : false;
×
603

604
        ?>
605
        <fieldset>
×
606
                <label>
×
607
                        <input type="checkbox" name="edac_delete_data" value="1" <?php checked( $option, 1 ); ?>>
×
608
                        <?php esc_html_e( 'Delete all Accessibility Checker data when the plugin is uninstalled.', 'accessibility-checker' ); ?>
×
609
                </label>
×
610
        </fieldset>
×
611
        <?php
×
612
}
613

614
/**
615
 * Sanitize checkbox values before being saved to database
616
 *
617
 * These are passed in as strings, but we will save them as integers.
618
 *
619
 * @since 1.11.0
620
 *
621
 * @param string $input Input to sanitize.
622
 * @return int either 1 for checked or 0 for unchecked
623
 */
624
function edac_sanitize_checkbox( $input ) {
625
        return ( isset( $input ) && '1' === $input ) ? 1 : 0;
×
626
}
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