Version Description
- Update: Significant reorganization of settings.
- Feature: Create & prepend simplified content summaries.
- Feature: Raise warning on long alt text.
- Feature: Generate color contrast via GET to make bookmarkable.
- Increase boldness of automatic focus outline.
- Set default focus outline color.
- Use wp_add_inline_styles for customizable CSS.
- Update automatic link underlines to skip
nav
elements. - Bug fix: some incorrect textdomains.
- Bug fix: toolbar tooltips should be dismissable without changing focus or hover. Support
esc
key. - Bug fix: Incorrect variable passed to color contrast, causing incorrect values.
- Auto generation of hook documentation: https://joedolson.github.io/wp-accessibility/
Download this release
Release Info
Developer | joedolson |
Plugin | WP Accessibility |
Version | 1.9.0 |
Comparing to | |
See all releases |
Code changes from version 1.8.1 to 1.9.0
- css/wpa-style.css +11 -0
- css/wpa-styles.css +36 -2
- js/wp-accessibility.js +1 -1
- js/wpa-toolbar.js +3 -3
- readme.txt +16 -1
- toolbar/css/a11y.css +6 -13
- toolbar/js/a11y.js +11 -0
- wp-accessibility-alt.php +50 -1
- wp-accessibility-contrast.php +16 -13
- wp-accessibility-help.php +49 -0
- wp-accessibility-settings.php +308 -209
- wp-accessibility-toolbar.php +36 -8
- wp-accessibility.php +285 -54
css/wpa-style.css
CHANGED
@@ -155,3 +155,14 @@ label.wpa-screen-reader-text {
|
|
155 |
width: 1px;
|
156 |
word-wrap: normal !important;
|
157 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
width: 1px;
|
156 |
word-wrap: normal !important;
|
157 |
}
|
158 |
+
|
159 |
+
.wpa-content-summary {
|
160 |
+
padding: 30px;
|
161 |
+
background: rgba( 0,0,0,.05 );
|
162 |
+
margin-bottom: 30px;
|
163 |
+
}
|
164 |
+
|
165 |
+
.wpa-content-summary div p:last-of-type {
|
166 |
+
margin-bottom: 0;
|
167 |
+
padding-bottom: 0;
|
168 |
+
}
|
css/wpa-styles.css
CHANGED
@@ -4,21 +4,55 @@
|
|
4 |
grid-template-columns: 70% 1fr;
|
5 |
}
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
.notice .views {
|
8 |
display: grid;
|
9 |
grid-template-columns: repeat( 2, minmax(0,1fr) );
|
10 |
column-gap: 20px;
|
11 |
row-gap: 20px;
|
12 |
align-items: start;
|
13 |
-
margin-bottom:
|
14 |
}
|
15 |
|
16 |
.notice .views p {
|
17 |
margin: 0;
|
18 |
padding: 8px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
-
#wpa_settings_page .postbox {
|
22 |
margin: 0 10px 10px 0;
|
23 |
}
|
24 |
|
4 |
grid-template-columns: 70% 1fr;
|
5 |
}
|
6 |
|
7 |
+
.wpa-settings-wrapper .inside h3 {
|
8 |
+
font-size: 1.1em;
|
9 |
+
margin: 0;
|
10 |
+
}
|
11 |
+
|
12 |
+
.wpa-checkboxes li {
|
13 |
+
display: flex;
|
14 |
+
flex-wrap: wrap;
|
15 |
+
column-gap: .5rem;
|
16 |
+
align-items: center;
|
17 |
+
}
|
18 |
+
|
19 |
+
.wpa-checkboxes li input {
|
20 |
+
margin-top: 0;
|
21 |
+
}
|
22 |
+
|
23 |
.notice .views {
|
24 |
display: grid;
|
25 |
grid-template-columns: repeat( 2, minmax(0,1fr) );
|
26 |
column-gap: 20px;
|
27 |
row-gap: 20px;
|
28 |
align-items: start;
|
29 |
+
margin-bottom: 1em;
|
30 |
}
|
31 |
|
32 |
.notice .views p {
|
33 |
margin: 0;
|
34 |
padding: 8px;
|
35 |
+
border: 3px solid;
|
36 |
+
text-align: center;
|
37 |
+
min-height: 40px;
|
38 |
+
}
|
39 |
+
|
40 |
+
.notice .views .large {
|
41 |
+
font-size: 25px;
|
42 |
+
}
|
43 |
+
|
44 |
+
.notice .views .small {
|
45 |
+
font-size: 18px;
|
46 |
+
}
|
47 |
+
|
48 |
+
#wpa_settings_page .checkboxes {
|
49 |
+
display: flex;
|
50 |
+
flex-wrap: wrap;
|
51 |
+
column-gap: 20px;
|
52 |
+
margin: 1em 0;
|
53 |
}
|
54 |
|
55 |
+
#wpa_settings_page .postbox, #wpa-sidebar .postbox {
|
56 |
margin: 0 10px 10px 0;
|
57 |
}
|
58 |
|
js/wp-accessibility.js
CHANGED
@@ -40,7 +40,7 @@
|
|
40 |
}
|
41 |
|
42 |
if ( wpa.underline.enabled ) {
|
43 |
-
$( wpa.underline.target ).css( 'text-decoration','underline' );
|
44 |
$( wpa.underline.target ).on( 'focusin mouseenter', function() {
|
45 |
$(this).css( 'text-decoration','none' );
|
46 |
});
|
40 |
}
|
41 |
|
42 |
if ( wpa.underline.enabled ) {
|
43 |
+
$( wpa.underline.target ).not( 'nav ' + wpa.underline.target ).css( 'text-decoration','underline' );
|
44 |
$( wpa.underline.target ).on( 'focusin mouseenter', function() {
|
45 |
$(this).css( 'text-decoration','none' );
|
46 |
});
|
js/wpa-toolbar.js
CHANGED
@@ -4,13 +4,13 @@
|
|
4 |
|
5 |
insert_a11y_toolbar += '<ul class="a11y-toolbar-list">';
|
6 |
if ( wpa.enable_contrast == 'true' ) {
|
7 |
-
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\">' + wpa.contrast + '</span><span class="aticon aticon-adjust" aria-hidden="true"></span></button></li>';
|
8 |
}
|
9 |
if ( wpa.enable_grayscale == 'true' ) {
|
10 |
-
insert_a11y_toolbar += '<li class="a11y-toolbar-list-item"><button type="button" class="a11y-toggle-grayscale toggle-grayscale" id="is_normal_color" aria-pressed="false"><span class="offscreen">' + wpa.grayscale + '</span><span class="aticon aticon-tint" aria-hidden="true"></span></button></li>';
|
11 |
}
|
12 |
if ( wpa.enable_fontsize == 'true' ) {
|
13 |
-
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">' + wpa.fontsize + '</span><span class="aticon aticon-font" aria-hidden="true"></span></button></li>';
|
14 |
}
|
15 |
insert_a11y_toolbar += '</ul>';
|
16 |
a11y_toolbar.classList.add( wpa.responsive, 'a11y-toolbar', wpa.is_rtl, wpa.is_right );
|
4 |
|
5 |
insert_a11y_toolbar += '<ul class="a11y-toolbar-list">';
|
6 |
if ( wpa.enable_contrast == 'true' ) {
|
7 |
+
insert_a11y_toolbar += '<li class="a11y-toolbar-list-item"><button type="button" class="a11y-toggle a11y-toggle-contrast toggle-contrast" id="is_normal_contrast" aria-pressed="false"><span class=\"offscreen\">' + wpa.contrast + '</span><span class="aticon aticon-adjust" aria-hidden="true"></span></button></li>';
|
8 |
}
|
9 |
if ( wpa.enable_grayscale == 'true' ) {
|
10 |
+
insert_a11y_toolbar += '<li class="a11y-toolbar-list-item"><button type="button" class="a11y-toggle a11y-toggle-grayscale toggle-grayscale" id="is_normal_color" aria-pressed="false"><span class="offscreen">' + wpa.grayscale + '</span><span class="aticon aticon-tint" aria-hidden="true"></span></button></li>';
|
11 |
}
|
12 |
if ( wpa.enable_fontsize == 'true' ) {
|
13 |
+
insert_a11y_toolbar += '<li class="a11y-toolbar-list-item"><button type="button" class="a11y-toggle a11y-toggle-fontsize toggle-fontsize" id="is_normal_fontsize" aria-pressed="false"><span class="offscreen">' + wpa.fontsize + '</span><span class="aticon aticon-font" aria-hidden="true"></span></button></li>';
|
14 |
}
|
15 |
insert_a11y_toolbar += '</ul>';
|
16 |
a11y_toolbar.classList.add( wpa.responsive, 'a11y-toolbar', wpa.is_rtl, wpa.is_right );
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: title, accessibility, accessible, navigation, wcag, a11y, section508, focu
|
|
5 |
Requires at least: 3.4.2
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 6.0
|
8 |
-
Stable tag: 1.
|
9 |
Text Domain: wp-accessibility
|
10 |
License: GPLv2 or later
|
11 |
|
@@ -76,6 +76,21 @@ The plug-in is intended to help with deficiencies commonly found in themes and t
|
|
76 |
|
77 |
[Suggest a change!](https://github.com/joedolson/wp-accessibility/issues/)
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
= 1.8.1 =
|
80 |
|
81 |
* Update: Fix accessibility issues in longdesc disclosure button.
|
5 |
Requires at least: 3.4.2
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 6.0
|
8 |
+
Stable tag: 1.9.0
|
9 |
Text Domain: wp-accessibility
|
10 |
License: GPLv2 or later
|
11 |
|
76 |
|
77 |
[Suggest a change!](https://github.com/joedolson/wp-accessibility/issues/)
|
78 |
|
79 |
+
= 1.9.0 =
|
80 |
+
|
81 |
+
* Update: Significant reorganization of settings.
|
82 |
+
* Feature: Create & prepend simplified content summaries.
|
83 |
+
* Feature: Raise warning on long alt text.
|
84 |
+
* Feature: Generate color contrast via GET to make bookmarkable.
|
85 |
+
* Increase boldness of automatic focus outline.
|
86 |
+
* Set default focus outline color.
|
87 |
+
* Use wp_add_inline_styles for customizable CSS.
|
88 |
+
* Update automatic link underlines to skip `nav` elements.
|
89 |
+
* Bug fix: some incorrect textdomains.
|
90 |
+
* Bug fix: toolbar tooltips should be dismissable without changing focus or hover. Support `esc` key.
|
91 |
+
* Bug fix: Incorrect variable passed to color contrast, causing incorrect values.
|
92 |
+
* Auto generation of hook documentation: https://joedolson.github.io/wp-accessibility/
|
93 |
+
|
94 |
= 1.8.1 =
|
95 |
|
96 |
* Update: Fix accessibility issues in longdesc disclosure button.
|
toolbar/css/a11y.css
CHANGED
@@ -41,7 +41,7 @@
|
|
41 |
.a11y-toolbar {
|
42 |
position: fixed;
|
43 |
z-index: 99999;
|
44 |
-
top:
|
45 |
left: 0;
|
46 |
}
|
47 |
|
@@ -92,7 +92,7 @@
|
|
92 |
border-radius: 0 0 4px;
|
93 |
}
|
94 |
|
95 |
-
|
96 |
.a11y-toolbar .offscreen,
|
97 |
.a11y_stylesheet_path {
|
98 |
position: absolute !important;
|
@@ -131,14 +131,7 @@
|
|
131 |
}
|
132 |
|
133 |
.desaturated {
|
134 |
-
filter:
|
135 |
-
filter: grayscale(100%) !important;
|
136 |
-
-webkit-filter: grayscale(100%) !important;
|
137 |
-
-webkit-filter: grayscale(1) !important;
|
138 |
-
-moz-filter: grayscale(100%) !important;
|
139 |
-
-ms-filter: grayscale(100%) !important;
|
140 |
-
-o-filter: grayscale(100%) !important;
|
141 |
-
filter: gray !important;
|
142 |
}
|
143 |
|
144 |
.a11y-toolbar button:hover .offscreen,
|
@@ -151,7 +144,7 @@
|
|
151 |
background: #f0f0f0;
|
152 |
padding: 8px 6px !important;
|
153 |
box-shadow: 0 0 1px #000;
|
154 |
-
border-radius:
|
155 |
font-size: 16px;
|
156 |
text-transform: none;
|
157 |
font-family: Arial;
|
@@ -159,10 +152,10 @@
|
|
159 |
|
160 |
.a11y-toolbar.right button:hover .offscreen,
|
161 |
.a11y-toolbar.right button:focus .offscreen {
|
162 |
-
right:
|
163 |
left: auto;
|
164 |
}
|
165 |
|
166 |
.a11y-toolbar button:hover .offscreen, .a11y-toolbar button:focus .offscreen {
|
167 |
-
left:
|
168 |
}
|
41 |
.a11y-toolbar {
|
42 |
position: fixed;
|
43 |
z-index: 99999;
|
44 |
+
top: 43vh;
|
45 |
left: 0;
|
46 |
}
|
47 |
|
92 |
border-radius: 0 0 4px;
|
93 |
}
|
94 |
|
95 |
+
.a11y-toolbar .a11y-toolbar-list .a11y-toolbar-list-item .tooltip-dismissed:focus .offscreen,
|
96 |
.a11y-toolbar .offscreen,
|
97 |
.a11y_stylesheet_path {
|
98 |
position: absolute !important;
|
131 |
}
|
132 |
|
133 |
.desaturated {
|
134 |
+
filter: grayscale(1) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
}
|
136 |
|
137 |
.a11y-toolbar button:hover .offscreen,
|
144 |
background: #f0f0f0;
|
145 |
padding: 8px 6px !important;
|
146 |
box-shadow: 0 0 1px #000;
|
147 |
+
border-radius: 5px;
|
148 |
font-size: 16px;
|
149 |
text-transform: none;
|
150 |
font-family: Arial;
|
152 |
|
153 |
.a11y-toolbar.right button:hover .offscreen,
|
154 |
.a11y-toolbar.right button:focus .offscreen {
|
155 |
+
right: 100%;
|
156 |
left: auto;
|
157 |
}
|
158 |
|
159 |
.a11y-toolbar button:hover .offscreen, .a11y-toolbar button:focus .offscreen {
|
160 |
+
left: 100%;
|
161 |
}
|
toolbar/js/a11y.js
CHANGED
@@ -39,6 +39,17 @@ function eraseCookie(name) {
|
|
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='" + wpa11y.path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
|
39 |
$('#is_normal_color').attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active');
|
40 |
}
|
41 |
|
42 |
+
$( '.a11y-toggle' ).on( 'focus', function(e) {
|
43 |
+
$( this ).removeClass( 'tooltip-dismissed' );
|
44 |
+
});
|
45 |
+
|
46 |
+
$( '.a11y-toggle' ).on( 'keyup', function(e) {
|
47 |
+
if ( e.keyCode == 27 ) {
|
48 |
+
$( this ).addClass( 'tooltip-dismissed' );
|
49 |
+
}
|
50 |
+
});
|
51 |
+
|
52 |
+
|
53 |
if (readCookie('a11y-high-contrast')) {
|
54 |
$('body').addClass('contrast');
|
55 |
$('head').append($("<link href='" + wpa11y.path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
|
wp-accessibility-alt.php
CHANGED
@@ -62,6 +62,8 @@ function wpa_media_value( $column, $id ) {
|
|
62 |
echo '<span class="missing"><span class="dashicons dashicons-no" aria-hidden="true"></span> <a href="' . get_edit_post_link( $id ) . '#attachment_alt">' . __( 'Invalid <code>alt</code>', 'wp-accessibility' ) . '</a></span>';
|
63 |
} elseif ( wpa_suspicious_alt( $alt ) ) {
|
64 |
echo '<span class="missing"><span class="dashicons dashicons-no" aria-hidden="true"></span> <a href="' . get_edit_post_link( $id ) . '#attachment_alt">' . __( 'Suspicious <code>alt</code>', 'wp-accessibility' ) . '</a></span>';
|
|
|
|
|
65 |
} else {
|
66 |
echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> ' . __( 'Has <code>alt</code>', 'wp-accessibility' ) . '</span>';
|
67 |
}
|
@@ -75,6 +77,32 @@ function wpa_media_value( $column, $id ) {
|
|
75 |
return $column;
|
76 |
}
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
/**
|
79 |
* Check whether an alt attribute contains suspect strings.
|
80 |
*
|
@@ -86,13 +114,34 @@ function wpa_suspicious_alt( $alt ) {
|
|
86 |
$case_insensitive = array(
|
87 |
'logo',
|
88 |
'image',
|
|
|
|
|
|
|
89 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
$case_insensitive = apply_filters( 'wpa_case_insensitive', $case_insensitive );
|
91 |
$case_sensitive = array(
|
92 |
'DSC',
|
93 |
'IMG',
|
94 |
);
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
foreach ( $case_insensitive as $term ) {
|
97 |
if ( false !== stripos( $alt, $term ) ) {
|
98 |
return true;
|
62 |
echo '<span class="missing"><span class="dashicons dashicons-no" aria-hidden="true"></span> <a href="' . get_edit_post_link( $id ) . '#attachment_alt">' . __( 'Invalid <code>alt</code>', 'wp-accessibility' ) . '</a></span>';
|
63 |
} elseif ( wpa_suspicious_alt( $alt ) ) {
|
64 |
echo '<span class="missing"><span class="dashicons dashicons-no" aria-hidden="true"></span> <a href="' . get_edit_post_link( $id ) . '#attachment_alt">' . __( 'Suspicious <code>alt</code>', 'wp-accessibility' ) . '</a></span>';
|
65 |
+
} elseif ( wpa_long_alt( $alt ) ) {
|
66 |
+
echo '<span class="long"><span class="dashicons dashicons-warning" aria-hidden="true"></span> <a href="' . get_edit_post_link( $id ) . '#attachment_alt">' . __( 'Long <code>alt</code> text', 'wp-accessibility' ) . '</a></span>';
|
67 |
} else {
|
68 |
echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> ' . __( 'Has <code>alt</code>', 'wp-accessibility' ) . '</span>';
|
69 |
}
|
77 |
return $column;
|
78 |
}
|
79 |
|
80 |
+
/**
|
81 |
+
* Check whether an alt is unusually long.
|
82 |
+
*
|
83 |
+
* @param string $alt Alt attribute.
|
84 |
+
*
|
85 |
+
* @return bool
|
86 |
+
*/
|
87 |
+
function wpa_long_alt( $alt ) {
|
88 |
+
$length = strlen( $alt );
|
89 |
+
/**
|
90 |
+
* What length of an alt text is considered long. Default `140`.
|
91 |
+
*
|
92 |
+
* @hook wpa_long_alt
|
93 |
+
*
|
94 |
+
* @param {int} $limit Default length to call alt text long.
|
95 |
+
*
|
96 |
+
* @return int
|
97 |
+
*/
|
98 |
+
$limit = apply_filters( 'wpa_long_alt', 140 );
|
99 |
+
if ( $length > $limit ) {
|
100 |
+
return true;
|
101 |
+
}
|
102 |
+
|
103 |
+
return false;
|
104 |
+
}
|
105 |
+
|
106 |
/**
|
107 |
* Check whether an alt attribute contains suspect strings.
|
108 |
*
|
114 |
$case_insensitive = array(
|
115 |
'logo',
|
116 |
'image',
|
117 |
+
'picture',
|
118 |
+
'alt text',
|
119 |
+
'alternative text',
|
120 |
);
|
121 |
+
/**
|
122 |
+
* Filter array of case insensitive strings that make alt text suspicious.
|
123 |
+
*
|
124 |
+
* @hook wpa_case_insensitive
|
125 |
+
*
|
126 |
+
* @param {array} $case_insensitive Array of strings.
|
127 |
+
*
|
128 |
+
* @return array
|
129 |
+
*/
|
130 |
$case_insensitive = apply_filters( 'wpa_case_insensitive', $case_insensitive );
|
131 |
$case_sensitive = array(
|
132 |
'DSC',
|
133 |
'IMG',
|
134 |
);
|
135 |
+
/**
|
136 |
+
* Filter array of case sensitive strings that make alt text suspicious.
|
137 |
+
*
|
138 |
+
* @hook wpa_case_sensitive
|
139 |
+
*
|
140 |
+
* @param {array} $case_sensitive Array of strings.
|
141 |
+
*
|
142 |
+
* @return array
|
143 |
+
*/
|
144 |
+
$case_sensitive = apply_filters( 'wpa_case_sensitive', $case_sensitive );
|
145 |
foreach ( $case_insensitive as $term ) {
|
146 |
if ( false !== stripos( $alt, $term ) ) {
|
147 |
return true;
|
wp-accessibility-contrast.php
CHANGED
@@ -26,6 +26,13 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
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;
|
@@ -42,7 +49,7 @@ function wpa_luminosity( $r, $r2, $g, $g2, $b, $b2 ) {
|
|
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 * $
|
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 );
|
@@ -101,17 +108,13 @@ function wpa_hex2rgb( $color ) {
|
|
101 |
}
|
102 |
|
103 |
/**
|
104 |
-
*
|
105 |
*/
|
106 |
function wpa_contrast() {
|
107 |
-
if ( ! empty( $
|
108 |
-
$
|
109 |
-
|
110 |
-
|
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 ) ) {
|
@@ -125,9 +128,9 @@ function wpa_contrast() {
|
|
125 |
} else {
|
126 |
$echo_hex_fore = 'FFFFFF';
|
127 |
}
|
128 |
-
if ( isset( $
|
129 |
-
$back_color = $
|
130 |
-
if ( '#' === $back_color
|
131 |
$back_color = str_replace( '#', '', $back_color );
|
132 |
}
|
133 |
if ( 3 === strlen( $back_color ) ) {
|
26 |
* @return luminosity ratio.
|
27 |
*/
|
28 |
function wpa_luminosity( $r, $r2, $g, $g2, $b, $b2 ) {
|
29 |
+
$r = (int) $r;
|
30 |
+
$r2 = (int) $r2;
|
31 |
+
$g = (int) $g;
|
32 |
+
$g2 = (int) $g2;
|
33 |
+
$b = (int) $b;
|
34 |
+
$b2 = (int) $b2;
|
35 |
+
|
36 |
$rs_rgb = $r / 255;
|
37 |
$gs_rgb = $g / 255;
|
38 |
$bs_rgb = $b / 255;
|
49 |
|
50 |
if ( $r + $g + $b <= $r2 + $g2 + $b2 ) {
|
51 |
$l2 = ( .2126 * $r_new + 0.7152 * $g_new + 0.0722 * $b_new );
|
52 |
+
$l1 = ( .2126 * $r2_new + 0.7152 * $g2_new + 0.0722 * $b2_new );
|
53 |
} else {
|
54 |
$l1 = ( .2126 * $r_new + 0.7152 * $g_new + 0.0722 * $b_new );
|
55 |
$l2 = ( .2126 * $r2_new + 0.7152 * $g2_new + 0.0722 * $b2_new );
|
108 |
}
|
109 |
|
110 |
/**
|
111 |
+
* Generate an array of RGB color values from hex codes.
|
112 |
*/
|
113 |
function wpa_contrast() {
|
114 |
+
if ( ! empty( $_GET['color'] ) ) {
|
115 |
+
if ( isset( $_GET['color'] ) && '' !== $_GET['color'] ) {
|
116 |
+
$fore_color = sanitize_text_field( $_GET['color'] );
|
117 |
+
if ( '#' === substr( $fore_color, 0, 1 ) ) {
|
|
|
|
|
|
|
|
|
118 |
$fore_color = str_replace( '#', '', $fore_color );
|
119 |
}
|
120 |
if ( 3 === strlen( $fore_color ) ) {
|
128 |
} else {
|
129 |
$echo_hex_fore = 'FFFFFF';
|
130 |
}
|
131 |
+
if ( isset( $_GET['color2'] ) && '' !== $_GET['color2'] ) {
|
132 |
+
$back_color = sanitize_text_field( $_GET['color2'] );
|
133 |
+
if ( '#' === substr( $back_color, 0, 1 ) ) {
|
134 |
$back_color = str_replace( '#', '', $back_color );
|
135 |
}
|
136 |
if ( 3 === strlen( $back_color ) ) {
|
wp-accessibility-help.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Output the WP Accessibility Help Screen.
|
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 |
+
/**
|
17 |
+
* Add Help screen.
|
18 |
+
*/
|
19 |
+
function wpa_help_screen() {
|
20 |
+
?>
|
21 |
+
<div class="wrap">
|
22 |
+
<h1><?php _e( 'WP Accessibility Help', 'wp-accessibility' ); ?></h1>
|
23 |
+
<div class="wpa-settings-wrapper">
|
24 |
+
<div id="wpa_settings_page" class="postbox-container">
|
25 |
+
<div class="metabox-holder">
|
26 |
+
<div class="ui-sortable meta-box-sortables">
|
27 |
+
<div class="postbox" id="get-support">
|
28 |
+
<h2 class='hndle'><?php _e( 'Get Plug-in Support', 'wp-accessibility' ); ?></h2>
|
29 |
+
|
30 |
+
<div class="inside">
|
31 |
+
<div class='wpa-support-me'>
|
32 |
+
<p>
|
33 |
+
<?php
|
34 |
+
// Translators: URL to donate.
|
35 |
+
printf( __( 'Please, consider <a href="%s">making a donation</a> to support WP Accessibility!', 'wp-accessibility' ), 'https://www.joedolson.com/donate/' );
|
36 |
+
?>
|
37 |
+
</p>
|
38 |
+
</div>
|
39 |
+
<?php wpa_get_support_form(); ?>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
</div>
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
<?php wpa_admin_sidebar(); ?>
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
<?php
|
49 |
+
}
|
wp-accessibility-settings.php
CHANGED
@@ -18,7 +18,7 @@ add_action( 'admin_enqueue_scripts', 'wpa_admin_styles' );
|
|
18 |
* Enqueue admin stylesheets.
|
19 |
*/
|
20 |
function wpa_admin_styles() {
|
21 |
-
if ( isset( $_GET['page'] ) && ( 'wp-accessibility
|
22 |
$version = wpa_check_version();
|
23 |
wp_enqueue_style( 'wpa-styles', plugins_url( 'css/wpa-styles.css', __FILE__ ), array( 'farbtastic' ), $version );
|
24 |
wp_enqueue_style( 'wp-color-picker' );
|
@@ -37,7 +37,7 @@ function wpa_update_settings() {
|
|
37 |
if ( ! empty( $_POST ) ) {
|
38 |
$nonce = $_REQUEST['_wpnonce'];
|
39 |
if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
|
40 |
-
|
41 |
}
|
42 |
if ( isset( $_POST['action'] ) && 'rta' === $_POST['action'] ) {
|
43 |
$rta_from_tag_clouds = ( isset( $_POST['rta_from_tag_clouds'] ) ) ? 'on' : '';
|
@@ -49,14 +49,14 @@ function wpa_update_settings() {
|
|
49 |
}
|
50 |
if ( isset( $_POST['action'] ) && 'asl' === $_POST['action'] ) {
|
51 |
$asl_enable = ( isset( $_POST['asl_enable'] ) ) ? 'on' : '';
|
52 |
-
$asl_content = ( isset( $_POST['asl_content'] ) ) ? $_POST['asl_content'] : '';
|
53 |
-
$asl_navigation = ( isset( $_POST['asl_navigation'] ) ) ? $_POST['asl_navigation'] : '';
|
54 |
-
$asl_sitemap = ( isset( $_POST['asl_sitemap'] ) ) ? $_POST['asl_sitemap'] : '';
|
55 |
-
$asl_extra_target = ( isset( $_POST['asl_extra_target'] ) ) ? $_POST['asl_extra_target'] : '';
|
56 |
-
$asl_extra_text = ( isset( $_POST['asl_extra_text'] ) ) ? $_POST['asl_extra_text'] : '';
|
57 |
$asl_visible = ( isset( $_POST['asl_visible'] ) ) ? 'on' : '';
|
58 |
-
$
|
59 |
-
$
|
60 |
update_option( 'asl_enable', $asl_enable );
|
61 |
update_option( 'asl_content', $asl_content );
|
62 |
update_option( 'asl_navigation', $asl_navigation );
|
@@ -64,49 +64,65 @@ function wpa_update_settings() {
|
|
64 |
update_option( 'asl_extra_target', $asl_extra_target );
|
65 |
update_option( 'asl_extra_text', $asl_extra_text );
|
66 |
update_option( 'asl_visible', $asl_visible );
|
|
|
67 |
$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>' : '';
|
68 |
|
69 |
-
update_option( '
|
70 |
-
|
71 |
-
$message = __( 'Add Skiplinks Settings Updated', 'wp-accessibility' );
|
72 |
|
73 |
return "<div class='updated'><p>" . $message . "</p>$notice</div>";
|
74 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
if ( isset( $_POST['action'] ) && 'misc' === $_POST['action'] ) {
|
76 |
$wpa_lang = ( isset( $_POST['wpa_lang'] ) ) ? 'on' : '';
|
77 |
$wpa_target = ( isset( $_POST['wpa_target'] ) ) ? 'on' : '';
|
78 |
$wpa_labels = ( isset( $_POST['wpa_labels'] ) ) ? 'on' : '';
|
79 |
$wpa_search = ( isset( $_POST['wpa_search'] ) ) ? 'on' : '';
|
80 |
-
$wpa_search_alt = ( isset( $_POST['wpa_search_alt'] ) ) ? 'on' : '';
|
81 |
$wpa_tabindex = ( isset( $_POST['wpa_tabindex'] ) ) ? 'on' : '';
|
82 |
$wpa_underline = ( isset( $_POST['wpa_underline'] ) ) ? 'on' : '';
|
83 |
-
$wpa_longdesc = ( isset( $_POST['wpa_longdesc'] ) ) ? esc_attr( $_POST['wpa_longdesc'] ) : 'false';
|
84 |
-
$wpa_longdesc_featured = ( isset( $_POST['wpa_longdesc_featured'] ) ) ? esc_attr( $_POST['wpa_longdesc_featured'] ) : 'false';
|
85 |
$wpa_image_titles = ( isset( $_POST['wpa_image_titles'] ) ) ? 'on' : '';
|
86 |
$wpa_more = ( isset( $_POST['wpa_more'] ) ) ? 'on' : '';
|
87 |
$wpa_focus = ( isset( $_POST['wpa_focus'] ) ) ? 'on' : '';
|
88 |
$wpa_focus_color = ( isset( $_POST['wpa_focus_color'] ) ) ? str_replace( '#', '', $_POST['wpa_focus_color'] ) : '';
|
89 |
-
$wpa_continue = ( isset( $_POST['wpa_continue'] ) ) ? $_POST['wpa_continue'] : 'Continue Reading';
|
90 |
-
$wpa_diagnostics = ( isset( $_POST['wpa_diagnostics'] ) ) ? 'on' : '';
|
91 |
-
$wpa_disable_fullscreen = ( isset( $_POST['wpa_disable_fullscreen'] ) ) ? 'on' : '';
|
92 |
$wpa_insert_roles = ( isset( $_POST['wpa_insert_roles'] ) ) ? 'on' : '';
|
93 |
-
$wpa_complementary_container = ( isset( $_POST['wpa_complementary_container'] ) ) ? str_replace( '#', '', $_POST['wpa_complementary_container'] ) : '';
|
94 |
update_option( 'wpa_lang', $wpa_lang );
|
95 |
update_option( 'wpa_target', $wpa_target );
|
96 |
update_option( 'wpa_labels', $wpa_labels );
|
97 |
update_option( 'wpa_search', $wpa_search );
|
98 |
-
update_option( 'wpa_search_alt', $wpa_search_alt );
|
99 |
update_option( 'wpa_tabindex', $wpa_tabindex );
|
100 |
update_option( 'wpa_underline', $wpa_underline );
|
101 |
-
update_option( 'wpa_longdesc', $wpa_longdesc );
|
102 |
-
update_option( 'wpa_longdesc_featured', $wpa_longdesc_featured );
|
103 |
update_option( 'wpa_image_titles', $wpa_image_titles );
|
104 |
update_option( 'wpa_more', $wpa_more );
|
105 |
update_option( 'wpa_focus', $wpa_focus );
|
106 |
update_option( 'wpa_focus_color', $wpa_focus_color );
|
107 |
update_option( 'wpa_continue', $wpa_continue );
|
108 |
-
update_option( '
|
109 |
-
update_option( 'wpa_disable_fullscreen', $wpa_disable_fullscreen );
|
110 |
$message = __( 'Miscellaneous Accessibility Settings Updated', 'wp-accessibility' );
|
111 |
|
112 |
return "<div class='updated'><p>" . $message . '</p></div>';
|
@@ -114,13 +130,13 @@ function wpa_update_settings() {
|
|
114 |
|
115 |
if ( isset( $_POST['action'] ) && 'toolbar' === $_POST['action'] ) {
|
116 |
$wpa_toolbar = ( isset( $_POST['wpa_toolbar'] ) ) ? 'on' : '';
|
117 |
-
$wpa_toolbar_size = ( isset( $_POST['wpa_toolbar_size'] ) ) ? $_POST['wpa_toolbar_size'] : '';
|
118 |
$wpa_alternate_fontsize = ( isset( $_POST['wpa_alternate_fontsize'] ) ) ? 'on' : '';
|
119 |
$wpa_widget_toolbar = ( isset( $_POST['wpa_widget_toolbar'] ) ) ? 'on' : '';
|
120 |
-
$wpa_toolbar_gs = ( isset( $_POST['wpa_toolbar_gs'] ) ) ? 'on' : '';
|
121 |
-
$wpa_toolbar_fs = ( isset( $_POST['wpa_toolbar_fs'] ) ) ? '
|
122 |
-
$wpa_toolbar_ct = ( isset( $_POST['wpa_toolbar_ct'] ) ) ? '
|
123 |
-
$wpa_toolbar_default = ( isset( $_POST['wpa_toolbar_default'] ) ) ? $_POST['wpa_toolbar_default'] : '';
|
124 |
$wpa_toolbar_right = ( isset( $_POST['wpa_toolbar_right'] ) ) ? 'on' : '';
|
125 |
$wpa_toolbar_mobile = ( isset( $_POST['wpa_toolbar_mobile'] ) ) ? 'on' : '';
|
126 |
update_option( 'wpa_toolbar', $wpa_toolbar );
|
@@ -149,7 +165,7 @@ function wpa_admin_settings() {
|
|
149 |
echo wpa_update_settings();
|
150 |
?>
|
151 |
<div class="wrap">
|
152 |
-
<h1><?php _e( 'WP Accessibility
|
153 |
<div class="wpa-settings-wrapper">
|
154 |
<div id="wpa_settings_page" class="postbox-container">
|
155 |
<div class="metabox-holder">
|
@@ -167,7 +183,7 @@ function wpa_admin_settings() {
|
|
167 |
<?php
|
168 |
} else {
|
169 |
?>
|
170 |
-
<form method="post" action="<?php echo admin_url( '
|
171 |
<fieldset>
|
172 |
<legend><?php _e( 'Configure Skiplinks', 'wp-accessibility' ); ?></legend>
|
173 |
<ul>
|
@@ -180,17 +196,24 @@ function wpa_admin_settings() {
|
|
180 |
<label for="asl_visible"><?php _e( 'Skiplinks always visible', 'wp-accessibility' ); ?></label>
|
181 |
</li>
|
182 |
<li>
|
183 |
-
<label for="asl_content"><?php _e( 'Skip to Content link target
|
184 |
-
<input type="text" id="asl_content" name="asl_content" size="
|
185 |
</li>
|
186 |
<li>
|
187 |
-
<label for="asl_navigation"><?php _e( 'Skip to Navigation link target
|
188 |
-
<input type="text" id="asl_navigation" name="asl_navigation" size="
|
189 |
</li>
|
|
|
|
|
|
|
190 |
<li>
|
191 |
<label for="asl_sitemap"><?php _e( 'Site Map link target (URL for your site map)', 'wp-accessibility' ); ?></label><br />
|
192 |
<input type="text" id="asl_sitemap" name="asl_sitemap" size="44" value="<?php echo esc_attr( get_option( 'asl_sitemap' ) ); ?>"/>
|
193 |
</li>
|
|
|
|
|
|
|
|
|
194 |
<li>
|
195 |
<label for="asl_extra_target"><?php _e( 'Add your own link (link or container ID)', 'wp-accessibility' ); ?></label><br />
|
196 |
<input type="text" id="asl_extra_target" name="asl_extra_target" size="44" value="<?php echo esc_attr( get_option( 'asl_extra_target' ) ); ?>"/>
|
@@ -199,28 +222,25 @@ function wpa_admin_settings() {
|
|
199 |
<label for="asl_extra_text"><?php _e( 'Link text for your link', 'wp-accessibility' ); ?></label><br />
|
200 |
<input type="text" id="asl_extra_text" name="asl_extra_text" size="44" value="<?php echo esc_attr( get_option( 'asl_extra_text' ) ); ?>"/>
|
201 |
</li>
|
202 |
-
|
203 |
-
<label for="asl_styles_focus"><?php _e( 'Styles for Skiplinks when they have focus', 'wp-accessibility' ); ?></label><br/>
|
204 |
-
<textarea name='asl_styles_focus' id='asl_styles_focus' cols='60' rows='4'><?php echo esc_attr( stripslashes( get_option( 'asl_styles_focus' ) ) ); ?></textarea>
|
205 |
-
</li>
|
206 |
-
<?php
|
207 |
-
if ( 'on' !== get_option( 'asl_visible' ) ) {
|
208 |
-
$disabled = " disabled='disabled' style='background: #eee;'";
|
209 |
-
$note = ' ' . __( '(Not currently visible)', 'wp-accessibility' );
|
210 |
-
} else {
|
211 |
-
$disabled = '';
|
212 |
-
$note = '';
|
213 |
}
|
|
|
214 |
?>
|
215 |
<li>
|
216 |
-
<label for="
|
|
|
|
|
217 |
<?php
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
<
|
|
|
223 |
</li>
|
|
|
|
|
|
|
224 |
</ul>
|
225 |
</fieldset>
|
226 |
<p>
|
@@ -235,37 +255,37 @@ function wpa_admin_settings() {
|
|
235 |
</div>
|
236 |
</div>
|
237 |
<div class="postbox">
|
238 |
-
<h2 id="toolbar" class='hndle'><?php esc_html_e( 'Accessibility Toolbar
|
239 |
<div class="inside">
|
240 |
-
<form method="post" action="<?php echo esc_url( admin_url( '
|
241 |
<ul>
|
242 |
-
<li>
|
243 |
<input type="checkbox" id="wpa_toolbar" name="wpa_toolbar" <?php checked( get_option( 'wpa_toolbar' ), 'on' ); ?>/>
|
244 |
-
<label for="wpa_toolbar"><?php _e( '
|
245 |
<ul>
|
246 |
<li>
|
247 |
-
<input type="checkbox" id="wpa_toolbar_fs" name="wpa_toolbar_fs" <?php checked( get_option( 'wpa_toolbar_fs' ), '
|
248 |
-
<label for="wpa_toolbar_fs"><?php _e( '
|
249 |
</li>
|
250 |
<li>
|
251 |
-
<input type="checkbox" id="wpa_toolbar_ct" name="wpa_toolbar_ct" <?php checked( get_option( 'wpa_toolbar_ct' ), '
|
252 |
-
<label for="wpa_toolbar_ct"><?php _e( '
|
253 |
</li>
|
254 |
<li>
|
255 |
<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' ); ?> />
|
256 |
-
<label for="wpa_toolbar_gs"><?php _e( '
|
257 |
</li>
|
258 |
</ul>
|
259 |
</li>
|
260 |
<li>
|
261 |
-
<label for="wpa_toolbar_default"><?php _e( 'Toolbar location (
|
262 |
-
<input type="text" id="wpa_toolbar_default" name="wpa_toolbar_default" value="<?php echo esc_attr( get_option( 'wpa_toolbar_default' ) ); ?>" />
|
263 |
</li>
|
264 |
<?php
|
265 |
$size = absint( get_option( 'wpa_toolbar_size' ) );
|
266 |
?>
|
267 |
<li>
|
268 |
-
<label for="wpa_toolbar_size"><?php _e( 'Toolbar font size', 'wp-accessibility' ); ?></label
|
269 |
<select name='wpa_toolbar_size' id='wpa_toolbar_size'>
|
270 |
<option value=''><?php _e( 'Default size', 'wp-accessibility' ); ?></option>
|
271 |
<?php
|
@@ -306,10 +326,12 @@ function wpa_admin_settings() {
|
|
306 |
</div>
|
307 |
</div>
|
308 |
<div class="postbox">
|
309 |
-
<h2 id="
|
310 |
|
311 |
<div class="inside">
|
312 |
-
<
|
|
|
|
|
313 |
<ul>
|
314 |
<?php
|
315 |
if ( ! wpa_accessible_theme() ) {
|
@@ -321,8 +343,10 @@ function wpa_admin_settings() {
|
|
321 |
<li>
|
322 |
<input type="checkbox" id="wpa_more" name="wpa_more" <?php checked( get_option( 'wpa_more' ), 'on' ); ?>/>
|
323 |
<label for="wpa_more"><?php _e( 'Add post title to "more" links.', 'wp-accessibility' ); ?></label>
|
324 |
-
|
325 |
-
|
|
|
|
|
326 |
</li>
|
327 |
<li>
|
328 |
<input type="checkbox" id="wpa_labels" name="wpa_labels" <?php checked( get_option( 'wpa_labels' ), 'on' ); ?> />
|
@@ -337,24 +361,49 @@ function wpa_admin_settings() {
|
|
337 |
?>
|
338 |
<li>
|
339 |
<input type="checkbox" id="wpa_target" name="wpa_target" <?php checked( get_option( 'wpa_target' ), 'on' ); ?>/>
|
340 |
-
<label for="wpa_target"><?php _e( '
|
341 |
</li>
|
342 |
<li>
|
343 |
-
<input type="checkbox" id="
|
344 |
-
<label for="
|
345 |
-
</li>
|
346 |
-
<li>
|
347 |
-
<input type="checkbox" id="wpa_search" name="wpa_search" <?php checked( get_option( 'wpa_search' ), 'on' ); ?>/>
|
348 |
-
<label for="wpa_search"><?php _e( 'Force search error on empty search submission (theme must have search.php template)', 'wp-accessibility' ); ?></label>
|
349 |
</li>
|
350 |
<li>
|
351 |
<input type="checkbox" id="wpa_tabindex" name="wpa_tabindex" <?php checked( get_option( 'wpa_tabindex' ), 'on' ); ?>/>
|
352 |
<label for="wpa_tabindex"><?php _e( 'Remove tabindex from focusable elements', 'wp-accessibility' ); ?></label>
|
353 |
</li>
|
354 |
<li>
|
355 |
-
<input type="checkbox" id="wpa_underline" name="wpa_underline" <?php checked( get_option( 'wpa_underline' ), 'on' ); ?>/>
|
356 |
-
<label for="wpa_underline"><?php _e( 'Force underline on
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
<li>
|
359 |
<label for="wpa_longdesc"><?php _e( 'Long Description UI', 'wp-accessibility' ); ?></label><br />
|
360 |
<select id="wpa_longdesc" name="wpa_longdesc">
|
@@ -368,29 +417,64 @@ function wpa_admin_settings() {
|
|
368 |
<label for="wpa_longdesc_featured"><?php _e( 'Support <code>longdesc</code> on featured images', 'wp-accessibility' ); ?></label>
|
369 |
</li>
|
370 |
<li>
|
371 |
-
<
|
372 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
<li>
|
375 |
-
<input type="checkbox" id="
|
376 |
-
<label for="
|
377 |
</li>
|
378 |
<li>
|
379 |
<input type="checkbox" id="wpa_disable_fullscreen" name="wpa_disable_fullscreen" <?php checked( get_option( 'wpa_disable_fullscreen' ), 'on' ); ?>/>
|
380 |
<label for="wpa_disable_fullscreen"><?php _e( 'Disable fullscreen block editor by default', 'wp-accessibility' ); ?></label>
|
381 |
</li>
|
382 |
<li>
|
383 |
-
<input type="checkbox" id="
|
384 |
-
<label for="
|
385 |
-
|
386 |
-
<input type="text" id="wpa_focus_color" name="wpa_focus_color" value="#<?php echo esc_attr( get_option( 'wpa_focus_color' ) ); ?>"/></li>
|
387 |
</ul>
|
388 |
<p>
|
389 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>" />
|
390 |
-
<input type="hidden" name="action" value="
|
391 |
</p>
|
392 |
-
|
393 |
-
<p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Update Miscellaneous Settings', 'wp-accessibility' ); ?>"/></p>
|
394 |
</form>
|
395 |
</div>
|
396 |
</div>
|
@@ -399,7 +483,7 @@ function wpa_admin_settings() {
|
|
399 |
|
400 |
<div class="inside">
|
401 |
<?php wpa_accessible_theme(); ?>
|
402 |
-
<form method="post" action="<?php echo admin_url( '
|
403 |
<fieldset>
|
404 |
<legend><?php _e( 'Remove title attributes from:', 'wp-accessibility' ); ?></legend>
|
405 |
<ul>
|
@@ -424,8 +508,8 @@ function wpa_admin_settings() {
|
|
424 |
<?php
|
425 |
$colors = wpa_contrast();
|
426 |
if ( $colors ) {
|
427 |
-
$l_contrast = wpa_luminosity( $colors['red1'], $colors['red2'], $colors['green1'], $colors['green2'], $colors['blue1'], $colors['blue2'] ) . ':1';
|
428 |
$luminance_raw = wpa_luminosity( $colors['red1'], $colors['red2'], $colors['green1'], $colors['green2'], $colors['blue1'], $colors['blue2'] );
|
|
|
429 |
$hex1 = esc_attr( $colors['hex1'] );
|
430 |
$hex2 = esc_attr( $colors['hex2'] );
|
431 |
} else {
|
@@ -436,7 +520,7 @@ function wpa_admin_settings() {
|
|
436 |
if ( $l_contrast ) {
|
437 |
$results = "<div class='updated notice'>";
|
438 |
// Translators: Contrast ratio, foreground Hex color, background Hex color.
|
439 |
-
$results .= '<
|
440 |
if ( $luminance_raw >= 7 ) {
|
441 |
$results .= __( 'The colors compared <strong>pass</strong> the relative luminosity test at level AAA.', 'wp-accessibility' );
|
442 |
}
|
@@ -444,7 +528,7 @@ function wpa_admin_settings() {
|
|
444 |
$results .= __( 'The colors compared <strong>pass</strong> the relative luminosity test at level AA.', 'wp-accessibility' );
|
445 |
}
|
446 |
if ( $luminance_raw >= 3 && $luminance_raw < 4.5 ) {
|
447 |
-
$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' );
|
448 |
}
|
449 |
if ( $luminance_raw < 3 ) {
|
450 |
$results .= __( 'The colors compared <strong>do not pass</strong> the relative luminosity test.', 'wp-accessibility' );
|
@@ -453,16 +537,16 @@ function wpa_admin_settings() {
|
|
453 |
$results .= '</p>';
|
454 |
$results .= "
|
455 |
<div class=\"views\">
|
456 |
-
<p class='large' style=\"
|
457 |
-
<p class='small' style=\"
|
458 |
-
<p class='large' style=\"
|
459 |
-
<p class='small' style=\"
|
460 |
</div>
|
461 |
</div>";
|
462 |
echo $results;
|
463 |
}
|
464 |
?>
|
465 |
-
<form method="
|
466 |
<fieldset>
|
467 |
<legend><?php _e( 'Test of relative luminosity', 'wp-accessibility' ); ?></legend>
|
468 |
<ul id="contrast-tester">
|
@@ -479,143 +563,129 @@ function wpa_admin_settings() {
|
|
479 |
</ul>
|
480 |
</fieldset>
|
481 |
<p>
|
482 |
-
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>" />
|
483 |
<input type="hidden" name="action" value="contrast" />
|
|
|
484 |
</p>
|
485 |
|
486 |
<p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Check Color Contrast', 'wp-accessibility' ); ?>"/></p>
|
487 |
</form>
|
488 |
</div>
|
489 |
</div>
|
490 |
-
<div class="postbox" id="privacy">
|
491 |
-
<h2 class='hndle'><?php _e( 'Privacy', 'wp-accessibility' ); ?></h2>
|
492 |
-
|
493 |
-
<div class="inside">
|
494 |
-
<h3><?php _e( 'Cookies', 'wp-accessibility' ); ?></h3>
|
495 |
-
<p><?php _e( 'The accessibility toolbar sets cookies to maintain awareness of the user\'s selected accessibility options. If the toolbar is not in use, WP Accessibility does not set any cookies.', 'wp-accessibility' ); ?></p>
|
496 |
-
<h3><?php _e( 'Information Collected by WP Accessibility', 'wp-accessibility' ); ?></h3>
|
497 |
-
<p><?php _e( 'WP Accessibility does not collect any private information about users or visitors.', 'wp-accessibility' ); ?></p>
|
498 |
-
</div>
|
499 |
-
</div>
|
500 |
-
<div class="postbox" id="get-support">
|
501 |
-
<h2 class='hndle'><?php _e( 'Get Plug-in Support', 'wp-accessibility' ); ?></h2>
|
502 |
-
|
503 |
-
<div class="inside">
|
504 |
-
<div class='wpa-support-me'>
|
505 |
-
<p>
|
506 |
-
<?php
|
507 |
-
// Translators: URL to donate.
|
508 |
-
printf( __( 'Please, consider <a href="%s">making a donation</a> to support WP Accessibility!', 'wp-accessibility' ), 'https://www.joedolson.com/donate/' );
|
509 |
-
?>
|
510 |
-
</p>
|
511 |
-
</div>
|
512 |
-
<?php wpa_get_support_form(); ?>
|
513 |
-
</div>
|
514 |
-
</div>
|
515 |
</div>
|
516 |
</div>
|
517 |
</div>
|
518 |
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
}
|
536 |
-
}(document, "script", "twitter-wjs");</script>
|
537 |
-
</p>
|
538 |
-
<p><?php _e( "If you've found WP Accessibility useful, then please <a href='https://wordpress.org/plugins/wp-accessibility/'>rate it five stars</a>, <a href='https://www.joedolson.com/donate/'>make a donation</a>, or <a href='https://translate.wordpress.org/projects/wp-plugins/wp-accessibility'>help with translation</a>.", 'wp-accessibility' ); ?></p>
|
539 |
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
546 |
</div>
|
547 |
</div>
|
|
|
548 |
|
549 |
-
|
550 |
-
|
551 |
-
<h2 class='hndle'><?php _e( 'Accessibility References', 'wp-accessibility' ); ?></h2>
|
552 |
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
</div>
|
563 |
-
</div>
|
564 |
</div>
|
|
|
565 |
|
566 |
-
|
567 |
-
|
568 |
-
<h2 class='hndle'><?php _e( 'Customization', 'wp-accessibility' ); ?></h2>
|
569 |
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
</div>
|
584 |
-
</div>
|
585 |
</div>
|
|
|
586 |
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
<h2 class='hndle'><?php _e( 'Your Theme', 'wp-accessibility' ); ?></h2>
|
591 |
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
</div>
|
603 |
-
</div>
|
604 |
</div>
|
605 |
-
|
|
|
606 |
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
619 |
</div>
|
620 |
</div>
|
621 |
</div>
|
@@ -623,3 +693,32 @@ function wpa_admin_settings() {
|
|
623 |
</div>
|
624 |
<?php
|
625 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
* Enqueue admin stylesheets.
|
19 |
*/
|
20 |
function wpa_admin_styles() {
|
21 |
+
if ( isset( $_GET['page'] ) && ( 'wp-accessibility' === $_GET['page'] || 'wp-accessibility-help' === $_GET['page'] ) ) {
|
22 |
$version = wpa_check_version();
|
23 |
wp_enqueue_style( 'wpa-styles', plugins_url( 'css/wpa-styles.css', __FILE__ ), array( 'farbtastic' ), $version );
|
24 |
wp_enqueue_style( 'wp-color-picker' );
|
37 |
if ( ! empty( $_POST ) ) {
|
38 |
$nonce = $_REQUEST['_wpnonce'];
|
39 |
if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
|
40 |
+
wp_die( 'WP Accessibility: Security check failed' );
|
41 |
}
|
42 |
if ( isset( $_POST['action'] ) && 'rta' === $_POST['action'] ) {
|
43 |
$rta_from_tag_clouds = ( isset( $_POST['rta_from_tag_clouds'] ) ) ? 'on' : '';
|
49 |
}
|
50 |
if ( isset( $_POST['action'] ) && 'asl' === $_POST['action'] ) {
|
51 |
$asl_enable = ( isset( $_POST['asl_enable'] ) ) ? 'on' : '';
|
52 |
+
$asl_content = ( isset( $_POST['asl_content'] ) ) ? sanitize_text_field( $_POST['asl_content'] ) : '';
|
53 |
+
$asl_navigation = ( isset( $_POST['asl_navigation'] ) ) ? sanitize_text_field( $_POST['asl_navigation'] ) : '';
|
54 |
+
$asl_sitemap = ( isset( $_POST['asl_sitemap'] ) ) ? sanitize_text_field( $_POST['asl_sitemap'] ) : '';
|
55 |
+
$asl_extra_target = ( isset( $_POST['asl_extra_target'] ) ) ? sanitize_text_field( $_POST['asl_extra_target'] ) : '';
|
56 |
+
$asl_extra_text = ( isset( $_POST['asl_extra_text'] ) ) ? sanitize_text_field( $_POST['asl_extra_text'] ) : '';
|
57 |
$asl_visible = ( isset( $_POST['asl_visible'] ) ) ? 'on' : '';
|
58 |
+
$asl_default_styles = ( isset( $_POST['asl_default_styles'] ) ) ? 'true' : '';
|
59 |
+
$asl_styles = ( isset( $_POST['asl_styles'] ) ) ? wp_filter_nohtml_kses( $_POST['asl_styles'] ) : '';
|
60 |
update_option( 'asl_enable', $asl_enable );
|
61 |
update_option( 'asl_content', $asl_content );
|
62 |
update_option( 'asl_navigation', $asl_navigation );
|
64 |
update_option( 'asl_extra_target', $asl_extra_target );
|
65 |
update_option( 'asl_extra_text', $asl_extra_text );
|
66 |
update_option( 'asl_visible', $asl_visible );
|
67 |
+
update_option( 'asl_default_styles', $asl_default_styles );
|
68 |
$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>' : '';
|
69 |
|
70 |
+
update_option( 'asl_styles', $asl_styles );
|
71 |
+
$message = __( 'Skiplinks Settings Updated', 'wp-accessibility' );
|
|
|
72 |
|
73 |
return "<div class='updated'><p>" . $message . "</p>$notice</div>";
|
74 |
}
|
75 |
+
|
76 |
+
if ( isset( $_POST['action'] ) && 'features' === $_POST['action'] ) {
|
77 |
+
$wpa_longdesc = ( isset( $_POST['wpa_longdesc'] ) ) ? sanitize_text_field( $_POST['wpa_longdesc'] ) : 'false';
|
78 |
+
$wpa_longdesc_featured = ( isset( $_POST['wpa_longdesc_featured'] ) ) ? sanitize_text_field( $_POST['wpa_longdesc_featured'] ) : 'false';
|
79 |
+
$wpa_post_types = ( isset( $_POST['wpa_post_types'] ) ) ? map_deep( $_POST['wpa_post_types'], 'sanitize_text_field' ) : array();
|
80 |
+
update_option( 'wpa_longdesc', $wpa_longdesc );
|
81 |
+
update_option( 'wpa_longdesc_featured', $wpa_longdesc_featured );
|
82 |
+
update_option( 'wpa_post_types', $wpa_post_types );
|
83 |
+
$message = __( 'Accessibility Features Updated', 'wp-accessibility' );
|
84 |
+
|
85 |
+
return "<div class='updated'><p>" . $message . '</p></div>';
|
86 |
+
}
|
87 |
+
|
88 |
+
if ( isset( $_POST['action'] ) && 'tools' === $_POST['action'] ) {
|
89 |
+
$wpa_search_alt = ( isset( $_POST['wpa_search_alt'] ) ) ? 'on' : '';
|
90 |
+
$wpa_diagnostics = ( isset( $_POST['wpa_diagnostics'] ) ) ? 'on' : '';
|
91 |
+
$wpa_disable_fullscreen = ( isset( $_POST['wpa_disable_fullscreen'] ) ) ? 'on' : '';
|
92 |
+
update_option( 'wpa_search_alt', $wpa_search_alt );
|
93 |
+
update_option( 'wpa_diagnostics', $wpa_diagnostics );
|
94 |
+
update_option( 'wpa_disable_fullscreen', $wpa_disable_fullscreen );
|
95 |
+
$message = __( 'Accessibility Tools Updated', 'wp-accessibility' );
|
96 |
+
|
97 |
+
return "<div class='updated'><p>" . $message . '</p></div>';
|
98 |
+
}
|
99 |
+
|
100 |
if ( isset( $_POST['action'] ) && 'misc' === $_POST['action'] ) {
|
101 |
$wpa_lang = ( isset( $_POST['wpa_lang'] ) ) ? 'on' : '';
|
102 |
$wpa_target = ( isset( $_POST['wpa_target'] ) ) ? 'on' : '';
|
103 |
$wpa_labels = ( isset( $_POST['wpa_labels'] ) ) ? 'on' : '';
|
104 |
$wpa_search = ( isset( $_POST['wpa_search'] ) ) ? 'on' : '';
|
|
|
105 |
$wpa_tabindex = ( isset( $_POST['wpa_tabindex'] ) ) ? 'on' : '';
|
106 |
$wpa_underline = ( isset( $_POST['wpa_underline'] ) ) ? 'on' : '';
|
|
|
|
|
107 |
$wpa_image_titles = ( isset( $_POST['wpa_image_titles'] ) ) ? 'on' : '';
|
108 |
$wpa_more = ( isset( $_POST['wpa_more'] ) ) ? 'on' : '';
|
109 |
$wpa_focus = ( isset( $_POST['wpa_focus'] ) ) ? 'on' : '';
|
110 |
$wpa_focus_color = ( isset( $_POST['wpa_focus_color'] ) ) ? str_replace( '#', '', $_POST['wpa_focus_color'] ) : '';
|
111 |
+
$wpa_continue = ( isset( $_POST['wpa_continue'] ) ) ? sanitize_text_field( $_POST['wpa_continue'] ) : __( 'Continue Reading', 'wp-accessibility' );
|
|
|
|
|
112 |
$wpa_insert_roles = ( isset( $_POST['wpa_insert_roles'] ) ) ? 'on' : '';
|
113 |
+
$wpa_complementary_container = ( isset( $_POST['wpa_complementary_container'] ) ) ? str_replace( '#', '', sanitize_text_field( $_POST['wpa_complementary_container'] ) ) : '';
|
114 |
update_option( 'wpa_lang', $wpa_lang );
|
115 |
update_option( 'wpa_target', $wpa_target );
|
116 |
update_option( 'wpa_labels', $wpa_labels );
|
117 |
update_option( 'wpa_search', $wpa_search );
|
|
|
118 |
update_option( 'wpa_tabindex', $wpa_tabindex );
|
119 |
update_option( 'wpa_underline', $wpa_underline );
|
|
|
|
|
120 |
update_option( 'wpa_image_titles', $wpa_image_titles );
|
121 |
update_option( 'wpa_more', $wpa_more );
|
122 |
update_option( 'wpa_focus', $wpa_focus );
|
123 |
update_option( 'wpa_focus_color', $wpa_focus_color );
|
124 |
update_option( 'wpa_continue', $wpa_continue );
|
125 |
+
update_option( 'wpa_insert_roles', $wpa_insert_roles );
|
|
|
126 |
$message = __( 'Miscellaneous Accessibility Settings Updated', 'wp-accessibility' );
|
127 |
|
128 |
return "<div class='updated'><p>" . $message . '</p></div>';
|
130 |
|
131 |
if ( isset( $_POST['action'] ) && 'toolbar' === $_POST['action'] ) {
|
132 |
$wpa_toolbar = ( isset( $_POST['wpa_toolbar'] ) ) ? 'on' : '';
|
133 |
+
$wpa_toolbar_size = ( isset( $_POST['wpa_toolbar_size'] ) ) ? sanitize_text_field( $_POST['wpa_toolbar_size'] ) : '';
|
134 |
$wpa_alternate_fontsize = ( isset( $_POST['wpa_alternate_fontsize'] ) ) ? 'on' : '';
|
135 |
$wpa_widget_toolbar = ( isset( $_POST['wpa_widget_toolbar'] ) ) ? 'on' : '';
|
136 |
+
$wpa_toolbar_gs = ( isset( $_POST['wpa_toolbar_gs'] ) ) ? 'on' : 'off';
|
137 |
+
$wpa_toolbar_fs = ( isset( $_POST['wpa_toolbar_fs'] ) ) ? 'on' : 'off';
|
138 |
+
$wpa_toolbar_ct = ( isset( $_POST['wpa_toolbar_ct'] ) ) ? 'on' : 'off';
|
139 |
+
$wpa_toolbar_default = ( isset( $_POST['wpa_toolbar_default'] ) ) ? sanitize_text_field( $_POST['wpa_toolbar_default'] ) : '';
|
140 |
$wpa_toolbar_right = ( isset( $_POST['wpa_toolbar_right'] ) ) ? 'on' : '';
|
141 |
$wpa_toolbar_mobile = ( isset( $_POST['wpa_toolbar_mobile'] ) ) ? 'on' : '';
|
142 |
update_option( 'wpa_toolbar', $wpa_toolbar );
|
165 |
echo wpa_update_settings();
|
166 |
?>
|
167 |
<div class="wrap">
|
168 |
+
<h1><?php _e( 'WP Accessibility Settings', 'wp-accessibility' ); ?></h1>
|
169 |
<div class="wpa-settings-wrapper">
|
170 |
<div id="wpa_settings_page" class="postbox-container">
|
171 |
<div class="metabox-holder">
|
183 |
<?php
|
184 |
} else {
|
185 |
?>
|
186 |
+
<form method="post" action="<?php echo admin_url( 'admin.php?page=wp-accessibility' ); ?>">
|
187 |
<fieldset>
|
188 |
<legend><?php _e( 'Configure Skiplinks', 'wp-accessibility' ); ?></legend>
|
189 |
<ul>
|
196 |
<label for="asl_visible"><?php _e( 'Skiplinks always visible', 'wp-accessibility' ); ?></label>
|
197 |
</li>
|
198 |
<li>
|
199 |
+
<label for="asl_content"><?php _e( 'Skip to Content link target', 'wp-accessibility' ); ?></label><br />
|
200 |
+
<input type="text" id="asl_content" name="asl_content" placeholder="#" size="30" aria-describedby="asl_content_description" value="<?php echo esc_attr( get_option( 'asl_content' ) ); ?>"/> <span id="asl_content_description"><?php _e( 'ID attribute starting with <code>#</code>', 'wp-accessibility' ); ?></span>
|
201 |
</li>
|
202 |
<li>
|
203 |
+
<label for="asl_navigation"><?php _e( 'Skip to Navigation link target', 'wp-accessibility' ); ?></label><br />
|
204 |
+
<input type="text" id="asl_navigation" name="asl_navigation" placeholder="#" size="30" aria-describedby="asl_navigation_description" value="<?php echo esc_attr( get_option( 'asl_navigation' ) ); ?>"/> <span id="asl_navigation_description"><?php _e( 'ID attribute starting with <code>#</code>', 'wp-accessibility' ); ?></span>
|
205 |
</li>
|
206 |
+
<?php
|
207 |
+
if ( '' !== get_option( 'asl_sitemap', '' ) ) {
|
208 |
+
?>
|
209 |
<li>
|
210 |
<label for="asl_sitemap"><?php _e( 'Site Map link target (URL for your site map)', 'wp-accessibility' ); ?></label><br />
|
211 |
<input type="text" id="asl_sitemap" name="asl_sitemap" size="44" value="<?php echo esc_attr( get_option( 'asl_sitemap' ) ); ?>"/>
|
212 |
</li>
|
213 |
+
<?php
|
214 |
+
}
|
215 |
+
if ( '' !== get_option( 'asl_extra_target', '' ) ) {
|
216 |
+
?>
|
217 |
<li>
|
218 |
<label for="asl_extra_target"><?php _e( 'Add your own link (link or container ID)', 'wp-accessibility' ); ?></label><br />
|
219 |
<input type="text" id="asl_extra_target" name="asl_extra_target" size="44" value="<?php echo esc_attr( get_option( 'asl_extra_target' ) ); ?>"/>
|
222 |
<label for="asl_extra_text"><?php _e( 'Link text for your link', 'wp-accessibility' ); ?></label><br />
|
223 |
<input type="text" id="asl_extra_text" name="asl_extra_text" size="44" value="<?php echo esc_attr( get_option( 'asl_extra_text' ) ); ?>"/>
|
224 |
</li>
|
225 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
}
|
227 |
+
$use_defaults = get_option( 'asl_default_styles', '' );
|
228 |
?>
|
229 |
<li>
|
230 |
+
<label for="asl_default_styles"><?php _e( 'Use default Skiplink CSS', 'wp-accessibility' ); ?></label>
|
231 |
+
<input type="checkbox" id="asl_default_styles" name="asl_default_styles" value="true" <?php checked( get_option( 'asl_default_styles' ), 'true' ); ?> />
|
232 |
+
</li>
|
233 |
<?php
|
234 |
+
if ( 'true' !== $use_defaults ) {
|
235 |
+
$styles = wpa_skiplink_css();
|
236 |
+
?>
|
237 |
+
<li>
|
238 |
+
<label for="asl_styles"><?php _e( 'Styles for Skiplinks', 'wp-accessibility' ); ?></label><br/>
|
239 |
+
<textarea name='asl_styles' id='asl_styles' cols='60' rows='4'><?php echo esc_textarea( stripcslashes( $styles ) ); ?></textarea>
|
240 |
</li>
|
241 |
+
<?php
|
242 |
+
}
|
243 |
+
?>
|
244 |
</ul>
|
245 |
</fieldset>
|
246 |
<p>
|
255 |
</div>
|
256 |
</div>
|
257 |
<div class="postbox">
|
258 |
+
<h2 id="toolbar" class='hndle'><?php esc_html_e( 'Accessibility Toolbar', 'wp-accessibility' ); ?></h2>
|
259 |
<div class="inside">
|
260 |
+
<form method="post" action="<?php echo esc_url( admin_url( 'admin.php?page=wp-accessibility' ) ); ?>">
|
261 |
<ul>
|
262 |
+
<li class="wpa-checkboxes">
|
263 |
<input type="checkbox" id="wpa_toolbar" name="wpa_toolbar" <?php checked( get_option( 'wpa_toolbar' ), 'on' ); ?>/>
|
264 |
+
<label for="wpa_toolbar"><?php _e( 'Enable Accessibility toolbar', 'wp-accessibility' ); ?></label>
|
265 |
<ul>
|
266 |
<li>
|
267 |
+
<input type="checkbox" id="wpa_toolbar_fs" name="wpa_toolbar_fs" <?php checked( get_option( 'wpa_toolbar_fs', '' ), 'on' ); ?> value='on' />
|
268 |
+
<label for="wpa_toolbar_fs"><?php _e( 'Font size', 'wp-accessibility' ); ?></label>
|
269 |
</li>
|
270 |
<li>
|
271 |
+
<input type="checkbox" id="wpa_toolbar_ct" name="wpa_toolbar_ct" <?php checked( get_option( 'wpa_toolbar_ct', '' ), 'on' ); ?> value='on' />
|
272 |
+
<label for="wpa_toolbar_ct"><?php _e( 'Contrast', 'wp-accessibility' ); ?></label>
|
273 |
</li>
|
274 |
<li>
|
275 |
<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' ); ?> />
|
276 |
+
<label for="wpa_toolbar_gs"><?php _e( 'Grayscale', 'wp-accessibility' ); ?></label> <em class="wpa-note" id="wpa_toolbar_gs_note"><?php _e( 'Grayscale is intended for testing, and will appear only for logged-in administrators', 'wp-accessibility' ); ?></em>
|
277 |
</li>
|
278 |
</ul>
|
279 |
</li>
|
280 |
<li>
|
281 |
+
<label for="wpa_toolbar_default"><?php _e( 'Toolbar location (optional)', 'wp-accessibility' ); ?></label><br />
|
282 |
+
<input type="text" id="wpa_toolbar_default" name="wpa_toolbar_default" aria-describedby="wpa_toolbar_default_description" placeholder="#" value="<?php echo esc_attr( get_option( 'wpa_toolbar_default' ) ); ?>" /> <span id="wpa_toolbar_default_description"><?php _e( 'ID attribute starting with <code>#</code>', 'wp-accessibility' ); ?></span>
|
283 |
</li>
|
284 |
<?php
|
285 |
$size = absint( get_option( 'wpa_toolbar_size' ) );
|
286 |
?>
|
287 |
<li>
|
288 |
+
<label for="wpa_toolbar_size"><?php _e( 'Toolbar font size', 'wp-accessibility' ); ?></label><br />
|
289 |
<select name='wpa_toolbar_size' id='wpa_toolbar_size'>
|
290 |
<option value=''><?php _e( 'Default size', 'wp-accessibility' ); ?></option>
|
291 |
<?php
|
326 |
</div>
|
327 |
</div>
|
328 |
<div class="postbox">
|
329 |
+
<h2 id="accessibility-settings" class='hndle'><?php _e( 'Accessibility Fixes', 'wp-accessibility' ); ?></h2>
|
330 |
|
331 |
<div class="inside">
|
332 |
+
<p><?php _e( 'Settings that fix potential accessibility issues on your site.', 'wp-accessibility' ); ?></p>
|
333 |
+
<hr>
|
334 |
+
<form method="post" action="<?php echo admin_url( 'admin.php?page=wp-accessibility' ); ?>">
|
335 |
<ul>
|
336 |
<?php
|
337 |
if ( ! wpa_accessible_theme() ) {
|
343 |
<li>
|
344 |
<input type="checkbox" id="wpa_more" name="wpa_more" <?php checked( get_option( 'wpa_more' ), 'on' ); ?>/>
|
345 |
<label for="wpa_more"><?php _e( 'Add post title to "more" links.', 'wp-accessibility' ); ?></label>
|
346 |
+
</li>
|
347 |
+
<li>
|
348 |
+
<label for="wpa_continue"><?php _e( 'Continue reading prefix text', 'wp-accessibility' ); ?></label><br />
|
349 |
+
<input type="text" id="wpa_continue" name="wpa_continue" value="<?php echo esc_attr( get_option( 'wpa_continue', __( 'Continue Reading', 'wp-accessibility' ) ) ); ?>"/>
|
350 |
</li>
|
351 |
<li>
|
352 |
<input type="checkbox" id="wpa_labels" name="wpa_labels" <?php checked( get_option( 'wpa_labels' ), 'on' ); ?> />
|
361 |
?>
|
362 |
<li>
|
363 |
<input type="checkbox" id="wpa_target" name="wpa_target" <?php checked( get_option( 'wpa_target' ), 'on' ); ?>/>
|
364 |
+
<label for="wpa_target"><?php _e( 'Prevent links from opening in new windows', 'wp-accessibility' ); ?></label>
|
365 |
</li>
|
366 |
<li>
|
367 |
+
<input type="checkbox" id="wpa_search" name="wpa_search" <?php checked( get_option( 'wpa_search' ), 'on' ); ?> aria-describedby="wpa-search-note" />
|
368 |
+
<label for="wpa_search"><?php _e( 'Force search error on empty search submission', 'wp-accessibility' ); ?></label> <em id="wpa-search-note" class="wpa-note"><?php _e( 'Your theme must have a search.php template', 'wp-accessibility' ); ?></em>
|
|
|
|
|
|
|
|
|
369 |
</li>
|
370 |
<li>
|
371 |
<input type="checkbox" id="wpa_tabindex" name="wpa_tabindex" <?php checked( get_option( 'wpa_tabindex' ), 'on' ); ?>/>
|
372 |
<label for="wpa_tabindex"><?php _e( 'Remove tabindex from focusable elements', 'wp-accessibility' ); ?></label>
|
373 |
</li>
|
374 |
<li>
|
375 |
+
<input type="checkbox" id="wpa_underline" aria-describedby="wpa-underline-note" name="wpa_underline" <?php checked( get_option( 'wpa_underline' ), 'on' ); ?>/>
|
376 |
+
<label for="wpa_underline"><?php _e( 'Force underline on links', 'wp-accessibility' ); ?></label> <em id="wpa-underline-note" class="wpa-note"><?php _e( 'Excludes links inside <code>nav</code> elements.', 'wp-accessibility' ); ?></em>
|
377 |
+
</li>
|
378 |
+
<li>
|
379 |
+
<input type="checkbox" id="wpa_image_titles" name="wpa_image_titles" <?php checked( get_option( 'wpa_image_titles' ), 'on' ); ?>/>
|
380 |
+
<label for="wpa_image_titles"><?php _e( 'Remove title attributes inserted into post content and featured images.', 'wp-accessibility' ); ?></label>
|
381 |
+
</li>
|
382 |
+
<li>
|
383 |
+
<input type="checkbox" id="wpa_focus" name="wpa_focus" <?php checked( get_option( 'wpa_focus' ), 'on' ); ?>/>
|
384 |
+
<label for="wpa_focus"><?php _e( 'Add outline to elements on keyboard focus', 'wp-accessibility' ); ?></label>
|
385 |
</li>
|
386 |
+
<li>
|
387 |
+
<label for="wpa_focus_color"><?php _e( 'Outline color (hexadecimal, optional)', 'wp-accessibility' ); ?></label><br />
|
388 |
+
<input type="text" id="wpa_focus_color" name="wpa_focus_color" value="#<?php echo esc_attr( get_option( 'wpa_focus_color' ) ); ?>"/>
|
389 |
+
</li>
|
390 |
+
</ul>
|
391 |
+
<p>
|
392 |
+
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>" />
|
393 |
+
<input type="hidden" name="action" value="misc" />
|
394 |
+
</p>
|
395 |
+
|
396 |
+
<p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Update Miscellaneous Settings', 'wp-accessibility' ); ?>"/></p>
|
397 |
+
</form>
|
398 |
+
</div>
|
399 |
+
</div>
|
400 |
+
<div class="postbox">
|
401 |
+
<h2 class="hndle"><?php _e( 'Accessibility Features', 'wp-accessibility' ); ?></h2>
|
402 |
+
<div class="inside">
|
403 |
+
<p><?php _e( 'Enable content features to improve site accessibility.', 'wp-accessibility' ); ?></p>
|
404 |
+
<hr>
|
405 |
+
<form method="post" action="<?php echo admin_url( 'admin.php?page=wp-accessibility' ); ?>">
|
406 |
+
<ul>
|
407 |
<li>
|
408 |
<label for="wpa_longdesc"><?php _e( 'Long Description UI', 'wp-accessibility' ); ?></label><br />
|
409 |
<select id="wpa_longdesc" name="wpa_longdesc">
|
417 |
<label for="wpa_longdesc_featured"><?php _e( 'Support <code>longdesc</code> on featured images', 'wp-accessibility' ); ?></label>
|
418 |
</li>
|
419 |
<li>
|
420 |
+
<fieldset>
|
421 |
+
<legend><?php _e( 'Enable Content Summaries', 'wp-accessibility' ); ?></legend>
|
422 |
+
<ul class="checkboxes">
|
423 |
+
<?php
|
424 |
+
$enabled = get_option( 'wpa_post_types', array() );
|
425 |
+
$post_types = get_post_types(
|
426 |
+
array(
|
427 |
+
'show_ui' => true,
|
428 |
+
'public' => true,
|
429 |
+
),
|
430 |
+
'objects'
|
431 |
+
);
|
432 |
+
foreach ( $post_types as $type ) {
|
433 |
+
$id = $type->name;
|
434 |
+
$name = $type->labels->singular_name;
|
435 |
+
$checked = ( in_array( $id, $enabled, true ) ) ? ' checked="checked"' : '';
|
436 |
+
|
437 |
+
echo '<li><input type="checkbox" name="wpa_post_types[]" id="wpa_post_types_' . $id . '" value="' . $id . '"' . $checked . '/> <label for="wpa_post_types_"' . $id . '">' . $name . '</label></li>';
|
438 |
+
}
|
439 |
+
?>
|
440 |
+
</ul>
|
441 |
+
</fieldset>
|
442 |
</li>
|
443 |
+
</ul>
|
444 |
+
<p>
|
445 |
+
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>" />
|
446 |
+
<input type="hidden" name="action" value="features" />
|
447 |
+
</p>
|
448 |
+
<p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Update Accessibility Features', 'wp-accessibility' ); ?>"/></p>
|
449 |
+
</form>
|
450 |
+
</div>
|
451 |
+
</div>
|
452 |
+
<div class="postbox">
|
453 |
+
<h2 class="hndle"><?php _e( 'Testing & Admin Experience', 'wp-accessibility' ); ?></h2>
|
454 |
+
|
455 |
+
<div class="inside">
|
456 |
+
<p><?php _e( 'These change the admin experience or help with testing.', 'wp-accessibility' ); ?></p>
|
457 |
+
<hr>
|
458 |
+
<form method="post" action="<?php echo admin_url( 'admin.php?page=wp-accessibility' ); ?>">
|
459 |
+
<ul>
|
460 |
<li>
|
461 |
+
<input type="checkbox" id="wpa_search_alt" name="wpa_search_alt" <?php checked( get_option( 'wpa_search_alt' ), 'on' ); ?> aria-describedby="wpa_search_alt_note" />
|
462 |
+
<label for="wpa_search_alt"><?php _e( 'Include alt attribute in media library searches', 'wp-accessibility' ); ?></label> <em class="wpa-note" id="wpa_search_alt_note"><?php _e( '* May cause slow searches on large media libraries.', 'wp-accessibility' ); ?></em>
|
463 |
</li>
|
464 |
<li>
|
465 |
<input type="checkbox" id="wpa_disable_fullscreen" name="wpa_disable_fullscreen" <?php checked( get_option( 'wpa_disable_fullscreen' ), 'on' ); ?>/>
|
466 |
<label for="wpa_disable_fullscreen"><?php _e( 'Disable fullscreen block editor by default', 'wp-accessibility' ); ?></label>
|
467 |
</li>
|
468 |
<li>
|
469 |
+
<input type="checkbox" id="wpa_diagnostics" name="wpa_diagnostics" <?php checked( get_option( 'wpa_diagnostics' ), 'on' ); ?>/>
|
470 |
+
<label for="wpa_diagnostics"><?php _e( 'Enable diagnostic CSS', 'wp-accessibility' ); ?></label>
|
471 |
+
</li>
|
|
|
472 |
</ul>
|
473 |
<p>
|
474 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>" />
|
475 |
+
<input type="hidden" name="action" value="tools" />
|
476 |
</p>
|
477 |
+
<p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Update Accessibility Tools', 'wp-accessibility' ); ?>"/></p>
|
|
|
478 |
</form>
|
479 |
</div>
|
480 |
</div>
|
483 |
|
484 |
<div class="inside">
|
485 |
<?php wpa_accessible_theme(); ?>
|
486 |
+
<form method="post" action="<?php echo admin_url( 'admin.php?page=wp-accessibility' ); ?>">
|
487 |
<fieldset>
|
488 |
<legend><?php _e( 'Remove title attributes from:', 'wp-accessibility' ); ?></legend>
|
489 |
<ul>
|
508 |
<?php
|
509 |
$colors = wpa_contrast();
|
510 |
if ( $colors ) {
|
|
|
511 |
$luminance_raw = wpa_luminosity( $colors['red1'], $colors['red2'], $colors['green1'], $colors['green2'], $colors['blue1'], $colors['blue2'] );
|
512 |
+
$l_contrast = $luminance_raw . ':1';
|
513 |
$hex1 = esc_attr( $colors['hex1'] );
|
514 |
$hex2 = esc_attr( $colors['hex2'] );
|
515 |
} else {
|
520 |
if ( $l_contrast ) {
|
521 |
$results = "<div class='updated notice'>";
|
522 |
// Translators: Contrast ratio, foreground Hex color, background Hex color.
|
523 |
+
$results .= '<h2 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>' ) . '</h2><p>';
|
524 |
if ( $luminance_raw >= 7 ) {
|
525 |
$results .= __( 'The colors compared <strong>pass</strong> the relative luminosity test at level AAA.', 'wp-accessibility' );
|
526 |
}
|
528 |
$results .= __( 'The colors compared <strong>pass</strong> the relative luminosity test at level AA.', 'wp-accessibility' );
|
529 |
}
|
530 |
if ( $luminance_raw >= 3 && $luminance_raw < 4.5 ) {
|
531 |
+
$results .= __( 'The colors compared pass the relative luminosity test <strong>only when used in large print</strong> situations (greater than 18pt (24px) text or 14pt (18.66px) bold text.)', 'wp-accessibility' );
|
532 |
}
|
533 |
if ( $luminance_raw < 3 ) {
|
534 |
$results .= __( 'The colors compared <strong>do not pass</strong> the relative luminosity test.', 'wp-accessibility' );
|
537 |
$results .= '</p>';
|
538 |
$results .= "
|
539 |
<div class=\"views\">
|
540 |
+
<p class='large' style=\"color: #$hex1;background: #$hex2\">Large Text (24px)</p>
|
541 |
+
<p class='small' style=\"color: #$hex1;background: #$hex2\">Standard Text (18px)</p>
|
542 |
+
<p class='large' style=\"color: #$hex2;background: #$hex1\">Large Text (24px) (Inverted)</p>
|
543 |
+
<p class='small' style=\"color: #$hex2;background: #$hex1\">Standard Text (18px) (Inverted)</p>
|
544 |
</div>
|
545 |
</div>";
|
546 |
echo $results;
|
547 |
}
|
548 |
?>
|
549 |
+
<form method="get" id="contrast" action="<?php echo admin_url( 'admin.php?page=wp-accessibility' ); ?>">
|
550 |
<fieldset>
|
551 |
<legend><?php _e( 'Test of relative luminosity', 'wp-accessibility' ); ?></legend>
|
552 |
<ul id="contrast-tester">
|
563 |
</ul>
|
564 |
</fieldset>
|
565 |
<p>
|
|
|
566 |
<input type="hidden" name="action" value="contrast" />
|
567 |
+
<input type="hidden" name="page" value="wp-accessibility" />
|
568 |
</p>
|
569 |
|
570 |
<p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Check Color Contrast', 'wp-accessibility' ); ?>"/></p>
|
571 |
</form>
|
572 |
</div>
|
573 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
574 |
</div>
|
575 |
</div>
|
576 |
</div>
|
577 |
|
578 |
+
<?php wpa_admin_sidebar(); ?>
|
579 |
+
</div>
|
580 |
+
</div>
|
581 |
+
<?php
|
582 |
+
}
|
583 |
|
584 |
+
/**
|
585 |
+
* Show admin sidebar.
|
586 |
+
*/
|
587 |
+
function wpa_admin_sidebar() {
|
588 |
+
?>
|
589 |
+
<div class="postbox-container" id="wpa-sidebar">
|
590 |
+
<div class="metabox-holder">
|
591 |
+
<div class="ui-sortable meta-box-sortables">
|
592 |
+
<div class="postbox">
|
593 |
+
<h2 class='hndle'><?php _e( 'Support this Plugin', 'wp-accessibility' ); ?></h2>
|
|
|
|
|
|
|
|
|
594 |
|
595 |
+
<div class="inside">
|
596 |
+
<p>
|
597 |
+
<a href="https://twitter.com/intent/follow?screen_name=joedolson" class="twitter-follow-button" data-size="small" data-related="joedolson">Follow @joedolson</a>
|
598 |
+
<script>!function (d, s, id) {
|
599 |
+
var js, fjs = d.getElementsByTagName(s)[0];
|
600 |
+
if (!d.getElementById(id)) {
|
601 |
+
js = d.createElement(s);
|
602 |
+
js.id = id;
|
603 |
+
js.src = "https://platform.twitter.com/widgets.js";
|
604 |
+
fjs.parentNode.insertBefore(js, fjs);
|
605 |
+
}
|
606 |
+
}(document, "script", "twitter-wjs");</script>
|
607 |
+
</p>
|
608 |
+
<p><?php _e( "If you've found WP Accessibility useful, then please <a href='https://wordpress.org/plugins/wp-accessibility/'>rate it five stars</a>, <a href='https://www.joedolson.com/donate/'>make a donation</a>, or <a href='https://translate.wordpress.org/projects/wp-plugins/wp-accessibility'>help with translation</a>.", 'wp-accessibility' ); ?></p>
|
609 |
+
|
610 |
+
<div>
|
611 |
+
<p class="wpa-donate">
|
612 |
+
<a href="https://www.joedolson.com/donate/"><?php _e( 'Support WP Accessibility', 'wp-accessibility' ); ?></a>
|
613 |
+
</p>
|
614 |
</div>
|
615 |
</div>
|
616 |
+
</div>
|
617 |
|
618 |
+
<div class="postbox">
|
619 |
+
<h2 class='hndle'><?php _e( 'Accessibility References', 'wp-accessibility' ); ?></h2>
|
|
|
620 |
|
621 |
+
<div class="inside">
|
622 |
+
<ul>
|
623 |
+
<li><a href="http://make.wordpress.org/accessibility/wp-accessibility-plugin/">Plugin Documentation</a></li>
|
624 |
+
<li><a href="http://make.wordpress.org/accessibility/">Make WordPress: Accessibility</a></li>
|
625 |
+
<li><a href="https://make.wordpress.org/themes/handbook/review/accessibility/">WordPress Theme Accessibility Guidelines</a></li>
|
626 |
+
<li><a href="https://www.joedolson.com/tools/color-contrast.php">Color Contrast Testing</a></li>
|
627 |
+
<li><a href="http://wave.webaim.org/">WAVE: Web accessibility evaluation tool</a></li>
|
628 |
+
<li><a href="https://www.linkedin.com/learning/wordpress-accessibility-2/">WordPress Accessibility course at LinkedIn Learning</a></li>
|
629 |
+
</ul>
|
|
|
|
|
630 |
</div>
|
631 |
+
</div>
|
632 |
|
633 |
+
<div class="postbox">
|
634 |
+
<h2 class='hndle'><?php _e( 'Customization', 'wp-accessibility' ); ?></h2>
|
|
|
635 |
|
636 |
+
<div class="inside">
|
637 |
+
<p>
|
638 |
+
<?php _e( 'Custom high-contrast styles go in <code>a11y-contrast.css</code> in your Theme\'s stylesheet directory.', 'wp-accessibility' ); ?>
|
639 |
+
</p>
|
640 |
+
<p>
|
641 |
+
<?php _e( 'Set custom styles for large print using the body class <code>.fontsize</code> in your theme styles or the customizer.', 'wp-accessibility' ); ?>
|
642 |
+
</p>
|
643 |
+
<p>
|
644 |
+
<?php _e( 'Set a custom long description template by adding <code>longdesc-template.php</code> to your theme directory.', 'wp-accessibility' ); ?>
|
645 |
+
</p>
|
646 |
+
<p>
|
647 |
+
<?php _e( 'The <a href="#wpa_widget_toolbar">shortcode for the Accessibility toolbar</a> is <code>[wpa_toolbar]</code>', 'wp-accessibility' ); ?>
|
648 |
+
</p>
|
|
|
|
|
649 |
</div>
|
650 |
+
</div>
|
651 |
|
652 |
+
<?php if ( wpa_accessible_theme() ) { ?>
|
653 |
+
<div class="postbox">
|
654 |
+
<h2 class='hndle'><?php _e( 'Your Theme', 'wp-accessibility' ); ?></h2>
|
|
|
655 |
|
656 |
+
<div class="inside">
|
657 |
+
<p>
|
658 |
+
<?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.", 'wp-accessibility' ); ?>
|
659 |
+
</p>
|
660 |
+
<p>
|
661 |
+
<?php
|
662 |
+
// Translators: URL to read about the accessibility ready tag requirements.
|
663 |
+
printf( __( 'Read more about the <a href="%s">WordPress accessibility-ready tag</a>', 'wp-accessibility' ), 'https://make.wordpress.org/themes/handbook/review/accessibility/' );
|
664 |
+
?>
|
665 |
+
</p>
|
|
|
|
|
666 |
</div>
|
667 |
+
</div>
|
668 |
+
<?php } ?>
|
669 |
|
670 |
+
<div class="postbox">
|
671 |
+
<h2 class='hndle'><?php _e( 'Contributing References', 'wp-accessibility' ); ?></h2>
|
672 |
+
<div class="inside">
|
673 |
+
<ul>
|
674 |
+
<li><a href="http://www.accessibleculture.org/articles/2010/08/continue-reading-links-in-wordpress/">Continue Reading Links in WordPress</a></li>
|
675 |
+
<li><a href="http://www.mothereffingtoolconfuser.com">Mother Effing Tool Confuser</a></li>
|
676 |
+
<li><a href="https://wordpress.org/extend/plugins/remove-title-attributes/">Remove Title Attributes</a></li>
|
677 |
+
<li><a href="https://wordpress.org/extend/plugins/img-title-removal/">IMG Title Removal</a></li>
|
678 |
+
</ul>
|
679 |
+
</div>
|
680 |
+
</div>
|
681 |
+
<div class="postbox" id="privacy">
|
682 |
+
<h2 class='hndle'><?php _e( 'Privacy', 'wp-accessibility' ); ?></h2>
|
683 |
+
|
684 |
+
<div class="inside">
|
685 |
+
<h3><?php _e( 'Cookies', 'wp-accessibility' ); ?></h3>
|
686 |
+
<p><?php _e( 'The accessibility toolbar sets cookies to maintain awareness of the user\'s selected accessibility options. If the toolbar is not in use, WP Accessibility does not set any cookies.', 'wp-accessibility' ); ?></p>
|
687 |
+
<h3><?php _e( 'Information collected by WP Accessibility', 'wp-accessibility' ); ?></h3>
|
688 |
+
<p><?php _e( 'WP Accessibility does not collect any information about WordPress users or site visitors.', 'wp-accessibility' ); ?></p>
|
689 |
</div>
|
690 |
</div>
|
691 |
</div>
|
693 |
</div>
|
694 |
<?php
|
695 |
}
|
696 |
+
|
697 |
+
// Use Codemirror for Skiplink style fields.
|
698 |
+
add_action(
|
699 |
+
'admin_enqueue_scripts',
|
700 |
+
function() {
|
701 |
+
if ( ! function_exists( 'wp_enqueue_code_editor' ) ) {
|
702 |
+
return;
|
703 |
+
}
|
704 |
+
if ( 'toplevel_page_wp-accessibility' !== get_current_screen()->id ) {
|
705 |
+
return;
|
706 |
+
}
|
707 |
+
|
708 |
+
// Enqueue code editor and settings for manipulating CSS.
|
709 |
+
$settings = wp_enqueue_code_editor( array( 'type' => 'text/css' ) );
|
710 |
+
|
711 |
+
// Bail if user disabled CodeMirror or using default styles.
|
712 |
+
if ( false === $settings || 'true' === get_option( 'asl_default_styles' ) ) {
|
713 |
+
return;
|
714 |
+
}
|
715 |
+
wp_add_inline_script(
|
716 |
+
'code-editor',
|
717 |
+
sprintf(
|
718 |
+
'jQuery( function() { wp.codeEditor.initialize( "asl_styles", %s ); } );',
|
719 |
+
wp_json_encode( $settings )
|
720 |
+
)
|
721 |
+
);
|
722 |
+
}
|
723 |
+
);
|
724 |
+
|
wp-accessibility-toolbar.php
CHANGED
@@ -36,6 +36,7 @@ add_action( 'wp_enqueue_scripts', 'wpa_toolbar_enqueue_scripts' );
|
|
36 |
* Enqueue Toolbar scripts dependent on options.
|
37 |
*/
|
38 |
function wpa_toolbar_enqueue_scripts() {
|
|
|
39 |
wp_enqueue_script( 'jquery' );
|
40 |
if ( 'on' === get_option( 'wpa_toolbar' ) ) {
|
41 |
// Enqueue Toolbar JS if enabled.
|
@@ -55,16 +56,34 @@ function wpa_toolbar_enqueue_scripts() {
|
|
55 |
wp_localize_script( 'ui-a11y', 'wpa11y', $plugin_path );
|
56 |
|
57 |
// Font files for toolbar.
|
58 |
-
wp_register_style( 'ui-font', plugins_url( 'toolbar/fonts/css/a11y-toolbar.css', __FILE__ ) );
|
59 |
|
60 |
// Toolbar CSS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
$toolbar_styles = apply_filters( 'wpa_toolbar_css', plugins_url( 'toolbar/css/a11y.css', __FILE__ ) );
|
62 |
-
wp_register_style( 'ui-a11y', $toolbar_styles, array( 'ui-font' ) );
|
63 |
|
64 |
// Font resizing stylesheet.
|
65 |
$fontsize_stylesheet = ( 'on' === get_option( 'wpa_alternate_fontsize' ) ) ? 'a11y-fontsize-alt' : 'a11y-fontsize';
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
// Control toolbar font size.
|
70 |
$toolbar_size = get_option( 'wpa_toolbar_size' );
|
@@ -127,13 +146,13 @@ function wpa_toolbar_html( $type = 'widget', $control = 'button' ) {
|
|
127 |
<div class="' . $responsive . ' ' . $is_rtl . ' ' . $is_right . ' ' . $toolbar_type . '">
|
128 |
<ul>';
|
129 |
if ( $enable_contrast ) {
|
130 |
-
$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>';
|
131 |
}
|
132 |
if ( $enable_grayscale ) {
|
133 |
-
$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>';
|
134 |
}
|
135 |
if ( $enable_fontsize ) {
|
136 |
-
$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>';
|
137 |
}
|
138 |
$toolbar .= '
|
139 |
</ul>
|
@@ -147,7 +166,16 @@ function wpa_toolbar_html( $type = 'widget', $control = 'button' ) {
|
|
147 |
* Generate Toolbar variables for localization in JS.
|
148 |
*/
|
149 |
function wpa_toolbar_js() {
|
150 |
-
$default
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
$location = apply_filters( 'wpa_move_toolbar', $default );
|
152 |
$is_rtl = ( is_rtl() ) ? 'rtl' : 'ltr';
|
153 |
$is_right = ( 'on' === get_option( 'wpa_toolbar_right' ) ) ? 'right' : 'left';
|
36 |
* Enqueue Toolbar scripts dependent on options.
|
37 |
*/
|
38 |
function wpa_toolbar_enqueue_scripts() {
|
39 |
+
$wpa_version = wpa_check_version();
|
40 |
wp_enqueue_script( 'jquery' );
|
41 |
if ( 'on' === get_option( 'wpa_toolbar' ) ) {
|
42 |
// Enqueue Toolbar JS if enabled.
|
56 |
wp_localize_script( 'ui-a11y', 'wpa11y', $plugin_path );
|
57 |
|
58 |
// Font files for toolbar.
|
59 |
+
wp_register_style( 'ui-font', plugins_url( 'toolbar/fonts/css/a11y-toolbar.css', __FILE__ ), array(), $wpa_version );
|
60 |
|
61 |
// Toolbar CSS.
|
62 |
+
/**
|
63 |
+
* Filter URL for toolbar CSS.
|
64 |
+
*
|
65 |
+
* @hook wpa_toolbar_css
|
66 |
+
*
|
67 |
+
* @param {string} $url URL to stylesheet for accessibility toolbar.
|
68 |
+
*
|
69 |
+
* @return string
|
70 |
+
*/
|
71 |
$toolbar_styles = apply_filters( 'wpa_toolbar_css', plugins_url( 'toolbar/css/a11y.css', __FILE__ ) );
|
72 |
+
wp_register_style( 'ui-a11y', $toolbar_styles, array( 'ui-font' ), $wpa_version );
|
73 |
|
74 |
// Font resizing stylesheet.
|
75 |
$fontsize_stylesheet = ( 'on' === get_option( 'wpa_alternate_fontsize' ) ) ? 'a11y-fontsize-alt' : 'a11y-fontsize';
|
76 |
+
/**
|
77 |
+
* Filter the URL to the stylesheet controlling large font views.
|
78 |
+
*
|
79 |
+
* @hook wpa_fontsize_css
|
80 |
+
*
|
81 |
+
* @param {string} $stylesheet URL for increased font size stylesheet.
|
82 |
+
*
|
83 |
+
* @return string
|
84 |
+
*/
|
85 |
+
$fontsize = apply_filters( 'wpa_fontsize_css', plugins_url( 'toolbar/css/' . $fontsize_stylesheet . '.css', __FILE__ ) );
|
86 |
+
wp_register_style( 'ui-fontsize.css', $fontsize, array(), $wpa_version );
|
87 |
|
88 |
// Control toolbar font size.
|
89 |
$toolbar_size = get_option( 'wpa_toolbar_size' );
|
146 |
<div class="' . $responsive . ' ' . $is_rtl . ' ' . $is_right . ' ' . $toolbar_type . '">
|
147 |
<ul>';
|
148 |
if ( $enable_contrast ) {
|
149 |
+
$toolbar .= '<li><' . $control_type . ' class="a11y-toggle 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>';
|
150 |
}
|
151 |
if ( $enable_grayscale ) {
|
152 |
+
$toolbar .= '<li><' . $control_type . ' class="a11y-toggle 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>';
|
153 |
}
|
154 |
if ( $enable_fontsize ) {
|
155 |
+
$toolbar .= '<li><' . $control_type . ' class="a11y-toggle 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>';
|
156 |
}
|
157 |
$toolbar .= '
|
158 |
</ul>
|
166 |
* Generate Toolbar variables for localization in JS.
|
167 |
*/
|
168 |
function wpa_toolbar_js() {
|
169 |
+
$default = ( false !== (bool) trim( get_option( 'wpa_toolbar_default' ) ) ) ? get_option( 'wpa_toolbar_default' ) : 'body';
|
170 |
+
/**
|
171 |
+
* Filter attachment location of the toolbar. Default `body`.
|
172 |
+
*
|
173 |
+
* @hook wpa_move_toolbar
|
174 |
+
*
|
175 |
+
* @param {string} $el Target element selector.
|
176 |
+
*
|
177 |
+
* @return string
|
178 |
+
*/
|
179 |
$location = apply_filters( 'wpa_move_toolbar', $default );
|
180 |
$is_rtl = ( is_rtl() ) ? 'rtl' : 'ltr';
|
181 |
$is_right = ( 'on' === get_option( 'wpa_toolbar_right' ) ) ? 'right' : 'left';
|
wp-accessibility.php
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
* Domain Path: /lang
|
18 |
* License: GPL-2.0+
|
19 |
* License URI: http://www.gnu.org/license/gpl-2.0.txt
|
20 |
-
* Version: 1.
|
21 |
*/
|
22 |
|
23 |
/*
|
@@ -45,6 +45,7 @@ require_once( dirname( __FILE__ ) . '/wp-accessibility-longdesc.php' );
|
|
45 |
require_once( dirname( __FILE__ ) . '/wp-accessibility-alt.php' );
|
46 |
require_once( dirname( __FILE__ ) . '/wp-accessibility-contrast.php' );
|
47 |
require_once( dirname( __FILE__ ) . '/wp-accessibility-settings.php' );
|
|
|
48 |
|
49 |
register_activation_hook( __FILE__, 'wpa_install' );
|
50 |
|
@@ -61,14 +62,15 @@ add_action( 'admin_menu', 'wpa_admin_menu' );
|
|
61 |
* Set up admin menu.
|
62 |
*/
|
63 |
function wpa_admin_menu() {
|
64 |
-
|
|
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
* Install on activation.
|
69 |
*/
|
70 |
function wpa_install() {
|
71 |
-
$wpa_version = '1.
|
72 |
if ( 'true' !== get_option( 'wpa_installed' ) ) {
|
73 |
add_option( 'rta_from_tag_clouds', 'on' );
|
74 |
add_option( 'asl_styles_focus', '' );
|
@@ -81,6 +83,7 @@ function wpa_install() {
|
|
81 |
add_option( 'wpa_installed', 'true' );
|
82 |
add_option( 'wpa_version', $wpa_version );
|
83 |
add_option( 'wpa_longdesc', 'jquery' );
|
|
|
84 |
} else {
|
85 |
wpa_check_version();
|
86 |
update_option( 'wpa_version', $wpa_version );
|
@@ -98,6 +101,18 @@ function wpa_check_version() {
|
|
98 |
if ( version_compare( $version, '1.3.0', '<' ) ) {
|
99 |
add_option( 'wpa_longdesc', 'jquery' );
|
100 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
return $version;
|
103 |
}
|
@@ -111,7 +126,7 @@ add_filter( 'plugin_action_links', 'wpa_plugin_action', 10, 2 );
|
|
111 |
*/
|
112 |
function wpa_plugin_action( $links, $file ) {
|
113 |
if ( plugin_basename( dirname( __FILE__ ) . '/wp-accessibility.php' ) === $file ) {
|
114 |
-
$admin_url = admin_url( '
|
115 |
$links[] = "<a href='$admin_url'>" . __( 'Accessibility Settings', 'wp-accessibility' ) . '</a>';
|
116 |
}
|
117 |
|
@@ -133,6 +148,15 @@ function wpacc_enqueue_scripts() {
|
|
133 |
'url' => __( 'Website', 'wp-accessibility' ),
|
134 |
'comment' => __( 'Comment', 'wp-accessibility' ),
|
135 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
wp_localize_script( 'wpa-labels', 'wpalabels', $labels );
|
137 |
}
|
138 |
if ( 'link' === get_option( 'wpa_longdesc' ) ) {
|
@@ -156,7 +180,10 @@ function wpacc_enqueue_scripts() {
|
|
156 |
)
|
157 |
);
|
158 |
}
|
159 |
-
|
|
|
|
|
|
|
160 |
}
|
161 |
|
162 |
add_action( 'wp_enqueue_scripts', 'wpa_stylesheet' );
|
@@ -165,10 +192,17 @@ add_action( 'wp_enqueue_scripts', 'wpa_stylesheet' );
|
|
165 |
*/
|
166 |
function wpa_stylesheet() {
|
167 |
$version = wpa_check_version();
|
168 |
-
// Respects SSL, Style.css is relative to the current file.
|
169 |
wp_register_style( 'wpa-style', plugins_url( 'css/wpa-style.css', __FILE__ ), array(), $version );
|
170 |
-
if ( 'link' === get_option( 'wpa_longdesc' ) || 'jquery' === get_option( 'wpa_longdesc' ) || 'on' === get_option( 'asl_enable' ) ) {
|
171 |
wp_enqueue_style( 'wpa-style' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
if ( current_user_can( 'edit_files' ) && 'on' === get_option( 'wpa_diagnostics' ) ) {
|
174 |
wp_register_style( 'diagnostic', plugins_url( 'css/diagnostic.css', __FILE__ ) );
|
@@ -191,60 +225,108 @@ function wpa_admin_stylesheet() {
|
|
191 |
}
|
192 |
}
|
193 |
|
194 |
-
add_action( 'wp_head', 'wpa_css' );
|
195 |
/**
|
196 |
-
* Generate
|
|
|
|
|
197 |
*/
|
198 |
-
function
|
199 |
-
$
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
if (
|
205 |
-
$
|
206 |
-
}
|
207 |
-
$default_focus = 'background-color: #f1f1f1; box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6); clip: auto; color: #0073aa; display: block; font-weight: 600; height: auto; line-height: normal; padding: 15px 23px 14px; position: absolute; left: 6px; top: ' . $top . '; text-decoration: none; text-transform: none; width: auto; z-index: 100000;';
|
208 |
-
if ( ! $focus ) {
|
209 |
-
$focus = $default_focus;
|
210 |
} else {
|
211 |
-
$focus
|
|
|
212 |
}
|
213 |
-
|
214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
|
216 |
-
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
}
|
231 |
-
$styles .= "
|
232 |
-
$class#skiplinks a, $invis $class#skiplinks a:visited { $passive }
|
233 |
-
$class#skiplinks a:active, $vis $class#skiplinks a:focus { $focus }
|
234 |
-
";
|
235 |
}
|
236 |
if ( 'on' === get_option( 'wpa_focus' ) ) {
|
237 |
-
$color = ( false !== (bool) get_option( 'wpa_focus_color' ) ) ? ' #' . get_option( 'wpa_focus_color' ) : '';
|
238 |
$styles .= "
|
239 |
-
:focus { outline:
|
240 |
";
|
241 |
}
|
242 |
-
|
243 |
-
echo "
|
244 |
-
<style type='text/css'>
|
245 |
-
$styles
|
246 |
-
</style>";
|
247 |
-
}
|
248 |
}
|
249 |
|
250 |
/**
|
@@ -286,7 +368,17 @@ function wpa_jquery_asl() {
|
|
286 |
$output = ( '' !== $html ) ? "<div class=\"$visibility$is_rtl\" id=\"skiplinks\" role=\"navigation\" aria-label=\"" . esc_attr( $skiplinks ) . "\">$html</div>" : '';
|
287 |
}
|
288 |
|
289 |
-
wp_enqueue_script( 'wp-accessibility', plugins_url( 'js/wp-accessibility.js', __FILE__ ), array( 'jquery' ), '1.0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
wp_localize_script(
|
291 |
'wp-accessibility',
|
292 |
'wpa',
|
@@ -299,7 +391,7 @@ function wpa_jquery_asl() {
|
|
299 |
'tabindex' => ( 'on' === get_option( 'wpa_tabindex' ) ) ? true : false,
|
300 |
'underline' => array(
|
301 |
'enabled' => ( 'on' === get_option( 'wpa_underline' ) ) ? true : false,
|
302 |
-
'target' =>
|
303 |
),
|
304 |
'dir' => ( is_rtl() ) ? 'rtl' : 'ltr',
|
305 |
'lang' => get_bloginfo( 'language' ),
|
@@ -564,7 +656,7 @@ $plugins_string
|
|
564 |
if ( isset( $_POST['wpa_support'] ) ) {
|
565 |
$nonce = $_REQUEST['_wpnonce'];
|
566 |
if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
|
567 |
-
|
568 |
}
|
569 |
$request = ( ! empty( $_POST['support_request'] ) ) ? sanitize_textarea_field( stripslashes( $_POST['support_request'] ) ) : false;
|
570 |
$has_donated = ( 'on' === $_POST['has_donated'] ) ? 'Donor' : 'No donation';
|
@@ -589,7 +681,7 @@ $plugins_string
|
|
589 |
}
|
590 |
}
|
591 |
}
|
592 |
-
$admin_url = admin_url( '
|
593 |
|
594 |
echo "
|
595 |
<form method='post' action='" . esc_url( $admin_url ) . "'>
|
@@ -646,3 +738,142 @@ function wpa_disable_editor_fullscreen_by_default() {
|
|
646 |
}
|
647 |
}
|
648 |
add_action( 'enqueue_block_editor_assets', 'wpa_disable_editor_fullscreen_by_default' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
* Domain Path: /lang
|
18 |
* License: GPL-2.0+
|
19 |
* License URI: http://www.gnu.org/license/gpl-2.0.txt
|
20 |
+
* Version: 1.9.0
|
21 |
*/
|
22 |
|
23 |
/*
|
45 |
require_once( dirname( __FILE__ ) . '/wp-accessibility-alt.php' );
|
46 |
require_once( dirname( __FILE__ ) . '/wp-accessibility-contrast.php' );
|
47 |
require_once( dirname( __FILE__ ) . '/wp-accessibility-settings.php' );
|
48 |
+
require_once( dirname( __FILE__ ) . '/wp-accessibility-help.php' );
|
49 |
|
50 |
register_activation_hook( __FILE__, 'wpa_install' );
|
51 |
|
62 |
* Set up admin menu.
|
63 |
*/
|
64 |
function wpa_admin_menu() {
|
65 |
+
add_menu_page( 'WP Accessibility', 'WP Accessibility', 'manage_options', 'wp-accessibility', 'wpa_admin_settings', 'dashicons-universal-access' );
|
66 |
+
add_submenu_page( 'wp-accessibility', 'WP Accessibility - Help', 'Get Help', 'manage_options', 'wp-accessibility-help', 'wpa_help_screen' );
|
67 |
}
|
68 |
|
69 |
/**
|
70 |
* Install on activation.
|
71 |
*/
|
72 |
function wpa_install() {
|
73 |
+
$wpa_version = '1.9.0';
|
74 |
if ( 'true' !== get_option( 'wpa_installed' ) ) {
|
75 |
add_option( 'rta_from_tag_clouds', 'on' );
|
76 |
add_option( 'asl_styles_focus', '' );
|
83 |
add_option( 'wpa_installed', 'true' );
|
84 |
add_option( 'wpa_version', $wpa_version );
|
85 |
add_option( 'wpa_longdesc', 'jquery' );
|
86 |
+
add_option( 'wpa_post_types', array( 'post' ) );
|
87 |
} else {
|
88 |
wpa_check_version();
|
89 |
update_option( 'wpa_version', $wpa_version );
|
101 |
if ( version_compare( $version, '1.3.0', '<' ) ) {
|
102 |
add_option( 'wpa_longdesc', 'jquery' );
|
103 |
}
|
104 |
+
// upgrade for version 1.9.0.
|
105 |
+
if ( version_compare( $version, '1.9.0', '<' ) ) {
|
106 |
+
add_option( 'wpa_post_types', array( 'post' ) );
|
107 |
+
$wpa_toolbar_fs = get_option( 'wpa_toolbar_fs', '' );
|
108 |
+
$wpa_toolbar_ct = get_option( 'wpa_toolbar_ct', '' );
|
109 |
+
if ( '' === $wpa_toolbar_fs ) {
|
110 |
+
update_option( 'wpa_toolbar_fs', 'on' );
|
111 |
+
}
|
112 |
+
if ( '' === $wpa_toolbar_ct ) {
|
113 |
+
update_option( 'wpa_toolbar_ct', 'on' );
|
114 |
+
}
|
115 |
+
}
|
116 |
|
117 |
return $version;
|
118 |
}
|
126 |
*/
|
127 |
function wpa_plugin_action( $links, $file ) {
|
128 |
if ( plugin_basename( dirname( __FILE__ ) . '/wp-accessibility.php' ) === $file ) {
|
129 |
+
$admin_url = admin_url( 'admin.php?page=wp-accessibility' );
|
130 |
$links[] = "<a href='$admin_url'>" . __( 'Accessibility Settings', 'wp-accessibility' ) . '</a>';
|
131 |
}
|
132 |
|
148 |
'url' => __( 'Website', 'wp-accessibility' ),
|
149 |
'comment' => __( 'Comment', 'wp-accessibility' ),
|
150 |
);
|
151 |
+
/**
|
152 |
+
* Customize labels passed to automatically label core WordPress fields.
|
153 |
+
*
|
154 |
+
* @hook wpa_labels
|
155 |
+
* @param {array} $labels Array of labels for search and comment fields.
|
156 |
+
*
|
157 |
+
* @return {array}
|
158 |
+
*/
|
159 |
+
$labels = apply_filters( 'wpa_labels', $labels );
|
160 |
wp_localize_script( 'wpa-labels', 'wpalabels', $labels );
|
161 |
}
|
162 |
if ( 'link' === get_option( 'wpa_longdesc' ) ) {
|
180 |
)
|
181 |
);
|
182 |
}
|
183 |
+
// aria-current was added in 5.3; don't enqueue this script on newer versions.
|
184 |
+
if ( version_compare( $GLOBALS['wp_version'], '5.3', '<' ) ) {
|
185 |
+
wp_enqueue_script( 'current.menu', plugins_url( 'js/current-menu-item.js', __FILE__ ), array( 'jquery' ), $version, true );
|
186 |
+
}
|
187 |
}
|
188 |
|
189 |
add_action( 'wp_enqueue_scripts', 'wpa_stylesheet' );
|
192 |
*/
|
193 |
function wpa_stylesheet() {
|
194 |
$version = wpa_check_version();
|
|
|
195 |
wp_register_style( 'wpa-style', plugins_url( 'css/wpa-style.css', __FILE__ ), array(), $version );
|
196 |
+
if ( 'link' === get_option( 'wpa_longdesc' ) || 'jquery' === get_option( 'wpa_longdesc' ) || 'on' === get_option( 'asl_enable' ) || ! empty( get_option( 'wpa_post_types', array() ) ) ) {
|
197 |
wp_enqueue_style( 'wpa-style' );
|
198 |
+
// these styles are derived from the WordPress skip link defaults.
|
199 |
+
$top = '7px';
|
200 |
+
if ( is_admin_bar_showing() ) {
|
201 |
+
$top = '37px';
|
202 |
+
}
|
203 |
+
$add_css = wpa_css();
|
204 |
+
$custom_css = ':root { --admin-bar-top : ' . $top . '; }';
|
205 |
+
wp_add_inline_style( 'wpa-style', wp_filter_nohtml_kses( stripcslashes( $add_css . $custom_css ) ) );
|
206 |
}
|
207 |
if ( current_user_can( 'edit_files' ) && 'on' === get_option( 'wpa_diagnostics' ) ) {
|
208 |
wp_register_style( 'diagnostic', plugins_url( 'css/diagnostic.css', __FILE__ ) );
|
225 |
}
|
226 |
}
|
227 |
|
|
|
228 |
/**
|
229 |
+
* Generate skiplink CSS.
|
230 |
+
*
|
231 |
+
* @return string
|
232 |
*/
|
233 |
+
function wpa_skiplink_css() {
|
234 |
+
$use_defaults = get_option( 'asl_default_styles', '' );
|
235 |
+
$styles = '';
|
236 |
+
$focus = '';
|
237 |
+
$passive = '';
|
238 |
+
if ( 'true' !== $use_defaults ) {
|
239 |
+
if ( '' !== get_option( 'asl_styles' ) ) {
|
240 |
+
$styles = wp_filter_nohtml_kses( get_option( 'asl_styles' ) );
|
|
|
|
|
|
|
|
|
241 |
} else {
|
242 |
+
$focus = wp_filter_nohtml_kses( get_option( 'asl_styles_focus' ) );
|
243 |
+
$passive = wp_filter_nohtml_kses( get_option( 'asl_styles_passive' ) );
|
244 |
}
|
245 |
+
}
|
246 |
+
if ( is_admin() && '' !== $styles ) {
|
247 |
+
return $styles;
|
248 |
+
}
|
249 |
+
// these styles are derived from the WordPress skip link defaults.
|
250 |
+
$default_focus = 'background-color: #f1f1f1;
|
251 |
+
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
|
252 |
+
clip: auto;
|
253 |
+
color: #0073aa;
|
254 |
+
display: block;
|
255 |
+
font-weight: 600;
|
256 |
+
height: auto;
|
257 |
+
line-height: normal;
|
258 |
+
padding: 15px 23px 14px;
|
259 |
+
position: absolute;
|
260 |
+
left: 6px;
|
261 |
+
top: var(--admin-bar-top);
|
262 |
+
text-decoration: none;
|
263 |
+
text-transform: none;
|
264 |
+
width: auto;
|
265 |
+
z-index: 100000;';
|
266 |
+
if ( ! $focus ) {
|
267 |
+
$focus = $default_focus;
|
268 |
+
} else {
|
269 |
+
$focus = $default_focus . $focus;
|
270 |
+
}
|
271 |
+
// Passive default styles derived from WordPress default focus styles.
|
272 |
+
$default_passive = 'background-color: #fff;
|
273 |
+
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.2);
|
274 |
+
clip: auto;
|
275 |
+
color: #333;
|
276 |
+
display: block;
|
277 |
+
font-weight: 600;
|
278 |
+
height: auto;
|
279 |
+
line-height: normal;
|
280 |
+
padding: 15px 23px 14px;
|
281 |
+
position: absolute;
|
282 |
+
left: 6px;
|
283 |
+
top: var(--admin-bar-top);
|
284 |
+
text-decoration: none;
|
285 |
+
text-transform: none;
|
286 |
+
width: auto;
|
287 |
+
z-index: 100000;';
|
288 |
+
|
289 |
+
$vis = '';
|
290 |
+
$invis = '';
|
291 |
|
292 |
+
$visibility = ( 'on' === get_option( 'asl_visible' ) ) ? 'wpa-visible' : 'wpa-hide';
|
293 |
+
$is_rtl = ( is_rtl() ) ? '-rtl' : '-ltr';
|
294 |
+
$class = '.' . $visibility . $is_rtl;
|
295 |
+
// If links are visible, "hover" is a focus style, otherwise, it's a passive style.
|
296 |
+
if ( 'on' === get_option( 'asl_visible' ) ) {
|
297 |
+
$vis = $class . '#skiplinks a:hover,';
|
298 |
+
$passive = $default_passive . $passive;
|
299 |
+
} else {
|
300 |
+
$invis = $class . '#skiplinks a:hover,';
|
301 |
+
$passive = '';
|
302 |
+
}
|
303 |
+
$styles .= "
|
304 |
+
$class#skiplinks a, $invis $class#skiplinks a:visited {
|
305 |
+
$passive
|
306 |
+
}
|
307 |
+
$class#skiplinks a:active, $vis $class#skiplinks a:focus {
|
308 |
+
$focus
|
309 |
+
}
|
310 |
+
";
|
311 |
|
312 |
+
return $styles;
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Generate styles needed for WP Accessibility options.
|
317 |
+
*/
|
318 |
+
function wpa_css() {
|
319 |
+
$styles = '';
|
320 |
+
if ( get_option( 'asl_enable' ) === 'on' ) {
|
321 |
+
$styles .= wpa_skiplink_css();
|
|
|
|
|
|
|
|
|
|
|
322 |
}
|
323 |
if ( 'on' === get_option( 'wpa_focus' ) ) {
|
324 |
+
$color = ( false !== (bool) get_option( 'wpa_focus_color' ) ) ? ' #' . get_option( 'wpa_focus_color' ) : '#233c7f';
|
325 |
$styles .= "
|
326 |
+
:focus { outline: 2px solid$color!important; outline-offset: 2px !important; }
|
327 |
";
|
328 |
}
|
329 |
+
return $styles;
|
|
|
|
|
|
|
|
|
|
|
330 |
}
|
331 |
|
332 |
/**
|
368 |
$output = ( '' !== $html ) ? "<div class=\"$visibility$is_rtl\" id=\"skiplinks\" role=\"navigation\" aria-label=\"" . esc_attr( $skiplinks ) . "\">$html</div>" : '';
|
369 |
}
|
370 |
|
371 |
+
wp_enqueue_script( 'wp-accessibility', plugins_url( 'js/wp-accessibility.js', __FILE__ ), array( 'jquery' ), '1.0.3', true );
|
372 |
+
/**
|
373 |
+
* Filter target element selector for underlines. Default `a`.
|
374 |
+
*
|
375 |
+
* @hook wpa_underline_target
|
376 |
+
*
|
377 |
+
* @param {string} $el Target element selector.
|
378 |
+
*
|
379 |
+
* @return string
|
380 |
+
*/
|
381 |
+
$target = apply_filters( 'wpa_underline_target', 'a' );
|
382 |
wp_localize_script(
|
383 |
'wp-accessibility',
|
384 |
'wpa',
|
391 |
'tabindex' => ( 'on' === get_option( 'wpa_tabindex' ) ) ? true : false,
|
392 |
'underline' => array(
|
393 |
'enabled' => ( 'on' === get_option( 'wpa_underline' ) ) ? true : false,
|
394 |
+
'target' => $target,
|
395 |
),
|
396 |
'dir' => ( is_rtl() ) ? 'rtl' : 'ltr',
|
397 |
'lang' => get_bloginfo( 'language' ),
|
656 |
if ( isset( $_POST['wpa_support'] ) ) {
|
657 |
$nonce = $_REQUEST['_wpnonce'];
|
658 |
if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
|
659 |
+
wp_die( 'WP Accessibility: Security check failed' );
|
660 |
}
|
661 |
$request = ( ! empty( $_POST['support_request'] ) ) ? sanitize_textarea_field( stripslashes( $_POST['support_request'] ) ) : false;
|
662 |
$has_donated = ( 'on' === $_POST['has_donated'] ) ? 'Donor' : 'No donation';
|
681 |
}
|
682 |
}
|
683 |
}
|
684 |
+
$admin_url = admin_url( 'admin.php?page=wp-accessibility' );
|
685 |
|
686 |
echo "
|
687 |
<form method='post' action='" . esc_url( $admin_url ) . "'>
|
738 |
}
|
739 |
}
|
740 |
add_action( 'enqueue_block_editor_assets', 'wpa_disable_editor_fullscreen_by_default' );
|
741 |
+
|
742 |
+
/**
|
743 |
+
* Insert content summary at top of article content.
|
744 |
+
*
|
745 |
+
* @param string $content Post content.
|
746 |
+
*
|
747 |
+
* @return string
|
748 |
+
*/
|
749 |
+
function wpa_content_summary( $content ) {
|
750 |
+
if ( is_singular() && wpa_in_post_type( get_queried_object_id() ) ) {
|
751 |
+
$post_id = get_the_ID();
|
752 |
+
$summary = wpa_get_content_summary( $post_id );
|
753 |
+
if ( ! $summary ) {
|
754 |
+
return $content;
|
755 |
+
}
|
756 |
+
$content = $summary . $content;
|
757 |
+
}
|
758 |
+
|
759 |
+
return $content;
|
760 |
+
}
|
761 |
+
add_filter( 'the_content', 'wpa_content_summary' );
|
762 |
+
|
763 |
+
/**
|
764 |
+
* Get a simplified summary for content.
|
765 |
+
*
|
766 |
+
* @param int $post_id Post ID.
|
767 |
+
*
|
768 |
+
* @return string
|
769 |
+
*/
|
770 |
+
function wpa_get_content_summary( $post_id ) {
|
771 |
+
$summary = trim( get_post_meta( $post_id, '_wpa_content_summary', true ) );
|
772 |
+
if ( ! $summary ) {
|
773 |
+
return '';
|
774 |
+
}
|
775 |
+
/**
|
776 |
+
* Filter the heading text for content summaries. Default `Summary`.
|
777 |
+
*
|
778 |
+
* @hook wpa_summary_heading
|
779 |
+
*
|
780 |
+
* @param {string} $heading Heading text.
|
781 |
+
* @param {int} $post_id Post ID.
|
782 |
+
*
|
783 |
+
* @return {string}
|
784 |
+
*/
|
785 |
+
$heading = apply_filters( 'wpa_summary_heading', __( 'Summary', 'wp-accessibility' ), $post_id );
|
786 |
+
/**
|
787 |
+
* Filter the heading leve for content summaries. Default `h2`.
|
788 |
+
*
|
789 |
+
* @hook wpa_summary_heading_level
|
790 |
+
*
|
791 |
+
* @param {string} $heading Element selector.
|
792 |
+
* @param {int} $post_id Post ID.
|
793 |
+
*
|
794 |
+
* @return {string}
|
795 |
+
*/
|
796 |
+
$level = apply_filters( 'wpa_summary_heading_level', 'h2', $post_id );
|
797 |
+
|
798 |
+
$heading = "<$level>" . $heading . "</$level>";
|
799 |
+
$content = '<section class="wpa-content-summary" id="summary-' . absint( $post_id ) . '"><div class="wpa-content-summary-inner">' . $heading . wpautop( wp_kses_post( stripslashes( $summary ) ) ) . '</div></section>';
|
800 |
+
|
801 |
+
return $content;
|
802 |
+
}
|
803 |
+
|
804 |
+
/**
|
805 |
+
* Check whether a given post is in an allowed post type for content summaries.
|
806 |
+
*
|
807 |
+
* @param integer $post_id Post ID.
|
808 |
+
*
|
809 |
+
* @return boolean True if post is allowed, false otherwise.
|
810 |
+
*/
|
811 |
+
function wpa_in_post_type( $post_id ) {
|
812 |
+
$settings = get_option( 'wpa_post_types', array() );
|
813 |
+
if ( is_array( $settings ) && ! empty( $settings ) ) {
|
814 |
+
$type = get_post_type( $post_id );
|
815 |
+
if ( in_array( $type, $settings, true ) ) {
|
816 |
+
return true;
|
817 |
+
}
|
818 |
+
}
|
819 |
+
|
820 |
+
return false;
|
821 |
+
}
|
822 |
+
|
823 |
+
add_action( 'admin_menu', 'wpa_add_outer_box' );
|
824 |
+
/**
|
825 |
+
* Add metabox for content summaries.
|
826 |
+
*/
|
827 |
+
function wpa_add_outer_box() {
|
828 |
+
$allowed = get_option( 'wpa_post_types', array() );
|
829 |
+
if ( is_array( $allowed ) ) {
|
830 |
+
foreach ( $allowed as $post_type ) {
|
831 |
+
add_meta_box( 'wpa_content_summary', __( 'Content Summary', 'wp-accessibility' ), 'wpa_add_inner_box', $post_type, 'normal', 'high' );
|
832 |
+
}
|
833 |
+
}
|
834 |
+
}
|
835 |
+
|
836 |
+
/**
|
837 |
+
* Render content summary form.
|
838 |
+
*/
|
839 |
+
function wpa_add_inner_box() {
|
840 |
+
global $post;
|
841 |
+
$summary = get_post_meta( $post->ID, '_wpa_content_summary', true );
|
842 |
+
$nonce = wp_nonce_field( 'wpa-nonce-field', 'wpa_nonce_name', true, false );
|
843 |
+
echo $nonce;
|
844 |
+
?>
|
845 |
+
<p class='wpa-content-summary-field'>
|
846 |
+
<label for="wpa_content_summary"><?php _e( 'Simple Content Summary', 'wp-accessibility' ); ?></label><br/>
|
847 |
+
<textarea class="wpa-content-summary widefat" name="wpa_content_summary" id="wpa_content_summary" rows="4" cols="60" aria-describedy="content-summary-description"><?php echo esc_textarea( $summary ); ?></textarea>
|
848 |
+
<span id="content-summary-description"><?php _e( 'Provide a simplified summary to aid comprehension of complex content.', 'wp-accessibility' ); ?></span>
|
849 |
+
</p>
|
850 |
+
<?php
|
851 |
+
}
|
852 |
+
|
853 |
+
/**
|
854 |
+
* Save content summary from post meta box.
|
855 |
+
*
|
856 |
+
* @param int $id Post ID.
|
857 |
+
* @param object $post Post.
|
858 |
+
*
|
859 |
+
* @return int
|
860 |
+
*/
|
861 |
+
function wpa_save_content_summary( $id, $post ) {
|
862 |
+
if ( empty( $_POST ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || wp_is_post_revision( $id ) || isset( $_POST['_inline_edit'] ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ! wpa_in_post_type( $id ) ) {
|
863 |
+
return $id;
|
864 |
+
}
|
865 |
+
|
866 |
+
// verify this came from our screen and with proper authorization.
|
867 |
+
// because save_post can be triggered at other times.
|
868 |
+
if ( isset( $_POST['wpa_nonce_name'] ) ) {
|
869 |
+
if ( ! wp_verify_nonce( $_POST['wpa_nonce_name'], 'wpa-nonce-field' ) ) {
|
870 |
+
return $id;
|
871 |
+
}
|
872 |
+
$summary = isset( $_POST['wpa_content_summary'] ) ? wp_kses_post( $_POST['wpa_content_summary'] ) : '';
|
873 |
+
update_post_meta( $id, '_wpa_content_summary', $summary );
|
874 |
+
}
|
875 |
+
|
876 |
+
return $id;
|
877 |
+
}
|
878 |
+
add_action( 'save_post', 'wpa_save_content_summary', 10, 2 );
|
879 |
+
|