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

equalizedigital / accessibility-checker / 15452164054

04 Jun 2025 08:32PM UTC coverage: 28.973%. First build
15452164054

Pull #1004

github

web-flow
Merge 28c013970 into 147ba9c27
Pull Request #1004: Release v1.24.0

7 of 92 new or added lines in 13 files covered. (7.61%)

1495 of 5160 relevant lines covered (28.97%)

1.5 hits per line

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

0.93
/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 = '';
×
NEW
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_html = '
×
61
                        <div class="edac-modal">
62
                                <div class="edac-modal-content">
63
                                        <button class="edac-modal-content-close edac-widget-modal-content-close" aria-label="' . esc_attr__( 'close ad', 'accessibility-checker' ) . '">&times;</button>
×
64
                                        <h3>' . __( 'Get Detailed Accessibility Reports', 'accessibility-checker' ) . '</h3>
×
65
                                        <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>
×
66
                                        <p class="edac-align-center">
67
                                        <a class="button button-primary" href="https://equalizedigital.com/accessibility-checker/pricing/?utm_source=accessibility-checker&utm_medium=software&utm_campaign=dashboard-widget">' . __( 'Upgrade Accessibility Checker', 'accessibility-checker' ) . '</a>
×
68
                                        </p>
69
                                </div>
70
                        </div>';
×
71
                        }
72

NEW
73
                        if ( ( defined( 'EDACP_VERSION' ) && EDAC_KEY_VALID ) || '' !== $pro_modal_html ) {
×
74

75
                                $html .= '
×
76
                        <div class="edac-summary edac-modal-container edac-hidden">';
×
77

78
                                $html .= $pro_modal_html;
×
79

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

97
                        <div class="edac-summary-info">
98
                                <div class="edac-summary-info-date">
99
                                        <div class="edac-summary-info-date-label">' . __( 'Report Last Updated:', 'accessibility-checker' ) . '</div>
×
100
                                        <div id="edac-summary-info-date" class="edac-summary-info-date-date edac-timestamp-to-local">-</div>';
×
101

102
                                $html .= '
×
103
                                </div>
104

105
                                <div class="edac-summary-info-count">
106
                                        <div class="edac-summary-scan-count-label">
107
                                                ' . __( 'URLs Scanned:', 'accessibility-checker' ) . '
×
108
                                        </div>
109
                                        <div id="edac-summary-info-count" class="edac-summary-info-count-number">-</div>
110
                                </div>';
×
111

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

130
                                $html .= '
×
131
                        <div class="edac-summary-notice edac-summary-notice-has-issues edac-hidden">
132
                                ' . __( 'Your site has accessibility issues that should be addressed as soon as possible to ensure compliance with accessibility guidelines.', 'accessibility-checker' ) . '
×
133
                        </div>
134
                         <div class="edac-summary-notice edac-summary-notice-no-issues edac-hidden">
135
                                ' . __( '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="https://equalizedigital.com/accessibility-checker/how-to-manually-check-your-website-for-accessibility/?utm_source=accessibility-checker&utm_medium=software&utm_campaign=dashboard-widget">' . __( 'manually test your site', 'accessibility-checker' ) . '</a>.
×
136
                        </div>';
×
137

138
                                $html .= '
×
139
                </div>
140
                <hr class="edac-hr" />';
×
141

142
                        }
143
                }
144

145
                $html .= '
×
146

147
                <div class="edac-issues-summary edac-hidden">
148

149
                        <h3 class="edac-issues-summary-header">
150
                                ' . __( 'Issues By Post Type', 'accessibility-checker' ) . '
×
151
                        </h3>
152

153
                        <table class="widefat striped">
154
                                <thead>
155
                                <tr>
156
                                        <th scope="col">
157
                                                ' . __( 'Post Type', 'accessibility-checker' ) . '
×
158
                                        </th>
159
                                        <th scope="col" >
160
                                                ' . __( 'Errors', 'accessibility-checker' ) . '
×
161
                                        </th>
162
                                        <th scope="col" >
163
                                                ' . __( 'Contrast', 'accessibility-checker' ) . '
×
164
                                        </th>
165
                                        <th scope="col" >
166
                                                ' . __( 'Warnings', 'accessibility-checker' ) . '
×
167
                                        </th>
168
                                </tr>
169
                                </thead>
170

171
                                <tbody>';
×
172

173
                                $scannable_post_types = Settings::get_scannable_post_types();
×
174

175
                                $post_types = get_post_types(
×
176
                                        [
×
177
                                                'public' => true,
×
178
                                        ]
×
179
                                );
