• 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.7
/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
                        ) {
NEW
60
                                $pro_modal_link = edac_generate_link_type(
×
NEW
61
                                        [
×
NEW
62
                                                'utm-campaign' => 'dashboard-widget',
×
NEW
63
                                                'utm-content'  => 'upgrade-to-edacp',
×
NEW
64
                                        ],
×
NEW
65
                                );
×
UNCOV
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">
NEW
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

NEW
136
                                $manually_check_link = edac_link_wrapper(
×
NEW
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',
×
NEW
138
                                        'dashboard-widget',
×
NEW
139
                                        'how-to-manually-check',
×
NEW
140
                                        false
×
NEW
141
                                );
×
NEW
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">
NEW
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

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

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

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

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

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

229
                        } else {
230

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

253
                        }
254
                }
255

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

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

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

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

268
                }
269

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

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

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

283
                $html .= '
×
284
                <hr class="edac-hr" />
285
                <h3 class="edac-summary-header">
286
                        ' . __( 'Learn Accessibility', 'accessibility-checker' ) . '
×
287
                </h3>';
×
288

289
                $html .= edac_get_upcoming_meetups_html( 'wordpress-accessibility-meetup-group', 2, 4 );
×
290

291
                $html .= '
×
292
                <hr class="edac-hr" />
293
                <div class="edac-widget-footer-link-list">';
×
294

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

311
                //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
312
                echo $html;
×
313
        }
314
}
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