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

equalizedigital / accessibility-checker / 22024231170

14 Feb 2026 09:04PM UTC coverage: 57.263%. First build
22024231170

Pull #1413

github

web-flow
Merge c07f857fb into 1cbcfbf9b
Pull Request #1413: Fix loopback helper warning on DNS AAAA failures

27 of 81 new or added lines in 24 files covered. (33.33%)

4147 of 7242 relevant lines covered (57.26%)

3.47 hits per line

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

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

8
namespace EDAC\Admin;
9

10
if ( ! defined( 'ABSPATH' ) ) {
2✔
NEW
11
        exit;
×
12
}
13

14
/**
15
 * Class that handles widgets
16
 */
17
class Widgets {
18

19
        /**
20
         * Initialize hooks.
21
         *
22
         * @return void
23
         */
24
        public function init_hooks() {
25
                add_action( 'wp_dashboard_setup', [ $this, 'dashboard_setup' ] );
2✔
26
        }
27

28
        /**
29
         * Add dashboard widget
30
         *
31
         * @return void
32
         */
33
        public function dashboard_setup() {
34

35
                if ( ! Helpers::current_user_can_see_widgets_and_notices() ) {
×
36
                        return;
×
37
                }
38
                wp_add_dashboard_widget(
×
39
                        'edac_dashboard_scan_summary',
×
40
                        'Accessibility Checker',
×
41
                        [ $this, 'render_dashboard_scan_summary' ]
×
42
                );
×
43
        }
44

45
        /**
46
         * Renders as widget
47
         *
48
         * @return void
49
         */
50
        public function render_dashboard_scan_summary() {
51

52
                $html  = '';
×
53
                $html .= '
×
54

55
                <div class="edac-widget">';
×
56

57
                if ( Settings::get_scannable_post_types() && Settings::get_scannable_post_statuses() ) {
×
58

59
                        $pro_modal_html = '';
×
60
                        if ( ( ! defined( 'EDACP_VERSION' ) ||
×
61
                        false === EDAC_KEY_VALID ) &&
×
62
                        true !== (bool) get_user_meta( get_current_user_id(), 'edac_dashboard_cta_dismissed', true )
×
63
                        ) {
64
                                $pro_modal_link = edac_generate_link_type(
×
65
                                        [
×
66
                                                'utm-campaign' => 'dashboard-widget',
×
67
                                                'utm-content'  => 'upgrade-to-edacp',
×
68
                                        ],
×
69
                                );
×
70
                                $pro_modal_html = '
×
71
                        <div class="edac-modal">
72
                                <div class="edac-modal-content">
73
                                        <button class="edac-modal-content-close edac-widget-modal-content-close" aria-label="' . esc_attr__( 'close ad', 'accessibility-checker' ) . '">&times;</button>
×
74
                                        <h3>' . __( 'Get Detailed Accessibility Reports', 'accessibility-checker' ) . '</h3>
×
75
                                        <p class="edac-align-center">' . __( 'Start scanning your entire website for accessibility issues, get full-site reports, and become compliant with accessibility guidelines faster.', 'accessibility-checker' ) . '</p>
×
76
                                        <p class="edac-align-center">
77
                                        <a class="button button-primary" href="' . $pro_modal_link . '">' . __( 'Upgrade Accessibility Checker', 'accessibility-checker' ) . '</a>
×
78
                                        </p>
79
                                </div>
80
                        </div>';
×
81
                        }
82

83
                        if ( ( defined( 'EDACP_VERSION' ) && EDAC_KEY_VALID ) || '' !== $pro_modal_html ) {
×
84

85
                                $html .= '
×
86
                        <div class="edac-summary edac-modal-container edac-hidden">';
×
87

88
                                $html .= $pro_modal_html;
×
89

90
                                $html .= '
×
91
                        <h3 class="edac-summary-header">' .
×
92
                                __( 'Full Site Accessibility Status', 'accessibility-checker' ) .
×
93
                                '</h3>
×
94
                        <div class="edac-summary-passed">
95
                                <div id="edac-summary-passed" class="edac-circle-progress" role="progressbar" aria-valuenow="0"
96
                                        aria-valuemin="0" aria-valuemax="100"
97
                                        style="text-align: center;
98
                                        background: radial-gradient(closest-side, white 85%, transparent 80% 100%),
99
                                        conic-gradient(#006600 0%, #e2e4e7 0);">
100
                                        <div class="edac-progress-percentage">-</div>
101
                                        <div class="edac-progress-label">' .
×
102
                                        __( 'Passed Tests', 'accessibility-checker' ) .
×
103
                                        '</div>
×
104
                                </div>
105
                        </div>
106

107
                        <div class="edac-summary-info">
108
                                <div class="edac-summary-info-date">
109
                                        <div class="edac-summary-info-date-label">' . __( 'Report Last Updated:', 'accessibility-checker' ) . '</div>
×
110
                                        <div id="edac-summary-info-date" class="edac-summary-info-date-date edac-timestamp-to-local">-</div>';
×
111

112
                                $html .= '
×
113
                                </div>
114

115
                                <div class="edac-summary-info-count">
116
                                        <div class="edac-summary-scan-count-label">
117
                                                ' . __( 'URLs Scanned:', 'accessibility-checker' ) . '
×
118
                                        </div>
119
                                        <div id="edac-summary-info-count" class="edac-summary-info-count-number">-</div>
120
                                </div>';
×
121

122
                                $html .= '
×
123
                                <div class="edac-summary-info-stats">
124
                                        <div  class="edac-summary-info-stats-box edac-summary-info-stats-box-error">
125
                                                <div class="edac-summary-info-stats-box-label">' . __( 'Errors:', 'accessibility-checker' ) . ' </div>
×
126
                                                <div id="edac-summary-info-errors" class="edac-summary-info-stats-box-number">-</div>
127
                                        </div>
128
                                        <div class="edac-summary-info-stats-box edac-summary-info-stats-box-contrast">
129
                                                <div class="edac-summary-info-stats-box-label">' . __( 'Color Contrast Errors:', 'accessibility-checker' ) . ' </div>
×
130
                                                <div id="edac-summary-info-contrast-errors" class="edac-summary-info-stats-box-number">-</div>
131
                                        </div>
132
                                        <div class="edac-summary-info-stats-box edac-summary-info-stats-box-warning">
133
                                                <div class="edac-summary-info-stats-box-label">' . __( 'Warnings:', 'accessibility-checker' ) . ' </div>
×
134
                                                <div id="edac-summary-info-warnings" class="edac-summary-info-stats-box-number">-</div>
135
                                        </div>
136
                                </div>
137
                        </div>
138
                        ';
×
139

140
                                $manually_check_link = edac_link_wrapper(
×
141
                                        'https://equalizedigital.com/accessibility-checker/how-to-manually-check-your-website-for-accessibility/?utm_source=accessibility-checker&utm_medium=software&utm_campaign=dashboard-widget',
×
142
                                        'dashboard-widget',
×
143
                                        'how-to-manually-check',
×
144
                                        false
×
145
                                );
×
146
                                $html               .= '
×
147
                        <div class="edac-summary-notice edac-summary-notice-has-issues edac-hidden">
148
                                ' . __( 'Your site has accessibility issues that should be addressed as soon as possible to ensure compliance with accessibility guidelines.', 'accessibility-checker' ) . '
×
149
                        </div>
150
                         <div class="edac-summary-notice edac-summary-notice-no-issues edac-hidden">
151
                                ' . __( 'Way to go! Accessibility Checker cannot find any accessibility problems in the content it tested. Some problems cannot be found by automated tools so don\'t forget to', 'accessibility-checker' ) . ' <a href="' . esc_url( $manually_check_link ) . '">' . __( 'manually test your site', 'accessibility-checker' ) . '</a>.
×
152
                        </div>';
×
153

154
                                $html .= '
×
155
                </div>
156
                <hr class="edac-hr" />';
×
157

158
                        }
159
                }
160

161
                $html .= '
×
162

163
                <div class="edac-issues-summary edac-hidden">
164

165
                        <h3 class="edac-issues-summary-header">
166
                                ' . __( 'Issues By Post Type', 'accessibility-checker' ) . '
×
167
                        </h3>
168

169
                        <table class="widefat striped">
170
                                <thead>
171
                                <tr>
172
                                        <th scope="col">
173
                                                ' . __( 'Post Type', 'accessibility-checker' ) . '
×
174
                                        </th>
175
                                        <th scope="col" >
176
                                                ' . __( 'Errors', 'accessibility-checker' ) . '
×
177
                                        </th>
178
                                        <th scope="col" >
179
                                                ' . __( 'Contrast', 'accessibility-checker' ) . '
×
180
                                        </th>
181
                                        <th scope="col" >
182
                                                ' . __( 'Warnings', 'accessibility-checker' ) . '
×
183
                                        </th>
184
                                </tr>
185
                                </thead>
186

187
                                <tbody>';
×
188

189
                                $scannable_post_types = Settings::get_scannable_post_types();
×
190

191
                                $post_types = get_post_types(
×
192
                                        [
×
193
                                                'public' => true,
×
194
                                        ]
×
195
                                );
×
196
                                unset( $post_types['attachment'] );
×
197

198
                foreach ( $post_types as $post_type ) {
×
199

200
                        $post_types_to_check = array_merge( [ 'post', 'page' ], $scannable_post_types );
×
201
                        $post_type_label     = edac_get_post_type_label( $post_type );
×
202

203
                        if ( in_array( $post_type, $post_types_to_check, true ) ) {
×
204

205
                                if ( in_array( $post_type, $scannable_post_types, true ) ) {
×
206

207
                                        $html .= '
×
208
                                                        <tr>
209
                                                                <th scope="col">' . esc_html( $post_type_label ) . '</th>
×
210
                                                                <td id="' . esc_attr( $post_type ) . '-errors">-</td>
×
211
                                                                <td id="' . esc_attr( $post_type ) . '-contrast-errors">-</td>
×
212
                                                                <td id="' . esc_attr( $post_type ) . '-warnings">-</td>
×
213
                                                        </tr>';
×
214
                                } else {
215
                                        $html .= '
×
216
                                                        <tr>
217
                                                                <th scope="col">' . esc_html( $post_type_label ) . '</th>
×
218
                                                                <td>-</td>
219
                                                                <td>-</td>
220
                                                                <td>-</td>
221
                                                        </tr>';
×
222

223
                                }
224
                        } elseif ( defined( 'EDACP_VERSION' ) && EDAC_KEY_VALID ) {
×
225

226
                                $html .= '
×
227
                                                <tr >
228
                                                        <th scope="col">' . esc_html( $post_type_label ) . '</th>
×
229
                                                        <td>-</td>
230
                                                        <td>-</td>
231
                                                        <td>-</td>
232
                                                </tr>';
×
233

234
                        } else {
235

236
                                $non_scannable_post_type_pro_link = edac_generate_link_type(
×
237
                                        [
×
238
                                                'utm-campaign' => 'dashboard-widget',
×
239
                                                'utm-content'  => 'upgrade-to-edacp',
×
240
                                        ],
×
241
                                        'pro',
×
242
                                        [
×
243
                                                'post_type' => $post_type,
×
244
                                        ]
×
245
                                );
×
246
                                $html                            .= '
×
247
                                                <tr >
248
                                                        <th scope="col">' . esc_html( $post_type_label ) . '</th>
×
249
                                                        <td colspan="3">
250
                                                                <div class="edac-issues-summary-notice-upgrade-to-edacp">
251
                                                                        <a href="' . esc_url( $non_scannable_post_type_pro_link ) . '">
×
252
                                                                                ' . __( 'Upgrade to Scan', 'accessibility-checker' ) . '
×
253
                                                                        </a>
254
                                                                </div>
255
                                                        </td>
256
                                                </tr>';
×
257

258
                        }
259
                }
260

261
                $html .= '
×
262
                                </tbody>
263
                        </table>
264
                </div>';
×
265

266
                $html .= '<div class="edac-summary-notice edac-summary-notice-is-truncated edac-hidden">Your site has a large number of issues. For performance reasons, not all issues have been included in this report.</div>';
×
267

268
                if ( ! Settings::get_scannable_post_types() || ! Settings::get_scannable_post_statuses() ) {
×
269

270
                        $html .= '<div class="edac-summary-notice edac-summary-notice-no-posts">There are no pages set to be checked. Update the post types to be checked under the
×
271
                        <a href="/wp-admin/admin.php?page=accessibility_checker_settings">general settings</a> tab.</div>';
×
272

273
                }
274

275
                $html .= '
×
276
                <div class="edac-buttons-container edac-mt-3 edac-mb-3">
277
                ';
×
278

279
                if ( defined( 'EDACP_VERSION' ) && EDAC_KEY_VALID ) {
×
280
                        $html .= '
×
281
                        <a class="button edac-mr-1" href="/wp-admin/admin.php?page=accessibility_checker">' . __( 'See More Reports', 'accessibility-checker' ) . '</a>';
×
282
                }
283

284
                $html .= '
×
285
                <a href="/wp-admin/admin.php?page=accessibility_checker_settings">Edit Accessibility Checker Settings</a>
286
                </div>';
×
287

288
                $meetup_html = edac_get_upcoming_meetups_html( 'wordpress-accessibility-meetup-group', 2, 4 );
×
289
                if ( ! empty( $meetup_html ) ) {
×
290
                        $html .= '
×
291
                <hr class="edac-hr" />
292
                <h3 class="edac-summary-header">
293
                        ' . __( 'Learn Accessibility', 'accessibility-checker' ) . '
×
294
                </h3>';
×
295

296
                        $html .= $meetup_html;
×
297
                }
298

299
                $html .= '
×
300
                <hr class="edac-hr" />
301
                <div class="edac-widget-footer-link-list">';
×
302

303
                $blog_link = edac_link_wrapper(
×
304
                        'https://equalizedigital.com/resources/',
×
305
                        'dashboard-widget',
×
306
                        'blog',
×
307
                        false
×
308
                );
×
309
                $docs_link = edac_link_wrapper(
×
310
                        'https://equalizedigital.com/accessibility-checker/documentation/',
×
311
                        'dashboard-widget',
×
312
                        'docs',
×
313
                        false
×
314
                );
×
315
                $html     .= '<h3 class="screen-reader-text">' . __( 'Additional Resources', 'accessibility-checker' ) . '</h3>';
×
316
                $html     .= '<a target="_blank" aria-label="' . __( 'Blog (opens in a new window)', 'accessibility-checker' ) . '" class="edac-widget-footer-link-list-item edac-mr-1" href="' . esc_url( $blog_link ) . '">' . __( 'Blog', 'accessibility-checker' ) . '</a>';
×
317
                $html     .= '<span class="edac-widget-footer-link-list-spacer"></span><a target="_blank" aria-label="' . __( 'Documentation (opens in a new window)', 'accessibility-checker' ) . '" class="edac-widget-footer-link-list-item edac-ml-1" href="' . esc_url( $docs_link ) . '">' . __( 'Documentation', 'accessibility-checker' ) . '</a></div></div>';
×
318

319
                //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- content is being escaped as it is being produced, late escaping would be more complicated and unreadable
320
                echo $html;
×
321
        }
322
}
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