WP Accessibility - Version 1.6.2

Version Description

  • Removed 'ScrollTo' JS.
  • Changed toolbar font size setting from em to px for predictability.
  • Updated 'diagnostic.css' to latest version.
  • Removed 'create_function' for PHP 7.2 compatibility.
  • Removed 'extract'
  • Code updated to conform to WordPress PHP standards
  • Code restructuring.
Download this release

Release Info

Developer joedolson
Plugin Icon 128x128 WP Accessibility
Version 1.6.2
Comparing to
See all releases

Code changes from version 1.6.1 to 1.6.2

class-wp-accessibility-toolbar.php ADDED
@@ -0,0 +1,86 @@
1
+ <?php
2
+ /**
3
+ * WP Accessibility toolbar widget
4
+ *
5
+ * @category Widgets
6
+ * @package WP Accessibility
7
+ * @author Joe Dolson
8
+ * @license GPLv2 or later
9
+ * @link https://www.joedolson.com/wp-accessibility/
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+
16
+ /**
17
+ * WP Accessibility toolbar widget class.
18
+ *
19
+ * @category Widgets
20
+ * @package WP Accessibility
21
+ * @author Joe Dolson
22
+ * @copyright 2012
23
+ * @license GPLv2 or later
24
+ * @version 1.0
25
+ */
26
+ class Wp_Accessibility_Toolbar extends WP_Widget {
27
+ /**
28
+ * Construct widget.
29
+ */
30
+ function __construct() {
31
+ parent::__construct(
32
+ false,
33
+ $name = __( 'Accessibility Toolbar', 'wp-accessibility' ),
34
+ array( 'customize_selective_refresh' => true )
35
+ );
36
+ }
37
+
38
+ /**
39
+ * Widget output.
40
+ *
41
+ * @param array $args Theme widget arguments.
42
+ * @param array $instance Widget settings.
43
+ */
44
+ function widget( $args, $instance ) {
45
+ $before_widget = $args['before_widget'];
46
+ $after_widget = $args['after_widget'];
47
+ $before_title = $args['before_title'];
48
+ $after_title = $args['after_title'];
49
+
50
+ $title = apply_filters( 'widget_title', ( empty( $instance['title'] ) ? false : $instance['title'] ), $instance, $args );
51
+ echo $before_widget;
52
+ echo ( $title ) ? $before_title . $title . $after_title : '';
53
+ echo wpa_toolbar_html();
54
+ echo $after_widget;
55
+ }
56
+
57
+ /**
58
+ * Form to construct widget settings.
59
+ *
60
+ * @param array $instance Current widget settings.
61
+ */
62
+ function form( $instance ) {
63
+ $title = ( isset( $instance['title'] ) ) ? esc_attr( $instance['title'] ) : '';
64
+ ?>
65
+ <p>
66
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'wp-accessibility' ); ?></label>
67
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>"/>
68
+ </p>
69
+ <?php
70
+ }
71
+
72
+ /**
73
+ * Update widget settings.
74
+ *
75
+ * @param array $new_instance New settings.
76
+ * @param array $old_instance Old settings.
77
+ *
78
+ * @return array updated settings.
79
+ */
80
+ function update( $new_instance, $old_instance ) {
81
+ $instance = $old_instance;
82
+ $instance['title'] = strip_tags( $new_instance['title'] );
83
+
84
+ return $instance;
85
+ }
86
+ }
css/diagnostic-head.css CHANGED
@@ -10,69 +10,144 @@ body:before {
10
background: #fcfcfc;
11
color: #933;
12
padding: 5px 0;
13
}
14
15
- /*
16
- dir attribute
17
- */
18
- /* If used, dir attribute only accepts 2 possible values */
19
- [dir]:not([dir="rtl"]):not([dir="ltr"]) {
20
- background-color: hotpink !important;
21
}
22
23
- [dir="rtl"]:before,
24
- [dir="ltr"]:before {
25
- content: "dir: " attr(dir);
26
- display: block;
27
- color: darkgreen !important;
28
- background-color: lightyellow !important;
29
}
30
31
/*
32
- title element: not empty, unique and in head
33
*/
34
- head, title {
35
- display: block;
36
}
37
38
- title:before {
39
- content: 'TITLE';
40
- margin: 0 0.4em;
41
- padding: 0 0.4em;
42
- color: black;
43
- background-color: #D0D0D0;
44
- border-radius: 3px;
45
}
46
47
- head > title {
48
- margin: 0;
49
- padding: 0.2em 0;
50
- border-bottom: 1px solid #CCC;
51
- color: #444;
52
- background-color: white;
53
}
54
55
/* empty? */
56
title:empty:after {
57
- content: "ERROR: title element is empty and it shouldn't be";
58
- color: #C22;
59
- background-color: white;
60
}
61
62
- title:empty:before,
63
- title ~ title:before {
64
- /* not unique? */
65
- color: white;
66
- background-color: #C22;
67
- }
68
69
- title ~ title:after {
70
- content: ' (ERROR: why is there more than one title element?)';
71
}
72
73
- title ~ title {
74
- color: #C22;
75
- background-color: white;
76
}
77
78
/*
@@ -80,39 +155,79 @@ title ~ title {
80
@source CSS selector from Opquast Checklist Accessibility First step https://checklists.opquast.com/en/accessibilityfirststep/
81
@reference Technique for WCAG 2.0 F40: Failure (...) due to using meta redirect with a time limit - http://www.w3.org/TR/WCAG-TECHS/F40.html
82
*/
83
- meta[http-equiv=refresh]:before {
84
- content: 'meta refresh detected';
85
}
86
87
- meta[http-equiv=refresh] {
88
- display: block;
89
- padding: 0.4em;
90
- font-weight: bold;
91
- color: white;
92
- background-color: darkred;
93
- }
94
95
/*
96
Lang attribute on html element
97
@reference Technique for WCAG 2.0 H57: Using language attributes on the html element - http://www.w3.org/TR/WCAG-TECHS/F40.html
98
*/
99
- html[lang] {
100
- display: block;
101
- margin-top: 0.4em;
102
}
103
104
- html:not([lang]):before {
105
- content: 'no lang attribute detected';
106
- margin: 0.4em;
107
- padding: 0 0.4em;
108
- color: white;
109
- background-color: darkred;
110
- border-radius: 3px;
111
}
112
113
- html[lang]:before {
114
- content: 'Default page language: ' attr(lang);
115
- margin: 0.4em;
116
- color: #444;
117
- background-color: white;
118
}
10
background: #fcfcfc;
11
color: #933;
12
padding: 5px 0;
13
+ font-size: 16px;
14
}
15
16
+ applet:after, basefont:after, center:after, dir:after, font:after, isindex:after, menu:after, s:after, strike:after, u:after,
17
+ *[background]:after, *[bgcolor]:after, *[clear]:after, *[color]:after, *[compact]:after, *[noshade]:after, *[nowrap]:after, *[size]:after,
18
+ *[start]:after, *[bottommargin]:after, *[leftmargin]:after, *[rightmargin]:after, *[topmargin]:after, *[marginheight]:after, *[marginwidth]:after,
19
+ *[alink]:after, *[link]:after, *[text]:after, *[vlink]:after, *[align]:after, *[valign]:after, *[hspace]:after, *[vspace]:after, *[height]:after,
20
+ *[width]:after, ul[type]:after, ol[type]:after, li[type]:after, iframe:not([title]):after, img[ismap]:after, img:not([alt]):after,
21
+ div[role="img"]:not([aria-label]):after, img:not([src]):after,img[src=""]:after, img[src="#"]:after, a[href=""]:after, a[href="#"]:after,
22
+ a:not([href]):after, a[href*=javascript\:]:after, a[onclick]:after, fieldset > :not(legend):first-child:after, fieldset > legend:not(:first-child):after,
23
+ input[type="image"][alt=""]:after, input[type="image"]:not([alt]):after, [dir]:not([dir="rtl"]):not([dir="ltr"]):after,
24
+ meta[http-equiv=refresh]:after, html:not([lang]):after, *[accesskey]:after, th:empty:after, table > tr:only-child:after, table > tbody > tr:only-child:after,
25
+ table[align]:after, table[bgcolor]:after, table[border]:after, table[cellpadding]:after,table[cellspacing]:after,table[width]:after, td[width]:after,
26
+ td[valign]:after, title:empty:after, ol > *:not(li):after, ul > *:not(li):after, dl > *:not(dt):not(dd):after, dt + *:not(dd):after, th > table:after,
27
+ td > table:after, body > table:first-child:after, p b:only-child:after, p strong:only-child:after, ol[type]:after, ul[type]:after, area:not([alt]):after,
28
+ table table:after
29
+ {
30
+ display: inline-block !important;
31
+ background: #dc143c !important;
32
+ padding: 0.25em !important;
33
+ font-family: 'comic sans ms', cursive !important;
34
+ color: #fff !important;
35
+ font-size: 14px !important;
36
+ text-shadow: none !important;
37
+ font-weight: normal !important;
38
+ font-style: normal !important;
39
}
40
41
+ /* Deprecated Elements - cannot be overridden by user styles */
42
+ applet:after, basefont:after, center:after, dir:after, font:after, isindex:after, menu:after, s:after, strike:after, u:after {
43
+ content: 'ERROR: Deprecated elements found. They cannot be overridden by user styles' !important;
44
+ }
45
+
46
+ /* Deprecated Attributes - should not be used anymore */
47
+ *[background]:after, *[bgcolor]:after, *[clear]:after, *[color]:after, *[compact]:after, *[noshade]:after, *[nowrap]:after, *[size]:after,
48
+ *[start]:after, *[bottommargin]:after, *[leftmargin]:after, *[rightmargin]:after, *[topmargin]:after, *[marginheight]:after, *[marginwidth]:after,
49
+ *[alink]:after, *[link]:after, *[text]:after, *[vlink]:after, *[align]:after, *[valign]:after, *[hspace]:after, *[vspace]:after, *[height]:after,
50
+ *[width]:after, ul[type]:after, ol[type]:after, li[type]:after {
51
+ content: 'ERROR: Deprecated attributes found. They should not be used anymore' !important;
52
+ }
53
+
54
+ /* Inline frames without title attribute */
55
+ iframe:not([title]):after{
56
+ content: 'ERROR: iframe has no title. ' !important;
57
+ }
58
+
59
+
60
+ /**
61
+ * Image-related checks
62
+ */
63
+
64
+ /* server-side image map. Yes these are sometimes still seen, if rarely */
65
+ img[ismap]:after{
66
+ content: 'ERROR: Replace server-side image map' !important;
67
+ }
68
+
69
+ /* Images without alt attribute */
70
+ img:not([alt]):after {
71
+ content: 'ERROR: All images must have alt attributes' !important;
72
+ }
73
+
74
+ area:not([alt]):after{
75
+ content: 'ERROR: Provide alt attribute for all areas of an image map' !important;
76
}
77
78
+
79
+ /* something that has a role of image but no alternative */
80
+ *[role="img"]:not([aria-label]):after{
81
+ content: 'ERROR: Item has image role without an alternative' !important;
82
+ }
83
+
84
+ /* images without a source */
85
+ img:not([src]):after,
86
+ img[src=""]:after,
87
+ img[src="#"]:after{
88
+ content: 'ERROR: image has no source' !important;
89
+ }
90
+
91
+ /**
92
+ * Link-related checks
93
+ */
94
+
95
+ /* Bad links, possibly relying on javascript to do something */
96
+ a[href=""]:after, a[href="#"]:after, a:not([href]):after, a[href*=javascript\:]:after, a:not([href])[onclick]:after{
97
+ content: 'ERROR: links must have a valid hypertext reference' !important;
98
+ }
99
+
100
+
101
+
102
+ /**
103
+ * form-related checks
104
+ */
105
+
106
/*
107
+ Legends
108
*/
109
+ fieldset > :not(legend):first-child:after, /* no other element than a legend can be first child of a fieldset element */
110
+ fieldset > legend:not(:first-child):after { /* and a legend can't be anything else than first child of a fieldset element */
111
+ content: 'ERROR: fieldsets must have legends' !important;
112
}
113
114
+
115
+
116
+ /*
117
+ Input[type="image"] and their alt attribute
118
+ Note: adding :before or :after on this type of element won't work as expected. Maybe background-image encoded in base64?
119
+ @reference Technique for WCAG 2.0 H36: Using alt attributes on images used as submit buttons - http://www.w3.org/TR/WCAG-TECHS/H36.html
120
+ @reference Technique for WCAG 2.0 F65: Failure (...) due to omitting the alt attribute on (...) input elements of type "image" - http://www.w3.org/TR/WCAG-TECHS/F65.html
121
+ */
122
+ input[type="image"][alt=""]:after,
123
+ input[type="image"]:not([alt]):after {
124
+ content: 'ERROR: Image input requires alt attribute' !important;
125
}
126
127
+
128
+ /*
129
+ dir attribute
130
+ */
131
+ /* If used, dir attribute only accepts 2 possible values */
132
+ [dir]:not([dir="rtl"]):not([dir="ltr"]):after {
133
+ content: 'ERROR: dir attribute has invalid value' !important;
134
}
135
136
/* empty? */
137
title:empty:after {
138
+ content: 'ERROR: title element is empty' !important;
139
}
140
141
142
+ /* Implicit headings */
143
+ p b:only-child:after, p strong:only-child:after{
144
+ content: 'ERROR: Should this bold text be a heading?' !important;
145
}
146
147
+
148
+ /* bullet type should be declared in CSS */
149
+ ol[type]:after, ul[type]:after{
150
+ content: 'ERROR: Bullet type should be declared in CSS' !important;
151
}
152
153
/*
155
@source CSS selector from Opquast Checklist Accessibility First step https://checklists.opquast.com/en/accessibilityfirststep/
156
@reference Technique for WCAG 2.0 F40: Failure (...) due to using meta redirect with a time limit - http://www.w3.org/TR/WCAG-TECHS/F40.html
157
*/
158
+ meta[http-equiv=refresh]:after {
159
+ content: 'ERROR: Replace meta refresh' !important;
160
}
161
162
163
/*
164
Lang attribute on html element
165
@reference Technique for WCAG 2.0 H57: Using language attributes on the html element - http://www.w3.org/TR/WCAG-TECHS/F40.html
166
*/
167
+
168
+ html:not([lang]):after{
169
+ content: 'ERROR: HTML element requires lang attribute' !important;
170
+ }
171
+
172
+
173
+
174
+ /* Accesskey is a bad idea.
175
+ * @reference Old discussion but still hits on salient points http://www.cs.tut.fi/~jkorpela/forms/accesskey.html */
176
+ *[accesskey]:after{
177
+ content: 'ERROR: Accesskey is a bad idea' !important;
178
+ }
179
+
180
+
181
+ /**
182
+ * TABLE RELATED CHECKS
183
+ */
184
+
185
+ /* Empty Header Cells */
186
+ th:empty:after {
187
+ content: 'ERROR: replace empty TH element with TD' !important;
188
+ }
189
+
190
+ /* test for nested table */
191
+ th > table:after, td > table:after, body > table:first-child:after, table table:after{
192
+ content: 'ERROR: nested table found. Is this a layout table?' !important;
193
+ }
194
+
195
+
196
+
197
+ /* only one TR in the table. Is that a layout table? */
198
+ table > tr:only-child:after,
199
+ table > tbody > tr:only-child:after {
200
+ content: 'ERROR: only one TR in this table. Is this a layout table?' !important;
201
+ }
202
+
203
+ /* Deprecated attributes on table */
204
+ table[align]:after,
205
+ table[bgcolor]:after,
206
+ table[border]:after,
207
+ table[cellpadding]:after,
208
+ table[cellspacing]:after,
209
+ table[width]:after,
210
+ td[width]:after,
211
+ td[valign]:after
212
+ {
213
+ content: 'ERROR: Deprecated markup in table' !important;
214
+ }
215
+
216
+
217
+ /**
218
+ * List-related issues
219
+ */
220
+
221
+
222
+ ol > *:not(li):after,
223
+ ul > *:not(li):after {
224
+ content: 'ERROR: List markup invalid' !important;
225
}
226
227
+ dl > *:not(dt):not(dd):after {
228
+ content: 'ERROR: Definition list markup invalid' !important;
229
}
230
231
+ dt + *:not(dd):after {
232
+ content: 'ERROR: Definition must follow term' !important;
233
}
lang/wp-accessibility-de_DE.mo DELETED
Binary file
lang/wp-accessibility-fr_FR.mo DELETED
Binary file
lang/wp-accessibility.pot DELETED
@@ -1,470 +0,0 @@
1
- # Copyright (C) 2014 WP Accessibility
2
- # This file is distributed under the same license as the WP Accessibility package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: WP Accessibility 1.3.0\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-accessibility\n"
7
- "POT-Creation-Date: 2014-04-01 18:39:06+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
12
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
- "Language-Team: LANGUAGE <LL@li.org>\n"
14
-
15
- #: templates/longdesc-template.php:26
16
- msgid "Return to article."
17
- msgstr ""
18
-
19
- #: wp-accessibility.php:75
20
- msgid "Accessibility Settings"
21
- msgstr ""
22
-
23
- #: wp-accessibility.php:180
24
- msgid "Accessibility Toolbar"
25
- msgstr ""
26
-
27
- #: wp-accessibility.php:189 wp-accessibility.php:209
28
- msgid "Toggle High Contrast"
29
- msgstr ""
30
-
31
- #: wp-accessibility.php:190 wp-accessibility.php:210
32
- msgid "Toggle Grayscale"
33
- msgstr ""
34
-
35
- #: wp-accessibility.php:191 wp-accessibility.php:211
36
- msgid "Toggle Font size"
37
- msgstr ""
38
-
39
- #: wp-accessibility.php:288
40
- msgid "Skip to content"
41
- msgstr ""
42
-
43
- #: wp-accessibility.php:289
44
- msgid "Skip to navigation"
45
- msgstr ""
46
-
47
- #: wp-accessibility.php:290
48
- msgid "Site map"
49
- msgstr ""
50
-
51
- #: wp-accessibility.php:479
52
- msgid "Remove Title Attributes Settings Updated"
53
- msgstr ""
54
-
55
- #: wp-accessibility.php:499
56
- msgid ""
57
- "WP Accessibility does not provide any styles for visible skiplinks. You can "
58
- "still set the look of the links using the textareas provided, but all other "
59
- "layout must be assigned in your theme."
60
- msgstr ""
61
-
62
- #: wp-accessibility.php:503
63
- msgid "Add Skiplinks Settings Updated"
64
- msgstr ""
65
-
66
- #: wp-accessibility.php:539
67
- msgid "Miscellaneous Accessibility Settings Updated"
68
- msgstr ""
69
-
70
- #: wp-accessibility.php:621
71
- msgid "WP Accessibility: Settings"
72
- msgstr ""
73
-
74
- #: wp-accessibility.php:626
75
- msgid "Remove Title Attributes"
76
- msgstr ""
77
-
78
- #: wp-accessibility.php:630
79
- msgid "Remove title attributes from:"
80
- msgstr ""
81
-
82
- #: wp-accessibility.php:632
83
- msgid "Nav menus"
84
- msgstr ""
85
-
86
- #: wp-accessibility.php:632 wp-accessibility.php:633 wp-accessibility.php:637
87
- #: wp-accessibility.php:638 wp-accessibility.php:639
88
- msgid "Obsolete since WordPress 3.8"
89
- msgstr ""
90
-
91
- #: wp-accessibility.php:633
92
- msgid "Page lists"
93
- msgstr ""
94
-
95
- #: wp-accessibility.php:634
96
- msgid "Category lists"
97
- msgstr ""
98
-
99
- #: wp-accessibility.php:635
100
- msgid "Archive links"
101
- msgstr ""
102
-
103
- #: wp-accessibility.php:636
104
- msgid "Tag clouds"
105
- msgstr ""
106
-
107
- #: wp-accessibility.php:637
108
- msgid "Category links"
109
- msgstr ""
110
-
111
- #: wp-accessibility.php:638
112
- msgid "Post edit links"
113
- msgstr ""
114
-
115
- #: wp-accessibility.php:639
116
- msgid "Edit comment links"
117
- msgstr ""
118
-
119
- #: wp-accessibility.php:646
120
- msgid "Update Title Attribute Settings"
121
- msgstr ""
122
-
123
- #: wp-accessibility.php:652
124
- msgid "Add Skiplinks"
125
- msgstr ""
126
-
127
- #: wp-accessibility.php:656
128
- msgid "Configure Skiplinks"
129
- msgstr ""
130
-
131
- #: wp-accessibility.php:658
132
- msgid "Enable Skiplinks"
133
- msgstr ""
134
-
135
- #: wp-accessibility.php:659
136
- msgid "Skiplinks always visible"
137
- msgstr ""
138
-
139
- #: wp-accessibility.php:660
140
- msgid "Skip to Content link target (ID of your main content container)"
141
- msgstr ""
142
-
143
- #: wp-accessibility.php:661
144
- msgid "Skip to Navigation link target (ID of your main navigation container)"
145
- msgstr ""
146
-
147
- #: wp-accessibility.php:662
148
- msgid "Site Map link target (URL for your site map)"
149
- msgstr ""
150
-
151
- #: wp-accessibility.php:663
152
- msgid "Add your own link (link or container ID)"
153
- msgstr ""
154
-
155
- #: wp-accessibility.php:663
156
- msgid "Link text for your link"
157
- msgstr ""
158
-
159
- #: wp-accessibility.php:664
160
- msgid "Styles for Skiplinks when they have focus"
161
- msgstr ""
162
-
163
- #: wp-accessibility.php:666
164
- msgid "(Not currently visible)"
165
- msgstr ""
166
-
167
- #: wp-accessibility.php:667
168
- msgid "Styles for Skiplinks without focus"
169
- msgstr ""
170
-
171
- #: wp-accessibility.php:675
172
- msgid "Update Skiplink Settings"
173
- msgstr ""
174
-
175
- #: wp-accessibility.php:681
176
- msgid "Miscellaneous Accessibility Settings"
177
- msgstr ""
178
-
179
- #: wp-accessibility.php:685
180
- msgid "Miscellaneous"
181
- msgstr ""
182
-
183
- #: wp-accessibility.php:687
184
- msgid "Add Site Language and text direction to HTML element"
185
- msgstr ""
186
-
187
- #: wp-accessibility.php:688
188
- msgid "Remove target attribute from links"
189
- msgstr ""
190
-
191
- #: wp-accessibility.php:689
192
- msgid ""
193
- "Force search error on empty search submission (theme must have search.php "
194
- "template)"
195
- msgstr ""
196
-
197
- #: wp-accessibility.php:690
198
- msgid "Remove tabindex from focusable elements"
199
- msgstr ""
200
-
201
- #: wp-accessibility.php:691
202
- msgid "Long Description UI"
203
- msgstr ""
204
-
205
- #: wp-accessibility.php:692
206
- msgid "Link to description"
207
- msgstr ""
208
-
209
- #: wp-accessibility.php:693
210
- msgid "Button trigger to overlay image"
211
- msgstr ""
212
-
213
- #: wp-accessibility.php:694
214
- msgid "Browser defaults only"
215
- msgstr ""
216
-
217
- #: wp-accessibility.php:697
218
- msgid "Enable WordPress Admin stylesheet"
219
- msgstr ""
220
-
221
- #: wp-accessibility.php:698
222
- msgid "Make row actions always visible"
223
- msgstr ""
224
-
225
- #: wp-accessibility.php:699
226
- msgid ""
227
- "Remove title attribute from images inserted into post content and featured "
228
- "images."
229
- msgstr ""
230
-
231
- #: wp-accessibility.php:700
232
- msgid "Add Accessibility toolbar with fontsize adjustment and contrast toggle"
233
- msgstr ""
234
-
235
- #: wp-accessibility.php:701
236
- msgid "Support Accessibility toolbar as shortcode or widget"
237
- msgstr ""
238
-
239
- #: wp-accessibility.php:702
240
- msgid "Include grayscale toggle with Accessibility toolbar"
241
- msgstr ""
242
-
243
- #: wp-accessibility.php:703
244
- msgid "Enable diagnostic CSS"
245
- msgstr ""
246
-
247
- #: wp-accessibility.php:704
248
- msgid "Add post title to \"more\" links."
249
- msgstr ""
250
-
251
- #: wp-accessibility.php:705
252
- msgid "Continue reading text"
253
- msgstr ""
254
-
255
- #: wp-accessibility.php:706
256
- msgid "Add outline to elements on keyboard focus"
257
- msgstr ""
258
-
259
- #: wp-accessibility.php:706
260
- msgid "Outline color (hexadecimal, optional)"
261
- msgstr ""
262
-
263
- #: wp-accessibility.php:713
264
- msgid "Update Miscellaneous Settings"
265
- msgstr ""
266
-
267
- #: wp-accessibility.php:718
268
- msgid "Color Contrast Tester"
269
- msgstr ""
270
-
271
- #: wp-accessibility.php:735
272
- msgid ""
273
- "Luminosity Contrast Ratio for <code>#%2$s</code> and <code>#%3$s</code> is "
274
- "<strong>%1$s</strong> (Threshold: greater than 7:1 for AAA, 4.5:1 for AA)"
275
- msgstr ""
276
-
277
- #: wp-accessibility.php:737
278
- msgid ""
279
- "The colors compared <strong>pass</strong> the relative luminosity test at "
280
- "level AAA."
281
- msgstr ""
282
-
283
- #: wp-accessibility.php:740
284
- msgid ""
285
- "The colors compared <strong>pass</strong> the relative luminosity test at "
286
- "level AA."
287
- msgstr ""
288
-
289
- #: wp-accessibility.php:743
290
- msgid ""
291
- "The colors compared pass the relative luminosity test <strong>only when used "
292
- "in large print</strong> situations (greater than 18pt text or 14pt bold "
293
- "text.)"
294
- msgstr ""
295
-
296
- #: wp-accessibility.php:746
297
- msgid ""
298
- "The colors compared <strong>do not pass</strong> the relative luminosity "
299
- "test."
300
- msgstr ""
301
-
302
- #: wp-accessibility.php:748
303
- msgid "Test another set of colors"
304
- msgstr ""
305
-
306
- #: wp-accessibility.php:763
307
- msgid "Test of relative luminosity"
308
- msgstr ""
309
-
310
- #: wp-accessibility.php:765
311
- msgid "Foreground color"
312
- msgstr ""
313
-
314
- #: wp-accessibility.php:766
315
- msgid "Background color"
316
- msgstr ""
317
-
318
- #: wp-accessibility.php:773
319
- msgid "Check Color Contrast"
320
- msgstr ""
321
-
322
- #: wp-accessibility.php:778
323
- msgid "Get Plug-in Support"
324
- msgstr ""
325
-
326
- #: wp-accessibility.php:791
327
- msgid "Support this Plugin"
328
- msgstr ""
329
-
330
- #: wp-accessibility.php:797
331
- msgid ""
332
- "If you've found WP Accessibility useful, then please consider <a "
333
- "href='http://wordpress.org/extend/plugins/wp-accessibility/'>rating it five "
334
- "stars</a>, <a href='http://www.joedolson.com/donate.php'>making a donation</"
335
- "a>, or <a href='http://translate.joedolson.com/projects/wp-"
336
- "accessibility'>helping with translation</a>."
337
- msgstr ""
338
-
339
- #: wp-accessibility.php:799
340
- msgid ""
341
- "<a href=\"http://www.joedolson.com/donate.php\">Make a donation today!</a> "
342
- "Every donation counts - donate $5, $20, or $100 and help me keep this plug-"
343
- "in running!"
344
- msgstr ""
345
-
346
- #: wp-accessibility.php:815
347
- msgid "Accessibility References"
348
- msgstr ""
349
-
350
- #: wp-accessibility.php:830
351
- msgid "Contributing References"
352
- msgstr ""
353
-
354
- #: wp-accessibility.php:848
355
- msgid "Customization Notes"
356
- msgstr ""
357
-
358
- #: wp-accessibility.php:851
359
- msgid ""
360
- "It is almost impossible for the Accessibility Toolbar to guarantee a good "
361
- "result for large text or high contrast modes. Author your own high-contrast "
362
- "styles by placing a stylesheet called <code>a11y-contrast.css</code> in your "
363
- "Theme's stylesheet directory."
364
- msgstr ""
365
-
366
- #: wp-accessibility.php:854
367
- msgid ""
368
- "Define custom styles for large print by asssigning them in the body class "
369
- "<code>.fontsize</code> in your theme stylesheet."
370
- msgstr ""
371
-
372
- #: wp-accessibility.php:857
373
- msgid ""
374
- "Define a custom long description template by adding the template \"longdesc-"
375
- "template.php\" to your theme directory."
376
- msgstr ""
377
-
378
- #: wp-accessibility.php:903
379
- msgid "WP A11Y: Recent Posts"
380
- msgstr ""
381
-
382
- #: wp-accessibility.php:920
383
- msgid "Recent Posts"
384
- msgstr ""
385
-
386
- #: wp-accessibility.php:963
387
- msgid "Title:"
388
- msgstr ""
389
-
390
- #: wp-accessibility.php:966
391
- msgid "Number of posts to show:"
392
- msgstr ""
393
-
394
- #: wp-accessibility.php:1053
395
- msgid ""
396
- "Please read the FAQ and other Help documents before making a support request."
397
- msgstr ""
398
-
399
- #: wp-accessibility.php:1055
400
- msgid "Please describe your problem. I'm not psychic."
401
- msgstr ""
402
-
403
- #: wp-accessibility.php:1059
404
- msgid ""
405
- "Thank you for supporting the continuing development of this plug-in! I'll "
406
- "get back to you as soon as I can."
407
- msgstr ""
408
-
409
- #: wp-accessibility.php:1061
410
- msgid ""
411
- "I cannot provide free support, but will treat your request as a bug report, "
412
- "and will incorporate any permanent solutions I discover into the plug-in."
413
- msgstr ""
414
-
415
- #: wp-accessibility.php:1073
416
- msgid ""
417
- "<strong>Please note</strong>: I do keep records of those who have donated, "
418
- "but if your donation came from somebody other than your account at this web "
419
- "site, you must note this in your message."
420
- msgstr ""
421
-
422
- #: wp-accessibility.php:1077
423
- msgid "From:"
424
- msgstr ""
425
-
426
- #: wp-accessibility.php:1080
427
- msgid ""
428
- "I have read <a href=\"%1$s\">the FAQ for this plug-in</a> <span>(required)</"
429
- "span>"
430
- msgstr ""
431
-
432
- #: wp-accessibility.php:1083
433
- msgid ""
434
- "I have <a href=\"%1$s\">made a donation to help support this plug-in</a>"
435
- msgstr ""
436
-
437
- #: wp-accessibility.php:1086
438
- msgid "Support Request:"
439
- msgstr ""
440
-
441
- #: wp-accessibility.php:1089
442
- msgid "Send Support Request"
443
- msgstr ""
444
-
445
- #: wp-accessibility.php:1092
446
- msgid ""
447
- "The following additional information will be sent with your support request:"
448
- msgstr ""
449
-
450
- #. Plugin Name of the plugin/theme
451
- msgid "WP Accessibility"
452
- msgstr ""
453
-
454
- #. Plugin URI of the plugin/theme
455
- msgid "http://www.joedolson.com/articles/wp-accessibility/"
456
- msgstr ""
457
-
458
- #. Description of the plugin/theme
459
- msgid ""
460
- "Provides options to improve accessibility in your WordPress site, including "
461
- "removing title attributes."
462
- msgstr ""
463
-
464
- #. Author of the plugin/theme
465
- msgid "Joe Dolson"
466
- msgstr ""
467
-
468
- #. Author URI of the plugin/theme
469
- msgid "http://www.joedolson.com/"
470
- msgstr ""
readme.txt CHANGED
@@ -3,8 +3,9 @@ Contributors: joedolson
3
Donate link: http://www.joedolson.com/donate/
4
Tags: title, accessibility, accessible, navigation, wcag, a11y, section508, focus, alt text, labels, aria
5
Requires at least: 3.4.2
6
Tested up to: 4.9
7
- Stable tag: 1.6.1
8
Text Domain: wp-accessibility
9
License: GPLv2 or later
10
@@ -46,7 +47,10 @@ Learn more! <a href="http://make.wordpress.org/accessibility/wp-accessibility-pl
46
47
The plug-in is intended to help with deficiencies commonly found in themes and to solve some issues in WordPress core. It can't correct every problem (by a long shot), but provides tools to fix some issues, supplement the accessibility of your site, or identify problems.
48
49
- Translating my plug-ins is always appreciated. Visit <a href="https://translate.wordpress.org/projects/wp-plugins/wp-accessibility">the WordPress translations site</a> to get your language into shape!
50
51
== Installation ==
52
@@ -58,10 +62,18 @@ Translating my plug-ins is always appreciated. Visit <a href="https://translate.
58
59
= Future =
60
61
- [Suggest a change!](https://github.com/joedolson/wp-accessibility/)
62
* Conflict with NextGen gallery to explore
63
- * Gutenberg: filter colors in cover text?
64
- *
65
66
= 1.6.1 =
67
3
Donate link: http://www.joedolson.com/donate/
4
Tags: title, accessibility, accessible, navigation, wcag, a11y, section508, focus, alt text, labels, aria
5
Requires at least: 3.4.2
6
+ Requires PHP: 5.3
7
Tested up to: 4.9
8
+ Stable tag: 1.6.2
9
Text Domain: wp-accessibility
10
License: GPLv2 or later
11
47
48
The plug-in is intended to help with deficiencies commonly found in themes and to solve some issues in WordPress core. It can't correct every problem (by a long shot), but provides tools to fix some issues, supplement the accessibility of your site, or identify problems.
49
50
+ = Contribute! =
51
+
52
+ * <a href="https://translate.wordpress.org/projects/wp-plugins/wp-accessibility">Help Translate WP Accessibility</a>
53
+ * <a href="https://github.com/joedolson/wp-accessibility">Contribute to WP Accessibility</a>
54
55
== Installation ==
56
62
63
= Future =
64
65
+ [Suggest a change!](https://github.com/joedolson/wp-accessibility/issues/)
66
* Conflict with NextGen gallery to explore
67
+
68
+ = 1.6.2 =
69
+
70
+ * Removed 'ScrollTo' JS.
71
+ * Changed toolbar font size setting from em to px for predictability.
72
+ * Updated 'diagnostic.css' to latest version.
73
+ * Removed 'create_function' for PHP 7.2 compatibility.
74
+ * Removed 'extract'
75
+ * Code updated to conform to WordPress PHP standards
76
+ * Code restructuring.
77
78
= 1.6.1 =
79
templates/longdesc-template.php CHANGED
@@ -1,9 +1,18 @@
1
<?php
2
- /*
3
- * The goal for this template is to provide the simplest possible interface to view the long description.
4
- * If you replace the template, I recommend against including your peripheral design, such as navigation.
5
- * The purpose of the long description is to get the description and return to your previous context.
6
- */
7
?>
8
<!DOCTYPE html>
9
<html <?php language_attributes(); ?>>
@@ -31,4 +40,4 @@
31
</div>
32
</div>
33
</body>
34
- </html>
1
<?php
2
+ /**
3
+ * Longdesc display template.
4
+ *
5
+ * The goal for this template is to provide the simplest possible interface to view the long description.
6
+ * If you replace the template, I recommend against including your peripheral design, such as navigation.
7
+ * The purpose of the long description is to get the description and return to your previous context.
8
+ *
9
+ * @category Templates
10
+ * @package WP Accessibility
11
+ * @author Joe Dolson
12
+ * @license GPLv2 or later
13
+ * @link https://www.joedolson.com/wp-accessibility/
14
+ */
15
+
16
?>
17
<!DOCTYPE html>
18
<html <?php language_attributes(); ?>>
40
</div>
41
</div>
42
</body>
43
+ </html>
toolbar/README.md DELETED
@@ -1,18 +0,0 @@
1
- <h1>a11y (accessibility) toolbar</h1>
2
-
3
- <h3>Goals</h3>
4
- <ul>
5
- <li>Subtle, yet noticeable; easy to use</li>
6
- <li>Minimally "designed" so that anyone and everyone can and will want to use it on their site, blog, ecommerce, etc.</li>
7
- <li>Doesn't change existing site layout, but will enhance readability when used</li>
8
- <li>Semantic; assistive technology and keyboard accessible</li>
9
- </ul>
10
-
11
- <h3>Known issues (things in-progress)</h3>
12
-
13
- <ul>
14
- <li>Only Firefox and Webkit browsers can desaturate</li>
15
- <li><strike>There are tiny shifts in the sizes of the icons when the font size is increased</strike></li>
16
- <li>Sometimes the styles of a website might take precedence over styles for the toolbar</li>
17
- <li>The skip link currently looks for a specific ID; I'd like to make it more relative, perhaps by skipping to HTML5's role='main' instead</li>
18
- </ul>
toolbar/js/a11y.js CHANGED
@@ -5,112 +5,101 @@
5
6
// Cookie handler, non-$ style
7
function createCookie(name, value, days) {
8
- if (days) {
9
- var date = new Date();
10
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
11
- var expires = "; expires=" + date.toGMTString();
12
- } else {
13
- var expires = "";
14
}
15
16
- document.cookie = name + "=" + value + expires + "; path=/";
17
}
18
19
function readCookie(name) {
20
- var nameEQ = name + "=";
21
- var ca = document.cookie.split(';');
22
- for (var i = 0; i < ca.length; i++) {
23
- var c = ca[i];
24
- while (c.charAt(0) == ' ') c = c.substring(1, c.length);
25
- if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
26
- }
27
28
- return null;
29
}
30
31
function eraseCookie(name) {
32
- // createCookie(name, "", -1);
33
- createCookie(name, "");
34
}
35
36
( function( $ ) {
37
- // Saturation handler
38
- if (readCookie('a11y-desaturated')) {
39
- $('body').addClass('desaturated');
40
- $('#is_normal_color').attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active');
41
- }
42
43
- if (readCookie('a11y-high-contrast')) {
44
- $('body').addClass('contrast');
45
- $('head').append($("<link href='" + a11y_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
46
- $('#is_normal_contrast').attr('id', 'is_high_contrast').attr('aria-pressed', true).addClass('active');
47
- $('.a11y-toolbar ul li a i').addClass('icon-white');
48
- }
49
50
- if (readCookie('a11y-larger-fontsize')) {
51
- $('html').addClass('fontsize');
52
- $('#is_normal_fontsize').attr('id', 'is_large_fontsize').attr('aria-pressed', true).addClass('active');
53
- }
54
55
- $('.toggle-grayscale').on('click', function (e) {
56
- if ($(this).attr('id') == "is_normal_color") {
57
- $('body').addClass('desaturated');
58
- $(this).attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active');
59
- createCookie('a11y-desaturated', '1');
60
- } else {
61
- $('body').removeClass('desaturated');
62
- $(this).attr('id', 'is_normal_color').attr('aria-pressed', false).removeClass('active');
63
- eraseCookie('a11y-desaturated');
64
- }
65
66
return false;
67
- });
68
69
- $('.toggle-contrast').on('click', function (e) {
70
- if ($(this).attr('id') == "is_normal_contrast") {
71
- $('head').append($("<link href='" + a11y_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
72
- $('body').addClass('contrast');
73
- $(this).attr('id', 'is_high_contrast').attr('aria-pressed', true).addClass('active');
74
- createCookie('a11y-high-contrast', '1');
75
- } else {
76
- $('#highContrastStylesheet').remove();
77
- $('body').removeClass('contrast');
78
- $(this).attr('id', 'is_normal_contrast').attr('aria-pressed', false).removeClass('active');
79
- eraseCookie('a11y-high-contrast');
80
- }
81
82
return false;
83
- });
84
85
- $('.toggle-fontsize').on('click', function (e) {
86
- if ($(this).attr('id') == "is_normal_fontsize") {
87
- $('html').addClass('fontsize');
88
- $(this).attr('id', 'is_large_fontsize').attr('aria-pressed', true).addClass('active');
89
- createCookie('a11y-larger-fontsize', '1');
90
- } else {
91
- $('html').removeClass('fontsize');
92
- $(this).attr('id', 'is_normal_fontsize').attr('aria-pressed', false).removeClass('active');
93
- eraseCookie('a11y-larger-fontsize');
94
- }
95
96
return false;
97
- });
98
-
99
- // Sets a -1 tabindex to ALL sections for .focus()-ing
100
- var sections = document.getElementsByTagName("section");
101
- for (var i = 0, max = sections.length; i < max; i++) {
102
- sections[i].setAttribute('tabindex', -1);
103
- sections[i].className += ' focusable';
104
- }
105
106
- // If there is a '#' in the URL (someone linking directly to a page with an anchor), go directly to that area and focus is
107
- // Thanks to WebAIM.org for this idea
108
- if (document.location.hash && document.location.hash != '#') {
109
- var anchorUponArrival = document.location.hash;
110
- setTimeout(function () {
111
- $(anchorUponArrival).scrollTo({duration: 1500});
112
- $(anchorUponArrival).focus();
113
- }, 100);
114
- }
115
116
} )( jQuery );
5
6
// Cookie handler, non-$ style
7
function createCookie(name, value, days) {
8
+ if (days) {
9
+ var date = new Date();
10
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
11
+ var expires = "; expires=" + date.toGMTString();
12
+ } else {
13
+ var expires = '';
14
}
15
16
+ document.cookie = name + "=" + value + expires + "; path=/";
17
}
18
19
function readCookie(name) {
20
+ var nameEQ = name + "=";
21
+ var ca = document.cookie.split(';');
22
+ for (var i = 0; i < ca.length; i++) {
23
+ var c = ca[i];
24
+ while (c.charAt(0) == ' ') c = c.substring(1, c.length);
25
+ if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
26
+ }
27
28
+ return null;
29
}
30
31
function eraseCookie(name) {
32
+ createCookie(name, "");
33
}
34
35
( function( $ ) {
36
+ // Saturation handler
37
+ if (readCookie('a11y-desaturated')) {
38
+ $('body').addClass('desaturated');
39
+ $('#is_normal_color').attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active');
40
+ }
41
42
+ if (readCookie('a11y-high-contrast')) {
43
+ $('body').addClass('contrast');
44
+ $('head').append($("<link href='" + a11y_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
45
+ $('#is_normal_contrast').attr('id', 'is_high_contrast').attr('aria-pressed', true).addClass('active');
46
+ $('.a11y-toolbar ul li a i').addClass('icon-white');
47
+ }
48
49
+ if (readCookie('a11y-larger-fontsize')) {
50
+ $('html').addClass('fontsize');
51
+ $('#is_normal_fontsize').attr('id', 'is_large_fontsize').attr('aria-pressed', true).addClass('active');
52
+ }
53
54
+ $('.toggle-grayscale').on('click', function (e) {
55
+ if ($(this).attr('id') == "is_normal_color") {
56
+ $('body').addClass('desaturated');
57
+ $(this).attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active');
58
+ createCookie('a11y-desaturated', '1');
59
+ } else {
60
+ $('body').removeClass('desaturated');
61
+ $(this).attr('id', 'is_normal_color').attr('aria-pressed', false).removeClass('active');
62
+ eraseCookie('a11y-desaturated');
63
+ }
64
65
return false;
66
+ });
67
68
+ $('.toggle-contrast').on('click', function (e) {
69
+ if ($(this).attr('id') == "is_normal_contrast") {
70
+ $('head').append($("<link href='" + a11y_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
71
+ $('body').addClass('contrast');
72
+ $(this).attr('id', 'is_high_contrast').attr('aria-pressed', true).addClass('active');
73
+ createCookie('a11y-high-contrast', '1');
74
+ } else {
75
+ $('#highContrastStylesheet').remove();
76
+ $('body').removeClass('contrast');
77
+ $(this).attr('id', 'is_normal_contrast').attr('aria-pressed', false).removeClass('active');
78
+ eraseCookie('a11y-high-contrast');
79
+ }
80
81
return false;
82
+ });
83
84
+ $('.toggle-fontsize').on('click', function (e) {
85
+ if ($(this).attr('id') == "is_normal_fontsize") {
86
+ $('html').addClass('fontsize');
87
+ $(this).attr('id', 'is_large_fontsize').attr('aria-pressed', true).addClass('active');
88
+ createCookie('a11y-larger-fontsize', '1');
89
+ } else {
90
+ $('html').removeClass('fontsize');
91
+ $(this).attr('id', 'is_normal_fontsize').attr('aria-pressed', false).removeClass('active');
92
+ eraseCookie('a11y-larger-fontsize');
93
+ }
94
95
return false;
96
+ });
97
98
+ // Sets a -1 tabindex to ALL sections for .focus()-ing
99
+ var sections = document.getElementsByTagName("section");
100
+ for (var i = 0, max = sections.length; i < max; i++) {
101
+ sections[i].setAttribute('tabindex', -1);
102
+ sections[i].className += ' focusable';
103
+ }
104
105
} )( jQuery );
toolbar/js/jquery.scrollto.min.js DELETED
@@ -1,89 +0,0 @@
1
- /**
2
- * Copyright (c) 2007-2013 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com
3
- * Dual licensed under MIT and GPL.
4
- * @author Ariel Flesler
5
- * @version 1.4.5
6
- */
7
- ;
8
- (function ($) {
9
- var h = $.scrollTo = function (a, b, c) {
10
- $(window).scrollTo(a, b, c)
11
- };
12
- h.defaults = {axis: 'xy', duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1, limit: true};
13
- h.window = function (a) {
14
- return $(window)._scrollable()
15
- };
16
- $.fn._scrollable = function () {
17
- return this.map(function () {
18
- var a = this, isWin = !a.nodeName || $.inArray(a.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body']) != -1;
19
- if (!isWin)return a;
20
- var b = (a.contentWindow || a).document || a.ownerDocument || a;
21
- return /webkit/i.test(navigator.userAgent) || b.compatMode == 'BackCompat' ? b.body : b.documentElement
22
- })
23
- };
24
- $.fn.scrollTo = function (e, f, g) {
25
- if (typeof f == 'object') {
26
- g = f;
27
- f = 0
28
- }
29
- if (typeof g == 'function')g = {onAfter: g};
30
- if (e == 'max')e = 9e9;
31
- g = $.extend({}, h.defaults, g);
32
- f = f || g.duration;
33
- g.queue = g.queue && g.axis.length > 1;
34
- if (g.queue)f /= 2;
35
- g.offset = both(g.offset);
36
- g.over = both(g.over);
37
- return this._scrollable().each(function () {
38
- if (e == null)return;
39
- var d = this, $elem = $(d), targ = e, toff, attr = {}, win = $elem.is('html,body');
40
- switch (typeof targ) {
41
- case'number':
42
- case'string':
43
- if (/^([+-]=?)?\d+(\.\d+)?(px|%)?#x2F;.test(targ)) {
44
- targ = both(targ);
45
- break
46
- }
47
- targ = $(targ, this);
48
- if (!targ.length)return;
49
- case'object':
50
- if (targ.is || targ.style)toff = (targ = $(targ)).offset()
51
- }
52
- $.each(g.axis.split(''), function (i, a) {
53
- var b = a == 'x' ? 'Left' : 'Top', pos = b.toLowerCase(), key = 'scroll' + b, old = d[key], max = h.max(d, a);
54
- if (toff) {
55
- attr[key] = toff[pos] + (win ? 0 : old - $elem.offset()[pos]);
56
- if (g.margin) {
57
- attr[key] -= parseInt(targ.css('margin' + b)) || 0;
58
- attr[key] -= parseInt(targ.css('border' + b + 'Width')) || 0
59
- }
60
- attr[key] += g.offset[pos] || 0;
61
- if (g.over[pos])attr[key] += targ[a == 'x' ? 'width' : 'height']() * g.over[pos]
62
- } else {
63
- var c = targ[pos];
64
- attr[key] = c.slice && c.slice(-1) == '%' ? parseFloat(c) / 100 * max : c
65
- }
66
- if (g.limit && /^\d+#x2F;.test(attr[key]))attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max);
67
- if (!i && g.queue) {
68
- if (old != attr[key])animate(g.onAfterFirst);
69
- delete attr[key]
70
- }
71
- });
72
- animate(g.onAfter);
73
- function animate(a) {
74
- $elem.animate(attr, f, g.easing, a && function () {
75
- a.call(this, e, g)
76
- })
77
- }
78
- }).end()
79
- };
80
- h.max = function (a, b) {
81
- var c = b == 'x' ? 'Width' : 'Height', scroll = 'scroll' + c;
82
- if (!$(a).is('html,body'))return a[scroll] - $(a)[c.toLowerCase()]();
83
- var d = 'client' + c, html = a.ownerDocument.documentElement, body = a.ownerDocument.body;
84
- return Math.max(html[scroll], body[scroll]) - Math.min(html[d], body[d])
85
- };
86
- function both(a) {
87
- return typeof a == 'object' ? a : {top: a, left: a}
88
- }
89
- })(jQuery);
uninstall.php CHANGED
@@ -1,4 +1,14 @@
1
<?php
2
if ( ! defined( 'ABSPATH' ) && ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
3
exit();
4
} else {
@@ -35,4 +45,4 @@ if ( ! defined( 'ABSPATH' ) && ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
35
delete_option( 'wpa_focus' );
36
delete_option( 'wpa_focus_color' );
37
delete_option( 'wpa_complementary_container' );
38
- }
1
<?php
2
+ /**
3
+ * Uninstall & delete options.
4
+ *
5
+ * @category Settings
6
+ * @package WP Accessibility
7
+ * @author Joe Dolson
8
+ * @license GPLv2 or later
9
+ * @link https://www.joedolson.com/wp-accessibility/
10
+ */
11
+
12
if ( ! defined( 'ABSPATH' ) && ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
exit();
14
} else {
45
delete_option( 'wpa_focus' );
46
delete_option( 'wpa_focus_color' );
47
delete_option( 'wpa_complementary_container' );
48
+ }
wp-accessibility-alt.php ADDED
@@ -0,0 +1,155 @@
1
+ <?php
2
+ /**
3
+ * WP Accessibility Alt control implementation
4
+ *
5
+ * @category Features
6
+ * @package WP Accessibility
7
+ * @author Joe Dolson
8
+ * @license GPLv2 or later
9
+ * @link https://www.joedolson.com/wp-access/
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+
16
+ add_filter( 'manage_media_columns', 'wpa_media_columns' );
17
+ add_action( 'manage_media_custom_column', 'wpa_media_value', 10, 2 );
18
+ /**
19
+ * Add column to media column table view indicating images with no alt attribute not also checked as decorative.
20
+ *
21
+ * @param array $columns Current table view columns.
22
+ *
23
+ * @return columns.
24
+ */
25
+ function wpa_media_columns( $columns ) {
26
+ $columns['wpa_data'] = __( 'Accessibility', 'wp-accessibility' );
27
+
28
+ return $columns;
29
+ }
30
+
31
+ /**
32
+ * Get media values for current item to indicate alt status.
33
+ *
34
+ * @param array $column Name of column being checked.
35
+ * @param int $id ID of object thiss row belongs to.
36
+ *
37
+ * @return String alt attribute status for this object.
38
+ */
39
+ function wpa_media_value( $column, $id ) {
40
+ if ( 'wpa_data' == $column ) {
41
+ $mime = get_post_mime_type( $id );
42
+ switch ( $mime ) {
43
+ case 'image/jpeg':
44
+ case 'image/png':
45
+ case 'image/gif':
46
+ $alt = get_post_meta( $id, '_wp_attachment_image_alt', true );
47
+ $no_alt = get_post_meta( $id, '_no_alt', true );
48
+ if ( ! $alt && ! $no_alt ) {
49
+ echo '<span class="missing"><span class="dashicons dashicons-no" aria-hidden="true"></span> <a href="' . get_edit_post_link( $id ) . '#attachment_alt">' . __( 'Add <code>alt</code> text', 'wp-accessibility' ) . '</a></span>';
50
+ } else {
51
+ if ( 1 == $no_alt ) {
52
+ echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> ' . __( 'Decorative', 'wp-accessibility' ) . '</span>';
53
+ } else {
54
+ echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> ' . __( 'Has <code>alt</code>', 'wp-accessibility' ) . '</span>';
55
+ }
56
+ }
57
+ break;
58
+ default:
59
+ echo '<span class="non-image">' . __( 'N/A', 'wp-accessibility' ) . '</span>';
60
+ break;
61
+ }
62
+ }
63
+ return $column;
64
+ }
65
+
66
+ add_filter( 'attachment_fields_to_edit', 'wpa_insert_alt_verification', 10, 2 );
67
+ /**
68
+ * Insert custom fields into attachment editor for alt verification.
69
+ *
70
+ * @param array $form_fields Existing form fields.
71
+ * @param object $post Media attachment object.
72
+ *
73
+ * @return array New form fields.
74
+ */
75
+ function wpa_insert_alt_verification( $form_fields, $post ) {
76
+ $mime = get_post_mime_type( $post->ID );
77
+ if ( 'image/jpeg' == $mime || 'image/png' == $mime || 'image/gif' == $mime ) {
78
+ $no_alt = get_post_meta( $post->ID, '_no_alt', true );
79
+ $alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
80
+ $checked = checked( $no_alt, 1, false );
81
+ $form_fields['no_alt'] = array(
82
+ 'label' => __( 'Decorative', 'wp-accessibility' ),
83
+ 'input' => 'html',
84
+ 'value' => 1,
85
+ 'html' => "<input name='attachments[$post->ID][no_alt]' id='attachments-$post->ID-no_alt' value='1' type='checkbox' aria-describedby='wpa_help' $checked /> <em class='help' id='wpa_help'>" . __( 'All images must either have an alt attribute or be declared as decorative.', 'wp-accessibility' ) . '</em>',
86
+ );
87
+ }
88
+ return $form_fields;
89
+ }
90
+
91
+ add_filter( 'attachment_fields_to_save', 'wpa_save_alt_verification', 10, 2 );
92
+ /**
93
+ * Save custom alt fields when attachment updated.
94
+ *
95
+ * @param array $post $post data.
96
+ * @param array $attachment Attachment data.
97
+ *
98
+ * @return $post
99
+ */
100
+ function wpa_save_alt_verification( $post, $attachment ) {
101
+ if ( isset( $attachment['no_alt'] ) ) {
102
+ update_post_meta( $post['ID'], '_no_alt', 1 );
103
+ } else {
104
+ delete_post_meta( $post['ID'], '_no_alt' );
105
+ }
106
+
107
+ return $post;
108
+ }
109
+
110
+ add_filter( 'image_send_to_editor', 'wpa_alt_attribute', 10, 8 );
111
+ /**
112
+ * Filter output when image is submitted to the editor. Check for alt attributes, and modify output.
113
+ *
114
+ * @param string $html Image HTML.
115
+ * @param int $id Post ID.
116
+ * @param string $caption Caption text.
117
+ * @param string $title Image title.
118
+ * @param string $align Image alignment.
119
+ * @param string $url Image URL.
120
+ * @param array $size Image size.
121
+ * @param string $alt Image alt attribute.
122
+ *
123
+ * @return string Image output.
124
+ */
125
+ function wpa_alt_attribute( $html, $id, $caption, $title, $align, $url, $size, $alt ) {
126
+ // Get data for the image attachment.
127
+ $noalt = get_post_meta( $id, '_no_alt', true );
128
+ // Get the original title to compare to alt.
129
+ $title = get_the_title( $id );
130
+ $warning = false;
131
+ if ( 1 == $noalt ) {
132
+ $html = str_replace( 'alt="' . $alt . '"', 'alt=""', $html );
133
+ }
134
+ if ( ( '' == $alt || $alt == $title ) && 1 != $noalt ) {
135
+ if ( $alt == $title ) {
136
+ $warning = __( 'The alt text for this image is the same as the title. In most cases, that means that the alt attribute has been automatically provided from the image file name.', 'wp-accessibility' );
137
+ $image = 'alt-same.png';
138
+ } else {
139
+ $warning = __( 'This image requires alt text, but the alt text is currently blank. Either add alt text or mark the image as decorative.', 'wp-accessibility' );
140
+ $image = 'alt-missing.png';
141
+ }
142
+ }
143
+ if ( $warning ) {
144
+ return $html . "<img class='wpa-image-missing-alt size-" . esc_attr( $size ) . ' ' . esc_attr( $align ) . "' src='" . plugins_url( "imgs/$image", __FILE__ ) . "' alt='" . esc_attr( $warning ) . "' />";
145
+ }
146
+ return $html;
147
+ }
148
+
149
+ add_action( 'init', 'wpa_add_editor_styles' );
150
+ /**
151
+ * Enqueue custom editor styles for WP Accessibility. Used in display of img replacements.
152
+ */
153
+ function wpa_add_editor_styles() {
154
+ add_editor_style( plugins_url( 'css/editor-style.css', __FILE__ ) );
155
+ }
wp-accessibility-contrast.php ADDED
@@ -0,0 +1,171 @@
1
+ <?php
2
+ /**
3
+ * WP Accessibility Color Contrast testing
4
+ *
5
+ * @category Features
6
+ * @package WP Accessibility
7
+ * @author Joe Dolson
8
+ * @license GPLv2 or later
9
+ * @link https://www.joedolson.com/wp-accessibility/
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+
16
+ /**
17
+ * Measure the relative luminosity between two RGB values.
18
+ *
19
+ * @param int $r Red value 1.
20
+ * @param int $r2 Red value 2.
21
+ * @param int $g Green value 1.
22
+ * @param int $g2 Green value 2.
23
+ * @param int $b Blue value 1.
24
+ * @param int $b2 Blue value 2.
25
+ *
26
+ * @return luminosity ratio.
27
+ */
28
+ function wpa_luminosity( $r, $r2, $g, $g2, $b, $b2 ) {
29
+ $rs_rgb = $r / 255;
30
+ $gs_rgb = $g / 255;
31
+ $bs_rgb = $b / 255;
32
+ $r_new = ( $rs_rgb <= 0.03928 ) ? $rs_rgb / 12.92 : pow( ( $rs_rgb + 0.055 ) / 1.055, 2.4 );
33
+ $g_new = ( $gs_rgb <= 0.03928 ) ? $gs_rgb / 12.92 : pow( ( $gs_rgb + 0.055 ) / 1.055, 2.4 );
34
+ $b_new = ( $bs_rgb <= 0.03928 ) ? $bs_rgb / 12.92 : pow( ( $bs_rgb + 0.055 ) / 1.055, 2.4 );
35
+
36
+ $rs_rgb2 = $r2 / 255;
37
+ $gs_rgb2 = $g2 / 255;
38
+ $bs_rgb2 = $b2 / 255;
39
+ $r2_new = ( $rs_rgb2 <= 0.03928 ) ? $rs_rgb2 / 12.92 : pow( ( $rs_rgb2 + 0.055 ) / 1.055, 2.4 );
40
+ $g2_new = ( $gs_rgb2 <= 0.03928 ) ? $gs_rgb2 / 12.92 : pow( ( $gs_rgb2 + 0.055 ) / 1.055, 2.4 );
41
+ $b2_new = ( $bs_rgb2 <= 0.03928 ) ? $bs_rgb2 / 12.92 : pow( ( $bs_rgb2 + 0.055 ) / 1.055, 2.4 );
42
+
43
+ if ( $r + $g + $b <= $r2 + $g2 + $b2 ) {
44
+ $l2 = ( .2126 * $r_new + 0.7152 * $g_new + 0.0722 * $b_new );
45
+ $l1 = ( .2126 * $r2_new + 0.7152 * $b2_new + 0.0722 * $b2_new );
46
+ } else {
47
+ $l1 = ( .2126 * $r_new + 0.7152 * $g_new + 0.0722 * $b_new );
48
+ $l2 = ( .2126 * $r2_new + 0.7152 * $g2_new + 0.0722 * $b2_new );
49
+ }
50
+ $luminosity = round( ( $l1 + 0.05 ) / ( $l2 + 0.05 ), 2 );
51
+
52
+ return $luminosity;
53
+ }
54
+
55
+ /**
56
+ * Convert an RGB value to a HEX value.
57
+ *
58
+ * @param int $r Red value.
59
+ * @param int $g Green value.
60
+ * @param int $b Blue value.
61
+ *
62
+ * @return Hexadecimal color equivalent.
63
+ */
64
+ function wpa_rgb2hex( $r, $g = - 1, $b = - 1 ) {
65
+ if ( is_array( $r ) && sizeof( $r ) == 3 ) {
66
+ list( $r, $g, $b ) = $r;
67
+ }
68
+ $r = intval( $r );
69
+ $g = intval( $g );
70
+ $b = intval( $b );
71
+
72
+ $r = dechex( $r < 0 ? 0 : ( $r > 255 ? 255 : $r ) );
73
+ $g = dechex( $g < 0 ? 0 : ( $g > 255 ? 255 : $g ) );
74
+ $b = dechex( $b < 0 ? 0 : ( $b > 255 ? 255 : $b ) );
75
+
76
+ $color = ( strlen( $r ) < 2 ? '0' : '' ) . $r;
77
+ $color .= ( strlen( $g ) < 2 ? '0' : '' ) . $g;
78
+ $color .= ( strlen( $b ) < 2 ? '0' : '' ) . $b;
79
+
80
+ return '#' . $color;
81
+ }
82
+
83
+ /**
84
+ * Convert a Hexadecimal color value to RGB.
85
+ *
86
+ * @param string $color Hexadecimal value for a color.
87
+ *
88
+ * @return array of RGB values in R,G,B order.
89
+ */
90
+ function wpa_hex2rgb( $color ) {
91
+ $color = str_replace( '#', '', $color );
92
+ if ( strlen( $color ) != 6 ) {
93
+ return array( 0, 0, 0 );
94
+ }
95
+ $rgb = array();
96
+ for ( $x = 0; $x < 3; $x ++ ) {
97
+ $rgb[ $x ] = hexdec( substr( $color, ( 2 * $x ), 2 ) );
98
+ }
99
+
100
+ return $rgb;
101
+ }
102
+
103
+ /**
104
+ * Calculate the luminosity ratio between two color values.
105
+ */
106
+ function wpa_contrast() {
107
+ if ( ! empty( $_POST ) ) {
108
+ $nonce = $_REQUEST['_wpnonce'];
109
+ if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
110
+ die( 'Security check failed' );
111
+ }
112
+ if ( isset( $_POST['color'] ) && '' != $_POST['color'] ) {
113
+ $fore_color = $_POST['color'];
114
+ if ( '#' == $fore_color[0] ) {
115
+ $fore_color = str_replace( '#', '', $fore_color );
116
+ }
117
+ if ( 3 == strlen( $fore_color ) ) {
118
+ $color6char = $fore_color[0] . $fore_color[0];
119
+ $color6char .= $fore_color[1] . $fore_color[1];
120
+ $color6char .= $fore_color[2] . $fore_color[2];
121
+ $fore_color = $color6char;
122
+ }
123
+ if ( preg_match( '/^#?([0-9a-f]{1,2}){3}#x2F;i', $fore_color ) ) {
124
+ $echo_hex_fore = str_replace( '#', '', $fore_color );
125
+ } else {
126
+ $echo_hex_fore = 'FFFFFF';
127
+ }
128
+ if ( isset( $_POST['color2'] ) && '' != $_POST['color2'] ) {
129
+ $back_color = $_POST['color2'];
130
+ if ( '#' == $back_color[0] ) {
131
+ $back_color = str_replace( '#', '', $back_color );
132
+ }
133
+ if ( 3 == strlen( $back_color ) ) {
134
+ $color6char = $back_color[0] . $back_color[0];
135
+ $color6char .= $back_color[1] . $back_color[1];
136
+ $color6char .= $back_color[2] . $back_color[2];
137
+ $back_color = $color6char;
138
+ }
139
+ if ( preg_match( '/^#?([0-9a-f]{1,2}){3}#x2F;i', $back_color ) ) {
140
+ $echo_hex_back = str_replace( '#', '', $back_color );
141
+ } else {
142
+ $echo_hex_back = 'FFFFFF';
143
+ }
144
+ $color = wpa_hex2rgb( $echo_hex_fore );
145
+ $color2 = wpa_hex2rgb( $echo_hex_back );
146
+ $rfore = $color[0];
147
+ $gfore = $color[1];
148
+ $bfore = $color[2];
149
+ $rback = $color2[0];
150
+ $gback = $color2[1];
151
+ $bback = $color2[2];
152
+ $colors = array(
153
+ 'hex1' => $echo_hex_fore,
154
+ 'hex2' => $echo_hex_back,
155
+ 'red1' => $rfore,
156
+ 'green1' => $gfore,
157
+ 'blue1' => $bfore,
158
+ 'red2' => $rback,
159
+ 'green2' => $gback,
160
+ 'blue2' => $bback,
161
+ );
162
+
163
+ return $colors;
164
+ } else {
165
+ return false;
166
+ }
167
+ }
168
+ }
169
+
170
+ return false;
171
+ }
wp-accessibility-longdesc.php ADDED
@@ -0,0 +1,169 @@
1
+ <?php
2
+ /**
3
+ * WP Accessibility Longdesc implementation
4
+ *
5
+ * @category Features
6
+ * @package WP Accessibility
7
+ * @author Joe Dolson
8
+ * @license GPLv2 or later
9
+ * @link https://www.joedolson.com/wp-access/
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+
16
+ add_filter( 'wp_get_attachment_image_attributes', 'wpa_featured_longdesc', 10, 3 );
17
+ /**
18
+ * Get long descriptions for featured images.
19
+ *
20
+ * @param array $attr Existing image attributes.
21
+ * @param object $attachment Current image attachment object.
22
+ * @param mixed array/string $size Image size shown.
23
+ *
24
+ * @return New attributes array.
25
+ */
26
+ function wpa_featured_longdesc( $attr, $attachment, $size ) {
27
+ if ( 'on' == get_option( 'wpa_longdesc_featured' ) ) {
28
+ $attachment_id = $attachment->ID;
29
+ $args = array( 'longdesc' => $attachment_id );
30
+ // The referrer is the post that the image is inserted into.
31
+ if ( isset( $_REQUEST['post_id'] ) || get_the_ID() ) {
32
+ $id = ( isset( $_REQUEST['post_id'] ) ) ? $_REQUEST['post_id'] : get_the_ID();
33
+ $args['referrer'] = intval( $id );
34
+ }
35
+
36
+ $target = add_query_arg( $args, home_url() );
37
+ $id = wpa_longdesc_return_anchor( $attachment_id );
38
+
39
+ $attr['longdesc'] = $target;
40
+ $attr['id'] = $id;
41
+ }
42
+
43
+ return $attr;
44
+ }
45
+
46
+
47
+ // longdesc support, based on work by Michael Fields (http://wordpress.org/plugins/long-description-for-image-attachments/).
48
+ define( 'WPA_TEMPLATES', trailingslashit( dirname( __FILE__ ) ) . 'templates/' );
49
+ add_action( 'template_redirect', 'wpa_longdesc_template' );
50
+ /**
51
+ * Load Template.
52
+ *
53
+ * The ID for an image attachment is expected to be
54
+ * passed via $_GET['longdesc']. If this value exists
55
+ * and a post is successfully queried, postdata will
56
+ * be prepared and a template will be loaded to display
57
+ * the post content.
58
+ *
59
+ * This template must be named "longdesc-template.php".
60
+ *
61
+ * First, this function will look in the child theme
62
+ * then in the parent theme and if no template is found
63
+ * in either theme, the default template will be loaded
64
+ * from the plugin's folder.
65
+ *
66
+ * This function is hooked into the "template_redirect"
67
+ * action and terminates script execution.
68
+ *
69
+ * @return void
70
+ * @link http://wordpress.org/plugins/long-description-for-image-attachments/
71
+ * @since 2010-09-26
72
+ * @alter 2011-03-27
73
+ */
74
+ function wpa_longdesc_template() {
75
+ // Return early if there is no reason to proceed.
76
+ if ( ! isset( $_GET['longdesc'] ) ) {
77
+ return;
78
+ }
79
+
80
+ global $post;
81
+
82
+ // Get the image attachment's data.
83
+ $id = absint( $_GET['longdesc'] );
84
+ $post = get_post( $id );
85
+ if ( is_object( $post ) ) {
86
+ setup_postdata( $post );
87
+ }
88
+
89
+ // Attachment must be an image.
90
+ if ( false === strpos( get_post_mime_type(), 'image' ) ) {
91
+ header( 'HTTP/1.0 404 Not Found' );
92
+ exit;
93
+ }
94
+
95
+ // The whole point here is to NOT show an image :).
96
+ remove_filter( 'the_content', 'prepend_attachment' );
97
+
98
+ // Check to see if there is a template in the theme.
99
+ $template = locate_template( array( 'longdesc-template.php' ) );
100
+ if ( ! empty( $template ) ) {
101
+ require_once( $template );
102
+ exit;
103
+ } // Use plugin's template file.
104
+ else {
105
+ require_once( WPA_TEMPLATES . 'longdesc-template.php' );
106
+ exit;
107
+ }
108
+
109
+ // You've gone too far. Error case.
110
+ header( 'HTTP/1.0 404 Not Found' );
111
+ exit;
112
+ }
113
+
114
+ /**
115
+ * Anchor.
116
+ *
117
+ * Create anchor id for linking from a Long Description to referring post.
118
+ * Also creates an anchor to return from Long Description page.
119
+ *
120
+ * @param int $id ID of the post which contains an image with a longdesc attribute.
121
+ *
122
+ * @return string
123
+ * @since 2010-09-26
124
+ */
125
+ function wpa_longdesc_return_anchor( $id ) {
126
+ return 'longdesc-return-' . $id;
127
+ }
128
+
129
+ add_filter( 'image_send_to_editor', 'wpa_longdesc_add_attr', 10, 8 );
130
+ /**
131
+ * Add Attribute.
132
+ *
133
+ * Add longdesc attribute when WordPress sends image to the editor.
134
+ * Also creates an anchor to return from Long Description page.
135
+ *
136
+ * @param string $html Image HTML.
137
+ * @param int $id Post ID.
138
+ * @param string $caption Caption text.
139
+ * @param string $title Image title.
140
+ * @param string $align Image alignment.
141
+ * @param string $url Image URL.
142
+ * @param array $size Image size.
143
+ * @param string $alt Image alt attribute.
144
+ *
145
+ * @return string
146
+ *
147
+ * @since 2010-09-20
148
+ * @alter 2011-04-06
149
+ */
150
+ function wpa_longdesc_add_attr( $html, $id, $caption, $title, $align, $url, $size, $alt ) {
151
+ // Get data for the image attachment.
152
+ $image = get_post( $id );
153
+ global $post_ID;
154
+ if ( isset( $image->ID ) && ! empty( $image->ID ) ) {
155
+ $args = array( 'longdesc' => $image->ID );
156
+ // The referrer is the post that the image is inserted into.
157
+ if ( isset( $_REQUEST['post_id'] ) || get_the_ID() ) {
158
+ $id = ( isset( $_REQUEST['post_id'] ) ) ? $_REQUEST['post_id'] : get_the_ID();
159
+ $args['referrer'] = intval( $id );
160
+ }
161
+ if ( ! empty( $image->post_content ) ) {
162
+ $search = '<img ';
163
+ $replace = '<img tabindex="-1" id="' . esc_attr( wpa_longdesc_return_anchor( $image->ID ) ) . '" longdesc="' . esc_url( add_query_arg( $args, home_url() ) ) . '" ';
164
+ $html = str_replace( $search, $replace, $html );
165
+ }
166
+ }
167
+
168
+ return $html;
169
+ }
wp-accessibility-settings.php CHANGED
@@ -1,26 +1,81 @@
1
<?php
2
3
if ( ! defined( 'ABSPATH' ) ) {
4
exit;
5
- } // Exit if accessed directly
6
7
8
function wpa_update_settings() {
9
wpa_check_version();
10
if ( ! empty( $_POST ) ) {
11
$nonce = $_REQUEST['_wpnonce'];
12
if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
13
- die( "Security check failed" );
14
}
15
- if ( isset( $_POST['action'] ) && $_POST['action'] == 'rta' ) {
16
- $rta_from_tag_clouds = ( isset( $_POST['rta_from_tag_clouds'] ) ) ? 'on' : '';
17
update_option( 'rta_from_tag_clouds', $rta_from_tag_clouds );
18
-
19
- $message = __( "Remove Title Attributes Settings Updated", 'wp-accessibility' );
20
21
- return "<div class='updated'><p>" . $message . "</p></div>";
22
}
23
- if ( isset( $_POST['action'] ) && $_POST['action'] == 'asl' ) {
24
$asl_enable = ( isset( $_POST['asl_enable'] ) ) ? 'on' : '';
25
$asl_content = ( isset( $_POST['asl_content'] ) ) ? $_POST['asl_content'] : '';
26
$asl_navigation = ( isset( $_POST['asl_navigation'] ) ) ? $_POST['asl_navigation'] : '';
@@ -37,15 +92,15 @@ function wpa_update_settings() {
37
update_option( 'asl_extra_target', $asl_extra_target );
38
update_option( 'asl_extra_text', $asl_extra_text );
39
update_option( 'asl_visible', $asl_visible );
40
- $notice = ( $asl_visible == 'on' ) ? "<p>" . __( 'WP Accessibility does not provide any styles for visible skiplinks. You can still set the look of the links using the textareas provided, but all other layout must be assigned in your theme.', 'wp-accessibility' ) . "</p>" : '';
41
42
update_option( 'asl_styles_focus', $asl_styles_focus );
43
update_option( 'asl_styles_passive', $asl_styles_passive );
44
- $message = __( "Add Skiplinks Settings Updated", 'wp-accessibility' );
45
46
return "<div class='updated'><p>" . $message . "</p>$notice</div>";
47
}
48
- if ( isset( $_POST['action'] ) && $_POST['action'] == 'misc' ) {
49
$wpa_lang = ( isset( $_POST['wpa_lang'] ) ) ? 'on' : '';
50
$wpa_target = ( isset( $_POST['wpa_target'] ) ) ? 'on' : '';
51
$wpa_labels = ( isset( $_POST['wpa_labels'] ) ) ? 'on' : '';
@@ -82,22 +137,22 @@ function wpa_update_settings() {
82
update_option( 'wpa_diagnostics', $wpa_diagnostics );
83
update_option( 'wpa_insert_roles', $wpa_insert_roles );
84
update_option( 'wpa_complementary_container', $wpa_complementary_container );
85
- $message = __( "Miscellaneous Accessibility Settings Updated", 'wp-accessibility' );
86
87
- return "<div class='updated'><p>" . $message . "</p></div>";
88
}
89
-
90
- if ( isset( $_POST['action'] ) && $_POST['action'] == 'toolbar' ) {
91
- $wpa_toolbar = ( isset( $_POST['wpa_toolbar'] ) ) ? 'on' : '';
92
- $wpa_toolbar_size = ( isset( $_POST['wpa_toolbar_size'] ) ) ? $_POST['wpa_toolbar_size'] : '';
93
- $wpa_alternate_fontsize = ( isset( $_POST['wpa_alternate_fontsize'] ) ) ? 'on' : '';
94
- $wpa_widget_toolbar = ( isset( $_POST['wpa_widget_toolbar'] ) ) ? 'on' : '';
95
- $wpa_toolbar_gs = ( isset( $_POST['wpa_toolbar_gs'] ) ) ? 'on' : '';
96
- $wpa_toolbar_fs = ( isset( $_POST['wpa_toolbar_fs'] ) ) ? 'off' : '';
97
- $wpa_toolbar_ct = ( isset( $_POST['wpa_toolbar_ct'] ) ) ? 'off' : '';
98
- $wpa_toolbar_default = ( isset( $_POST['wpa_toolbar_default'] ) ) ? $_POST['wpa_toolbar_default'] : '';
99
- $wpa_toolbar_right = ( isset( $_POST['wpa_toolbar_right'] ) ) ? 'on' : '';
100
- $wpa_toolbar_mobile = ( isset( $_POST['wpa_toolbar_mobile'] ) ) ? 'on' : '';
101
update_option( 'wpa_toolbar', $wpa_toolbar );
102
update_option( 'wpa_toolbar_size', $wpa_toolbar_size );
103
update_option( 'wpa_alternate_fontsize', $wpa_alternate_fontsize );
@@ -107,18 +162,22 @@ function wpa_update_settings() {
107
update_option( 'wpa_toolbar_ct', $wpa_toolbar_ct );
108
update_option( 'wpa_toolbar_default', $wpa_toolbar_default );
109
update_option( 'wpa_toolbar_right', $wpa_toolbar_right );
110
- update_option( 'wpa_toolbar_mobile', $wpa_toolbar_mobile );
111
- $message = __( "Toolbar Settings Updated", 'wp-accessibility' );
112
113
- return "<div class='updated'><p>" . $message . "</p></div>";
114
- }
115
} else {
116
return;
117
}
118
}
119
120
- function wpa_admin_menu() {
121
- echo wpa_update_settings(); ?>
122
<div class="wrap">
123
<h1><?php _e( 'WP Accessibility: Settings', 'wp-accessibility' ); ?></h1>
124
@@ -129,63 +188,66 @@ function wpa_admin_menu() {
129
<h2 class='hndle'><?php _e( 'Add Skiplinks', 'wp-accessibility' ); ?></h2>
130
131
<div class="inside">
132
- <?php if ( wpa_accessible_theme() && get_option( 'asl_enable' ) != 'on' ) { ?>
133
- <p>
134
- <?php _e( 'Your <code>accessibility-ready</code> theme has skip links built in.', 'wp-accessibility' ); ?>
135
- </p>
136
- <?php } else { ?>
137
- <form method="post"
138
- action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
139
<fieldset>
140
<legend><?php _e( 'Configure Skiplinks', 'wp-accessibility' ); ?></legend>
141
<ul>
142
- <li><input type="checkbox" id="asl_enable"
143
- name="asl_enable" <?php if ( get_option( 'asl_enable' ) == "on" ) {
144
- echo 'checked="checked" ';
145
- } ?>/> <label
146
- for="asl_enable"><?php _e( 'Enable Skiplinks', 'wp-accessibility' ); ?></label>
147
</li>
148
- <li><input type="checkbox" id="asl_visible"
149
- name="asl_visible" <?php if ( get_option( 'asl_visible' ) == "on" ) {
150
- echo 'checked="checked" ';
151
- } ?>/> <label
152
- for="asl_visible"><?php _e( 'Skiplinks always visible', 'wp-accessibility' ); ?></label>
153
</li>
154
- <li><label
155
- for="asl_content"><?php _e( 'Skip to Content link target (ID of your main content container)', 'wp-accessibility' ); ?></label>
156
- <input type="text" id="asl_content" name="asl_content"
157
- value="<?php esc_attr_e( get_option( 'asl_content' ) ); ?>"/></li>
158
- <li><label
159
- for="asl_navigation"><?php _e( 'Skip to Navigation link target (ID of your main navigation container)', 'wp-accessibility' ); ?></label>
160
- <input type="text" id="asl_navigation" name="asl_navigation"
161
- value="<?php esc_attr_e( get_option( 'asl_navigation' ) ); ?>"/></li>
162
- <li><label
163
- for="asl_sitemap"><?php _e( 'Site Map link target (URL for your site map)', 'wp-accessibility' ); ?></label><input
164
- type="text" id="asl_sitemap" name="asl_sitemap" size="44"
165
- value="<?php esc_attr_e( get_option( 'asl_sitemap' ) ); ?>"/></li>
166
- <li><label
167
- for="asl_extra_target"><?php _e( 'Add your own link (link or container ID)', 'wp-accessibility' ); ?></label>
168
- <input type="text" id="asl_extra_target" name="asl_extra_target"
169
- value="<?php esc_attr_e( get_option( 'asl_extra_target' ) ); ?>"/> <label
170
- for="asl_extra_text"><?php _e( 'Link text for your link', 'wp-accessibility' ); ?></label>
171
- <input type="text" id="asl_extra_text" name="asl_extra_text"
172
- value="<?php esc_attr_e( get_option( 'asl_extra_text' ) ); ?>"/></li>
173
- <li><label
174
- for="asl_styles_focus"><?php _e( 'Styles for Skiplinks when they have focus', 'wp-accessibility' ); ?></label><br/>
175
- <textarea name='asl_styles_focus' id='asl_styles_focus' cols='60'
176
- rows='4'><?php esc_attr_e( stripslashes( get_option( 'asl_styles_focus' ) ) ); ?></textarea>
177
</li>
178
- <?php if ( get_option( 'asl_visible' ) != 'on' ) {
179
$disabled = " disabled='disabled' style='background: #eee;'";
180
$note = ' ' . __( '(Not currently visible)', 'wp-accessibility' );
181
} else {
182
- $disabled = $note = '';
183
- } ?>
184
- <li><label
185
- for="asl_styles_passive"><?php _e( 'Styles for Skiplinks without focus', 'wp-accessibility' );
186
- echo $note; ?></label><br/>
187
- <textarea name='asl_styles_passive' id='asl_styles_passive' cols='60'
188
- rows='4'<?php echo $disabled; ?>><?php echo stripslashes( get_option( 'asl_styles_passive' ) ); ?></textarea>
189
</li>
190
</ul>
191
</fieldset>
@@ -194,10 +256,11 @@ function wpa_admin_menu() {
194
<input type="hidden" name="action" value="asl"/>
195
</p>
196
197
- <p><input type="submit" name="wpa-settings" class="button-primary"
198
- value="<?php _e( 'Update Skiplink Settings', 'wp-accessibility' ) ?>"/></p>
199
</form>
200
- <?php } ?>
201
</div>
202
</div>
203
<div class="postbox">
@@ -205,84 +268,69 @@ function wpa_admin_menu() {
205
<div class="inside">
206
<form method="post" action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
207
<ul>
208
- <li><input type="checkbox" id="wpa_toolbar"
209
- name="wpa_toolbar" <?php if ( get_option( 'wpa_toolbar' ) == "on" ) {
210
- echo 'checked="checked" ';
211
- } ?>/> <label
212
- for="wpa_toolbar"><?php _e( 'Add Accessibility toolbar with fontsize adjustment and contrast toggle', 'wp-accessibility' ); ?></label>
213
<ul>
214
- <li><input type="checkbox" id="wpa_toolbar_fs"
215
- name="wpa_toolbar_fs" <?php if ( get_option( 'wpa_toolbar_fs' ) == "off" ) {
216
- echo 'checked="checked" ';
217
- } ?>/> <label
218
- for="wpa_toolbar_fs"><?php _e( 'Exclude font size toggle from Accessibility toolbar', 'wp-accessibility' ); ?></label>
219
</li>
220
- <li><input type="checkbox" id="wpa_toolbar_ct"
221
- name="wpa_toolbar_ct" <?php if ( get_option( 'wpa_toolbar_ct' ) == "off" ) {
222
- echo 'checked="checked" ';
223
- } ?>/> <label
224
- for="wpa_toolbar_ct"><?php _e( 'Exclude contrast toggle from Accessibility toolbar', 'wp-accessibility' ); ?></label>
225
</li>
226
- <li><input type="checkbox" aria-describedby="wpa_toolbar_gs_note" id="wpa_toolbar_gs"
227
- name="wpa_toolbar_gs" <?php if ( get_option( 'wpa_toolbar_gs' ) == "on" ) {
228
- echo 'checked="checked" ';
229
- } ?>/> <label
230
- for="wpa_toolbar_gs"><?php _e( 'Include grayscale toggle with Accessibility toolbar', 'wp-accessibility' ); ?></label><br /><em id="wpa_toolbar_gs_note"><?php _e( 'The grayscale toggle is only intended for testing, and will appear only for logged-in administrators', 'wp-accessibility' ); ?></em>
231
- </li>
232
</ul>
233
</li>
234
<li>
235
- <label for="wpa_toolbar_default"><?php _e( 'Toolbar location (ID attribute)', 'wp-accessibility' ); ?></label> <input type="text" id="wpa_toolbar_default" name="wpa_toolbar_default" value="<?php esc_attr_e( get_option( 'wpa_toolbar_default' ) ); ?>" />
236
- </li>
237
<?php
238
$size = get_option( 'wpa_toolbar_size' );
239
?>
240
- <li><label
241
- for="wpa_toolbar_size"><?php _e( 'Toolbar font size', 'wp-accessibility' ); ?></label>
242
<select name='wpa_toolbar_size' id='wpa_toolbar_size'>
243
<option value=''><?php _e( 'Default size', 'wp-accessibility' ); ?></option>
244
<?php
245
for ( $i = 1; $i <= 2.5; ) {
246
- $current = $i . 'em';
247
$selected_size = ( $current == $size ) ? ' selected="selected"' : '';
248
- echo "<option value='$i" . "em'$selected_size>$i em</option>";
249
$i = $i + .1;
250
}
251
?>
252
</select>
253
</li>
254
- <li><input type="checkbox" id="wpa_alternate_fontsize"
255
- name="wpa_alternate_fontsize" <?php if ( get_option( 'wpa_alternate_fontsize' ) == "on" ) {
256
- echo 'checked="checked" ';
257
- } ?>/> <label
258
- for="wpa_alternate_fontsize"><?php _e( 'Use alternate font resizing stylesheet', 'wp-accessibility' ); ?></label>
259
- </li>
260
- <li><input type="checkbox" id="wpa_widget_toolbar"
261
- name="wpa_widget_toolbar" <?php if ( get_option( 'wpa_widget_toolbar' ) == "on" ) {
262
- echo 'checked="checked" ';
263
- } ?>/> <label
264
- for="wpa_widget_toolbar"><?php _e( 'Support Accessibility toolbar as shortcode or widget', 'wp-accessibility' ); ?></label>
265
</li>
266
- <li><input type="checkbox" id="wpa_toolbar_right"
267
- name="wpa_toolbar_right" <?php if ( get_option( 'wpa_toolbar_right' ) == "on" ) {
268
- echo 'checked="checked" ';
269
- } ?>/> <label
270
- for="wpa_toolbar_right"><?php _e( 'Place toolbar on right side of screen.', 'wp-accessibility' ); ?></label>
271
</li>
272
- <li><input type="checkbox" id="wpa_toolbar_mobile"
273
- name="wpa_toolbar_mobile" <?php if ( get_option( 'wpa_toolbar_mobile' ) == "on" ) {
274
- echo 'checked="checked" ';
275
- } ?>/> <label
276
- for="wpa_toolbar_mobile"><?php _e( 'Hide toolbar on small screens.', 'wp-accessibility' ); ?></label>
277
- </li>
278
</ul>
279
<p>
280
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
281
<input type="hidden" name="action" value="toolbar" />
282
</p>
283
284
- <p><input type="submit" name="wpa-settings" class="button-primary"
285
- value="<?php _e( 'Update Toolbar Settings', 'wp-accessibility' ) ?>"/></p>
286
</form>
287
</div>
288
</div>
@@ -292,121 +340,92 @@ function wpa_admin_menu() {
292
<div class="inside">
293
<form method="post" action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
294
<ul>
295
- <?php if ( !wpa_accessible_theme() ) { ?>
296
- <li><input type="checkbox" id="wpa_lang"
297
- name="wpa_lang" <?php if ( get_option( 'wpa_lang' ) == "on" ) {
298
- echo 'checked="checked" ';
299
- } ?>/> <label
300
- for="wpa_lang"><?php _e( 'Add Site Language and text direction to HTML element', 'wp-accessibility' ); ?></label>
301
</li>
302
- <li><input type="checkbox" id="wpa_more"
303
- name="wpa_more" <?php if ( get_option( 'wpa_more' ) == "on" ) {
304
- echo 'checked="checked" ';
305
- } ?>/> <label
306
- for="wpa_more"><?php _e( 'Add post title to "more" links.', 'wp-accessibility' ); ?></label>
307
<label for="wpa_continue"><?php _e( 'Continue reading text', 'wp-accessibility' ); ?></label>
308
- <input type="text" id="wpa_continue" name="wpa_continue" value="<?php esc_attr_e( get_option( 'wpa_continue' ) ); ?>"/></li>
309
- <li><input type="checkbox" id="wpa_insert_roles"
310
- name="wpa_insert_roles" <?php if ( get_option( 'wpa_insert_roles' ) == "on" ) {
311
- echo 'checked="checked" ';
312
- } ?>/> <label
313
- for="wpa_insert_roles"><?php _e( 'Add landmark roles to HTML5 structural elements', 'wp-accessibility' ); ?></label><br/><label
314
- for="wpa_complementary_container"><?php _e( 'ID for complementary role', 'wp-accessibility' ); ?></label><input
315
- type="text" id="wpa_complementary_container" name="wpa_complementary_container"
316
- value="#<?php esc_attr_e( get_option( 'wpa_complementary_container' ) ); ?>"/>
317
</li>
318
<li>
319
- <input type="checkbox" id="wpa_labels" name="wpa_labels" <?php checked( get_option( 'wpa_labels'), 'on' ); ?> /> <label for='wpa_labels'><?php _e( 'Automatically Label WordPress search form and comment forms', 'wp-accessibility' ); ?></label>
320
</li>
321
- <?php } else { ?>
322
<li><?php _e( '<strong>Four disabled features:</strong> Site language, continue reading text, landmark roles and standard form labels are defined in your <code>accessibility-ready</code> theme.', 'wp-accessibility' ); ?></li>
323
- <?php } ?>
324
- <li><input type="checkbox" id="wpa_target"
325
- name="wpa_target" <?php if ( get_option( 'wpa_target' ) == "on" ) {
326
- echo 'checked="checked" ';
327
- } ?>/> <label
328
- for="wpa_target"><?php _e( 'Remove target attribute from links', 'wp-accessibility' ); ?></label>
329
</li>
330
- <li><input type="checkbox" id="wpa_search"
331
- name="wpa_search" <?php if ( get_option( 'wpa_search' ) == "on" ) {
332
- echo 'checked="checked" ';
333
- } ?>/> <label
334
- for="wpa_search"><?php _e( 'Force search error on empty search submission (theme must have search.php template)', 'wp-accessibility' ); ?></label>
335
</li>
336
- <li><input type="checkbox" id="wpa_tabindex"
337
- name="wpa_tabindex" <?php if ( get_option( 'wpa_tabindex' ) == "on" ) {
338
- echo 'checked="checked" ';
339
- } ?>/> <label
340
- for="wpa_tabindex"><?php _e( 'Remove tabindex from focusable elements', 'wp-accessibility' ); ?></label>
341
</li>
342
- <li><input type="checkbox" id="wpa_underline"
343
- name="wpa_underline" <?php if ( get_option( 'wpa_underline' ) == "on" ) {
344
- echo 'checked="checked" ';
345
- } ?>/> <label
346
- for="wpa_underline"><?php _e( 'Force underline on all links', 'wp-accessibility' ); ?></label>
347
</li>
348
- <li><label
349
- for="wpa_longdesc"><?php _e( 'Long Description UI', 'wp-accessibility' ); ?></label>
350
<select id="wpa_longdesc" name="wpa_longdesc">
351
- <option value='link'<?php if ( get_option( 'wpa_longdesc' ) == "link" ) {
352
- echo 'selected="selected" ';
353
- } ?>><?php _e( 'Link to description', 'wp-accessibility' ); ?></option>
354
- <option value='jquery'<?php if ( get_option( 'wpa_longdesc' ) == "jquery" ) {
355
- echo 'selected="selected" ';
356
- } ?>><?php _e( 'Button trigger to overlay image', 'wp-accessibility' ); ?></option>
357
- <option value='false'
358
- <?php if ( get_option( 'wpa_longdesc' ) == "false" || ! get_option( 'wpa_longdesc' ) ) {
359
- echo 'selected="selected"';
360
- } ?>><?php _e( 'Browser defaults only', 'wp-accessibility' ); ?></option>
361
</select>
362
</li>
363
- <li><input type="checkbox" id="wpa_longdesc_featured"
364
- name="wpa_longdesc_featured" <?php if ( get_option( 'wpa_longdesc_featured' ) == "on" ) {
365
- echo 'checked="checked" ';
366
- } ?>/> <label
367
- for="wpa_longdesc_featured"><?php _e( 'Support <code>longdesc</code> on featured images', 'wp-accessibility' ); ?></label>
368
</li>
369
- <li><input type="checkbox" id="wpa_row_actions"
370
- name="wpa_row_actions" <?php if ( get_option( 'wpa_row_actions' ) == "on" ) {
371
- echo 'checked="checked" ';
372
- } ?>/> <label
373
- for="wpa_row_actions"><?php _e( 'Make row actions always visible', 'wp-accessibility' ); ?></label>
374
</li>
375
- <li><input type="checkbox" id="wpa_image_titles"
376
- name="wpa_image_titles" <?php if ( get_option( 'wpa_image_titles' ) == "on" ) {
377
- echo 'checked="checked" ';
378
- } ?>/> <label
379
- for="wpa_image_titles"><?php _e( 'Remove title attributes inserted into post content and featured images.', 'wp-accessibility' ); ?></label>
380
</li>
381
- <li><input type="checkbox" id="wpa_diagnostics"
382
- name="wpa_diagnostics" <?php if ( get_option( 'wpa_diagnostics' ) == "on" ) {
383
- echo 'checked="checked" ';
384
- } ?>/> <label
385
- for="wpa_diagnostics"><?php _e( 'Enable diagnostic CSS', 'wp-accessibility' ); ?></label>
386
</li>
387
- <li><input type="checkbox" id="wpa_focus"
388
- name="wpa_focus" <?php if ( get_option( 'wpa_focus' ) == "on" ) {
389
- echo 'checked="checked" ';
390
- } ?>/> <label
391
- for="wpa_focus"><?php _e( 'Add outline to elements on keyboard focus', 'wp-accessibility' ); ?></label>
392
- <label
393
- for="wpa_focus_color"><?php _e( 'Outline color (hexadecimal, optional)', 'wp-accessibility' ); ?></label><input
394
- type="text" id="wpa_focus_color" name="wpa_focus_color"
395
- value="#<?php esc_attr_e( get_option( 'wpa_focus_color' ) ); ?>"/></li>
396
- <li><input type="checkbox" id="wpa_current_menu"
397
- name="wpa_current_menu" <?php if ( get_option( 'wpa_current_menu' ) == "on" ) {
</