×
180
                                unset( $post_types['attachment'] );
×
181

182
                foreach ( $post_types as $post_type ) {
×
183

184
                        $post_types_to_check = array_merge( [ 'post', 'page' ], $scannable_post_types );
×
185

186
                        if ( in_array( $post_type, $post_types_to_check, true ) ) {
×
187

188
                                if ( in_array( $post_type, $scannable_post_types, true ) ) {
×
189

190
                                        $html .= '
×
191
                                                        <tr>
192
                                                                <th scope="col">' . esc_html( ucwords( $post_type ) ) . '</th>
×
193
                                                                <td id="' . esc_attr( $post_type ) . '-errors">-</td>
×
194
                                                                <td id="' . esc_attr( $post_type ) . '-contrast-errors">-</td>
×
195
                                                                <td id="' . esc_attr( $post_type ) . '-warnings">-</td>
×
196
                                                        </tr>';
×
197
                                } else {
198
                                        $html .= '
×
199
                                                        <tr>
200
                                                                <th scope="col">' . esc_html( ucwords( $post_type ) ) . '</th>
×
201
                                                                <td>-</td>
202
                                                                <td>-</td>
203
                                                                <td>-</td>
204
                                                        </tr>';
×
205

206
                                }
NEW
207
                        } elseif ( defined( 'EDACP_VERSION' ) && EDAC_KEY_VALID ) {
×
208

209
                                $html .= '
×
210
                                                <tr >
211
                                                        <th scope="col">' . esc_html( ucwords( $post_type ) ) . '</th>
×
212
                                                        <td>-</td>
213
                                                        <td>-</td>
214
                                                        <td>-</td>
215
                                                </tr>';
×
216

217
                        } else {
218

219
                                $html .= '
×
220
                                                <tr >
221
                                                        <th scope="col">' . esc_html( ucwords( $post_type ) ) . '</th>
×
222
                                                        <td colspan="3">
223
                                                                <div class="edac-issues-summary-notice-upgrade-to-edacp">
224
                                                                        <a href="https://equalizedigital.com/accessibility-checker/pricing/?utm_source=accessibility-checker&utm_medium=software&utm_campaign=dashboard-widget">
225
                                                                                ' . __( 'Upgrade to Scan', 'accessibility-checker' ) . '
×
226
                                                                        </a>
227
                                                                </div>
228
                                                        </td>
229
                                                </tr>';
×
230

231
                        }
232
                }
233

234
                $html .= '
×
235
                                </tbody>
236
                        </table>
237
                </div>';
×
238

239
                $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>';
×
240

241
                if ( ! Settings::get_scannable_post_types() || ! Settings::get_scannable_post_statuses() ) {
×
242

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

246
                }
247

248
                $html .= '
×
249
                <div class="edac-buttons-container edac-mt-3 edac-mb-3">
250
                ';
×
251

NEW
252
                if ( defined( 'EDACP_VERSION' ) && EDAC_KEY_VALID ) {
×
253
                        $html .= '
×
254
                        <a class="button edac-mr-1" href="/wp-admin/admin.php?page=accessibility_checker">' . __( 'See More Reports', 'accessibility-checker' ) . '</a>';
×
255
                }
256

257
                $html .= '
×
258
                <a href="/wp-admin/admin.php?page=accessibility_checker_settings">Edit Accessibility Checker Settings</a>
259
                </div>';
×
260

261
                $html .= '
×
262
                <hr class="edac-hr" />
263
                <h3 class="edac-summary-header">
264
                        ' . __( 'Learn Accessibility', 'accessibility-checker' ) . '
×
265
                </h3>';
×
266

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

269
                $html .= '
×
270
                <hr class="edac-hr" />
271
                <div class="edac-widget-footer-link-list">';
×
272

273
                $html .= '<h3 class="screen-reader-text">' . __( 'Additional Resources', 'accessibility-checker' ) . '</h3>';
×
274
                $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="https://equalizedigital.com/resources/?utm_source=accessibility-checker&utm_medium=software&utm_campaign=dashboard-widget">' . __( 'Blog', 'accessibility-checker' ) . '</a>';
×
275
                $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="https://equalizedigital.com/accessibility-checker/documentation/?utm_source=accessibility-checker&utm_medium=software&utm_campaign=dashboard-widget">' . __( 'Documentation', 'accessibility-checker' ) . '</a></div></div>';
×
276

277
                //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
278
                echo $html;
×
279
        }
280
}
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

© 2025 Coveralls, Inc