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

equalizedigital / accessibility-checker / 19969151623

05 Dec 2025 04:24PM UTC coverage: 57.464%. First build
19969151623

Pull #1298

github

web-flow
Merge 49562b37a into fb04bca5f
Pull Request #1298: Release v1.35.0

65 of 108 new or added lines in 10 files covered. (60.19%)

4173 of 7262 relevant lines covered (57.46%)

3.44 hits per line

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

0.69
/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
/**
11
 * Class that handles widgets
12
 */
13
class Widgets {
14

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

24
        /**
25
         * Add dashboard widget
26
         *
27
         * @return void
28
         */
29
        public function dashboard_setup() {
30

31
                if ( ! Helpers::current_user_can_see_widgets_and_notices() ) {
×
32
                        return;
×
33
                }
34
                wp_add_dashboard_widget(
×
35
                        'edac_dashboard_scan_summary',
×
36
                        'Accessibility Checker',
×
37
                        [ $this, 'render_dashboard_scan_summary' ]
×
38
                );
×
39
        }
40

41
        /**
42
         * Renders as widget
43
         *
44
         * @return void
45
         */
46
        public function render_dashboard_scan_summary() {
47

48
                $html  = '';
×
49
                $html .= '
×
50

51
                <div class="edac-widget">';
×
52

53
                if ( Settings::get_scannable_post_types() && Settings::get_scannable_post_statuses() ) {
×
54

55
                        $pro_modal_html = '';
×
56
                        if ( ( ! defined( 'EDACP_VERSION' ) ||
×
57
                        false === EDAC_KEY_VALID ) &&
×
58
                        true !== (bool) get_user_meta( get_current_user_id(), 'edac_dashboard_cta_dismissed', true )
×
59
                        ) {
60
                                $pro_modal_link = edac_generate_link_type(
×
61
                                        [
×
62
                                                'utm-campaign' => 'dashboard-widget',
×
63
                                                'utm-content'  => 'upgrade-to-edacp',
×
64
                                        ],
×
65
                                );
×
66
                                $pro_modal_html = '
×
67
                        <div class="edac-modal">
68
                                <div class="edac-modal-content">
69
                                        <button class="edac-modal-content-close edac-widget-modal-content-close" aria-label="' . esc_attr__( 'close ad', 'accessibility-checker' ) . '">&times;</button>
×
70
                                        <h3>' . __( 'Get Detailed Accessibility Reports', 'accessibility-checker' ) . '</h3>
×
71
                                        <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>
×
72
                                        <p class="edac-align-center">
73
                                        <a class="button button-primary" href="' . $pro_modal_link . '">' . __( 'Upgrade Accessibility Checker', 'accessibility-checker' ) . '</a>
×
74
                                        </p>
75
                                </div>
76
                        </div>';
×
77
                        }
78

79
                        if ( ( defined( 'EDACP_VERSION' ) && EDAC_KEY_VALID ) || '' !== $pro_modal_html ) {
×
80

81
                                $html .= '
×
82
                        <div class="edac-summary edac-modal-container edac-hidden">';
×
83

84
                                $html .= $pro_modal_html;
×
85

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

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

108
                                $html .= '
×
109
                                </div>
110

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

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

136
                                $manually_check_link = edac_link_wrapper(
×
137
                                        'https://equalizedigital.com/accessibility-checker/how-to-manually-check-your-website-for-accessibility/?utm_source=accessibility-checker&utm_medium=software&utm_campaign=dashboard-widget',
×
138
                                        'dashboard-widget',
×
139
                                        'how-to-manually-check',
×
140
                                        false
×
141
                                );
×
142
                                $html               .= '
×
143
                        <div class="edac-summary-notice edac-summary-notice-has-issues edac-hidden">
144
                                ' . __( 'Your site has accessibility issues that should be addressed as soon as possible to ensure compliance with accessibility guidelines.', 'accessibility-checker' ) . '
×
145
                        </div>
146
                         <div class="edac-summary-notice edac-summary-notice-no-issues edac-hidden">
147
                                ' . __( '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>.
×
148
                        </div>';
×
149

150
                                $html .= '
×
151
                </div>
152
                <hr class="edac-hr" />';
×
153

154
                        }
155
                }
156

157
                $html .= '
×
158

159
                <div class="edac-issues-summary edac-hidden">
160

161
                        <h3 class="edac-issues-summary-header">
162
                                ' . __( 'Issues By Post Type', 'accessibility-checker' ) . '
×
163
                        </h3>
164

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

183
                                <tbody>';
×
184

185
                                $scannable_post_types = Settings::get_scannable_post_types();
×
186

187
                                $post_types = get_post_types(
×
188
                                        [
×
189
                                                'public' => true,
×
190
                                        ]
×
191
                                );
×
192
                                unset( $post_types['attachment'] );
×
193

194
                foreach ( $post_types as $post_type ) {
×
195

196
                        $post_types_to_check = array_merge( [ 'post', 'page' ], $scannable_post_types );
×
197
                        $post_type_label     = edac_get_post_type_label( $post_type );
×
198

199
                        if ( in_array( $post_type, $post_types_to_check, true ) ) {
×
200

201
                                if ( in_array( $post_type, $scannable_post_types, true ) ) {
×
202

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

219
                                }
220
                        } elseif ( defined( 'EDACP_VERSION' ) && EDAC_KEY_VALID ) {
×
221

222
                                $html .= '
×
223
                                                <tr >
224
                                                        <th scope="col">' . esc_html( $post_type_label ) . '</th>
×
225
                                                        <td>-</td>
226
                                                        <td>-</td>
227
                                                        <td>-</td>
228
                                                </tr>';
×
229

230
                        } else {
231

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

254
                        }
255
                }
256

257
                $html .= '
×
258
                                </tbody>
259
                        </table>
260
                </div>';
×
261

262
                $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>';
×
263

264
                if ( ! Settings::get_scannable_post_types() || ! Settings::get_scannable_post_statuses() ) {
×
265

266
                        $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
×
267
                        <a href="/wp-admin/admin.php?page=accessibility_checker_settings">general settings</a> tab.</div>';
×
268

269
                }
270

271
                $html .= '
×
272
                <div class="edac-buttons-container edac-mt-3 edac-mb-3">
273
                ';
×
274

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

280
                $html .= '
×
281
                <a href="/wp-admin/admin.php?page=accessibility_checker_settings">Edit Accessibility Checker Settings</a>
282
                </div>';
×
283

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

NEW
292
                        $html .= $meetup_html;
×
293
                }
294

295
                $html .= '
×
296
                <hr class="edac-hr" />
297
                <div class="edac-widget-footer-link-list">';
×
298

299
                $blog_link = edac_link_wrapper(
×
300
                        'https://equalizedigital.com/resources/',
×
301
                        'dashboard-widget',
×
302
                        'blog',
×
303
                        false
×
304
                );
×
305
                $docs_link = edac_link_wrapper(
×
306
                        'https://equalizedigital.com/accessibility-checker/documentation/',
×
307
                        'dashboard-widget',
×
308
                        'docs',
×
309
                        false
×
310
                );
×
311
                $html     .= '<h3 class="screen-reader-text">' . __( 'Additional Resources', 'accessibility-checker' ) . '</h3>';
×
312
                $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>';
×
313
                $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>';
×
314

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