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 | 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 +86 -0
- css/diagnostic-head.css +181 -66
- lang/wp-accessibility-de_DE.mo +0 -0
- lang/wp-accessibility-fr_FR.mo +0 -0
- lang/wp-accessibility.pot +0 -470
- readme.txt +17 -5
- templates/longdesc-template.php +15 -6
- toolbar/README.md +0 -18
- toolbar/js/a11y.js +72 -83
- toolbar/js/jquery.scrollto.min.js +0 -89
- uninstall.php +11 -1
- wp-accessibility-alt.php +155 -0
- wp-accessibility-contrast.php +171 -0
- wp-accessibility-longdesc.php +169 -0
- wp-accessibility-settings.php +297 -283
- wp-accessibility-toolbar.php +64 -46
- wp-accessibility-widget.php +0 -35
- wp-accessibility.php +288 -589
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 |
-
|
17 |
-
|
18 |
-
|
19 |
-
[
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
content:
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
/*
|
32 |
-
|
33 |
*/
|
34 |
-
|
35 |
-
|
|
|
36 |
}
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
53 |
}
|
54 |
|
55 |
/* empty? */
|
56 |
title:empty:after {
|
57 |
-
|
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 |
-
|
70 |
-
|
|
|
71 |
}
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
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]:
|
84 |
-
content: 'meta refresh
|
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 |
-
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
}
|
103 |
|
104 |
-
|
105 |
-
content: '
|
106 |
-
margin: 0.4em;
|
107 |
-
padding: 0 0.4em;
|
108 |
-
color: white;
|
109 |
-
background-color: darkred;
|
110 |
-
border-radius: 3px;
|
111 |
}
|
112 |
|
113 |
-
|
114 |
-
content: '
|
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.
|
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 |
-
|
|
|
|
|
|
|
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 |
-
|
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 |
-
*
|
4 |
-
*
|
5 |
-
*
|
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 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
}
|
15 |
|
16 |
-
|
17 |
}
|
18 |
|
19 |
function readCookie(name) {
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
|
28 |
-
|
29 |
}
|
30 |
|
31 |
function eraseCookie(name) {
|
32 |
-
|
33 |
-
createCookie(name, "");
|
34 |
}
|
35 |
|
36 |
( function( $ ) {
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
|
66 |
return false;
|
67 |
-
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
|
82 |
return false;
|
83 |
-
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
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 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
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|%)?$/.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+$/.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}$/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}$/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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
14 |
}
|
15 |
-
if ( isset( $_POST['action'] ) && $_POST['action']
|
16 |
-
$rta_from_tag_clouds
|
17 |
update_option( 'rta_from_tag_clouds', $rta_from_tag_clouds );
|
18 |
-
|
19 |
-
$message = __( "Remove Title Attributes Settings Updated", 'wp-accessibility' );
|
20 |
|
21 |
-
|
|
|
|
|
22 |
}
|
23 |
-
if ( isset( $_POST['action'] ) && $_POST['action']
|
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 = (
|
41 |
|
42 |
update_option( 'asl_styles_focus', $asl_styles_focus );
|
43 |
update_option( 'asl_styles_passive', $asl_styles_passive );
|
44 |
-
$message = __(
|
45 |
|
46 |
return "<div class='updated'><p>" . $message . "</p>$notice</div>";
|
47 |
}
|
48 |
-
if ( isset( $_POST['action'] ) && $_POST['action']
|
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 = __(
|
86 |
|
87 |
-
return "<div class='updated'><p>" . $message .
|
88 |
}
|
89 |
-
|
90 |
-
if ( isset( $_POST['action'] ) && $_POST['action']
|
91 |
-
$wpa_toolbar
|
92 |
-
$wpa_toolbar_size
|
93 |
-
$wpa_alternate_fontsize
|
94 |
-
$wpa_widget_toolbar
|
95 |
-
$wpa_toolbar_gs
|
96 |
-
$wpa_toolbar_fs
|
97 |
-
$wpa_toolbar_ct
|
98 |
-
$wpa_toolbar_default
|
99 |
-
$wpa_toolbar_right
|
100 |
-
$wpa_toolbar_mobile
|
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 = __(
|
112 |
|
113 |
-
return "<div class='updated'><p>" . $message .
|
114 |
-
}
|
115 |
} else {
|
116 |
return;
|
117 |
}
|
118 |
}
|
119 |
|
120 |
-
|
121 |
-
|
|
|
|
|
|
|
|
|
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
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
|
|
|
|
139 |
<fieldset>
|
140 |
<legend><?php _e( 'Configure Skiplinks', 'wp-accessibility' ); ?></legend>
|
141 |
<ul>
|
142 |
-
<li
|
143 |
-
|
144 |
-
|
145 |
-
} ?>/> <label
|
146 |
-
for="asl_enable"><?php _e( 'Enable Skiplinks', 'wp-accessibility' ); ?></label>
|
147 |
</li>
|
148 |
-
<li
|
149 |
-
|
150 |
-
|
151 |
-
} ?>/> <label
|
152 |
-
for="asl_visible"><?php _e( 'Skiplinks always visible', 'wp-accessibility' ); ?></label>
|
153 |
</li>
|
154 |
-
<li
|
155 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
$disabled = " disabled='disabled' style='background: #eee;'";
|
180 |
$note = ' ' . __( '(Not currently visible)', 'wp-accessibility' );
|
181 |
} else {
|
182 |
-
$disabled =
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
<
|
188 |
-
|
|
|
|
|
|
|
|
|
|
|
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
|
209 |
-
|
210 |
-
|
211 |
-
} ?>/> <label
|
212 |
-
for="wpa_toolbar"><?php _e( 'Add Accessibility toolbar with fontsize adjustment and contrast toggle', 'wp-accessibility' ); ?></label>
|
213 |
<ul>
|
214 |
-
<li
|
215 |
-
|
216 |
-
|
217 |
-
} ?>/> <label
|
218 |
-
for="wpa_toolbar_fs"><?php _e( 'Exclude font size toggle from Accessibility toolbar', 'wp-accessibility' ); ?></label>
|
219 |
</li>
|
220 |
-
<li
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
|
|
|
|
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>
|
236 |
-
|
|
|
237 |
<?php
|
238 |
$size = get_option( 'wpa_toolbar_size' );
|
239 |
?>
|
240 |
-
<li
|
241 |
-
|
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 |
-
$
|
|
|
247 |
$selected_size = ( $current == $size ) ? ' selected="selected"' : '';
|
248 |
-
echo "<option value='$
|
249 |
$i = $i + .1;
|
250 |
}
|
251 |
?>
|
252 |
</select>
|
253 |
</li>
|
254 |
-
<li
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
</li>
|
266 |
-
<li
|
267 |
-
|
268 |
-
|
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
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
</li>
|
302 |
-
<li
|
303 |
-
|
304 |
-
|
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
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
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' ); ?> />
|
|
|
320 |
</li>
|
321 |
-
<?php
|
|
|
|
|
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 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
</li>
|
330 |
-
<li
|
331 |
-
|
332 |
-
|
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
|
337 |
-
|
338 |
-
|
339 |
-
} ?>/> <label
|
340 |
-
for="wpa_tabindex"><?php _e( 'Remove tabindex from focusable elements', 'wp-accessibility' ); ?></label>
|
341 |
</li>
|
342 |
-
<li
|
343 |
-
|
344 |
-
|
345 |
-
} ?>/> <label
|
346 |
-
for="wpa_underline"><?php _e( 'Force underline on all links', 'wp-accessibility' ); ?></label>
|
347 |
</li>
|
348 |
-
<li
|
349 |
-
|
350 |
<select id="wpa_longdesc" name="wpa_longdesc">
|
351 |
-
<option value='
|
352 |
-
|
353 |
-
|
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
|
364 |
-
|
365 |
-
|
366 |
-
} ?>/> <label
|
367 |
-
for="wpa_longdesc_featured"><?php _e( 'Support <code>longdesc</code> on featured images', 'wp-accessibility' ); ?></label>
|
368 |
</li>
|
369 |
-
<li
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
|
|
|
|
374 |
</li>
|
375 |
-
<li
|
376 |
-
|
377 |
-
|
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
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
|
|
|
|
|
|
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" ) {
|
398 |
-
echo 'checked="checked" ';
|
399 |
-
} ?>/> <label
|
400 |
-
for="wpa_current_menu"><?php _e( 'Non-visually identify currently active menu item', 'wp-accessibility' ); ?></label>
|
401 |
-
</li>
|
402 |
</ul>
|
403 |
<p>
|
404 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
|
405 |
<input type="hidden" name="action" value="misc"/>
|
406 |
</p>
|
407 |
|
408 |
-
<p><input type="submit" name="wpa-settings" class="button-primary"
|
409 |
-
value="<?php _e( 'Update Miscellaneous Settings', 'wp-accessibility' ) ?>"/></p>
|
410 |
</form>
|
411 |
</div>
|
412 |
</div>
|
@@ -415,17 +434,13 @@ function wpa_admin_menu() {
|
|
415 |
|
416 |
<div class="inside">
|
417 |
<?php wpa_accessible_theme(); ?>
|
418 |
-
<form method="post"
|
419 |
-
action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
|
420 |
<fieldset>
|
421 |
<legend><?php _e( 'Remove title attributes from:', 'wp-accessibility' ); ?></legend>
|
422 |
<ul>
|
423 |
-
<li><input type="checkbox" id="rta_from_tag_clouds"
|
424 |
-
|
425 |
-
|
426 |
-
} ?>/> <label
|
427 |
-
for="rta_from_tag_clouds"><?php _e( 'Tag clouds', 'wp-accessibility' ); ?></label>
|
428 |
-
</li>
|
429 |
</ul>
|
430 |
</fieldset>
|
431 |
<p>
|
@@ -433,11 +448,10 @@ function wpa_admin_menu() {
|
|
433 |
<input type="hidden" name="action" value="rta"/>
|
434 |
</p>
|
435 |
|
436 |
-
<p><input type="submit" name="wpa-settings" class="button-primary"
|
437 |
-
value="<?php _e( 'Update Title Attribute Settings', 'wp-accessibility' ) ?>"/></p>
|
438 |
</form>
|
439 |
</div>
|
440 |
-
</div>
|
441 |
<div class="postbox">
|
442 |
<h2 class='hndle'><?php _e( 'Color Contrast Tester', 'wp-accessibility' ); ?></h2>
|
443 |
|
@@ -455,23 +469,23 @@ function wpa_admin_menu() {
|
|
455 |
$l_contrast = false;
|
456 |
}
|
457 |
if ( $l_contrast ) {
|
458 |
-
$results = "
|
459 |
-
|
460 |
-
$results .=
|
461 |
if ( $luminance_raw >= 7 ) {
|
462 |
-
$results .= __(
|
463 |
}
|
464 |
if ( $luminance_raw >= 4.5 && $luminance_raw < 7 ) {
|
465 |
-
$results .= __(
|
466 |
}
|
467 |
if ( $luminance_raw >= 3 && $luminance_raw < 4.5 ) {
|
468 |
-
$results .= __(
|
469 |
}
|
470 |
if ( $luminance_raw < 3 ) {
|
471 |
-
$results .= __(
|
472 |
}
|
473 |
-
$results .= " <a href='#contrast'>" . __( 'Test another set of colors', 'wp-accessibility' ) .
|
474 |
-
$results .=
|
475 |
$results .= "
|
476 |
<div class=\"views\">
|
477 |
<p class='large' style=\"font-size: 2em; line-height: 1.4;color: #$hex1;background: #$hex2;border: 3px solid #$hex1\">Large Print Example</p>
|
@@ -483,22 +497,19 @@ function wpa_admin_menu() {
|
|
483 |
echo $results;
|
484 |
}
|
485 |
?>
|
486 |
-
<form method="post"
|
487 |
-
action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
|
488 |
<fieldset>
|
489 |
<legend><?php _e( 'Test of relative luminosity', 'wp-accessibility' ); ?></legend>
|
490 |
<ul>
|
491 |
<li class='fore'>
|
492 |
<div id="fore"></div>
|
493 |
-
<label
|
494 |
-
|
495 |
-
type="text" name="color" value="#<?php esc_attr_e( $hex1 ); ?>" size="34" id="color1"/>
|
496 |
</li>
|
497 |
<li class='back'>
|
498 |
<div id="back"></div>
|
499 |
-
<label
|
500 |
-
|
501 |
-
type="text" name="color2" value="#<?php esc_attr_e( $hex2 ); ?>" size="34" id="color2"/>
|
502 |
</li>
|
503 |
</ul>
|
504 |
</fieldset>
|
@@ -507,8 +518,7 @@ function wpa_admin_menu() {
|
|
507 |
<input type="hidden" name="action" value="contrast"/>
|
508 |
</p>
|
509 |
|
510 |
-
<p><input type="submit" name="wpa-settings" class="button-primary"
|
511 |
-
value="<?php _e( 'Check Color Contrast', 'wp-accessibility' ) ?>"/></p>
|
512 |
</form>
|
513 |
</div>
|
514 |
</div>
|
@@ -518,12 +528,13 @@ function wpa_admin_menu() {
|
|
518 |
<div class="inside">
|
519 |
<div class='wpa-support-me'>
|
520 |
<p>
|
521 |
-
|
522 |
-
|
523 |
-
|
|
|
524 |
</p>
|
525 |
-
</div>
|
526 |
-
|
527 |
</div>
|
528 |
</div>
|
529 |
</div>
|
@@ -538,8 +549,7 @@ function wpa_admin_menu() {
|
|
538 |
|
539 |
<div class="inside">
|
540 |
<p>
|
541 |
-
<a href="https://twitter.com/intent/follow?screen_name=joedolson" class="twitter-follow-button"
|
542 |
-
data-size="small" data-related="joedolson">Follow @joedolson</a>
|
543 |
<script>!function (d, s, id) {
|
544 |
var js, fjs = d.getElementsByTagName(s)[0];
|
545 |
if (!d.getElementById(id)) {
|
@@ -559,8 +569,7 @@ function wpa_admin_menu() {
|
|
559 |
<div>
|
560 |
<input type="hidden" name="cmd" value="_s-xclick"/>
|
561 |
<input type="hidden" name="hosted_button_id" value="QK9MXYGQKYUZY"/>
|
562 |
-
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif"
|
563 |
-
name="submit" alt="Donate"/>
|
564 |
<img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/>
|
565 |
</div>
|
566 |
</form>
|
@@ -574,11 +583,16 @@ function wpa_admin_menu() {
|
|
574 |
<h2 class='hndle'><?php _e( 'Access Monitor', 'wp-accessibility' ); ?></h2>
|
575 |
|
576 |
<div class="inside">
|
577 |
-
<p
|
|
|
|
|
|
|
|
|
|
|
578 |
</div>
|
579 |
</div>
|
580 |
</div>
|
581 |
-
|
582 |
<div class="ui-sortable meta-box-sortables">
|
583 |
<div class="postbox">
|
584 |
<h2 class='hndle'><?php _e( 'Accessibility References', 'wp-accessibility' ); ?></h2>
|
@@ -603,27 +617,24 @@ function wpa_admin_menu() {
|
|
603 |
|
604 |
<div class="inside">
|
605 |
<p>
|
606 |
-
|
607 |
</p>
|
608 |
<p>
|
609 |
-
|
610 |
</p>
|
611 |
-
|
612 |
<p>
|
613 |
-
|
614 |
</p>
|
615 |
-
|
616 |
<p>
|
617 |
-
|
618 |
</p>
|
619 |
-
|
620 |
<p>
|
621 |
-
|
622 |
</p>
|
623 |
</div>
|
624 |
</div>
|
625 |
</div>
|
626 |
-
|
627 |
<?php if ( wpa_accessible_theme() ) { ?>
|
628 |
<div class="ui-sortable meta-box-sortables">
|
629 |
<div class="postbox">
|
@@ -634,13 +645,16 @@ function wpa_admin_menu() {
|
|
634 |
<?php _e( "You're using a theme reviewed as <code>accessibility-ready</code> by the WordPress theme review team. Some options have been disabled in WP Accessibility because your theme has taken care of that issue.", 'wp-accessibility' ); ?>
|
635 |
</p>
|
636 |
<p>
|
637 |
-
<?php
|
|
|
|
|
|
|
638 |
</p>
|
639 |
</div>
|
640 |
</div>
|
641 |
</div>
|
642 |
-
<?php } ?>
|
643 |
-
|
644 |
|
645 |
<div class="ui-sortable meta-box-sortables">
|
646 |
<div class="postbox">
|
@@ -651,7 +665,6 @@ function wpa_admin_menu() {
|
|
651 |
<li><a href="http://www.accessibleculture.org/articles/2010/08/continue-reading-links-in-wordpress/">Continue Reading Links in WordPress</a></li>
|
652 |
<li><a href="http://www.mothereffingtoolconfuser.com">Mother Effing Tool Confuser</a></li>
|
653 |
<li><a href="http://wordpress.org/extend/plugins/remove-title-attributes/">Remove Title Attributes</a></li>
|
654 |
-
<li><a href="http://accessites.org/site/2008/11/wordpress-and-accessibility/#comment-2926">WordPress and Accessibility (Comment)</a></li>
|
655 |
<li><a href="http://wordpress.org/extend/plugins/img-title-removal/">IMG Title Removal</a></li>
|
656 |
<li><a href="https://github.com/clrux/a11y">Accessibility Toolbar</a></li>
|
657 |
<li><a href="https://wordpress.org/plugins/long-description-for-image-attachments/">WordPress Long Description</a></li>
|
@@ -659,10 +672,11 @@ function wpa_admin_menu() {
|
|
659 |
</div>
|
660 |
</div>
|
661 |
</div>
|
662 |
-
|
663 |
-
|
664 |
</div>
|
665 |
</div>
|
666 |
|
667 |
-
</div
|
668 |
-
|
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Output the WP Accessibility Settings.
|
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' ) ) {
|
13 |
exit;
|
14 |
+
}
|
15 |
+
|
16 |
+
add_action( 'admin_head', 'wpa_admin_styles' );
|
17 |
+
/**
|
18 |
+
* Enqueue admin stylesheets.
|
19 |
+
*/
|
20 |
+
function wpa_admin_styles() {
|
21 |
+
if ( isset( $_GET['page'] ) && ( 'wp-accessibility/wp-accessibility.php' == $_GET['page'] ) ) {
|
22 |
+
wp_enqueue_style( 'farbtastic' );
|
23 |
+
echo '<link type="text/css" rel="stylesheet" href="' . plugins_url( 'css/wpa-styles.css', __FILE__ ) . '" />';
|
24 |
+
}
|
25 |
+
}
|
26 |
|
27 |
+
/**
|
28 |
+
* Write admin JS.
|
29 |
+
*/
|
30 |
+
function wpa_write_js() {
|
31 |
+
global $current_screen;
|
32 |
+
if ( 'settings_page_wp-accessibility/wp-accessibility' == $current_screen->base ) {
|
33 |
+
?>
|
34 |
+
<script>
|
35 |
+
//<![CDATA[
|
36 |
+
(function ($) {
|
37 |
+
'use strict';
|
38 |
+
$('#fore').farbtastic('#color1');
|
39 |
+
$('#back').farbtastic('#color2');
|
40 |
+
}(jQuery));
|
41 |
+
//]]>
|
42 |
+
</script>
|
43 |
+
<?php
|
44 |
+
}
|
45 |
+
}
|
46 |
|
47 |
+
add_action( 'admin_enqueue_scripts', 'wpa_admin_js' );
|
48 |
+
/**
|
49 |
+
* Enqueue color picker for contrast testing
|
50 |
+
**/
|
51 |
+
function wpa_admin_js() {
|
52 |
+
global $current_screen;
|
53 |
+
if ( 'settings_page_wp-accessibility/wp-accessibility' == $current_screen->base ) {
|
54 |
+
wp_enqueue_script( 'farbtastic' );
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Update WP Accessibility settings.
|
60 |
+
*
|
61 |
+
* @return string Update confirmation message.
|
62 |
+
*/
|
63 |
function wpa_update_settings() {
|
64 |
wpa_check_version();
|
65 |
if ( ! empty( $_POST ) ) {
|
66 |
$nonce = $_REQUEST['_wpnonce'];
|
67 |
if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
|
68 |
+
die( 'Security check failed' );
|
69 |
}
|
70 |
+
if ( isset( $_POST['action'] ) && 'rta' == $_POST['action'] ) {
|
71 |
+
$rta_from_tag_clouds = ( isset( $_POST['rta_from_tag_clouds'] ) ) ? 'on' : '';
|
72 |
update_option( 'rta_from_tag_clouds', $rta_from_tag_clouds );
|
|
|
|
|
73 |
|
74 |
+
$message = __( 'Remove Title Attributes Settings Updated', 'wp-accessibility' );
|
75 |
+
|
76 |
+
return "<div class='updated'><p>" . $message . '</p></div>';
|
77 |
}
|
78 |
+
if ( isset( $_POST['action'] ) && 'asl' == $_POST['action'] ) {
|
79 |
$asl_enable = ( isset( $_POST['asl_enable'] ) ) ? 'on' : '';
|
80 |
$asl_content = ( isset( $_POST['asl_content'] ) ) ? $_POST['asl_content'] : '';
|
81 |
$asl_navigation = ( isset( $_POST['asl_navigation'] ) ) ? $_POST['asl_navigation'] : '';
|
92 |
update_option( 'asl_extra_target', $asl_extra_target );
|
93 |
update_option( 'asl_extra_text', $asl_extra_text );
|
94 |
update_option( 'asl_visible', $asl_visible );
|
95 |
+
$notice = ( 'asl' == $asl_visible ) ? '<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>' : '';
|
96 |
|
97 |
update_option( 'asl_styles_focus', $asl_styles_focus );
|
98 |
update_option( 'asl_styles_passive', $asl_styles_passive );
|
99 |
+
$message = __( 'Add Skiplinks Settings Updated', 'wp-accessibility' );
|
100 |
|
101 |
return "<div class='updated'><p>" . $message . "</p>$notice</div>";
|
102 |
}
|
103 |
+
if ( isset( $_POST['action'] ) && 'misc' == $_POST['action'] ) {
|
104 |
$wpa_lang = ( isset( $_POST['wpa_lang'] ) ) ? 'on' : '';
|
105 |
$wpa_target = ( isset( $_POST['wpa_target'] ) ) ? 'on' : '';
|
106 |
$wpa_labels = ( isset( $_POST['wpa_labels'] ) ) ? 'on' : '';
|
137 |
update_option( 'wpa_diagnostics', $wpa_diagnostics );
|
138 |
update_option( 'wpa_insert_roles', $wpa_insert_roles );
|
139 |
update_option( 'wpa_complementary_container', $wpa_complementary_container );
|
140 |
+
$message = __( 'Miscellaneous Accessibility Settings Updated', 'wp-accessibility' );
|
141 |
|
142 |
+
return "<div class='updated'><p>" . $message . '</p></div>';
|
143 |
}
|
144 |
+
|
145 |
+
if ( isset( $_POST['action'] ) && 'toolbar' == $_POST['action'] ) {
|
146 |
+
$wpa_toolbar = ( isset( $_POST['wpa_toolbar'] ) ) ? 'on' : '';
|
147 |
+
$wpa_toolbar_size = ( isset( $_POST['wpa_toolbar_size'] ) ) ? $_POST['wpa_toolbar_size'] : '';
|
148 |
+
$wpa_alternate_fontsize = ( isset( $_POST['wpa_alternate_fontsize'] ) ) ? 'on' : '';
|
149 |
+
$wpa_widget_toolbar = ( isset( $_POST['wpa_widget_toolbar'] ) ) ? 'on' : '';
|
150 |
+
$wpa_toolbar_gs = ( isset( $_POST['wpa_toolbar_gs'] ) ) ? 'on' : '';
|
151 |
+
$wpa_toolbar_fs = ( isset( $_POST['wpa_toolbar_fs'] ) ) ? 'off' : '';
|
152 |
+
$wpa_toolbar_ct = ( isset( $_POST['wpa_toolbar_ct'] ) ) ? 'off' : '';
|
153 |
+
$wpa_toolbar_default = ( isset( $_POST['wpa_toolbar_default'] ) ) ? $_POST['wpa_toolbar_default'] : '';
|
154 |
+
$wpa_toolbar_right = ( isset( $_POST['wpa_toolbar_right'] ) ) ? 'on' : '';
|
155 |
+
$wpa_toolbar_mobile = ( isset( $_POST['wpa_toolbar_mobile'] ) ) ? 'on' : '';
|
156 |
update_option( 'wpa_toolbar', $wpa_toolbar );
|
157 |
update_option( 'wpa_toolbar_size', $wpa_toolbar_size );
|
158 |
update_option( 'wpa_alternate_fontsize', $wpa_alternate_fontsize );
|
162 |
update_option( 'wpa_toolbar_ct', $wpa_toolbar_ct );
|
163 |
update_option( 'wpa_toolbar_default', $wpa_toolbar_default );
|
164 |
update_option( 'wpa_toolbar_right', $wpa_toolbar_right );
|
165 |
+
update_option( 'wpa_toolbar_mobile', $wpa_toolbar_mobile );
|
166 |
+
$message = __( 'Toolbar Settings Updated', 'wp-accessibility' );
|
167 |
|
168 |
+
return "<div class='updated'><p>" . $message . '</p></div>';
|
169 |
+
}
|
170 |
} else {
|
171 |
return;
|
172 |
}
|
173 |
}
|
174 |
|
175 |
+
/**
|
176 |
+
* Display settings admin page.
|
177 |
+
*/
|
178 |
+
function wpa_admin_settings() {
|
179 |
+
echo wpa_update_settings();
|
180 |
+
?>
|
181 |
<div class="wrap">
|
182 |
<h1><?php _e( 'WP Accessibility: Settings', 'wp-accessibility' ); ?></h1>
|
183 |
|
188 |
<h2 class='hndle'><?php _e( 'Add Skiplinks', 'wp-accessibility' ); ?></h2>
|
189 |
|
190 |
<div class="inside">
|
191 |
+
<?php
|
192 |
+
if ( wpa_accessible_theme() && 'on' != get_option( 'asl_enable' ) ) {
|
193 |
+
?>
|
194 |
+
<p>
|
195 |
+
<?php _e( 'Your <code>accessibility-ready</code> theme has skip links built in.', 'wp-accessibility' ); ?>
|
196 |
+
</p>
|
197 |
+
<?php
|
198 |
+
} else {
|
199 |
+
?>
|
200 |
+
<form method="post" action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
|
201 |
<fieldset>
|
202 |
<legend><?php _e( 'Configure Skiplinks', 'wp-accessibility' ); ?></legend>
|
203 |
<ul>
|
204 |
+
<li>
|
205 |
+
<input type="checkbox" id="asl_enable" name="asl_enable" <?php checked( get_option( 'asl_enable' ), 'on' ); ?>/>
|
206 |
+
<label for="asl_enable"><?php _e( 'Enable Skiplinks', 'wp-accessibility' ); ?></label>
|
|
|
|
|
207 |
</li>
|
208 |
+
<li>
|
209 |
+
<input type="checkbox" id="asl_visible" name="asl_visible" <?php checked( get_option( 'asl_visible' ), 'on' ); ?>/>
|
210 |
+
<label for="asl_visible"><?php _e( 'Skiplinks always visible', 'wp-accessibility' ); ?></label>
|
|
|
|
|
211 |
</li>
|
212 |
+
<li>
|
213 |
+
<label for="asl_content"><?php _e( 'Skip to Content link target (ID of your main content container)', 'wp-accessibility' ); ?></label>
|
214 |
+
<input type="text" id="asl_content" name="asl_content" value="<?php echo esc_attr( get_option( 'asl_content' ) ); ?>"/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
</li>
|
216 |
+
<li>
|
217 |
+
<label for="asl_navigation"><?php _e( 'Skip to Navigation link target (ID of your main navigation container)', 'wp-accessibility' ); ?></label>
|
218 |
+
<input type="text" id="asl_navigation" name="asl_navigation" value="<?php echo esc_attr( get_option( 'asl_navigation' ) ); ?>"/>
|
219 |
+
</li>
|
220 |
+
<li>
|
221 |
+
<label for="asl_sitemap"><?php _e( 'Site Map link target (URL for your site map)', 'wp-accessibility' ); ?></label>
|
222 |
+
<input type="text" id="asl_sitemap" name="asl_sitemap" size="44" value="<?php echo esc_attr( get_option( 'asl_sitemap' ) ); ?>"/>
|
223 |
+
</li>
|
224 |
+
<li>
|
225 |
+
<label for="asl_extra_target"><?php _e( 'Add your own link (link or container ID)', 'wp-accessibility' ); ?></label>
|
226 |
+
<input type="text" id="asl_extra_target" name="asl_extra_target" value="<?php echo esc_attr( get_option( 'asl_extra_target' ) ); ?>"/>
|
227 |
+
<label for="asl_extra_text"><?php _e( 'Link text for your link', 'wp-accessibility' ); ?></label>
|
228 |
+
<input type="text" id="asl_extra_text" name="asl_extra_text" value="<?php echo esc_attr( get_option( 'asl_extra_text' ) ); ?>"/>
|
229 |
+
</li>
|
230 |
+
<li>
|
231 |
+
<label for="asl_styles_focus"><?php _e( 'Styles for Skiplinks when they have focus', 'wp-accessibility' ); ?></label><br/>
|
232 |
+
<textarea name='asl_styles_focus' id='asl_styles_focus' cols='60' rows='4'><?php echo esc_attr( stripslashes( get_option( 'asl_styles_focus' ) ) ); ?></textarea>
|
233 |
+
</li>
|
234 |
+
<?php
|
235 |
+
if ( 'on' != get_option( 'asl_visible' ) ) {
|
236 |
$disabled = " disabled='disabled' style='background: #eee;'";
|
237 |
$note = ' ' . __( '(Not currently visible)', 'wp-accessibility' );
|
238 |
} else {
|
239 |
+
$disabled = '';
|
240 |
+
$note = '';
|
241 |
+
}
|
242 |
+
?>
|
243 |
+
<li>
|
244 |
+
<label for="asl_styles_passive">
|
245 |
+
<?php
|
246 |
+
_e( 'Styles for Skiplinks without focus', 'wp-accessibility' );
|
247 |
+
echo $note;
|
248 |
+
?>
|
249 |
+
</label><br/>
|
250 |
+
<textarea name='asl_styles_passive' id='asl_styles_passive' cols='60' rows='4'<?php echo $disabled; ?>><?php echo stripslashes( get_option( 'asl_styles_passive' ) ); ?></textarea>
|
251 |
</li>
|
252 |
</ul>
|
253 |
</fieldset>
|
256 |
<input type="hidden" name="action" value="asl"/>
|
257 |
</p>
|
258 |
|
259 |
+
<p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Update Skiplink Settings', 'wp-accessibility' ); ?>"/></p>
|
|
|
260 |
</form>
|
261 |
+
<?php
|
262 |
+
}
|
263 |
+
?>
|
264 |
</div>
|
265 |
</div>
|
266 |
<div class="postbox">
|
268 |
<div class="inside">
|
269 |
<form method="post" action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
|
270 |
<ul>
|
271 |
+
<li>
|
272 |
+
<input type="checkbox" id="wpa_toolbar" name="wpa_toolbar" <?php checked( get_option( 'wpa_toolbar' ), 'on' ); ?>/>
|
273 |
+
<label for="wpa_toolbar"><?php _e( 'Add Accessibility toolbar with fontsize adjustment and contrast toggle', 'wp-accessibility' ); ?></label>
|
|
|
|
|
274 |
<ul>
|
275 |
+
<li>
|
276 |
+
<input type="checkbox" id="wpa_toolbar_fs" name="wpa_toolbar_fs" <?php checked( get_option( 'wpa_toolbar_fs' ), 'off' ); ?>/>
|
277 |
+
<label for="wpa_toolbar_fs"><?php _e( 'Exclude font size toggle from Accessibility toolbar', 'wp-accessibility' ); ?></label>
|
|
|
|
|
278 |
</li>
|
279 |
+
<li>
|
280 |
+
<input type="checkbox" id="wpa_toolbar_ct" name="wpa_toolbar_ct" <?php checked( get_option( 'wpa_toolbar_ct' ), 'off' ); ?>/>
|
281 |
+
<label for="wpa_toolbar_ct"><?php _e( 'Exclude contrast toggle from Accessibility toolbar', 'wp-accessibility' ); ?></label>
|
282 |
+
</li>
|
283 |
+
<li>
|
284 |
+
<input type="checkbox" aria-describedby="wpa_toolbar_gs_note" id="wpa_toolbar_gs" name="wpa_toolbar_gs" <?php checked( get_option( 'wpa_toolbar_gs' ), 'on' ); ?> />
|
285 |
+
<label 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>
|
286 |
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
</ul>
|
288 |
</li>
|
289 |
<li>
|
290 |
+
<label for="wpa_toolbar_default"><?php _e( 'Toolbar location (ID attribute)', 'wp-accessibility' ); ?></label>
|
291 |
+
<input type="text" id="wpa_toolbar_default" name="wpa_toolbar_default" value="<?php echo esc_attr( get_option( 'wpa_toolbar_default' ) ); ?>" />
|
292 |
+
</li>
|
293 |
<?php
|
294 |
$size = get_option( 'wpa_toolbar_size' );
|
295 |
?>
|
296 |
+
<li>
|
297 |
+
<label for="wpa_toolbar_size"><?php _e( 'Toolbar font size', 'wp-accessibility' ); ?></label>
|
298 |
<select name='wpa_toolbar_size' id='wpa_toolbar_size'>
|
299 |
<option value=''><?php _e( 'Default size', 'wp-accessibility' ); ?></option>
|
300 |
<?php
|
301 |
for ( $i = 1; $i <= 2.5; ) {
|
302 |
+
$val = ( $i * 10 ) + 2;
|
303 |
+
$current = $val;
|
304 |
$selected_size = ( $current == $size ) ? ' selected="selected"' : '';
|
305 |
+
echo "<option value='$val'$selected_size>$val px</option>";
|
306 |
$i = $i + .1;
|
307 |
}
|
308 |
?>
|
309 |
</select>
|
310 |
</li>
|
311 |
+
<li>
|
312 |
+
<input type="checkbox" id="wpa_alternate_fontsize" name="wpa_alternate_fontsize" <?php checked( get_option( 'wpa_alternate_fontsize' ), 'on' ); ?>/>
|
313 |
+
<label for="wpa_alternate_fontsize"><?php _e( 'Use alternate font resizing stylesheet', 'wp-accessibility' ); ?></label>
|
314 |
+
</li>
|
315 |
+
<li>
|
316 |
+
<input type="checkbox" id="wpa_widget_toolbar" name="wpa_widget_toolbar" <?php checked( get_option( 'wpa_widget_toolbar' ), 'on' ); ?>/>
|
317 |
+
<label for="wpa_widget_toolbar"><?php _e( 'Support Accessibility toolbar as shortcode or widget', 'wp-accessibility' ); ?></label>
|
318 |
+
</li>
|
319 |
+
<li>
|
320 |
+
<input type="checkbox" id="wpa_toolbar_right" name="wpa_toolbar_right" <?php checked( get_option( 'wpa_toolbar_right' ), 'on' ); ?>/>
|
321 |
+
<label for="wpa_toolbar_right"><?php _e( 'Place toolbar on right side of screen.', 'wp-accessibility' ); ?></label>
|
322 |
</li>
|
323 |
+
<li>
|
324 |
+
<input type="checkbox" id="wpa_toolbar_mobile" name="wpa_toolbar_mobile" <?php checked( get_option( 'wpa_toolbar_mobile' ), 'on' ); ?>/>
|
325 |
+
<label for="wpa_toolbar_mobile"><?php _e( 'Hide toolbar on small screens.', 'wp-accessibility' ); ?></label>
|
|
|
|
|
326 |
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
</ul>
|
328 |
<p>
|
329 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
|
330 |
<input type="hidden" name="action" value="toolbar" />
|
331 |
</p>
|
332 |
|
333 |
+
<p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Update Toolbar Settings', 'wp-accessibility' ); ?>"/></p>
|
|
|
334 |
</form>
|
335 |
</div>
|
336 |
</div>
|
340 |
<div class="inside">
|
341 |
<form method="post" action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
|
342 |
<ul>
|
343 |
+
<?php
|
344 |
+
if ( ! wpa_accessible_theme() ) {
|
345 |
+
?>
|
346 |
+
<li>
|
347 |
+
<input type="checkbox" id="wpa_lang" name="wpa_lang" <?php checked( get_option( 'wpa_lang' ), 'on' ); ?>/>
|
348 |
+
<label for="wpa_lang"><?php _e( 'Add Site Language and text direction to HTML element', 'wp-accessibility' ); ?></label>
|
349 |
</li>
|
350 |
+
<li>
|
351 |
+
<input type="checkbox" id="wpa_more" name="wpa_more" <?php checked( get_option( 'wpa_more' ), 'on' ); ?>/>
|
352 |
+
<label for="wpa_more"><?php _e( 'Add post title to "more" links.', 'wp-accessibility' ); ?></label>
|
|
|
|
|
353 |
<label for="wpa_continue"><?php _e( 'Continue reading text', 'wp-accessibility' ); ?></label>
|
354 |
+
<input type="text" id="wpa_continue" name="wpa_continue" value="<?php echo esc_attr( get_option( 'wpa_continue' ) ); ?>"/>
|
355 |
+
</li>
|
356 |
+
<li>
|
357 |
+
<input type="checkbox" id="wpa_insert_roles" name="wpa_insert_roles" <?php checked( get_option( 'wpa_insert_roles' ), 'on' ); ?>/>
|
358 |
+
<label for="wpa_insert_roles"><?php _e( 'Add landmark roles to HTML5 structural elements', 'wp-accessibility' ); ?></label><br/>
|
359 |
+
<label for="wpa_complementary_container"><?php _e( 'ID for complementary role', 'wp-accessibility' ); ?></label>
|
360 |
+
<input type="text" id="wpa_complementary_container" name="wpa_complementary_container" value="#<?php echo esc_attr( get_option( 'wpa_complementary_container' ) ); ?>"/>
|
|
|
|
|
361 |
</li>
|
362 |
<li>
|
363 |
+
<input type="checkbox" id="wpa_labels" name="wpa_labels" <?php checked( get_option( 'wpa_labels' ), 'on' ); ?> />
|
364 |
+
<label for='wpa_labels'><?php _e( 'Automatically Label WordPress search form and comment forms', 'wp-accessibility' ); ?></label>
|
365 |
</li>
|
366 |
+
<?php
|
367 |
+
} else {
|
368 |
+
?>
|
369 |
<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>
|
370 |
+
<?php
|
371 |
+
}
|
372 |
+
?>
|
373 |
+
<li>
|
374 |
+
<input type="checkbox" id="wpa_target" name="wpa_target" <?php checked( get_option( 'wpa_target' ), 'on' ); ?>/>
|
375 |
+
<label for="wpa_target"><?php _e( 'Remove target attribute from links', 'wp-accessibility' ); ?></label>
|
376 |
</li>
|
377 |
+
<li>
|
378 |
+
<input type="checkbox" id="wpa_search" name="wpa_search" <?php checked( get_option( 'wpa_search' ), 'on' ); ?>/>
|
379 |
+
<label for="wpa_search"><?php _e( 'Force search error on empty search submission (theme must have search.php template)', 'wp-accessibility' ); ?></label>
|
|
|
|
|
380 |
</li>
|
381 |
+
<li>
|
382 |
+
<input type="checkbox" id="wpa_tabindex" name="wpa_tabindex" <?php checked( get_option( 'wpa_tabindex' ), 'on' ); ?>/>
|
383 |
+
<label for="wpa_tabindex"><?php _e( 'Remove tabindex from focusable elements', 'wp-accessibility' ); ?></label>
|
|
|
|
|
384 |
</li>
|
385 |
+
<li>
|
386 |
+
<input type="checkbox" id="wpa_underline" name="wpa_underline" <?php checked( get_option( 'wpa_underline' ), 'on' ); ?>/>
|
387 |
+
<label for="wpa_underline"><?php _e( 'Force underline on all links', 'wp-accessibility' ); ?></label>
|
|
|
|
|
388 |
</li>
|
389 |
+
<li>
|
390 |
+
<label for="wpa_longdesc"><?php _e( 'Long Description UI', 'wp-accessibility' ); ?></label>
|
391 |
<select id="wpa_longdesc" name="wpa_longdesc">
|
392 |
+
<option value='false'<?php selected( get_option( 'wpa_longdesc' ), 'false' ); ?>><?php _e( 'Browser defaults only', 'wp-accessibility' ); ?></option>
|
393 |
+
<option value='link'<?php selected( get_option( 'wpa_longdesc' ), 'link' ); ?>><?php _e( 'Link to description', 'wp-accessibility' ); ?></option>
|
394 |
+
<option value='jquery'<?php selected( get_option( 'wpa_longdesc' ), 'jquery' ); ?>><?php _e( 'Button trigger to overlay image', 'wp-accessibility' ); ?></option>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
</select>
|
396 |
</li>
|
397 |
+
<li>
|
398 |
+
<input type="checkbox" id="wpa_longdesc_featured" name="wpa_longdesc_featured" <?php checked( get_option( 'wpa_longdesc_featured' ), 'on' ); ?>/>
|
399 |
+
<label for="wpa_longdesc_featured"><?php _e( 'Support <code>longdesc</code> on featured images', 'wp-accessibility' ); ?></label>
|
|
|
|
|
400 |
</li>
|
401 |
+
<li>
|
402 |
+
<input type="checkbox" id="wpa_row_actions" name="wpa_row_actions" <?php checked( get_option( 'wpa_row_actions' ), 'on' ); ?>/>
|
403 |
+
<label for="wpa_row_actions"><?php _e( 'Make row actions always visible', 'wp-accessibility' ); ?></label>
|
404 |
+
</li>
|
405 |
+
<li>
|
406 |
+
<input type="checkbox" id="wpa_image_titles" name="wpa_image_titles" <?php checked( get_option( 'wpa_image_titles' ), 'on' ); ?>/>
|
407 |
+
<label for="wpa_image_titles"><?php _e( 'Remove title attributes inserted into post content and featured images.', 'wp-accessibility' ); ?></label>
|
408 |
</li>
|
409 |
+
<li>
|
410 |
+
<input type="checkbox" id="wpa_diagnostics" name="wpa_diagnostics" <?php checked( get_option( 'wpa_diagnostics' ), 'on' ); ?>/>
|
411 |
+
<label for="wpa_diagnostics"><?php _e( 'Enable diagnostic CSS', 'wp-accessibility' ); ?></label>
|
|
|
|
|
412 |
</li>
|
413 |
+
<li>
|
414 |
+
<input type="checkbox" id="wpa_focus" name="wpa_focus" <?php checked( get_option( 'wpa_focus' ), 'on' ); ?>/>
|
415 |
+
<label for="wpa_focus"><?php _e( 'Add outline to elements on keyboard focus', 'wp-accessibility' ); ?></label>
|
416 |
+
<label for="wpa_focus_color"><?php _e( 'Outline color (hexadecimal, optional)', 'wp-accessibility' ); ?></label>
|
417 |
+
<input type="text" id="wpa_focus_color" name="wpa_focus_color" value="#<?php echo esc_attr( get_option( 'wpa_focus_color' ) ); ?>"/></li>
|
418 |
+
<li>
|
419 |
+
<input type="checkbox" id="wpa_current_menu" name="wpa_current_menu" <?php checked( get_option( 'wpa_current_menu' ), 'on' ); ?>/>
|
420 |
+
<label for="wpa_current_menu"><?php _e( 'Non-visually identify currently active menu item', 'wp-accessibility' ); ?></label>
|
421 |
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
</ul>
|
423 |
<p>
|
424 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
|
425 |
<input type="hidden" name="action" value="misc"/>
|
426 |
</p>
|
427 |
|
428 |
+
<p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Update Miscellaneous Settings', 'wp-accessibility' ); ?>"/></p>
|
|
|
429 |
</form>
|
430 |
</div>
|
431 |
</div>
|
434 |
|
435 |
<div class="inside">
|
436 |
<?php wpa_accessible_theme(); ?>
|
437 |
+
<form method="post" action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
|
|
|
438 |
<fieldset>
|
439 |
<legend><?php _e( 'Remove title attributes from:', 'wp-accessibility' ); ?></legend>
|
440 |
<ul>
|
441 |
+
<li><input type="checkbox" id="rta_from_tag_clouds" name="rta_from_tag_clouds" <?php checked( get_option( 'rta_from_tag_clouds' ), 'on' ); ?>/>
|
442 |
+
<label for="rta_from_tag_clouds"><?php _e( 'Tag clouds', 'wp-accessibility' ); ?></label>
|
443 |
+
</li>
|
|
|
|
|
|
|
444 |
</ul>
|
445 |
</fieldset>
|
446 |
<p>
|
448 |
<input type="hidden" name="action" value="rta"/>
|
449 |
</p>
|
450 |
|
451 |
+
<p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Update Title Attribute Settings', 'wp-accessibility' ); ?>"/></p>
|
|
|
452 |
</form>
|
453 |
</div>
|
454 |
+
</div>
|
455 |
<div class="postbox">
|
456 |
<h2 class='hndle'><?php _e( 'Color Contrast Tester', 'wp-accessibility' ); ?></h2>
|
457 |
|
469 |
$l_contrast = false;
|
470 |
}
|
471 |
if ( $l_contrast ) {
|
472 |
+
$results = "<div class='updated notice'>";
|
473 |
+
// Translators: Contrast ratio, foreground Hex color, background Hex color.
|
474 |
+
$results .= '<p class="stats wcag2">' . sprintf( __( 'Luminosity Contrast Ratio for %2$s and %3$s is %1$s (Threshold: greater than 7:1 for AAA, 4.5:1 for AA)', 'wp-accessibility' ), '<strong>' . $l_contrast . '</strong>', '<code>#' . $hex1 . '</code>', '<code>#' . $hex2 . '</code>' ) . '</p><p>';
|
475 |
if ( $luminance_raw >= 7 ) {
|
476 |
+
$results .= __( 'The colors compared <strong>pass</strong> the relative luminosity test at level AAA.', 'wp-accessibility' );
|
477 |
}
|
478 |
if ( $luminance_raw >= 4.5 && $luminance_raw < 7 ) {
|
479 |
+
$results .= __( 'The colors compared <strong>pass</strong> the relative luminosity test at level AA.', 'wp-accessibility' );
|
480 |
}
|
481 |
if ( $luminance_raw >= 3 && $luminance_raw < 4.5 ) {
|
482 |
+
$results .= __( 'The colors compared pass the relative luminosity test <strong>only when used in large print</strong> situations (greater than 18pt text or 14pt bold text.)', 'wp-accessibility' );
|
483 |
}
|
484 |
if ( $luminance_raw < 3 ) {
|
485 |
+
$results .= __( 'The colors compared <strong>do not pass</strong> the relative luminosity test.', 'wp-accessibility' );
|
486 |
}
|
487 |
+
$results .= " <a href='#contrast'>" . __( 'Test another set of colors', 'wp-accessibility' ) . '</a>';
|
488 |
+
$results .= '</p>';
|
489 |
$results .= "
|
490 |
<div class=\"views\">
|
491 |
<p class='large' style=\"font-size: 2em; line-height: 1.4;color: #$hex1;background: #$hex2;border: 3px solid #$hex1\">Large Print Example</p>
|
497 |
echo $results;
|
498 |
}
|
499 |
?>
|
500 |
+
<form method="post" action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
|
|
|
501 |
<fieldset>
|
502 |
<legend><?php _e( 'Test of relative luminosity', 'wp-accessibility' ); ?></legend>
|
503 |
<ul>
|
504 |
<li class='fore'>
|
505 |
<div id="fore"></div>
|
506 |
+
<label for="color1"><?php _e( 'Foreground color', 'wp-accessibility' ); ?></label><br/>
|
507 |
+
<input type="text" name="color" value="#<?php echo esc_attr( $hex1 ); ?>" size="34" id="color1"/>
|
|
|
508 |
</li>
|
509 |
<li class='back'>
|
510 |
<div id="back"></div>
|
511 |
+
<label for="color2"><?php _e( 'Background color', 'wp-accessibility' ); ?></label><br/>
|
512 |
+
<input type="text" name="color2" value="#<?php echo esc_attr( $hex2 ); ?>" size="34" id="color2"/>
|
|
|
513 |
</li>
|
514 |
</ul>
|
515 |
</fieldset>
|
518 |
<input type="hidden" name="action" value="contrast"/>
|
519 |
</p>
|
520 |
|
521 |
+
<p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Check Color Contrast', 'wp-accessibility' ); ?>"/></p>
|
|
|
522 |
</form>
|
523 |
</div>
|
524 |
</div>
|
528 |
<div class="inside">
|
529 |
<div class='wpa-support-me'>
|
530 |
<p>
|
531 |
+
<?php
|
532 |
+
// Translators: URL to donate.
|
533 |
+
printf( __( 'Please, consider <a href="%s">making a donation</a> to support WP Accessibility!', 'wp-accessibility' ), 'https://www.joedolson.com/donate/' );
|
534 |
+
?>
|
535 |
</p>
|
536 |
+
</div>
|
537 |
+
<?php wpa_get_support_form(); ?>
|
538 |
</div>
|
539 |
</div>
|
540 |
</div>
|
549 |
|
550 |
<div class="inside">
|
551 |
<p>
|
552 |
+
<a href="https://twitter.com/intent/follow?screen_name=joedolson" class="twitter-follow-button" data-size="small" data-related="joedolson">Follow @joedolson</a>
|
|
|
553 |
<script>!function (d, s, id) {
|
554 |
var js, fjs = d.getElementsByTagName(s)[0];
|
555 |
if (!d.getElementById(id)) {
|
569 |
<div>
|
570 |
<input type="hidden" name="cmd" value="_s-xclick"/>
|
571 |
<input type="hidden" name="hosted_button_id" value="QK9MXYGQKYUZY"/>
|
572 |
+
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="Donate"/>
|
|
|
573 |
<img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/>
|
574 |
</div>
|
575 |
</form>
|
583 |
<h2 class='hndle'><?php _e( 'Access Monitor', 'wp-accessibility' ); ?></h2>
|
584 |
|
585 |
<div class="inside">
|
586 |
+
<p>
|
587 |
+
<?php
|
588 |
+
// Translators: URL to visit Access Monitor at WordPress.org.
|
589 |
+
printf( __( 'Try using <a href="%s">Access Monitor</a> to do scheduled and on-demand evaluations of your web site accessibility.', 'wp-accessibility' ), 'https://wordpress.org/plugins/access-monitor/' );
|
590 |
+
?>
|
591 |
+
</p>
|
592 |
</div>
|
593 |
</div>
|
594 |
</div>
|
595 |
+
|
596 |
<div class="ui-sortable meta-box-sortables">
|
597 |
<div class="postbox">
|
598 |
<h2 class='hndle'><?php _e( 'Accessibility References', 'wp-accessibility' ); ?></h2>
|
617 |
|
618 |
<div class="inside">
|
619 |
<p>
|
620 |
+
<?php _e( 'It is almost impossible for the Accessibility Toolbar to guarantee a good result for large text or high contrast modes.', 'wp-accessibility' ); ?>
|
621 |
</p>
|
622 |
<p>
|
623 |
+
<?php _e( 'Author high-contrast styles by placing a stylesheet called <code>a11y-contrast.css</code> in your Theme\'s stylesheet directory.', 'wp-accessibility' ); ?>
|
624 |
</p>
|
|
|
625 |
<p>
|
626 |
+
<?php _e( 'Define custom styles for large print by assigning them in the body class <code>.fontsize</code> in your theme stylesheet.', 'wp-accessibility' ); ?>
|
627 |
</p>
|
|
|
628 |
<p>
|
629 |
+
<?php _e( 'Define a custom long description template by adding the template "longdesc-template.php" to your theme directory.', 'wp-accessibility' ); ?>
|
630 |
</p>
|
|
|
631 |
<p>
|
632 |
+
<?php _e( 'The <a href="#wpa_widget_toolbar">shortcode for the Accessibility toolbar</a> (if enabled) is <code>[wpa_toolbar]</code>', 'wp-accessibility' ); ?>
|
633 |
</p>
|
634 |
</div>
|
635 |
</div>
|
636 |
</div>
|
637 |
+
|
638 |
<?php if ( wpa_accessible_theme() ) { ?>
|
639 |
<div class="ui-sortable meta-box-sortables">
|
640 |
<div class="postbox">
|
645 |
<?php _e( "You're using a theme reviewed as <code>accessibility-ready</code> by the WordPress theme review team. Some options have been disabled in WP Accessibility because your theme has taken care of that issue.", 'wp-accessibility' ); ?>
|
646 |
</p>
|
647 |
<p>
|
648 |
+
<?php
|
649 |
+
// Translators: URL to read about the accessibility ready tag requirements.
|
650 |
+
printf( __( 'Read more about the <a href="%s">WordPress accessibility-ready tag</a>', 'wp-accessibility' ), 'https://make.wordpress.org/themes/handbook/review/accessibility/' );
|
651 |
+
?>
|
652 |
</p>
|
653 |
</div>
|
654 |
</div>
|
655 |
</div>
|
656 |
+
<?php } ?>
|
657 |
+
|
658 |
|
659 |
<div class="ui-sortable meta-box-sortables">
|
660 |
<div class="postbox">
|
665 |
<li><a href="http://www.accessibleculture.org/articles/2010/08/continue-reading-links-in-wordpress/">Continue Reading Links in WordPress</a></li>
|
666 |
<li><a href="http://www.mothereffingtoolconfuser.com">Mother Effing Tool Confuser</a></li>
|
667 |
<li><a href="http://wordpress.org/extend/plugins/remove-title-attributes/">Remove Title Attributes</a></li>
|
|
|
668 |
<li><a href="http://wordpress.org/extend/plugins/img-title-removal/">IMG Title Removal</a></li>
|
669 |
<li><a href="https://github.com/clrux/a11y">Accessibility Toolbar</a></li>
|
670 |
<li><a href="https://wordpress.org/plugins/long-description-for-image-attachments/">WordPress Long Description</a></li>
|
672 |
</div>
|
673 |
</div>
|
674 |
</div>
|
675 |
+
|
676 |
+
|
677 |
</div>
|
678 |
</div>
|
679 |
|
680 |
+
</div>
|
681 |
+
<?php
|
682 |
+
}
|
wp-accessibility-toolbar.php
CHANGED
@@ -1,31 +1,47 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
add_shortcode( 'wpa_toolbar', 'wpa_toolbar_html' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
function wpa_toolbar_html( $type = 'widget' ) {
|
5 |
$contrast = __( 'Toggle High Contrast', 'wp-accessibility' );
|
6 |
$grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
|
7 |
$fontsize = __( 'Toggle Font size', 'wp-accessibility' );
|
8 |
-
$enable_grayscale = ( get_option( 'wpa_toolbar_gs' )
|
9 |
-
$enable_contrast = ( get_option( 'wpa_toolbar_ct' )
|
10 |
-
$enable_fontsize = ( get_option( 'wpa_toolbar_fs' )
|
11 |
-
$responsive = ( get_option( 'wpa_toolbar_mobile' )
|
12 |
$is_rtl = ( is_rtl() ) ? ' rtl' : ' ltr';
|
13 |
-
$is_right = ( get_option( 'wpa_toolbar_right' )
|
14 |
-
$toolbar_type = (
|
15 |
-
$control_type = (
|
16 |
-
$closure = (
|
17 |
$toolbar = '
|
18 |
<!-- a11y toolbar widget -->
|
19 |
<div class="' . $responsive . ' ' . $is_rtl . ' ' . $is_right . ' ' . $toolbar_type . '">
|
20 |
<ul>';
|
21 |
if ( $enable_contrast ) {
|
22 |
-
$toolbar .= '<li><' . $control_type . ' class="a11y-toggle-contrast toggle-contrast" id="is_normal_contrast" aria-pressed="false"><span class="offscreen">'
|
23 |
}
|
24 |
if ( $enable_grayscale ) {
|
25 |
-
$toolbar .= '<li><' . $control_type . ' class="a11y-toggle-grayscale toggle-grayscale" id="is_normal_color" aria-pressed="false"><span class="offscreen">'
|
26 |
}
|
27 |
if ( $enable_fontsize ) {
|
28 |
-
$toolbar .= '<li><' . $control_type . ' class="a11y-toggle-fontsize toggle-fontsize" id="is_normal_fontsize" aria-pressed="false"><span class="offscreen">'
|
29 |
}
|
30 |
$toolbar .= '
|
31 |
</ul>
|
@@ -35,45 +51,47 @@ function wpa_toolbar_html( $type = 'widget' ) {
|
|
35 |
return $toolbar;
|
36 |
}
|
37 |
|
|
|
|
|
|
|
38 |
function wpa_toolbar_js() {
|
39 |
// Toolbar does not work on Edge. Disable unless I solve the issue.
|
40 |
-
$default
|
41 |
-
$location
|
42 |
$user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? $_SERVER['HTTP_USER_AGENT'] : '';
|
43 |
-
$is_rtl
|
44 |
-
$is_right
|
45 |
-
$responsive
|
46 |
-
|
47 |
if ( preg_match( '/Edge/i', $user_agent ) ) {
|
48 |
echo wpa_toolbar_html( 'js' );
|
49 |
-
echo "
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
58 |
} else {
|
59 |
-
|
60 |
$contrast = __( 'Toggle High Contrast', 'wp-accessibility' );
|
61 |
$grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
|
62 |
$fontsize = __( 'Toggle Font size', 'wp-accessibility' );
|
63 |
-
$enable_grayscale = ( get_option( 'wpa_toolbar_gs' )
|
64 |
-
$enable_fontsize = ( get_option( 'wpa_toolbar_fs' )
|
65 |
-
$enable_contrast = ( get_option( 'wpa_toolbar_ct' )
|
66 |
|
67 |
-
|
68 |
echo
|
69 |
"
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
if ( get_option( 'wpa_toolbar' ) == 'on' && $enable_contrast ) {
|
77 |
echo "insert_a11y_toolbar += '<li class=\"a11y-toolbar-list-item\"><button type=\"button\" class=\"a11y-toggle-contrast toggle-contrast\" id=\"is_normal_contrast\" aria-pressed=\"false\"><span class=\"offscreen\">$contrast</span><span class=\"aticon aticon-adjust\" aria-hidden=\"true\"></span></button></li>';";
|
78 |
}
|
79 |
if ( get_option( 'wpa_toolbar' ) == 'on' && $enable_grayscale ) {
|
@@ -83,12 +101,12 @@ function wpa_toolbar_js() {
|
|
83 |
echo "insert_a11y_toolbar += '<li class=\"a11y-toolbar-list-item\"><button type=\"button\" class=\"a11y-toggle-fontsize toggle-fontsize\" id=\"is_normal_fontsize\" aria-pressed=\"false\"><span class=\"offscreen\">$fontsize</span><span class=\"aticon aticon-font\" aria-hidden=\"true\"></span></button></li>';";
|
84 |
}
|
85 |
echo "
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
}
|
94 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Generate Toolbar HTML & JS
|
4 |
+
*
|
5 |
+
* @category Toolbar
|
6 |
+
* @package WP Accessibility
|
7 |
+
* @author Joe Dolson
|
8 |
+
* @license GPLv2 or later
|
9 |
+
* @link https://www.joedolson.com/wp-accessibility/
|
10 |
+
*/
|
11 |
|
12 |
add_shortcode( 'wpa_toolbar', 'wpa_toolbar_html' );
|
13 |
+
/**
|
14 |
+
* Generate Toolbar as HTML.
|
15 |
+
*
|
16 |
+
* @param string $type widget, shortcode, or button.
|
17 |
+
*
|
18 |
+
* @return string HTML.
|
19 |
+
*/
|
20 |
function wpa_toolbar_html( $type = 'widget' ) {
|
21 |
$contrast = __( 'Toggle High Contrast', 'wp-accessibility' );
|
22 |
$grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
|
23 |
$fontsize = __( 'Toggle Font size', 'wp-accessibility' );
|
24 |
+
$enable_grayscale = ( 'on' == get_option( 'wpa_toolbar_gs' ) && current_user_can( 'manage_options' ) ) ? true : false;
|
25 |
+
$enable_contrast = ( 'off' == get_option( 'wpa_toolbar_ct' ) ) ? false : true;
|
26 |
+
$enable_fontsize = ( 'off' == get_option( 'wpa_toolbar_fs' ) ) ? false : true;
|
27 |
+
$responsive = ( 'on' == get_option( 'wpa_toolbar_mobile' ) ) ? 'a11y-responsive ' : '';
|
28 |
$is_rtl = ( is_rtl() ) ? ' rtl' : ' ltr';
|
29 |
+
$is_right = ( 'on' == get_option( 'wpa_toolbar_right' ) ) ? ' right' : ' left';
|
30 |
+
$toolbar_type = ( 'widget' == $type ) ? 'a11y-toolbar-widget' : 'a11y-toolbar';
|
31 |
+
$control_type = ( 'button' != $type ) ? 'a href="#" role="button"' : 'button type="button"'; // button control does not work in Edge.
|
32 |
+
$closure = ( 'button' != $type ) ? 'a' : 'button'; // button control does not work in Edge.
|
33 |
$toolbar = '
|
34 |
<!-- a11y toolbar widget -->
|
35 |
<div class="' . $responsive . ' ' . $is_rtl . ' ' . $is_right . ' ' . $toolbar_type . '">
|
36 |
<ul>';
|
37 |
if ( $enable_contrast ) {
|
38 |
+
$toolbar .= '<li><' . $control_type . ' class="a11y-toggle-contrast toggle-contrast" id="is_normal_contrast" aria-pressed="false"><span class="offscreen">' . $contrast . '</span><span class="aticon aticon-adjust" aria-hidden="true"></span></' . $closure . '></li>';
|
39 |
}
|
40 |
if ( $enable_grayscale ) {
|
41 |
+
$toolbar .= '<li><' . $control_type . ' class="a11y-toggle-grayscale toggle-grayscale" id="is_normal_color" aria-pressed="false"><span class="offscreen">' . $grayscale . '</span><span class="aticon aticon-tint" aria-hidden="true"></span></' . $closure . '></li>';
|
42 |
}
|
43 |
if ( $enable_fontsize ) {
|
44 |
+
$toolbar .= '<li><' . $control_type . ' class="a11y-toggle-fontsize toggle-fontsize" id="is_normal_fontsize" aria-pressed="false"><span class="offscreen">' . $fontsize . '</span><span class="aticon aticon-font" aria-hidden="true"></span></' . $closure . '></li>';
|
45 |
}
|
46 |
$toolbar .= '
|
47 |
</ul>
|
51 |
return $toolbar;
|
52 |
}
|
53 |
|
54 |
+
/**
|
55 |
+
* Generate Toolbar as JS.
|
56 |
+
*/
|
57 |
function wpa_toolbar_js() {
|
58 |
// Toolbar does not work on Edge. Disable unless I solve the issue.
|
59 |
+
$default = ( '' != get_option( 'wpa_toolbar_default' ) ) ? get_option( 'wpa_toolbar_default' ) : 'body';
|
60 |
+
$location = apply_filters( 'wpa_move_toolbar', $default );
|
61 |
$user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? $_SERVER['HTTP_USER_AGENT'] : '';
|
62 |
+
$is_rtl = ( is_rtl() ) ? ' rtl' : ' ltr';
|
63 |
+
$is_right = ( 'on' == get_option( 'wpa_toolbar_right' ) ) ? ' right' : ' left';
|
64 |
+
$responsive = ( 'on' == get_option( 'wpa_toolbar_mobile' ) ) ? 'a11y-responsive ' : 'a11y-non-responsive ';
|
65 |
+
|
66 |
if ( preg_match( '/Edge/i', $user_agent ) ) {
|
67 |
echo wpa_toolbar_html( 'js' );
|
68 |
+
echo "
|
69 |
+
<script type='text/javascript'>
|
70 |
+
//<![CDATA[
|
71 |
+
(function( $ ) { 'use strict';
|
72 |
+
var toolbar = $( '.a11y-toolbar-widget' );
|
73 |
+
toolbar.removeClass( 'a11y-toolbar-widget' );
|
74 |
+
$( document ).find( '$location' ).prepend( toolbar );
|
75 |
+
}(jQuery));
|
76 |
+
//]]>
|
77 |
+
</script>";
|
78 |
} else {
|
|
|
79 |
$contrast = __( 'Toggle High Contrast', 'wp-accessibility' );
|
80 |
$grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
|
81 |
$fontsize = __( 'Toggle Font size', 'wp-accessibility' );
|
82 |
+
$enable_grayscale = ( 'on' == get_option( 'wpa_toolbar_gs' ) && current_user_can( 'manage_options' ) ) ? true : false;
|
83 |
+
$enable_fontsize = ( 'off' == get_option( 'wpa_toolbar_fs' ) ) ? false : true;
|
84 |
+
$enable_contrast = ( 'off' == get_option( 'wpa_toolbar_ct' ) ) ? false : true;
|
85 |
|
|
|
86 |
echo
|
87 |
"
|
88 |
+
<script type='text/javascript'>
|
89 |
+
//<![CDATA[
|
90 |
+
(function( $ ) { 'use strict';
|
91 |
+
var insert_a11y_toolbar = '<!-- a11y toolbar -->';
|
92 |
+
insert_a11y_toolbar += '<div class=\"" . $responsive . "a11y-toolbar$is_rtl$is_right\">';
|
93 |
+
insert_a11y_toolbar += '<ul class=\"a11y-toolbar-list\">';";
|
94 |
+
if ( get_option( 'wpa_toolbar' ) == 'on' && $enable_contrast ) {
|
95 |
echo "insert_a11y_toolbar += '<li class=\"a11y-toolbar-list-item\"><button type=\"button\" class=\"a11y-toggle-contrast toggle-contrast\" id=\"is_normal_contrast\" aria-pressed=\"false\"><span class=\"offscreen\">$contrast</span><span class=\"aticon aticon-adjust\" aria-hidden=\"true\"></span></button></li>';";
|
96 |
}
|
97 |
if ( get_option( 'wpa_toolbar' ) == 'on' && $enable_grayscale ) {
|
101 |
echo "insert_a11y_toolbar += '<li class=\"a11y-toolbar-list-item\"><button type=\"button\" class=\"a11y-toggle-fontsize toggle-fontsize\" id=\"is_normal_fontsize\" aria-pressed=\"false\"><span class=\"offscreen\">$fontsize</span><span class=\"aticon aticon-font\" aria-hidden=\"true\"></span></button></li>';";
|
102 |
}
|
103 |
echo "
|
104 |
+
insert_a11y_toolbar += '</ul>';
|
105 |
+
insert_a11y_toolbar += '</div>';
|
106 |
+
insert_a11y_toolbar += '<!-- // a11y toolbar -->';
|
107 |
+
$( document ).find( '$location' ).prepend( insert_a11y_toolbar );
|
108 |
+
}(jQuery));
|
109 |
+
//]]>
|
110 |
+
</script>";
|
111 |
}
|
112 |
+
}
|
wp-accessibility-widget.php
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
add_action( 'widgets_init', create_function( '', 'return register_widget("wp_accessibility_toolbar");' ) );
|
4 |
-
class wp_accessibility_toolbar extends WP_Widget {
|
5 |
-
function __construct() {
|
6 |
-
parent::__construct( false, $name = __( 'Accessibility Toolbar', 'wp-accessibility' ), array( 'customize_selective_refresh' => true ) );
|
7 |
-
}
|
8 |
-
|
9 |
-
function widget( $args, $instance ) {
|
10 |
-
extract( $args );
|
11 |
-
|
12 |
-
$title = apply_filters( 'widget_title', ( empty( $instance['title'] ) ? false : $instance['title'] ), $instance, $args );
|
13 |
-
echo $before_widget;
|
14 |
-
echo ( $title ) ? $before_title . $title . $after_title : '';
|
15 |
-
echo wpa_toolbar_html();
|
16 |
-
echo $after_widget;
|
17 |
-
}
|
18 |
-
|
19 |
-
function form( $instance ) {
|
20 |
-
$title = ( isset( $instance['title'] ) ) ? esc_attr( $instance['title'] ) : '';
|
21 |
-
?>
|
22 |
-
<p>
|
23 |
-
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'wp-accessibility' ); ?></label>
|
24 |
-
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php esc_attr_e( $title ); ?>"/>
|
25 |
-
</p>
|
26 |
-
<?php
|
27 |
-
}
|
28 |
-
|
29 |
-
function update( $new_instance, $old_instance ) {
|
30 |
-
$instance = $old_instance;
|
31 |
-
$instance['title'] = strip_tags( $new_instance['title'] );
|
32 |
-
|
33 |
-
return $instance;
|
34 |
-
}
|
35 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wp-accessibility.php
CHANGED
@@ -1,70 +1,75 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/*
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
This program is distributed in the hope that it will be useful,
|
20 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
-
GNU General Public License for more details.
|
23 |
-
|
24 |
-
You should have received a copy of the GNU General Public License
|
25 |
-
along with this program; if not, write to the Free Software
|
26 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
register_activation_hook( __FILE__, 'wpa_install' );
|
33 |
|
34 |
-
// Enable internationalisation
|
35 |
add_action( 'plugins_loaded', 'wpa_load_textdomain' );
|
|
|
|
|
|
|
36 |
function wpa_load_textdomain() {
|
37 |
load_plugin_textdomain( 'wp-accessibility', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
|
38 |
}
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
43 |
add_action( 'admin_print_footer_scripts', 'wpa_write_js' );
|
44 |
-
add_options_page( 'WP Accessibility', 'WP Accessibility', 'manage_options', __FILE__, '
|
45 |
}
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
?>
|
51 |
-
<script>
|
52 |
-
//<![CDATA[
|
53 |
-
(function ($) {
|
54 |
-
'use strict';
|
55 |
-
$('#fore').farbtastic('#color1');
|
56 |
-
$('#back').farbtastic('#color2');
|
57 |
-
}(jQuery));
|
58 |
-
//]]>
|
59 |
-
</script>
|
60 |
-
<?php
|
61 |
-
}
|
62 |
-
}
|
63 |
-
|
64 |
-
// ACTIVATION
|
65 |
function wpa_install() {
|
66 |
-
$wpa_version = '1.6.
|
67 |
-
if ( get_option( 'wpa_installed' )
|
68 |
add_option( 'rta_from_nav_menu', 'on' );
|
69 |
add_option( 'rta_from_page_lists', 'on' );
|
70 |
add_option( 'rta_from_category_lists', 'on' );
|
@@ -89,51 +94,51 @@ function wpa_install() {
|
|
89 |
}
|
90 |
}
|
91 |
|
|
|
|
|
|
|
92 |
function wpa_check_version() {
|
93 |
-
// upgrade for version 1.3.0
|
94 |
if ( version_compare( get_option( 'wpa_version' ), '1.3.0', '<' ) ) {
|
95 |
add_option( 'wpa_longdesc', 'jquery' );
|
96 |
}
|
97 |
}
|
98 |
|
99 |
add_filter( 'plugin_action_links', 'wpa_plugin_action', 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
function wpa_plugin_action( $links, $file ) {
|
101 |
-
if (
|
102 |
$admin_url = admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' );
|
103 |
-
$links[] = "<a href='$admin_url'>" . __( 'Accessibility Settings', 'wp-accessibility'
|
104 |
}
|
105 |
|
106 |
return $links;
|
107 |
}
|
108 |
|
109 |
-
/**
|
110 |
-
* Enqueue color picker for contrast testing
|
111 |
-
**/
|
112 |
-
add_action( 'admin_enqueue_scripts', 'wpa_admin_js' );
|
113 |
-
function wpa_admin_js() {
|
114 |
-
global $current_screen;
|
115 |
-
if ( $current_screen->base == 'settings_page_wp-accessibility/wp-accessibility' ) {
|
116 |
-
wp_enqueue_script( 'farbtastic' );
|
117 |
-
}
|
118 |
-
}
|
119 |
-
|
120 |
-
|
121 |
add_action( 'wp_enqueue_scripts', 'wpa_register_scripts' );
|
|
|
|
|
|
|
122 |
function wpa_register_scripts() {
|
123 |
-
// register jQuery scripts;
|
124 |
wp_register_script( 'skiplinks.webkit', plugins_url( 'wp-accessibility/js/skiplinks.webkit.js' ) );
|
125 |
wp_register_script( 'ui-a11y.js', plugins_url( 'wp-accessibility/toolbar/js/a11y.js' ), array( 'jquery' ), '1.0', true );
|
126 |
-
wp_register_script( 'scrollTo', plugins_url( 'wp-accessibility/toolbar/js/jquery.scrollto.min.js' ), array( 'jquery' ), '1.4.5', true );
|
127 |
}
|
128 |
|
129 |
add_action( 'wp_enqueue_scripts', 'wpacc_enqueue_scripts' );
|
|
|
|
|
|
|
130 |
function wpacc_enqueue_scripts() {
|
131 |
wp_enqueue_script( 'jquery' );
|
132 |
-
if ( get_option( 'asl_enable' )
|
133 |
wp_enqueue_script( 'skiplinks.webkit' );
|
134 |
}
|
135 |
-
if ( get_option( 'wpa_toolbar' )
|
136 |
-
wp_enqueue_script( 'scrollTo' );
|
137 |
wp_enqueue_script( 'ui-a11y.js' );
|
138 |
$plugin_path = plugins_url( 'wp-accessibility/toolbar/css/a11y-contrast.css' );
|
139 |
if ( file_exists( get_stylesheet_directory() . '/a11y-contrast.css' ) ) {
|
@@ -141,7 +146,7 @@ function wpacc_enqueue_scripts() {
|
|
141 |
}
|
142 |
wp_localize_script( 'ui-a11y.js', 'a11y_stylesheet_path', $plugin_path );
|
143 |
}
|
144 |
-
if ( get_option( 'wpa_insert_roles' )
|
145 |
wp_enqueue_script( 'wpa-complementary', plugins_url( 'js/roles.jquery.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
146 |
if ( get_option( 'wpa_complementary_container' ) ) {
|
147 |
$wpa_comp = get_option( 'wpa_complementary_container' );
|
@@ -150,58 +155,63 @@ function wpacc_enqueue_scripts() {
|
|
150 |
}
|
151 |
wp_localize_script( 'wpa-complementary', 'wpaComplementary', $wpa_comp );
|
152 |
}
|
153 |
-
if ( get_option( 'wpa_labels' )
|
154 |
wp_enqueue_script( 'wpa-labels', plugins_url( 'js/wpa.labels.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
155 |
-
$labels = array(
|
156 |
-
's'
|
157 |
-
'author'
|
158 |
-
'email'
|
159 |
-
'url'
|
160 |
-
'comment' => __( 'Comment', 'wp-accessibility' )
|
161 |
);
|
162 |
wp_localize_script( 'wpa-labels', 'wpalabels', $labels );
|
163 |
}
|
164 |
-
if ( get_option( 'wpa_toolbar' )
|
165 |
add_action( 'wp_footer', 'wpa_toolbar_js' );
|
166 |
}
|
167 |
-
if ( get_option( 'wpa_longdesc' )
|
168 |
wp_enqueue_script( 'longdesc.link', plugins_url( 'js/longdesc.link.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
169 |
}
|
170 |
-
if ( get_option( 'wpa_longdesc' )
|
171 |
wp_enqueue_script( 'longdesc.button', plugins_url( 'js/longdesc.button.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
172 |
}
|
173 |
-
if ( get_option( 'wpa_current_menu' )
|
174 |
wp_enqueue_script( 'current.menu', plugins_url( 'js/current-menu-item.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
175 |
}
|
176 |
}
|
177 |
|
178 |
add_action( 'wp_enqueue_scripts', 'wpa_stylesheet' );
|
|
|
|
|
|
|
179 |
function wpa_stylesheet() {
|
180 |
-
// Respects SSL, Style.css is relative to the current file
|
181 |
wp_register_style( 'wpa-style', plugins_url( 'css/wpa-style.css', __FILE__ ) );
|
182 |
wp_register_style( 'ui-font.css', plugins_url( 'toolbar/fonts/css/a11y-toolbar.css', __FILE__ ) );
|
183 |
$toolbar = apply_filters( 'wpa_toolbar_css', plugins_url( 'toolbar/css/a11y.css', __FILE__ ) );
|
184 |
wp_register_style( 'ui-a11y.css', $toolbar, array( 'ui-font.css' ) );
|
185 |
-
$fontsize_stylesheet = ( get_option( 'wpa_alternate_fontsize' )
|
186 |
-
$fontsize
|
187 |
wp_register_style( 'ui-fontsize.css', $fontsize );
|
188 |
-
|
189 |
-
|
|
|
|
|
190 |
echo "
|
191 |
<style type='text/css'>
|
192 |
.a11y-toolbar ul li button {
|
193 |
-
font-size: " .
|
194 |
}
|
195 |
-
</style>
|
196 |
}
|
197 |
-
if ( get_option( 'wpa_longdesc' )
|
198 |
wp_enqueue_style( 'wpa-style' );
|
199 |
}
|
200 |
-
if ( get_option( 'wpa_toolbar' )
|
201 |
wp_enqueue_style( 'ui-a11y.css' );
|
202 |
wp_enqueue_style( 'ui-fontsize.css' );
|
203 |
}
|
204 |
-
if ( current_user_can( 'edit_files' ) && get_option( 'wpa_diagnostics' )
|
205 |
wp_register_style( 'diagnostic', plugins_url( 'css/diagnostic.css', __FILE__ ) );
|
206 |
wp_register_style( 'diagnostic-head', plugins_url( 'css/diagnostic-head.css', __FILE__ ) );
|
207 |
wp_enqueue_style( 'diagnostic' );
|
@@ -209,10 +219,10 @@ function wpa_stylesheet() {
|
|
209 |
}
|
210 |
}
|
211 |
|
|
|
212 |
/**
|
213 |
* Enqueue admin stylesheets if enabled
|
214 |
*/
|
215 |
-
add_action( 'admin_head', 'wpa_admin_stylesheet' );
|
216 |
function wpa_admin_stylesheet() {
|
217 |
// Used to provide an admin CSS from plug-in, now only enqueue if custom provided in theme.
|
218 |
if ( file_exists( get_stylesheet_directory() . '/wp-admin.css' ) ) {
|
@@ -220,8 +230,8 @@ function wpa_admin_stylesheet() {
|
|
220 |
wp_register_style( 'wp-a11y-css', $file );
|
221 |
wp_enqueue_style( 'wp-a11y-css' );
|
222 |
}
|
223 |
-
|
224 |
-
if ( get_option( 'wpa_row_actions' )
|
225 |
if ( file_exists( get_stylesheet_directory() . '/wp-admin-row-actions.css' ) ) {
|
226 |
$file = get_stylesheet_directory_uri() . '/wp-admin-row-actions.css';
|
227 |
} else {
|
@@ -233,40 +243,44 @@ function wpa_admin_stylesheet() {
|
|
233 |
}
|
234 |
|
235 |
add_action( 'wp_head', 'wpa_css' );
|
|
|
|
|
|
|
236 |
function wpa_css() {
|
237 |
$styles = '';
|
238 |
if ( get_option( 'asl_enable' ) == 'on' ) {
|
239 |
$focus = get_option( 'asl_styles_focus' );
|
240 |
-
// these styles are derived from the WordPress skip link defaults
|
241 |
-
$default_focus =
|
242 |
if ( ! $focus ) {
|
243 |
$focus = $default_focus;
|
244 |
} else {
|
245 |
$focus = $default_focus . $focus;
|
246 |
}
|
247 |
$passive = get_option( 'asl_styles_passive' );
|
248 |
-
$vis =
|
249 |
-
|
250 |
-
|
|
|
251 |
$vis = '#skiplinks a:hover,';
|
252 |
} else {
|
253 |
$invis = '#skiplinks a:hover,';
|
254 |
}
|
255 |
-
$visibility
|
256 |
-
$is_rtl
|
257 |
-
$class
|
258 |
-
$styles
|
259 |
$class#skiplinks a, $invis $class#skiplinks a:visited { $passive }
|
260 |
$class#skiplinks a:active, $vis $class#skiplinks a:focus { $focus }
|
261 |
";
|
262 |
}
|
263 |
-
if ( get_option( 'wpa_focus' )
|
264 |
-
$color
|
265 |
$styles .= "
|
266 |
:focus { outline: 1px solid$color!important; }
|
267 |
";
|
268 |
}
|
269 |
-
if (
|
270 |
echo "
|
271 |
<style type='text/css'>
|
272 |
$styles
|
@@ -274,50 +288,64 @@ function wpa_css() {
|
|
274 |
}
|
275 |
}
|
276 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
function wpa_is_url( $url ) {
|
278 |
return preg_match( '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url );
|
279 |
}
|
280 |
|
281 |
add_action( 'wp_footer', 'wpa_jquery_asl', 100 );
|
|
|
|
|
|
|
282 |
function wpa_jquery_asl() {
|
283 |
-
$skiplinks_js =
|
284 |
-
$
|
285 |
-
|
|
|
|
|
|
|
|
|
286 |
$html = '';
|
287 |
-
// set up skiplinks
|
288 |
$extra = get_option( 'asl_extra_target' );
|
289 |
$extra = ( wpa_is_url( $extra ) ) ? esc_url( $extra ) : str_replace( '#', '', esc_attr( $extra ) );
|
290 |
-
if (
|
291 |
$extra = "#$extra";
|
292 |
}
|
293 |
-
$extra_text
|
294 |
-
$content
|
295 |
-
$nav
|
296 |
-
$sitemap
|
297 |
-
$html
|
298 |
-
$html
|
299 |
-
$html
|
300 |
-
$html
|
301 |
-
$is_rtl
|
302 |
-
$skiplinks
|
303 |
-
$output
|
304 |
-
//
|
305 |
-
$focusable = (
|
306 |
-
$focusable .= (
|
307 |
$skiplinks_js = ( $output ) ? "$('body').prepend('$output'); $focusable" : '';
|
308 |
}
|
309 |
-
//
|
310 |
-
if ( get_option( 'wpa_lang' )
|
311 |
$lang = get_bloginfo( 'language' );
|
312 |
-
$dir =
|
313 |
$lang_js = "$('html').attr( 'lang','$lang' ); $('html').attr( 'dir','$dir' )";
|
314 |
}
|
315 |
-
//
|
316 |
$underline_target = apply_filters( 'wpa_underline_target', 'a' );
|
317 |
-
$targets
|
318 |
-
$tabindex
|
319 |
-
$underlines
|
320 |
-
|
321 |
$display = ( $skiplinks_js || $targets || $lang_js || $tabindex || $longdesc ) ? true : false;
|
322 |
if ( $display ) {
|
323 |
$script = "
|
@@ -336,9 +364,14 @@ function wpa_jquery_asl() {
|
|
336 |
}
|
337 |
}
|
338 |
|
339 |
-
// courtesy of Graham Armfield (modified)
|
340 |
-
// http://www.coolfields.co.uk/2013/02/wordpress-permanently-visible-log-out-link-plugin-version-0-1/
|
341 |
add_action( 'admin_bar_menu', 'wpa_logout_item', 11 );
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
function wpa_logout_item( $admin_bar ) {
|
343 |
if ( ! is_user_logged_in() ) {
|
344 |
return;
|
@@ -352,8 +385,15 @@ function wpa_logout_item( $admin_bar ) {
|
|
352 |
$admin_bar->add_node( $args );
|
353 |
}
|
354 |
|
355 |
-
add_filter( 'mce_css', '
|
356 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
if ( get_option( 'wpa_diagnostics' ) == 'on' ) {
|
358 |
$mce_css .= ', ' . plugins_url( 'css/diagnostic.css', __FILE__ );
|
359 |
}
|
@@ -361,138 +401,20 @@ function wp_diagnostic_css( $mce_css ) {
|
|
361 |
return $mce_css;
|
362 |
}
|
363 |
|
364 |
-
function wpa_luminosity( $r, $r2, $g, $g2, $b, $b2 ) {
|
365 |
-
$RsRGB = $r / 255;
|
366 |
-
$GsRGB = $g / 255;
|
367 |
-
$BsRGB = $b / 255;
|
368 |
-
$R = ( $RsRGB <= 0.03928 ) ? $RsRGB / 12.92 : pow( ( $RsRGB + 0.055 ) / 1.055, 2.4 );
|
369 |
-
$G = ( $GsRGB <= 0.03928 ) ? $GsRGB / 12.92 : pow( ( $GsRGB + 0.055 ) / 1.055, 2.4 );
|
370 |
-
$B = ( $BsRGB <= 0.03928 ) ? $BsRGB / 12.92 : pow( ( $BsRGB + 0.055 ) / 1.055, 2.4 );
|
371 |
-
|
372 |
-
$RsRGB2 = $r2 / 255;
|
373 |
-
$GsRGB2 = $g2 / 255;
|
374 |
-
$BsRGB2 = $b2 / 255;
|
375 |
-
$R2 = ( $RsRGB2 <= 0.03928 ) ? $RsRGB2 / 12.92 : pow( ( $RsRGB2 + 0.055 ) / 1.055, 2.4 );
|
376 |
-
$G2 = ( $GsRGB2 <= 0.03928 ) ? $GsRGB2 / 12.92 : pow( ( $GsRGB2 + 0.055 ) / 1.055, 2.4 );
|
377 |
-
$B2 = ( $BsRGB2 <= 0.03928 ) ? $BsRGB2 / 12.92 : pow( ( $BsRGB2 + 0.055 ) / 1.055, 2.4 );
|
378 |
-
|
379 |
-
if ( $r + $g + $b <= $r2 + $g2 + $b2 ) {
|
380 |
-
$l2 = ( .2126 * $R + 0.7152 * $G + 0.0722 * $B );
|
381 |
-
$l1 = ( .2126 * $R2 + 0.7152 * $G2 + 0.0722 * $B2 );
|
382 |
-
} else {
|
383 |
-
$l1 = ( .2126 * $R + 0.7152 * $G + 0.0722 * $B );
|
384 |
-
$l2 = ( .2126 * $R2 + 0.7152 * $G2 + 0.0722 * $B2 );
|
385 |
-
}
|
386 |
-
$luminosity = round( ( $l1 + 0.05 ) / ( $l2 + 0.05 ), 2 );
|
387 |
-
|
388 |
-
return $luminosity;
|
389 |
-
}
|
390 |
-
|
391 |
-
function wpa_rgb2hex( $r, $g = - 1, $b = - 1 ) {
|
392 |
-
if ( is_array( $r ) && sizeof( $r ) == 3 ) {
|
393 |
-
list( $r, $g, $b ) = $r;
|
394 |
-
}
|
395 |
-
$r = intval( $r );
|
396 |
-
$g = intval( $g );
|
397 |
-
$b = intval( $b );
|
398 |
-
|
399 |
-
$r = dechex( $r < 0 ? 0 : ( $r > 255 ? 255 : $r ) );
|
400 |
-
$g = dechex( $g < 0 ? 0 : ( $g > 255 ? 255 : $g ) );
|
401 |
-
$b = dechex( $b < 0 ? 0 : ( $b > 255 ? 255 : $b ) );
|
402 |
-
|
403 |
-
$color = ( strlen( $r ) < 2 ? '0' : '' ) . $r;
|
404 |
-
$color .= ( strlen( $g ) < 2 ? '0' : '' ) . $g;
|
405 |
-
$color .= ( strlen( $b ) < 2 ? '0' : '' ) . $b;
|
406 |
-
|
407 |
-
return '#' . $color;
|
408 |
-
}
|
409 |
-
|
410 |
-
function wpa_hex2rgb( $color ) {
|
411 |
-
$color = str_replace( '#', '', $color );
|
412 |
-
if ( strlen( $color ) != 6 ) {
|
413 |
-
return array( 0, 0, 0 );
|
414 |
-
}
|
415 |
-
$rgb = array();
|
416 |
-
for ( $x = 0; $x < 3; $x ++ ) {
|
417 |
-
$rgb[ $x ] = hexdec( substr( $color, ( 2 * $x ), 2 ) );
|
418 |
-
}
|
419 |
-
|
420 |
-
return $rgb;
|
421 |
-
}
|
422 |
-
|
423 |
-
function wpa_contrast() {
|
424 |
-
if ( ! empty( $_POST ) ) {
|
425 |
-
$nonce = $_REQUEST['_wpnonce'];
|
426 |
-
if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
|
427 |
-
die( "Security check failed" );
|
428 |
-
}
|
429 |
-
if ( isset( $_POST['color'] ) && $_POST['color'] != "" ) {
|
430 |
-
$fore_color = $_POST['color'];
|
431 |
-
if ( $fore_color[0] == "#" ) {
|
432 |
-
$fore_color = str_replace( '#', '', $fore_color );
|
433 |
-
}
|
434 |
-
if ( strlen( $fore_color ) == 3 ) {
|
435 |
-
$color6char = $fore_color[0] . $fore_color[0];
|
436 |
-
$color6char .= $fore_color[1] . $fore_color[1];
|
437 |
-
$color6char .= $fore_color[2] . $fore_color[2];
|
438 |
-
$fore_color = $color6char;
|
439 |
-
}
|
440 |
-
if ( preg_match( '/^#?([0-9a-f]{1,2}){3}$/i', $fore_color ) ) {
|
441 |
-
$echo_hex_fore = str_replace( '#', '', $fore_color );
|
442 |
-
} else {
|
443 |
-
$echo_hex_fore = 'FFFFFF';
|
444 |
-
}
|
445 |
-
if ( isset( $_POST['color2'] ) && $_POST['color2'] != "" ) {
|
446 |
-
$back_color = $_POST['color2'];
|
447 |
-
if ( $back_color[0] == "#" ) {
|
448 |
-
$back_color = str_replace( '#', '', $back_color );
|
449 |
-
}
|
450 |
-
if ( strlen( $back_color ) == 3 ) {
|
451 |
-
$color6char = $back_color[0] . $back_color[0];
|
452 |
-
$color6char .= $back_color[1] . $back_color[1];
|
453 |
-
$color6char .= $back_color[2] . $back_color[2];
|
454 |
-
$back_color = $color6char;
|
455 |
-
}
|
456 |
-
if ( preg_match( '/^#?([0-9a-f]{1,2}){3}$/i', $back_color ) ) {
|
457 |
-
$echo_hex_back = str_replace( '#', '', $back_color );
|
458 |
-
} else {
|
459 |
-
$echo_hex_back = 'FFFFFF';
|
460 |
-
}
|
461 |
-
$color = wpa_hex2rgb( $echo_hex_fore );
|
462 |
-
$color2 = wpa_hex2rgb( $echo_hex_back );
|
463 |
-
$rfore = $color[0];
|
464 |
-
$gfore = $color[1];
|
465 |
-
$bfore = $color[2];
|
466 |
-
$rback = $color2[0];
|
467 |
-
$gback = $color2[1];
|
468 |
-
$bback = $color2[2];
|
469 |
-
$colors = array( 'hex1' => $echo_hex_fore,
|
470 |
-
'hex2' => $echo_hex_back,
|
471 |
-
'red1' => $rfore,
|
472 |
-
'green1' => $gfore,
|
473 |
-
'blue1' => $bfore,
|
474 |
-
'red2' => $rback,
|
475 |
-
'green2' => $gback,
|
476 |
-
'blue2' => $bback
|
477 |
-
);
|
478 |
-
|
479 |
-
return $colors;
|
480 |
-
} else {
|
481 |
-
return false;
|
482 |
-
}
|
483 |
-
}
|
484 |
-
}
|
485 |
-
|
486 |
-
return false;
|
487 |
-
}
|
488 |
-
|
489 |
if ( 'on' == get_option( 'wpa_search' ) ) {
|
490 |
add_filter( 'pre_get_posts', 'wpa_filter' );
|
491 |
}
|
492 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
493 |
function wpa_filter( $query ) {
|
494 |
if ( ! is_admin() ) {
|
495 |
-
if ( isset( $_GET['s'] ) &&
|
496 |
$query->query_vars['s'] = ' ';
|
497 |
$query->set( 'is_search', 1 );
|
498 |
add_action( 'template_include', 'wpa_search_error' );
|
@@ -502,6 +424,13 @@ function wpa_filter( $query ) {
|
|
502 |
return $query;
|
503 |
}
|
504 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
505 |
function wpa_search_error( $template ) {
|
506 |
$search = locate_template( 'search.php' );
|
507 |
if ( $search ) {
|
@@ -511,12 +440,19 @@ function wpa_search_error( $template ) {
|
|
511 |
return $template;
|
512 |
}
|
513 |
|
514 |
-
if ( get_option( 'wpa_image_titles' )
|
515 |
add_filter( 'the_content', 'wpa_image_titles', 100 );
|
516 |
add_filter( 'post_thumbnail_html', 'wpa_image_titles', 100 );
|
517 |
add_filter( 'wp_get_attachment_image', 'wpa_image_titles', 100 );
|
518 |
}
|
519 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
function wpa_image_titles( $content ) {
|
521 |
$results = array();
|
522 |
preg_match_all( '|title="[^"]*"|U', $content, $results );
|
@@ -527,28 +463,52 @@ function wpa_image_titles( $content ) {
|
|
527 |
return $content;
|
528 |
}
|
529 |
|
530 |
-
if ( get_option( 'wpa_more' )
|
531 |
add_filter( 'get_the_excerpt', 'wpa_custom_excerpt_more', 100 );
|
532 |
add_filter( 'excerpt_more', 'wpa_excerpt_more', 100 );
|
533 |
add_filter( 'the_content_more_link', 'wpa_content_more', 100 );
|
534 |
}
|
535 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
536 |
function wpa_continue_reading( $id ) {
|
537 |
-
return '<a class="continue" href="' . get_permalink( $id ) . '">' . get_option( 'wpa_continue' ) .
|
538 |
}
|
539 |
|
|
|
|
|
|
|
|
|
|
|
540 |
function wpa_excerpt_more() {
|
541 |
global $id;
|
542 |
|
543 |
return '… ' . wpa_continue_reading( $id );
|
544 |
}
|
545 |
|
|
|
|
|
|
|
|
|
|
|
546 |
function wpa_content_more() {
|
547 |
global $id;
|
548 |
|
549 |
return wpa_continue_reading( $id );
|
550 |
}
|
551 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
552 |
function wpa_custom_excerpt_more( $output ) {
|
553 |
if ( has_excerpt() && ! is_attachment() ) {
|
554 |
global $id;
|
@@ -558,73 +518,56 @@ function wpa_custom_excerpt_more( $output ) {
|
|
558 |
return $output;
|
559 |
}
|
560 |
|
561 |
-
|
562 |
-
|
563 |
-
function wpa_admin_styles() {
|
564 |
-
if ( isset( $_GET['page'] ) && ( $_GET['page'] == 'wp-accessibility/wp-accessibility.php' ) ) {
|
565 |
-
wp_enqueue_style( 'farbtastic' );
|
566 |
-
echo '<link type="text/css" rel="stylesheet" href="' . plugins_url( 'css/wpa-styles.css', __FILE__ ) . '" />';
|
567 |
-
}
|
568 |
-
}
|
569 |
-
|
570 |
-
if ( get_option( 'rta_from_tag_clouds' ) == 'on' ) {
|
571 |
add_filter( 'wp_tag_cloud', 'wpa_remove_title_attributes' );
|
572 |
}
|
573 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
574 |
function wpa_remove_title_attributes( $output ) {
|
575 |
$output = preg_replace( '/\s*title\s*=\s*(["\']).*?\1/', '', $output );
|
576 |
|
577 |
return $output;
|
578 |
}
|
579 |
|
580 |
-
|
581 |
/**
|
582 |
-
*
|
583 |
-
|
584 |
-
function wpa_deprecated_warning( $context ) {
|
585 |
-
if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
|
586 |
-
switch ( $context ) {
|
587 |
-
case 'recent_posts' :
|
588 |
-
return __( 'The WP Accessibility recent posts widget is deprecated. The standard WordPress widget no longer uses title attributes, so this widget is no longer necessary. It will be removed without warning in a future version of WP Accessibility. This warning is only visible to administrators of your site.', 'wp-accessibility' );
|
589 |
-
default:
|
590 |
-
return;
|
591 |
-
}
|
592 |
-
}
|
593 |
-
|
594 |
-
return;
|
595 |
-
}
|
596 |
-
*/
|
597 |
-
|
598 |
function wpa_get_support_form() {
|
599 |
global $current_user, $wpa_version;
|
600 |
$current_user = wp_get_current_user();
|
601 |
-
$request
|
602 |
-
$version
|
603 |
-
// send fields for all plugins
|
604 |
$wp_version = get_bloginfo( 'version' );
|
605 |
$home_url = home_url();
|
606 |
$wp_url = site_url();
|
607 |
$language = get_bloginfo( 'language' );
|
608 |
$charset = get_bloginfo( 'charset' );
|
609 |
-
// server
|
610 |
$php_version = phpversion();
|
611 |
|
612 |
-
// theme data
|
613 |
$theme = wp_get_theme();
|
614 |
-
$theme_name = $theme->Name;
|
615 |
-
$theme_uri = $theme->ThemeURI;
|
616 |
-
$theme_parent = $theme->Template;
|
617 |
-
$theme_version = $theme->Version;
|
618 |
|
619 |
-
// plugin data
|
620 |
$plugins = get_plugins();
|
621 |
$plugins_string = '';
|
622 |
foreach ( array_keys( $plugins ) as $key ) {
|
623 |
if ( is_plugin_active( $key ) ) {
|
624 |
-
$plugin
|
625 |
-
$plugin_name
|
626 |
-
$plugin_uri
|
627 |
-
$plugin_version
|
628 |
$plugins_string .= "$plugin_name: $plugin_version; $plugin_uri\n";
|
629 |
}
|
630 |
}
|
@@ -658,31 +601,31 @@ $plugins_string
|
|
658 |
if ( isset( $_POST['wpa_support'] ) ) {
|
659 |
$nonce = $_REQUEST['_wpnonce'];
|
660 |
if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
|
661 |
-
die(
|
662 |
}
|
663 |
$request = ( ! empty( $_POST['support_request'] ) ) ? stripslashes( $_POST['support_request'] ) : false;
|
664 |
-
$has_donated = ( $_POST['has_donated']
|
665 |
-
$has_read_faq = ( $_POST['has_read_faq']
|
666 |
$subject = "WP Accessibility support request. $has_donated";
|
667 |
$message = $request . "\n\n" . $data;
|
668 |
-
// Get the site domain and get rid of www. from pluggable.php
|
669 |
$sitename = strtolower( $_SERVER['SERVER_NAME'] );
|
670 |
-
if ( substr( $sitename, 0, 4 )
|
671 |
$sitename = substr( $sitename, 4 );
|
672 |
}
|
673 |
$from_email = 'wordpress@' . $sitename;
|
674 |
$from = "From: \"$current_user->display_name\" <$from_email>\r\nReply-to: \"$current_user->display_name\" <$current_user->user_email>\r\n";
|
675 |
|
676 |
if ( ! $has_read_faq ) {
|
677 |
-
echo "<div class='message error'><p>" . __( 'Please read the FAQ and other Help documents before making a support request.', 'wp-accessibility' ) .
|
678 |
-
}
|
679 |
-
echo "<div class='message error'><p>" . __( 'Please describe your problem. I\'m not psychic.', 'wp-accessibility' ) .
|
680 |
} else {
|
681 |
-
wp_mail(
|
682 |
-
if (
|
683 |
-
echo "<div class='message updated'><p>" . __( 'Thank you for supporting the continuing development of this plug-in! I\'ll get back to you as soon as I can.', 'wp-accessibility' ) .
|
684 |
} else {
|
685 |
-
echo "<div class='message updated'><p>" . __( 'I cannot provide support, but will treat your request as a bug report, and will incorporate any permanent solutions I discover into the plug-in.', 'wp-accessibility' ) .
|
686 |
}
|
687 |
}
|
688 |
}
|
@@ -692,294 +635,50 @@ $plugins_string
|
|
692 |
<form method='post' action='$admin_url'>
|
693 |
<div><input type='hidden' name='_wpnonce' value='" . wp_create_nonce( 'wpa-nonce' ) . "' /></div>
|
694 |
<div>";
|
695 |
-
echo
|
696 |
<p>
|
697 |
-
<code>
|
698 |
</p>
|
|
|
|
|
|
|
699 |
<p>
|
700 |
-
<input type='checkbox' name='
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
<label for='support_request'>" . __( 'Support Request:', 'wp-accessibility' ) . "</label><br /><textarea name='support_request' required id='support_request' cols='80' rows='10' class='widefat'>" . stripslashes( $request ) . "</textarea>
|
707 |
</p>
|
708 |
<p>
|
709 |
<input type='submit' value='" . __( 'Send Support Request', 'wp-accessibility' ) . "' name='wpa_support' class='button-primary' />
|
710 |
</p>
|
711 |
-
<p>" .
|
712 |
-
__( 'The following additional information will be sent with your support request:', 'wp-accessibility' )
|
713 |
-
. "</p>
|
714 |
<div class='wpa_support'>
|
715 |
-
" . wpautop( $data ) .
|
716 |
</div>
|
717 |
</div>
|
718 |
-
</form>
|
719 |
-
}
|
720 |
-
|
721 |
-
|
722 |
-
add_filter( 'wp_get_attachment_image_attributes', 'wpa_featured_longdesc', 10, 3 );
|
723 |
-
function wpa_featured_longdesc( $attr, $attachment, $size ) {
|
724 |
-
if ( get_option( 'wpa_longdesc_featured' ) == 'on' ) {
|
725 |
-
$attachment_id = $attachment->ID;
|
726 |
-
$args = array( 'longdesc' => $attachment_id );
|
727 |
-
/* The referrer is the post that the image is inserted into. */
|
728 |
-
if ( isset( $_REQUEST['post_id'] ) || get_the_ID() ) {
|
729 |
-
$id = ( isset( $_REQUEST['post_id'] ) ) ? $_REQUEST['post_id'] : get_the_ID();
|
730 |
-
$args['referrer'] = intval( $id );
|
731 |
-
}
|
732 |
-
|
733 |
-
$target = add_query_arg( $args, home_url() );
|
734 |
-
$id = longdesc_return_anchor( $attachment_id );
|
735 |
-
|
736 |
-
$attr['longdesc'] = $target;
|
737 |
-
$attr['id'] = $id;
|
738 |
-
}
|
739 |
-
|
740 |
-
return $attr;
|
741 |
}
|
742 |
|
743 |
-
|
744 |
-
/* longdesc support, based on work by Michael Fields (http://wordpress.org/plugins/long-description-for-image-attachments/) */
|
745 |
-
|
746 |
-
define( 'WPA_TEMPLATES', trailingslashit( dirname( __FILE__ ) ) . 'templates/' );
|
747 |
-
|
748 |
/**
|
749 |
-
*
|
750 |
-
*
|
751 |
-
* The ID for an image attachment is expected to be
|
752 |
-
* passed via $_GET['longdesc']. If this value exists
|
753 |
-
* and a post is successfully queried, postdata will
|
754 |
-
* be prepared and a template will be loaded to display
|
755 |
-
* the post content.
|
756 |
-
*
|
757 |
-
* This template must be named "longdesc-template.php".
|
758 |
-
*
|
759 |
-
* First, this function will look in the child theme
|
760 |
-
* then in the parent theme and if no template is found
|
761 |
-
* in either theme, the default template will be loaded
|
762 |
-
* from the plugin's folder.
|
763 |
-
*
|
764 |
-
* This function is hooked into the "template_redirect"
|
765 |
-
* action and terminates script execution.
|
766 |
-
*
|
767 |
-
* @return void
|
768 |
*
|
769 |
-
* @
|
770 |
-
* @alter 2011-03-27
|
771 |
*/
|
772 |
-
function longdesc_template() {
|
773 |
-
|
774 |
-
/* Return early if there is no reason to proceed. */
|
775 |
-
if ( ! isset( $_GET['longdesc'] ) ) {
|
776 |
-
return;
|
777 |
-
}
|
778 |
-
|
779 |
-
global $post;
|
780 |
-
|
781 |
-
/* Get the image attachment's data. */
|
782 |
-
$id = absint( $_GET['longdesc'] );
|
783 |
-
$post = get_post( $id );
|
784 |
-
if ( is_object( $post ) ) {
|
785 |
-
setup_postdata( $post );
|
786 |
-
}
|
787 |
-
|
788 |
-
/* Attachment must be an image. */
|
789 |
-
if ( false === strpos( get_post_mime_type(), 'image' ) ) {
|
790 |
-
header( 'HTTP/1.0 404 Not Found' );
|
791 |
-
exit;
|
792 |
-
}
|
793 |
-
|
794 |
-
/* The whole point here is to NOT show an image :) */
|
795 |
-
remove_filter( 'the_content', 'prepend_attachment' );
|
796 |
-
|
797 |
-
/* Check to see if there is a template in the theme. */
|
798 |
-
$template = locate_template( array( 'longdesc-template.php' ) );
|
799 |
-
if ( ! empty( $template ) ) {
|
800 |
-
require_once( $template );
|
801 |
-
exit;
|
802 |
-
} /* Use plugin's template file. */
|
803 |
-
else {
|
804 |
-
require_once( WPA_TEMPLATES . 'longdesc-template.php' );
|
805 |
-
exit;
|
806 |
-
}
|
807 |
-
|
808 |
-
/* You've gone too far! */
|
809 |
-
header( 'HTTP/1.0 404 Not Found' );
|
810 |
-
exit;
|
811 |
-
}
|
812 |
-
|
813 |
-
add_action( 'template_redirect', 'longdesc_template' );
|
814 |
-
|
815 |
-
/**
|
816 |
-
* Anchor.
|
817 |
-
*
|
818 |
-
* Create anchor id for linking from a Long Description to referring post.
|
819 |
-
* Also creates an anchor to return from Long Description page.
|
820 |
-
*
|
821 |
-
* @param int ID of the post which contains an image with a longdesc attribute.
|
822 |
-
*
|
823 |
-
* @return string
|
824 |
-
*
|
825 |
-
* @since 2010-09-26
|
826 |
-
*/
|
827 |
-
function longdesc_return_anchor( $id ) {
|
828 |
-
return 'longdesc-return-' . $id;
|
829 |
-
}
|
830 |
-
|
831 |
-
/**
|
832 |
-
* Add Attribute.
|
833 |
-
*
|
834 |
-
* Add longdesc attribute when WordPress sends image to the editor.
|
835 |
-
* Also creates an anchor to return from Long Description page.
|
836 |
-
*
|
837 |
-
* @return string
|
838 |
-
*
|
839 |
-
* @since 2010-09-20
|
840 |
-
* @alter 2011-04-06
|
841 |
-
*/
|
842 |
-
function longdesc_add_attr( $html, $id, $caption, $title, $align, $url, $size, $alt ) {
|
843 |
-
|
844 |
-
/* Get data for the image attachment. */
|
845 |
-
$image = get_post( $id );
|
846 |
-
global $post_ID;
|
847 |
-
if ( isset( $image->ID ) && ! empty( $image->ID ) ) {
|
848 |
-
$args = array( 'longdesc' => $image->ID );
|
849 |
-
/* The referrer is the post that the image is inserted into. */
|
850 |
-
if ( isset( $_REQUEST['post_id'] ) || get_the_ID() ) {
|
851 |
-
$id = ( isset( $_REQUEST['post_id'] ) ) ? $_REQUEST['post_id'] : get_the_ID();
|
852 |
-
$args['referrer'] = intval( $id );
|
853 |
-
}
|
854 |
-
if ( ! empty( $image->post_content ) ) {
|
855 |
-
$search = '<img ';
|
856 |
-
$replace = '<img tabindex="-1" id="' . esc_attr( longdesc_return_anchor( $image->ID ) ) . '" longdesc="' . esc_url( add_query_arg( $args, home_url() ) ) . '" ';
|
857 |
-
$html = str_replace( $search, $replace, $html );
|
858 |
-
}
|
859 |
-
}
|
860 |
-
|
861 |
-
return $html;
|
862 |
-
}
|
863 |
-
|
864 |
-
add_filter( 'image_send_to_editor', 'longdesc_add_attr', 10, 8 );
|
865 |
-
|
866 |
-
/* Tests whether the current theme is labeled accessibility-ready */
|
867 |
function wpa_accessible_theme() {
|
868 |
$theme = wp_get_theme();
|
869 |
-
$tags
|
870 |
if ( is_array( $tags ) && in_array( 'accessibility-ready', $tags ) ) {
|
871 |
return true;
|
872 |
}
|
873 |
return false;
|
874 |
}
|
875 |
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
}
|
883 |
-
|
884 |
-
add_action( 'admin_notices', 'wpa_update_notice' );
|
885 |
-
function wpa_update_notice() {
|
886 |
-
if ( current_user_can( 'activate_plugins' ) && get_option( 'wpa_update_notice' ) == 0 || ! get_option( 'wpa_update_notice' ) ) {
|
887 |
-
$dismiss = admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php&dismiss=update' );
|
888 |
-
$access_monitor = "https://wordpress.org/plugins/access-monitor/";
|
889 |
-
echo "<div class='updated fade'><p>" . sprintf( __( 'Have you seen my new accessibility plug-in? <a href="%1$s">Check out Access Monitor</a>! <a href="%2$s">Dismiss Notice<span class="dashicons dashicons-no" aria-hidden="true"></span></a>', 'wp-accessibility' ), $access_monitor, $dismiss ) . "</p></div>";
|
890 |
-
}
|
891 |
-
}
|
892 |
-
*/
|
893 |
-
|
894 |
-
add_filter( 'manage_media_columns', 'wpa_media_columns' );
|
895 |
-
add_action( 'manage_media_custom_column', 'wpa_media_value', 10, 2 );
|
896 |
-
|
897 |
-
function wpa_media_columns( $columns ) {
|
898 |
-
$columns['wpa_data'] = __( 'Accessibility', 'wp-accessibility' );
|
899 |
-
return $columns;
|
900 |
-
}
|
901 |
-
|
902 |
-
function wpa_media_value( $column, $id ) {
|
903 |
-
if ( $column == 'wpa_data' ) {
|
904 |
-
$mime = get_post_mime_type( $id );
|
905 |
-
switch ( $mime ) {
|
906 |
-
case 'image/jpeg':
|
907 |
-
case 'image/png':
|
908 |
-
case 'image/gif':
|
909 |
-
$alt = get_post_meta( $id, '_wp_attachment_image_alt', true );
|
910 |
-
$no_alt = get_post_meta( $id, '_no_alt', true );
|
911 |
-
if ( !$alt && !$no_alt ) {
|
912 |
-
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>';
|
913 |
-
} else {
|
914 |
-
if ( $no_alt == 1 ) {
|
915 |
-
echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> '.__( 'Decorative', 'wp-accessibility' ).'</span>';
|
916 |
-
} else {
|
917 |
-
echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> '.__( 'Has <code>alt</code>', 'wp-accessibility' ).'</span>';
|
918 |
-
}
|
919 |
-
}
|
920 |
-
break;
|
921 |
-
default:
|
922 |
-
echo '<span class="non-image">' . __( 'N/A', 'wp-accessibility' ) . '</span>';
|
923 |
-
break;
|
924 |
-
}
|
925 |
-
}
|
926 |
-
return $column;
|
927 |
-
}
|
928 |
-
|
929 |
-
add_filter( 'attachment_fields_to_edit', 'wpa_insert_alt_verification', 10, 2 );
|
930 |
-
function wpa_insert_alt_verification( $form_fields, $post ) {
|
931 |
-
$mime = get_post_mime_type( $post->ID );
|
932 |
-
if ( $mime == 'image/jpeg' || $mime == 'image/png' || $mime == 'image/gif' ) {
|
933 |
-
$no_alt = get_post_meta( $post->ID, '_no_alt', true );
|
934 |
-
$alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
|
935 |
-
$checked = checked( $no_alt, 1, false );
|
936 |
-
$form_fields['no_alt'] = array(
|
937 |
-
'label' => __( 'Decorative', 'wp-accessibility' ),
|
938 |
-
'input' => 'html',
|
939 |
-
'value' => 1,
|
940 |
-
'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>"
|
941 |
-
);
|
942 |
-
}
|
943 |
-
return $form_fields;
|
944 |
-
}
|
945 |
-
|
946 |
-
add_filter( 'attachment_fields_to_save', 'wpa_save_alt_verification', 10, 2 );
|
947 |
-
function wpa_save_alt_verification( $post, $attachment ) {
|
948 |
-
if ( isset( $attachment['no_alt'] ) ) {
|
949 |
-
update_post_meta( $post['ID'], '_no_alt', 1 );
|
950 |
-
} else {
|
951 |
-
delete_post_meta( $post['ID'], '_no_alt' );
|
952 |
-
}
|
953 |
-
|
954 |
-
return $post;
|
955 |
-
}
|
956 |
-
|
957 |
-
add_filter( 'image_send_to_editor', 'wpa_alt_attribute', 10, 8 );
|
958 |
-
function wpa_alt_attribute( $html, $id, $caption, $title, $align, $url, $size, $alt ) {
|
959 |
-
/* Get data for the image attachment. */
|
960 |
-
$noalt = get_post_meta( $id, '_no_alt', true );
|
961 |
-
/* Get the original title to compare to alt */
|
962 |
-
$title = get_the_title( $id );
|
963 |
-
$warning = false;
|
964 |
-
if ( $noalt == 1 ) {
|
965 |
-
$html = str_replace( 'alt="'.$alt.'"', 'alt=""', $html );
|
966 |
-
}
|
967 |
-
if ( ( $alt == '' || $alt == $title ) && $noalt != 1 ) {
|
968 |
-
if ( $alt == $title ) {
|
969 |
-
$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' );
|
970 |
-
$image = 'alt-same.png';
|
971 |
-
} else {
|
972 |
-
$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' );
|
973 |
-
$image = 'alt-missing.png';
|
974 |
-
}
|
975 |
-
}
|
976 |
-
if ( $warning ) {
|
977 |
-
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 ) . "' />";
|
978 |
-
}
|
979 |
-
return $html;
|
980 |
-
}
|
981 |
-
|
982 |
-
add_action( 'init', 'wpa_add_editor_styles' );
|
983 |
-
function wpa_add_editor_styles() {
|
984 |
-
add_editor_style( plugins_url( 'css/editor-style.css', __FILE__ ) );
|
985 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* WP Accessibility
|
4 |
+
*
|
5 |
+
* @package WP Accessibility
|
6 |
+
* @author Joe Dolson
|
7 |
+
* @copyright 2012-2018 Joe Dolson
|
8 |
+
* @license GPL-2.0+
|
9 |
+
*
|
10 |
+
* @wordpress-plugin
|
11 |
+
* Plugin Name: WP Accessibility
|
12 |
+
* Plugin URI: http://www.joedolson.com/wp-accessibility/
|
13 |
+
* Description: Helps improve accessibility in your WordPress site, like removing title attributes.
|
14 |
+
* Author: Joe Dolson
|
15 |
+
* Author URI: http://www.joedolson.com/
|
16 |
+
* Text Domain: wp-accessibility
|
17 |
+
* Domain Path: /lang
|
18 |
+
* License: GPL-2.0+
|
19 |
+
* License URI: http://www.gnu.org/license/gpl-2.0.txt
|
20 |
+
* Version: 1.6.2
|
21 |
+
*/
|
22 |
+
|
23 |
/*
|
24 |
+
Copyright 2012-2018 Joe Dolson (email : joe@joedolson.com)
|
25 |
+
|
26 |
+
This program is free software; you can redistribute it and/or modify
|
27 |
+
it under the terms of the GNU General Public License as published by
|
28 |
+
the Free Software Foundation; either version 2 of the License, or
|
29 |
+
(at your option) any later version.
|
30 |
+
|
31 |
+
This program is distributed in the hope that it will be useful,
|
32 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
33 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
34 |
+
GNU General Public License for more details.
|
35 |
+
|
36 |
+
You should have received a copy of the GNU General Public License
|
37 |
+
along with this program; if not, write to the Free Software
|
38 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
*/
|
40 |
|
41 |
+
require_once( dirname( __FILE__ ) . '/class-wp-accessibility-toolbar.php' );
|
42 |
+
require_once( dirname( __FILE__ ) . '/wp-accessibility-toolbar.php' );
|
43 |
+
require_once( dirname( __FILE__ ) . '/wp-accessibility-longdesc.php' );
|
44 |
+
require_once( dirname( __FILE__ ) . '/wp-accessibility-alt.php' );
|
45 |
+
require_once( dirname( __FILE__ ) . '/wp-accessibility-contrast.php' );
|
46 |
+
require_once( dirname( __FILE__ ) . '/wp-accessibility-settings.php' );
|
47 |
+
|
48 |
register_activation_hook( __FILE__, 'wpa_install' );
|
49 |
|
|
|
50 |
add_action( 'plugins_loaded', 'wpa_load_textdomain' );
|
51 |
+
/**
|
52 |
+
* Load internationalization.
|
53 |
+
*/
|
54 |
function wpa_load_textdomain() {
|
55 |
load_plugin_textdomain( 'wp-accessibility', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
|
56 |
}
|
57 |
|
58 |
+
add_action( 'admin_menu', 'wpa_admin_menu' );
|
59 |
+
/**
|
60 |
+
* Set up admin menu.
|
61 |
+
*/
|
62 |
+
function wpa_admin_menu() {
|
63 |
add_action( 'admin_print_footer_scripts', 'wpa_write_js' );
|
64 |
+
add_options_page( 'WP Accessibility', 'WP Accessibility', 'manage_options', __FILE__, 'wpa_admin_settings' );
|
65 |
}
|
66 |
|
67 |
+
/**
|
68 |
+
* Install on activation.
|
69 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
function wpa_install() {
|
71 |
+
$wpa_version = '1.6.2';
|
72 |
+
if ( 'true' != get_option( 'wpa_installed' ) ) {
|
73 |
add_option( 'rta_from_nav_menu', 'on' );
|
74 |
add_option( 'rta_from_page_lists', 'on' );
|
75 |
add_option( 'rta_from_category_lists', 'on' );
|
94 |
}
|
95 |
}
|
96 |
|
97 |
+
/**
|
98 |
+
* Check current version and upgrade if needed.
|
99 |
+
*/
|
100 |
function wpa_check_version() {
|
101 |
+
// upgrade for version 1.3.0.
|
102 |
if ( version_compare( get_option( 'wpa_version' ), '1.3.0', '<' ) ) {
|
103 |
add_option( 'wpa_longdesc', 'jquery' );
|
104 |
}
|
105 |
}
|
106 |
|
107 |
add_filter( 'plugin_action_links', 'wpa_plugin_action', 10, 2 );
|
108 |
+
/**
|
109 |
+
* Add plugin action links.
|
110 |
+
*
|
111 |
+
* @param array $links Existing links.
|
112 |
+
* @param string $file File name.
|
113 |
+
*/
|
114 |
function wpa_plugin_action( $links, $file ) {
|
115 |
+
if ( plugin_basename( dirname( __FILE__ ) . '/wp-accessibility.php' ) == $file ) {
|
116 |
$admin_url = admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' );
|
117 |
+
$links[] = "<a href='$admin_url'>" . __( 'Accessibility Settings', 'wp-accessibility' ) . '</a>';
|
118 |
}
|
119 |
|
120 |
return $links;
|
121 |
}
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
add_action( 'wp_enqueue_scripts', 'wpa_register_scripts' );
|
124 |
+
/**
|
125 |
+
* Register jQuery scripts.
|
126 |
+
*/
|
127 |
function wpa_register_scripts() {
|
|
|
128 |
wp_register_script( 'skiplinks.webkit', plugins_url( 'wp-accessibility/js/skiplinks.webkit.js' ) );
|
129 |
wp_register_script( 'ui-a11y.js', plugins_url( 'wp-accessibility/toolbar/js/a11y.js' ), array( 'jquery' ), '1.0', true );
|
|
|
130 |
}
|
131 |
|
132 |
add_action( 'wp_enqueue_scripts', 'wpacc_enqueue_scripts' );
|
133 |
+
/**
|
134 |
+
* Enqueue accessibility scripts dependent on options.
|
135 |
+
*/
|
136 |
function wpacc_enqueue_scripts() {
|
137 |
wp_enqueue_script( 'jquery' );
|
138 |
+
if ( 'on' == get_option( 'asl_enable' ) ) {
|
139 |
wp_enqueue_script( 'skiplinks.webkit' );
|
140 |
}
|
141 |
+
if ( 'on' == get_option( 'wpa_toolbar' ) || 'on' == get_option( 'wpa_widget_toolbar' ) ) {
|
|
|
142 |
wp_enqueue_script( 'ui-a11y.js' );
|
143 |
$plugin_path = plugins_url( 'wp-accessibility/toolbar/css/a11y-contrast.css' );
|
144 |
if ( file_exists( get_stylesheet_directory() . '/a11y-contrast.css' ) ) {
|
146 |
}
|
147 |
wp_localize_script( 'ui-a11y.js', 'a11y_stylesheet_path', $plugin_path );
|
148 |
}
|
149 |
+
if ( 'on' == get_option( 'wpa_insert_roles' ) ) {
|
150 |
wp_enqueue_script( 'wpa-complementary', plugins_url( 'js/roles.jquery.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
151 |
if ( get_option( 'wpa_complementary_container' ) ) {
|
152 |
$wpa_comp = get_option( 'wpa_complementary_container' );
|
155 |
}
|
156 |
wp_localize_script( 'wpa-complementary', 'wpaComplementary', $wpa_comp );
|
157 |
}
|
158 |
+
if ( 'on' == get_option( 'wpa_labels' ) ) {
|
159 |
wp_enqueue_script( 'wpa-labels', plugins_url( 'js/wpa.labels.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
160 |
+
$labels = array(
|
161 |
+
's' => __( 'Search', 'wp-accessibility' ),
|
162 |
+
'author' => __( 'Name', 'wp-accessibility' ),
|
163 |
+
'email' => __( 'Email', 'wp-accessibility' ),
|
164 |
+
'url' => __( 'Website', 'wp-accessibility' ),
|
165 |
+
'comment' => __( 'Comment', 'wp-accessibility' ),
|
166 |
);
|
167 |
wp_localize_script( 'wpa-labels', 'wpalabels', $labels );
|
168 |
}
|
169 |
+
if ( 'on' == get_option( 'wpa_toolbar' ) ) {
|
170 |
add_action( 'wp_footer', 'wpa_toolbar_js' );
|
171 |
}
|
172 |
+
if ( 'link' == get_option( 'wpa_longdesc' ) ) {
|
173 |
wp_enqueue_script( 'longdesc.link', plugins_url( 'js/longdesc.link.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
174 |
}
|
175 |
+
if ( 'jquery' == get_option( 'wpa_longdesc' ) ) {
|
176 |
wp_enqueue_script( 'longdesc.button', plugins_url( 'js/longdesc.button.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
177 |
}
|
178 |
+
if ( 'on' == get_option( 'wpa_current_menu' ) ) {
|
179 |
wp_enqueue_script( 'current.menu', plugins_url( 'js/current-menu-item.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
180 |
}
|
181 |
}
|
182 |
|
183 |
add_action( 'wp_enqueue_scripts', 'wpa_stylesheet' );
|
184 |
+
/**
|
185 |
+
* Enqueue stylesheets for WP Accessibility.
|
186 |
+
*/
|
187 |
function wpa_stylesheet() {
|
188 |
+
// Respects SSL, Style.css is relative to the current file.
|
189 |
wp_register_style( 'wpa-style', plugins_url( 'css/wpa-style.css', __FILE__ ) );
|
190 |
wp_register_style( 'ui-font.css', plugins_url( 'toolbar/fonts/css/a11y-toolbar.css', __FILE__ ) );
|
191 |
$toolbar = apply_filters( 'wpa_toolbar_css', plugins_url( 'toolbar/css/a11y.css', __FILE__ ) );
|
192 |
wp_register_style( 'ui-a11y.css', $toolbar, array( 'ui-font.css' ) );
|
193 |
+
$fontsize_stylesheet = ( 'on' == get_option( 'wpa_alternate_fontsize' ) ) ? 'a11y-fontsize-alt' : 'a11y-fontsize';
|
194 |
+
$fontsize = apply_filters( 'wpa_fontsize_css', plugins_url( 'toolbar/css/' . $fontsize_stylesheet . '.css', __FILE__ ) );
|
195 |
wp_register_style( 'ui-fontsize.css', $fontsize );
|
196 |
+
$toolbar_size = get_option( 'wpa_toolbar_size' );
|
197 |
+
$toolbar_size = ( false === stripos( $toolbar_size, 'em' ) ) ? $toolbar_size . 'px' : $toolbar_size;
|
198 |
+
// Only enable styles when required by options.
|
199 |
+
if ( get_option( 'wpa_toolbar_size' ) && 'on' == get_option( 'wpa_toolbar' ) ) {
|
200 |
echo "
|
201 |
<style type='text/css'>
|
202 |
.a11y-toolbar ul li button {
|
203 |
+
font-size: " . $toolbar_size . ' !important;
|
204 |
}
|
205 |
+
</style>';
|
206 |
}
|
207 |
+
if ( 'link' == get_option( 'wpa_longdesc' ) || 'jquery' == get_option( 'wpa_longdesc' ) || 'on' == get_option( 'asl_enable' ) ) {
|
208 |
wp_enqueue_style( 'wpa-style' );
|
209 |
}
|
210 |
+
if ( 'on' == get_option( 'wpa_toolbar' ) || 'on' == get_option( 'wpa_widget_toolbar' ) && ( $toolbar && $fontsize ) ) {
|
211 |
wp_enqueue_style( 'ui-a11y.css' );
|
212 |
wp_enqueue_style( 'ui-fontsize.css' );
|
213 |
}
|
214 |
+
if ( current_user_can( 'edit_files' ) && 'on' == get_option( 'wpa_diagnostics' ) ) {
|
215 |
wp_register_style( 'diagnostic', plugins_url( 'css/diagnostic.css', __FILE__ ) );
|
216 |
wp_register_style( 'diagnostic-head', plugins_url( 'css/diagnostic-head.css', __FILE__ ) );
|
217 |
wp_enqueue_style( 'diagnostic' );
|
219 |
}
|
220 |
}
|
221 |
|
222 |
+
add_action( 'admin_head', 'wpa_admin_stylesheet' );
|
223 |
/**
|
224 |
* Enqueue admin stylesheets if enabled
|
225 |
*/
|
|
|
226 |
function wpa_admin_stylesheet() {
|
227 |
// Used to provide an admin CSS from plug-in, now only enqueue if custom provided in theme.
|
228 |
if ( file_exists( get_stylesheet_directory() . '/wp-admin.css' ) ) {
|
230 |
wp_register_style( 'wp-a11y-css', $file );
|
231 |
wp_enqueue_style( 'wp-a11y-css' );
|
232 |
}
|
233 |
+
|
234 |
+
if ( 'on' == get_option( 'wpa_row_actions' ) ) {
|
235 |
if ( file_exists( get_stylesheet_directory() . '/wp-admin-row-actions.css' ) ) {
|
236 |
$file = get_stylesheet_directory_uri() . '/wp-admin-row-actions.css';
|
237 |
} else {
|
243 |
}
|
244 |
|
245 |
add_action( 'wp_head', 'wpa_css' );
|
246 |
+
/**
|
247 |
+
* Generate styles needed for WP Accessibility options.
|
248 |
+
*/
|
249 |
function wpa_css() {
|
250 |
$styles = '';
|
251 |
if ( get_option( 'asl_enable' ) == 'on' ) {
|
252 |
$focus = get_option( 'asl_styles_focus' );
|
253 |
+
// these styles are derived from the WordPress skip link defaults.
|
254 |
+
$default_focus = 'background-color: #f1f1f1; box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6); clip: auto; color: #21759b; display: block; font-size: 14px; font-weight: bold; height: auto; line-height: normal; padding: 15px 23px 14px; position: absolute; left: 5px; top: 5px; text-decoration: none; text-transform: none; width: auto; z-index: 100000;';
|
255 |
if ( ! $focus ) {
|
256 |
$focus = $default_focus;
|
257 |
} else {
|
258 |
$focus = $default_focus . $focus;
|
259 |
}
|
260 |
$passive = get_option( 'asl_styles_passive' );
|
261 |
+
$vis = '';
|
262 |
+
$invis = '';
|
263 |
+
// If links are visible, "hover" is a focus style, otherwise, it's a passive style.
|
264 |
+
if ( 'on' == get_option( 'asl_visible' ) ) {
|
265 |
$vis = '#skiplinks a:hover,';
|
266 |
} else {
|
267 |
$invis = '#skiplinks a:hover,';
|
268 |
}
|
269 |
+
$visibility = ( 'on' == get_option( 'asl_visible' ) ) ? 'wpa-visible' : 'wpa-hide';
|
270 |
+
$is_rtl = ( is_rtl() ) ? '-rtl' : '-ltr';
|
271 |
+
$class = '.' . $visibility . $is_rtl;
|
272 |
+
$styles .= "
|
273 |
$class#skiplinks a, $invis $class#skiplinks a:visited { $passive }
|
274 |
$class#skiplinks a:active, $vis $class#skiplinks a:focus { $focus }
|
275 |
";
|
276 |
}
|
277 |
+
if ( 'on' == get_option( 'wpa_focus' ) ) {
|
278 |
+
$color = ( '' != get_option( 'wpa_focus_color' ) ) ? ' #' . get_option( 'wpa_focus_color' ) : '';
|
279 |
$styles .= "
|
280 |
:focus { outline: 1px solid$color!important; }
|
281 |
";
|
282 |
}
|
283 |
+
if ( '' != $styles ) {
|
284 |
echo "
|
285 |
<style type='text/css'>
|
286 |
$styles
|
288 |
}
|
289 |
}
|
290 |
|
291 |
+
/**
|
292 |
+
* Test whether a URL is validly structured.
|
293 |
+
*
|
294 |
+
* @param string $url A purported URL.
|
295 |
+
*
|
296 |
+
* @return mixed URL if valid, false if not.
|
297 |
+
*/
|
298 |
function wpa_is_url( $url ) {
|
299 |
return preg_match( '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url );
|
300 |
}
|
301 |
|
302 |
add_action( 'wp_footer', 'wpa_jquery_asl', 100 );
|
303 |
+
/**
|
304 |
+
* Generate JS needed for options.
|
305 |
+
*/
|
306 |
function wpa_jquery_asl() {
|
307 |
+
$skiplinks_js = false;
|
308 |
+
$targets = false;
|
309 |
+
$lang_js = false;
|
310 |
+
$tabindex = false;
|
311 |
+
$longdesc = false;
|
312 |
+
$visibility = ( 'on' == get_option( 'asl_visible' ) ) ? 'wpa-visible' : 'wpa-hide';
|
313 |
+
if ( 'on' == get_option( 'asl_enable' ) ) {
|
314 |
$html = '';
|
315 |
+
// set up skiplinks.
|
316 |
$extra = get_option( 'asl_extra_target' );
|
317 |
$extra = ( wpa_is_url( $extra ) ) ? esc_url( $extra ) : str_replace( '#', '', esc_attr( $extra ) );
|
318 |
+
if ( '' != $extra && ! wpa_is_url( $extra ) ) {
|
319 |
$extra = "#$extra";
|
320 |
}
|
321 |
+
$extra_text = stripslashes( get_option( 'asl_extra_text' ) );
|
322 |
+
$content = str_replace( '#', '', esc_attr( get_option( 'asl_content' ) ) );
|
323 |
+
$nav = str_replace( '#', '', esc_attr( get_option( 'asl_navigation' ) ) );
|
324 |
+
$sitemap = esc_url( get_option( 'asl_sitemap' ) );
|
325 |
+
$html .= ( '' != $content ) ? "<a href=\"#$content\">" . __( 'Skip to content', 'wp-accessibility' ) . '</a> ' : '';
|
326 |
+
$html .= ( '' != $nav ) ? "<a href=\"#$nav\">" . __( 'Skip to navigation', 'wp-accessibility' ) . '</a> ' : '';
|
327 |
+
$html .= ( '' != $sitemap ) ? "<a href=\"$sitemap\">" . __( 'Site map', 'wp-accessibility' ) . '</a> ' : '';
|
328 |
+
$html .= ( '' != $extra && '' != $extra_text ) ? "<a href=\"$extra\">$extra_text</a> " : '';
|
329 |
+
$is_rtl = ( is_rtl() ) ? '-rtl' : '-ltr';
|
330 |
+
$skiplinks = __( 'Skip links', 'wp-accessibility' );
|
331 |
+
$output = ( '' != $html ) ? "<div class=\"$visibility$is_rtl\" id=\"skiplinks\" role=\"navigation\" aria-label=\"$skiplinks\">$html</div>" : '';
|
332 |
+
// Attach skiplinks HTML; set tab index on #content area to -1.
|
333 |
+
$focusable = ( '' != $content ) ? "$('#$content').attr('tabindex','-1');" : '';
|
334 |
+
$focusable .= ( '' != $nav ) ? "$('#$nav').attr('tabindex','-1');" : '';
|
335 |
$skiplinks_js = ( $output ) ? "$('body').prepend('$output'); $focusable" : '';
|
336 |
}
|
337 |
+
// Attach language to html element.
|
338 |
+
if ( 'on' == get_option( 'wpa_lang' ) ) {
|
339 |
$lang = get_bloginfo( 'language' );
|
340 |
+
$dir = ( is_rtl() ) ? 'rtl' : 'ltr';
|
341 |
$lang_js = "$('html').attr( 'lang','$lang' ); $('html').attr( 'dir','$dir' )";
|
342 |
}
|
343 |
+
// Force links to open in the same window.
|
344 |
$underline_target = apply_filters( 'wpa_underline_target', 'a' );
|
345 |
+
$targets = ( 'on' == get_option( 'wpa_target' ) ) ? "$('a').removeAttr('target');" : '';
|
346 |
+
$tabindex = ( 'on' == get_option( 'wpa_tabindex' ) ) ? "$('input,a,select,textarea,button').removeAttr('tabindex');" : '';
|
347 |
+
$underlines = ( 'on' == get_option( 'wpa_underline' ) ) ? "$('$underline_target').css( 'text-decoration','underline' );$('$underline_target').on( 'focusin mouseenter', function() { $(this).css( 'text-decoration','none' ); });$('$underline_target').on( 'focusout mouseleave', function() { $(this).css( 'text-decoration','underline' ); } );" : '';
|
348 |
+
|
349 |
$display = ( $skiplinks_js || $targets || $lang_js || $tabindex || $longdesc ) ? true : false;
|
350 |
if ( $display ) {
|
351 |
$script = "
|
364 |
}
|
365 |
}
|
366 |
|
367 |
+
// courtesy of Graham Armfield (modified).
|
|
|
368 |
add_action( 'admin_bar_menu', 'wpa_logout_item', 11 );
|
369 |
+
/**
|
370 |
+
* Add adminbar menu logout.
|
371 |
+
*
|
372 |
+
* @link http://www.coolfields.co.uk/2013/02/wordpress-permanently-visible-log-out-link-plugin-version-0-1/
|
373 |
+
* @param object $admin_bar Admin bar object.
|
374 |
+
*/
|
375 |
function wpa_logout_item( $admin_bar ) {
|
376 |
if ( ! is_user_logged_in() ) {
|
377 |
return;
|
385 |
$admin_bar->add_node( $args );
|
386 |
}
|
387 |
|
388 |
+
add_filter( 'mce_css', 'wpa_diagnostic_css' );
|
389 |
+
/**
|
390 |
+
* Add diagnostic CSS.
|
391 |
+
*
|
392 |
+
* @param string $mce_css Existing CSS.
|
393 |
+
*
|
394 |
+
* @return full string css.
|
395 |
+
*/
|
396 |
+
function wpa_diagnostic_css( $mce_css ) {
|
397 |
if ( get_option( 'wpa_diagnostics' ) == 'on' ) {
|
398 |
$mce_css .= ', ' . plugins_url( 'css/diagnostic.css', __FILE__ );
|
399 |
}
|
401 |
return $mce_css;
|
402 |
}
|
403 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
if ( 'on' == get_option( 'wpa_search' ) ) {
|
405 |
add_filter( 'pre_get_posts', 'wpa_filter' );
|
406 |
}
|
407 |
|
408 |
+
/**
|
409 |
+
* Filter search queries to ensure that an error page is returned if no results.
|
410 |
+
*
|
411 |
+
* @param object $query Main WP_Query object.
|
412 |
+
*
|
413 |
+
* @return $query.
|
414 |
+
*/
|
415 |
function wpa_filter( $query ) {
|
416 |
if ( ! is_admin() ) {
|
417 |
+
if ( isset( $_GET['s'] ) && null == trim( $_GET['s'] ) && ( $query->is_main_query() ) ) {
|
418 |
$query->query_vars['s'] = ' ';
|
419 |
$query->set( 'is_search', 1 );
|
420 |
add_action( 'template_include', 'wpa_search_error' );
|
424 |
return $query;
|
425 |
}
|
426 |
|
427 |
+
/**
|
428 |
+
* Locate template for the search error page.
|
429 |
+
*
|
430 |
+
* @param string $template Current template name.
|
431 |
+
*
|
432 |
+
* @return string New template name if changed.
|
433 |
+
*/
|
434 |
function wpa_search_error( $template ) {
|
435 |
$search = locate_template( 'search.php' );
|
436 |
if ( $search ) {
|
440 |
return $template;
|
441 |
}
|
442 |
|
443 |
+
if ( 'on' == get_option( 'wpa_image_titles' ) ) {
|
444 |
add_filter( 'the_content', 'wpa_image_titles', 100 );
|
445 |
add_filter( 'post_thumbnail_html', 'wpa_image_titles', 100 );
|
446 |
add_filter( 'wp_get_attachment_image', 'wpa_image_titles', 100 );
|
447 |
}
|
448 |
|
449 |
+
/**
|
450 |
+
* Filter out title attributes on images.
|
451 |
+
*
|
452 |
+
* @param string $content A block of content in an image, post thumbnail, or post content.
|
453 |
+
*
|
454 |
+
* @return string $content minus title attributes.
|
455 |
+
*/
|
456 |
function wpa_image_titles( $content ) {
|
457 |
$results = array();
|
458 |
preg_match_all( '|title="[^"]*"|U', $content, $results );
|
463 |
return $content;
|
464 |
}
|
465 |
|
466 |
+
if ( 'on' == get_option( 'wpa_more' ) ) {
|
467 |
add_filter( 'get_the_excerpt', 'wpa_custom_excerpt_more', 100 );
|
468 |
add_filter( 'excerpt_more', 'wpa_excerpt_more', 100 );
|
469 |
add_filter( 'the_content_more_link', 'wpa_content_more', 100 );
|
470 |
}
|
471 |
|
472 |
+
/**
|
473 |
+
* Custom "Continue Reading" with post title context.
|
474 |
+
*
|
475 |
+
* @param int $id Post ID.
|
476 |
+
*
|
477 |
+
* @return string HTML link & text.
|
478 |
+
*/
|
479 |
function wpa_continue_reading( $id ) {
|
480 |
+
return '<a class="continue" href="' . get_permalink( $id ) . '">' . get_option( 'wpa_continue' ) . '<span> ' . get_the_title( $id ) . '</span></a>';
|
481 |
}
|
482 |
|
483 |
+
/**
|
484 |
+
* Add custom continue reading text to excerpts.
|
485 |
+
*
|
486 |
+
* @return Ellipsis + continue reading text.
|
487 |
+
*/
|
488 |
function wpa_excerpt_more() {
|
489 |
global $id;
|
490 |
|
491 |
return '… ' . wpa_continue_reading( $id );
|
492 |
}
|
493 |
|
494 |
+
/**
|
495 |
+
* Add custom continue reading text to content.
|
496 |
+
*
|
497 |
+
* @return continue reading text.
|
498 |
+
*/
|
499 |
function wpa_content_more() {
|
500 |
global $id;
|
501 |
|
502 |
return wpa_continue_reading( $id );
|
503 |
}
|
504 |
|
505 |
+
/**
|
506 |
+
* Add custom continue reading text to custom excerpts.
|
507 |
+
*
|
508 |
+
* @param string $output Existing content.
|
509 |
+
*
|
510 |
+
* @return continue reading text.
|
511 |
+
*/
|
512 |
function wpa_custom_excerpt_more( $output ) {
|
513 |
if ( has_excerpt() && ! is_attachment() ) {
|
514 |
global $id;
|
518 |
return $output;
|
519 |
}
|
520 |
|
521 |
+
if ( 'on' == get_option( 'rta_from_tag_clouds' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
522 |
add_filter( 'wp_tag_cloud', 'wpa_remove_title_attributes' );
|
523 |
}
|
524 |
|
525 |
+
/**
|
526 |
+
* Strip title attributes from tag clouds.
|
527 |
+
*
|
528 |
+
* @param string $output Tag Cloud.
|
529 |
+
*
|
530 |
+
* @return string Tag cloud without title attributes.
|
531 |
+
*/
|
532 |
function wpa_remove_title_attributes( $output ) {
|
533 |
$output = preg_replace( '/\s*title\s*=\s*(["\']).*?\1/', '', $output );
|
534 |
|
535 |
return $output;
|
536 |
}
|
537 |
|
|
|
538 |
/**
|
539 |
+
* Create support form.
|
540 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
541 |
function wpa_get_support_form() {
|
542 |
global $current_user, $wpa_version;
|
543 |
$current_user = wp_get_current_user();
|
544 |
+
$request = '';
|
545 |
+
$version = $wpa_version;
|
546 |
+
// send fields for all plugins.
|
547 |
$wp_version = get_bloginfo( 'version' );
|
548 |
$home_url = home_url();
|
549 |
$wp_url = site_url();
|
550 |
$language = get_bloginfo( 'language' );
|
551 |
$charset = get_bloginfo( 'charset' );
|
552 |
+
// server.
|
553 |
$php_version = phpversion();
|
554 |
|
555 |
+
// theme data.
|
556 |
$theme = wp_get_theme();
|
557 |
+
$theme_name = $theme->get( 'Name' );
|
558 |
+
$theme_uri = $theme->get( 'ThemeURI' );
|
559 |
+
$theme_parent = $theme->get( 'Template' );
|
560 |
+
$theme_version = $theme->get( 'Version' );
|
561 |
|
562 |
+
// plugin data.
|
563 |
$plugins = get_plugins();
|
564 |
$plugins_string = '';
|
565 |
foreach ( array_keys( $plugins ) as $key ) {
|
566 |
if ( is_plugin_active( $key ) ) {
|
567 |
+
$plugin =& $plugins[ $key ];
|
568 |
+
$plugin_name = $plugin['Name'];
|
569 |
+
$plugin_uri = $plugin['PluginURI'];
|
570 |
+
$plugin_version = $plugin['Version'];
|
571 |
$plugins_string .= "$plugin_name: $plugin_version; $plugin_uri\n";
|
572 |
}
|
573 |
}
|
601 |
if ( isset( $_POST['wpa_support'] ) ) {
|
602 |
$nonce = $_REQUEST['_wpnonce'];
|
603 |
if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
|
604 |
+
die( 'Security check failed' );
|
605 |
}
|
606 |
$request = ( ! empty( $_POST['support_request'] ) ) ? stripslashes( $_POST['support_request'] ) : false;
|
607 |
+
$has_donated = ( 'on' == $_POST['has_donated'] ) ? 'Donor' : 'No donation';
|
608 |
+
$has_read_faq = ( 'on' == $_POST['has_read_faq'] ) ? 'Read FAQ' : false;
|
609 |
$subject = "WP Accessibility support request. $has_donated";
|
610 |
$message = $request . "\n\n" . $data;
|
611 |
+
// Get the site domain and get rid of www. from pluggable.php.
|
612 |
$sitename = strtolower( $_SERVER['SERVER_NAME'] );
|
613 |
+
if ( 'www.' == substr( $sitename, 0, 4 ) ) {
|
614 |
$sitename = substr( $sitename, 4 );
|
615 |
}
|
616 |
$from_email = 'wordpress@' . $sitename;
|
617 |
$from = "From: \"$current_user->display_name\" <$from_email>\r\nReply-to: \"$current_user->display_name\" <$current_user->user_email>\r\n";
|
618 |
|
619 |
if ( ! $has_read_faq ) {
|
620 |
+
echo "<div class='message error'><p>" . __( 'Please read the FAQ and other Help documents before making a support request.', 'wp-accessibility' ) . '</p></div>';
|
621 |
+
} elseif ( ! $request ) {
|
622 |
+
echo "<div class='message error'><p>" . __( 'Please describe your problem. I\'m not psychic.', 'wp-accessibility' ) . '</p></div>';
|
623 |
} else {
|
624 |
+
wp_mail( 'plugins@joedolson.com', $subject, $message, $from );
|
625 |
+
if ( 'Donor' == $has_donated ) {
|
626 |
+
echo "<div class='message updated'><p>" . __( 'Thank you for supporting the continuing development of this plug-in! I\'ll get back to you as soon as I can.', 'wp-accessibility' ) . '</p></div>';
|
627 |
} else {
|
628 |
+
echo "<div class='message updated'><p>" . __( 'I cannot provide support, but will treat your request as a bug report, and will incorporate any permanent solutions I discover into the plug-in.', 'wp-accessibility' ) . '</p></div>';
|
629 |
}
|
630 |
}
|
631 |
}
|
635 |
<form method='post' action='$admin_url'>
|
636 |
<div><input type='hidden' name='_wpnonce' value='" . wp_create_nonce( 'wpa-nonce' ) . "' /></div>
|
637 |
<div>";
|
638 |
+
echo '
|
639 |
<p>
|
640 |
+
<code>' . __( 'From:', 'wp-accessibility' ) . " \"$current_user->display_name\" <$current_user->user_email></code>
|
641 |
</p>
|
642 |
+
<p>";
|
643 |
+
// Translators: Frequently Asked Questions URL.
|
644 |
+
echo "<input type='checkbox' name='has_read_faq' id='has_read_faq' value='on' /> <label for='has_read_faq'>" . sprintf( __( 'I have read <a href="%s">the FAQ for this plug-in</a> <span>(required)</span>', 'wp-accessibility' ), 'http://www.joedolson.com/wp-accessibility/faqs/' ) . "</label></p>
|
645 |
<p>
|
646 |
+
<input type='checkbox' name='has_donated' id='has_donated' value='on' /> <label for='has_donated'>";
|
647 |
+
// Translators: Donation URL.
|
648 |
+
echo sprintf( __( 'I <a href="%s">made a donation</a> to help support this plugin', 'wp-accessibility' ), 'https://www.joedolson.com/donate/' ) . "</label>
|
649 |
+
</p>
|
650 |
+
<p>
|
651 |
+
<label for='support_request'>" . __( 'Support Request:', 'wp-accessibility' ) . "</label><br /><textarea name='support_request' required id='support_request' cols='80' rows='10' class='widefat'>" . stripslashes( $request ) . "</textarea>
|
|
|
652 |
</p>
|
653 |
<p>
|
654 |
<input type='submit' value='" . __( 'Send Support Request', 'wp-accessibility' ) . "' name='wpa_support' class='button-primary' />
|
655 |
</p>
|
656 |
+
<p>" . __( 'The following additional information will be sent with your support request:', 'wp-accessibility' ) . "</p>
|
|
|
|
|
657 |
<div class='wpa_support'>
|
658 |
+
" . wpautop( $data ) . '
|
659 |
</div>
|
660 |
</div>
|
661 |
+
</form>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
662 |
}
|
663 |
|
|
|
|
|
|
|
|
|
|
|
664 |
/**
|
665 |
+
* Tests whether the current theme is labeled accessibility-ready
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
666 |
*
|
667 |
+
* @return boolean True if this theme has the tag 'accessibility-ready'.
|
|
|
668 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
669 |
function wpa_accessible_theme() {
|
670 |
$theme = wp_get_theme();
|
671 |
+
$tags = $theme->get( 'Tags' );
|
672 |
if ( is_array( $tags ) && in_array( 'accessibility-ready', $tags ) ) {
|
673 |
return true;
|
674 |
}
|
675 |
return false;
|
676 |
}
|
677 |
|
678 |
+
add_action( 'widgets_init', 'wpa_register_toolbar_widget' );
|
679 |
+
/**
|
680 |
+
* Register toolbar widget.
|
681 |
+
*/
|
682 |
+
function wpa_register_toolbar_widget() {
|
683 |
+
register_widget( 'Wp_Accessibility_Toolbar' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
684 |
}
|