WP Accessibility - Version 1.5.6

Version Description

  • Feature: Add support for longdesc in featured images.
  • Feature: Option to enable only a single element in toolbar
Download this release

Release Info

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

Code changes from version 1.5.0 to 1.5.6

css/editor-style-rtl.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ .wpa-image-missing-alt {
2
+ border: 2px solid red;
3
+ box-shadow: 2px 2px 0 0 #ffa;
4
+ }
css/wpa-styles.css CHANGED
@@ -19,4 +19,27 @@ li.fore {
19
 
20
  li.back {
21
  margin-left: 230px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  }
19
 
20
  li.back {
21
  margin-left: 230px;
22
+ }
23
+
24
+ .wpa-support-me p {
25
+ font-size: 1.6em;
26
+ font-weight: 600;
27
+ background: #007eb3;
28
+ text-shadow: 1px 1px rgb( 35, 60, 127 );
29
+ padding: 1em;
30
+ text-align: center;
31
+ margin: 0 0 1em;
32
+ }
33
+
34
+ .wpa-support-me p, .wpa-support-me a {
35
+ color: #fff;
36
+ }
37
+
38
+ .wpa-support-me a:hover, .wpa-support-me a:focus {
39
+ text-decoration: none;
40
+ background: #fff;
41
+ }
42
+
43
+ #wpa_settings_page ul ul {
44
+ margin: 1em 2em;
45
  }
js/longdesc.button.js CHANGED
@@ -4,7 +4,7 @@
4
  var longdesc = $(this).attr('longdesc');
5
  var text = '<span>Long Description</span>';
6
  var classes = $(this).attr('class');
7
- var class_array = classes.split(' ');
8
  var image_id = '';
9
  $.each( class_array, function ( index, value ) {
10
  if ( value.match( /wp-image-/gi ) ) {
4
  var longdesc = $(this).attr('longdesc');
5
  var text = '<span>Long Description</span>';
6
  var classes = $(this).attr('class');
7
+ var class_array = ( Array.isArray(classes) ) ? classes.split(' ') : [];
8
  var image_id = '';
9
  $.each( class_array, function ( index, value ) {
10
  if ( value.match( /wp-image-/gi ) ) {
lang/wp-accessibility-en_AU.mo DELETED
Binary file
lang/wp-accessibility-nl_NL.mo DELETED
Binary file
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: joedolson
3
  Donate link: http://www.joedolson.com/donate/
4
  Tags: title, accessibility, accessible, navigation, wcag, a11y, section508, focus, alt text, labels, aria
5
  Requires at least: 3.4.2
6
- Tested up to: 4.4.0
7
- Stable tag: 1.4.6
8
  Text Domain: wp-accessibility
9
  License: GPLv2 or later
10
 
@@ -46,12 +46,7 @@ Learn more! <a href="http://make.wordpress.org/accessibility/wp-accessibility-pl
46
 
47
  The plug-in is intended to help with deficiencies commonly found in themes and to solve some issues in WordPress core. It can't correct every problem (by a long shot), but provides tools to fix some issues, supplement the accessibility of your site, or identify problems.
48
 
49
- Translating my plug-ins is always appreciated. Visit <a href="http://translate.joedolson.com">my translations site</a> to start getting your language into shape!
50
-
51
- Available translations (in order of completeness):
52
- Dutch, Finnish, French, Portuguese (Brazil), Bulgarian, Greek, Spanish, Portuguese (Portugal), Italian, Russian, Romanian, German, Polish, Hebrew, Slovenian
53
-
54
- Visit the [WP Accessibility translations site](http://translate.joedolson.com/projects/wp-accessibility/) to check the progress of a translation.
55
 
56
  == Installation ==
57
 
@@ -63,10 +58,58 @@ Visit the [WP Accessibility translations site](http://translate.joedolson.com/pr
63
 
64
  = Future =
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  = 1.5.0 =
67
 
68
  * Updated toolbar fonts
69
- * Updated toolbar to use <button> instead of <a>
70
  * Improved fontsize increase default CSS. Most themes will still benefit from custom styles.
71
  * Added option to place toolbar on right side of screen.
72
  * Update load method for text domain
3
  Donate link: http://www.joedolson.com/donate/
4
  Tags: title, accessibility, accessible, navigation, wcag, a11y, section508, focus, alt text, labels, aria
5
  Requires at least: 3.4.2
6
+ Tested up to: 4.6
7
+ Stable tag: 1.5.5
8
  Text Domain: wp-accessibility
9
  License: GPLv2 or later
10
 
46
 
47
  The plug-in is intended to help with deficiencies commonly found in themes and to solve some issues in WordPress core. It can't correct every problem (by a long shot), but provides tools to fix some issues, supplement the accessibility of your site, or identify problems.
48
 
49
+ Translating my plug-ins is always appreciated. Visit <a href="https://translate.wordpress.org/projects/wp-plugins/wp-accessibility">the WordPress translations site</a> to get your language into shape!
 
 
 
 
 
50
 
51
  == Installation ==
52
 
58
 
59
  = Future =
60
 
61
+ [Suggest a change!](https://github.com/joedolson/wp-accessibility/)
62
+
63
+ = 1.5.6 =
64
+
65
+ * Feature: Add support for longdesc in featured images.
66
+ * Feature: Option to enable only a single element in toolbar
67
+
68
+ = 1.5.5 =
69
+
70
+ * Bug fix: use aria-pressed on toolbar buttons. Props Jose Manuel (https://github.com/joedolson/wp-accessibility/pull/7)
71
+ * Bug fix: Don't show logout link if user not logged in. Props @boonebgorges (https://github.com/joedolson/wp-accessibility/pull/9)
72
+ * Bug fix: Don't assume that images with long descriptions have classes
73
+ * Text change to better describe content title attribute stripping.
74
+ * Add aria-label to skip link navigation region.
75
+ * Add role=menu to toolbar.
76
+ * Update readme.txt
77
+
78
+ = 1.5.4 =
79
+
80
+ * Bug fix: .fontsize default classes used immediate children selector, which was incompatible with the switch to using html as the parent selector.
81
+ * Change: Added option to hide toolbar on small screens.
82
+ * UI Change: Split Toolbar & Miscellaneous settings into separate sections.
83
+ * Updated informational and contributing links
84
+ * Re-ordered settings groups to better reflect need.
85
+ * Split settings into separate plug-in file.
86
+
87
+ = 1.5.3 =
88
+
89
+ * Bug fix: incorrect assignment of fontsize class on subsequent pages.
90
+ * Removal of en_AU and nl_NL languages in favor of completed language packs
91
+
92
+ = 1.5.2 =
93
+
94
+ * Bug fix: Add RTL version of editor styles
95
+ * Bug fix: incorrect textdomain on donate request
96
+ * Bug fix: Issue with :focus state on skiplinks when not always visible
97
+ * Bug fix: Install with no default focus styles; add custom styles to end of default focus styles string
98
+ * Bug fix: search filter could prevent display of nav menus (props @jdelia & @GaryJones)
99
+ * Bug fix: extraneous anchor generated in longdesc format (https://github.com/joedolson/wp-accessibility/issues/4)
100
+ * Add alternate font resizing stylesheet for improved use with rems
101
+ * Add support for selective refresh in customizer
102
+
103
+ = 1.5.1 =
104
+
105
+ * Add: :hover/:focus text describing toolbar buttons; replaces title attributes removed in 1.5.0
106
+ * Missing: Add woff2 call
107
+ * Bug fix: Re-order font format imports
108
+
109
  = 1.5.0 =
110
 
111
  * Updated toolbar fonts
112
+ * Updated toolbar to use `button` instead of `a`
113
  * Improved fontsize increase default CSS. Most themes will still benefit from custom styles.
114
  * Added option to place toolbar on right side of screen.
115
  * Update load method for text domain
toolbar/css/a11y-fontsize-alt.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /* enqueue these as a separate stylesheet so they can be filtered */
2
+ html.fontsize {
3
+ font-size: 100% !important;
4
+ }
toolbar/css/a11y-fontsize.css CHANGED
@@ -1,5 +1,6 @@
1
  /* enqueue these as a separate stylesheet so they can be filtered */
2
- .fontsize, .fontsize > h1, .fontsize > h2, .fontsize > h3, .fontsize > h4, .fontsize > h5, .fontsize > h6, .fontsize > p, .fontsize > li, .fontsize > label, .fontsize > input, .fontsize > select, .fontsize > textarea, .fontsize > legend, .fontsize > code, .fontsize > pre, .fontsize > dd, .fontsize > dt, .fontsize > blockquote {
 
3
  font-size: 150% !important;
4
  line-height: 1.4;
5
  }
@@ -10,8 +11,4 @@
10
 
11
  .fontsize li li li {
12
  font-size: 100% !important;
13
- }
14
-
15
- .fontsize .a11y-toolbar ul li {
16
- font-size: 66.666666% !important;
17
  }
1
  /* enqueue these as a separate stylesheet so they can be filtered */
2
+
3
+ .fontsize, .fontsize h1, .fontsize h2, .fontsize h3, .fontsize h4, .fontsize h5, .fontsize h6, .fontsize p, .fontsize li:not(.a11y-toolbar-list-item), .fontsize label, .fontsize input, .fontsize select, .fontsize textarea, .fontsize legend, .fontsize code, .fontsize pre, .fontsize dd, .fontsize dt, .fontsize blockquote {
4
  font-size: 150% !important;
5
  line-height: 1.4;
6
  }
11
 
12
  .fontsize li li li {
13
  font-size: 100% !important;
 
 
 
 
14
  }
toolbar/css/a11y.css CHANGED
@@ -2,6 +2,13 @@
2
  Accessibility styles
3
  chris@inathought.com
4
  */
 
 
 
 
 
 
 
5
  .focusable:focus {
6
  outline: none !important;
7
  }
@@ -65,6 +72,7 @@
65
  text-align: center;
66
  border-top: 1px solid #f5f5f5;
67
  border-bottom: 1px solid #d2d2d2;
 
68
  }
69
 
70
  .a11y-toolbar ul li button:hover {
@@ -128,4 +136,27 @@
128
  -o-filter: grayscale(100%) !important;
129
  filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale") !important;
130
  filter: gray !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  }
2
  Accessibility styles
3
  chris@inathought.com
4
  */
5
+ @media only screen and (max-width: 800px) {
6
+ /* Remove toolbar on small screens */
7
+ .a11y-responsive {
8
+ display: none;
9
+ }
10
+ }
11
+
12
  .focusable:focus {
13
  outline: none !important;
14
  }
72
  text-align: center;
73
  border-top: 1px solid #f5f5f5;
74
  border-bottom: 1px solid #d2d2d2;
75
+ position: relative;
76
  }
77
 
78
  .a11y-toolbar ul li button:hover {
136
  -o-filter: grayscale(100%) !important;
137
  filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale") !important;
138
  filter: gray !important;
139
+ }
140
+
141
+ .a11y-toolbar button:hover .offscreen, .a11y-toolbar button:focus .offscreen {
142
+ height: auto !important;
143
+ width: 10em !important;
144
+ clip: unset !important;
145
+ color: #333;
146
+ background: #ffe;
147
+ padding: 3px;
148
+ box-shadow: 0 0 1px #000;
149
+ border-radius: 3px;
150
+ font-size: 14px;
151
+ top: 25%;
152
+ display: block;
153
+ }
154
+
155
+ .a11y-toolbar.right button:hover .offscreen, .a11y-toolbar.right button:focus .offscreen{
156
+ right: 3em;
157
+ left: auto;
158
+ }
159
+
160
+ .a11y-toolbar button:hover .offscreen, .a11y-toolbar button:focus .offscreen{
161
+ left: 3em;
162
  }
toolbar/fonts/css/a11y-toolbar.css CHANGED
@@ -2,8 +2,9 @@
2
  font-family: 'a11y';
3
  src:url('a11y.eot');
4
  src:url('a11y.eot?#iefix') format('embedded-opentype'),
5
- url('a11y.ttf') format('truetype'),
6
  url('a11y.woff') format('woff'),
 
7
  url('a11y.svg#a11y') format('svg');
8
  font-weight: normal;
9
  font-style: normal;
2
  font-family: 'a11y';
3
  src:url('a11y.eot');
4
  src:url('a11y.eot?#iefix') format('embedded-opentype'),
5
+ url('a11y.woff2') format('woff2'),
6
  url('a11y.woff') format('woff'),
7
+ url('a11y.ttf') format('truetype'),
8
  url('a11y.svg#a11y') format('svg');
9
  font-weight: normal;
10
  font-style: normal;
toolbar/js/a11y.js CHANGED
@@ -1,118 +1,116 @@
1
- /*
2
- * Chris Rodriguez
3
- * chris@inathought.com
4
- */
5
-
6
- // Cookie handler, non-$ style
7
- function createCookie(name, value, days) {
8
- if (days) {
9
- var date = new Date();
10
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
11
- var expires = "; expires=" + date.toGMTString();
12
- } else
13
- var expires = "";
14
- document.cookie = name + "=" + value + expires + "; path=/";
15
- }
16
-
17
- function readCookie(name) {
18
- var nameEQ = name + "=";
19
- var ca = document.cookie.split(';');
20
- for (var i = 0; i < ca.length; i++) {
21
- var c = ca[i];
22
- while (c.charAt(0) == ' ') c = c.substring(1, c.length);
23
- if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
24
- }
25
- return null;
26
- }
27
-
28
- function eraseCookie(name) {
29
- // createCookie(name, "", -1);
30
- createCookie(name, "");
31
- }
32
-
33
- jQuery(document).ready(function ($) {
34
- // Saturation handler
35
- if (readCookie('a11y-desaturated')) {
36
- $('body').addClass('desaturated');
37
- $('#is_normal_color').attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active');
38
- }
39
- ;
40
- $('.toggle-grayscale').on('click', function () {
41
- if ($(this).attr('id') == "is_normal_color") {
42
- $('body').addClass('desaturated');
43
- $(this).attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active');
44
- createCookie('a11y-desaturated', '1');
45
- return false;
46
- } else {
47
- $('body').removeClass('desaturated');
48
- $(this).attr('id', 'is_normal_color').removeAttr('aria-pressed').removeClass('active');
49
- eraseCookie('a11y-desaturated');
50
- return false;
51
- }
52
- });
53
- //var a11y_stylesheet_path = $('.a11y_stylesheet_path').html();
54
- // Contrast handler
55
- if (readCookie('a11y-high-contrast')) {
56
- $('body').addClass('contrast');
57
- $('head').append($("<link href='" + a11y_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
58
- $('#is_normal_contrast').attr('id', 'is_high_contrast').attr('aria-pressed', true).addClass('active');
59
- $('.a11y-toolbar ul li a i').addClass('icon-white');
60
- }
61
- ;
62
-
63
- $('.toggle-contrast').on('click', function () {
64
- if ($(this).attr('id') == "is_normal_contrast") {
65
- $('head').append($("<link href='" + a11y_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
66
- $('body').addClass('contrast');
67
- $(this).attr('id', 'is_high_contrast').attr('aria-pressed', true).addClass('active');
68
- $(this).parent().parent().find('i').addClass('icon-white');
69
- createCookie('a11y-high-contrast', '1');
70
- return false;
71
- } else {
72
- $('#highContrastStylesheet').remove();
73
- $('body').removeClass('contrast');
74
- $(this).attr('id', 'is_normal_contrast').removeAttr('aria-pressed').removeClass('active');
75
- $(this).parent().parent().find('i').removeClass('icon-white');
76
- eraseCookie('a11y-high-contrast');
77
- return false;
78
- }
79
- });
80
-
81
- // Fontsize handler
82
- if (readCookie('a11y-larger-fontsize')) {
83
- $('body').addClass('fontsize');
84
- $('#is_normal_fontsize').attr('id', 'is_large_fontsize').attr('aria-checked', true).addClass('active');
85
- }
86
-
87
- $('.toggle-fontsize').on('click', function () {
88
- if ($(this).attr('id') == "is_normal_fontsize") {
89
- $('body').addClass('fontsize');
90
- $(this).attr('id', 'is_large_fontsize').attr('aria-checked', true).addClass('active');
91
- createCookie('a11y-larger-fontsize', '1');
92
- return false;
93
- } else {
94
- $('body').removeClass('fontsize');
95
- $(this).attr('id', 'is_normal_fontsize').removeAttr('aria-checked').removeClass('active');
96
- eraseCookie('a11y-larger-fontsize');
97
- return false;
98
- }
99
- });
100
-
101
- // Sets a -1 tabindex to ALL sections for .focus()-ing
102
- var sections = document.getElementsByTagName("section");
103
- for (var i = 0, max = sections.length; i < max; i++) {
104
- sections[i].setAttribute('tabindex', -1);
105
- sections[i].className += ' focusable';
106
- }
107
-
108
- // If there is a '#' in the URL (someone linking directly to a page with an anchor), go directly to that area and focus is
109
- // Thanks to WebAIM.org for this idea
110
- if (document.location.hash && document.location.hash != '#') {
111
- var anchorUponArrival = document.location.hash;
112
- setTimeout(function () {
113
- $(anchorUponArrival).scrollTo({duration: 1500});
114
- $(anchorUponArrival).focus();
115
- }, 100);
116
- }
117
-
118
  });
1
+ /*
2
+ * Chris Rodriguez
3
+ * chris@inathought.com
4
+ */
5
+
6
+ // Cookie handler, non-$ style
7
+ function createCookie(name, value, days) {
8
+ if (days) {
9
+ var date = new Date();
10
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
11
+ var expires = "; expires=" + date.toGMTString();
12
+ } else
13
+ var expires = "";
14
+ document.cookie = name + "=" + value + expires + "; path=/";
15
+ }
16
+
17
+ function readCookie(name) {
18
+ var nameEQ = name + "=";
19
+ var ca = document.cookie.split(';');
20
+ for (var i = 0; i < ca.length; i++) {
21
+ var c = ca[i];
22
+ while (c.charAt(0) == ' ') c = c.substring(1, c.length);
23
+ if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
24
+ }
25
+ return null;
26
+ }
27
+
28
+ function eraseCookie(name) {
29
+ // createCookie(name, "", -1);
30
+ createCookie(name, "");
31
+ }
32
+
33
+ jQuery(document).ready(function ($) {
34
+ // Saturation handler
35
+ if (readCookie('a11y-desaturated')) {
36
+ $('body').addClass('desaturated');
37
+ $('#is_normal_color').attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active');
38
+ }
39
+ ;
40
+ $('.toggle-grayscale').on('click', function () {
41
+ if ($(this).attr('id') == "is_normal_color") {
42
+ $('body').addClass('desaturated');
43
+ $(this).attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active');
44
+ createCookie('a11y-desaturated', '1');
45
+ return false;
46
+ } else {
47
+ $('body').removeClass('desaturated');
48
+ $(this).attr('id', 'is_normal_color').attr('aria-pressed', false).removeClass('active');
49
+ eraseCookie('a11y-desaturated');
50
+ return false;
51
+ }
52
+ });
53
+ //var a11y_stylesheet_path = $('.a11y_stylesheet_path').html();
54
+ // Contrast handler
55
+ if (readCookie('a11y-high-contrast')) {
56
+ $('body').addClass('contrast');
57
+ $('head').append($("<link href='" + a11y_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
58
+ $('#is_normal_contrast').attr('id', 'is_high_contrast').attr('aria-pressed', true).addClass('active');
59
+ $('.a11y-toolbar ul li a i').addClass('icon-white');
60
+ }
61
+ ;
62
+
63
+ $('.toggle-contrast').on('click', function () {
64
+ if ($(this).attr('id') == "is_normal_contrast") {
65
+ $('head').append($("<link href='" + a11y_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
66
+ $('body').addClass('contrast');
67
+ $(this).attr('id', 'is_high_contrast').attr('aria-pressed', true).addClass('active');
68
+ createCookie('a11y-high-contrast', '1');
69
+ return false;
70
+ } else {
71
+ $('#highContrastStylesheet').remove();
72
+ $('body').removeClass('contrast');
73
+ $(this).attr('id', 'is_normal_contrast').attr('aria-pressed', false).removeClass('active');
74
+ eraseCookie('a11y-high-contrast');
75
+ return false;
76
+ }
77
+ });
78
+
79
+ // Fontsize handler
80
+ if (readCookie('a11y-larger-fontsize')) {
81
+ $('html').addClass('fontsize');
82
+ $('#is_normal_fontsize').attr('id', 'is_large_fontsize').attr('aria-pressed', true).addClass('active');
83
+ }
84
+
85
+ $('.toggle-fontsize').on('click', function () {
86
+ if ($(this).attr('id') == "is_normal_fontsize") {
87
+ $('html').addClass('fontsize');
88
+ $(this).attr('id', 'is_large_fontsize').attr('aria-pressed', true).addClass('active');
89
+ createCookie('a11y-larger-fontsize', '1');
90
+ return false;
91
+ } else {
92
+ $('html').removeClass('fontsize');
93
+ $(this).attr('id', 'is_normal_fontsize').attr('aria-pressed', false).removeClass('active');
94
+ eraseCookie('a11y-larger-fontsize');
95
+ return false;
96
+ }
97
+ });
98
+
99
+ // Sets a -1 tabindex to ALL sections for .focus()-ing
100
+ var sections = document.getElementsByTagName("section");
101
+ for (var i = 0, max = sections.length; i < max; i++) {
102
+ sections[i].setAttribute('tabindex', -1);
103
+ sections[i].className += ' focusable';
104
+ }
105
+
106
+ // If there is a '#' in the URL (someone linking directly to a page with an anchor), go directly to that area and focus is
107
+ // Thanks to WebAIM.org for this idea
108
+ if (document.location.hash && document.location.hash != '#') {
109
+ var anchorUponArrival = document.location.hash;
110
+ setTimeout(function () {
111
+ $(anchorUponArrival).scrollTo({duration: 1500});
112
+ $(anchorUponArrival).focus();
113
+ }, 100);
114
+ }
115
+
 
 
116
  });
wp-accessibility-settings.php ADDED
@@ -0,0 +1,725 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+
8
+ function wpa_update_settings() {
9
+ wpa_check_version();
10
+ if ( ! empty( $_POST ) ) {
11
+ $nonce = $_REQUEST['_wpnonce'];
12
+ if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
13
+ die( "Security check failed" );
14
+ }
15
+ if ( isset( $_POST['action'] ) && $_POST['action'] == 'rta' ) {
16
+ $rta_from_nav_menu = ( isset( $_POST['rta_from_nav_menu'] ) ) ? 'on' : '';
17
+ $rta_from_page_lists = ( isset( $_POST['rta_from_page_lists'] ) ) ? 'on' : '';
18
+ $rta_from_category_lists = ( isset( $_POST['rta_from_category_lists'] ) ) ? 'on' : '';
19
+ $rta_from_archive_links = ( isset( $_POST['rta_from_archive_links'] ) ) ? 'on' : '';
20
+ $rta_from_tag_clouds = ( isset( $_POST['rta_from_tag_clouds'] ) ) ? 'on' : '';
21
+ $rta_from_category_links = ( isset( $_POST['rta_from_category_links'] ) ) ? 'on' : '';
22
+ $rta_from_post_edit_links = ( isset( $_POST['rta_from_post_edit_links'] ) ) ? 'on' : '';
23
+ $rta_from_edit_comment_links = ( isset( $_POST['rta_from_edit_comment_links'] ) ) ? 'on' : '';
24
+ update_option( 'rta_from_nav_menu', $rta_from_nav_menu );
25
+ update_option( 'rta_from_page_lists', $rta_from_page_lists );
26
+ update_option( 'rta_from_category_lists', $rta_from_category_lists );
27
+ update_option( 'rta_from_archive_links', $rta_from_archive_links );
28
+ update_option( 'rta_from_tag_clouds', $rta_from_tag_clouds );
29
+ update_option( 'rta_from_category_links', $rta_from_category_links );
30
+ update_option( 'rta_from_post_edit_links', $rta_from_post_edit_links );
31
+ update_option( 'rta_from_edit_comment_links', $rta_from_edit_comment_links );
32
+ $message = __( "Remove Title Attributes Settings Updated", 'wp-accessibility' );
33
+
34
+ return "<div class='updated'><p>" . $message . "</p></div>";
35
+ }
36
+ if ( isset( $_POST['action'] ) && $_POST['action'] == 'asl' ) {
37
+ $asl_enable = ( isset( $_POST['asl_enable'] ) ) ? 'on' : '';
38
+ $asl_content = ( isset( $_POST['asl_content'] ) ) ? $_POST['asl_content'] : '';
39
+ $asl_navigation = ( isset( $_POST['asl_navigation'] ) ) ? $_POST['asl_navigation'] : '';
40
+ $asl_sitemap = ( isset( $_POST['asl_sitemap'] ) ) ? $_POST['asl_sitemap'] : '';
41
+ $asl_extra_target = ( isset( $_POST['asl_extra_target'] ) ) ? $_POST['asl_extra_target'] : '';
42
+ $asl_extra_text = ( isset( $_POST['asl_extra_text'] ) ) ? $_POST['asl_extra_text'] : '';
43
+ $asl_visible = ( isset( $_POST['asl_visible'] ) ) ? 'on' : '';
44
+ $asl_styles_focus = ( isset( $_POST['asl_styles_focus'] ) ) ? $_POST['asl_styles_focus'] : '';
45
+ $asl_styles_passive = ( isset( $_POST['asl_styles_passive'] ) ) ? $_POST['asl_styles_passive'] : '';
46
+ update_option( 'asl_enable', $asl_enable );
47
+ update_option( 'asl_content', $asl_content );
48
+ update_option( 'asl_navigation', $asl_navigation );
49
+ update_option( 'asl_sitemap', $asl_sitemap );
50
+ update_option( 'asl_extra_target', $asl_extra_target );
51
+ update_option( 'asl_extra_text', $asl_extra_text );
52
+ update_option( 'asl_visible', $asl_visible );
53
+ $notice = ( $asl_visible == 'on' ) ? "<p>" . __( 'WP Accessibility does not provide any styles for visible skiplinks. You can still set the look of the links using the textareas provided, but all other layout must be assigned in your theme.', 'wp-accessibility' ) . "</p>" : '';
54
+
55
+ update_option( 'asl_styles_focus', $asl_styles_focus );
56
+ update_option( 'asl_styles_passive', $asl_styles_passive );
57
+ $message = __( "Add Skiplinks Settings Updated", 'wp-accessibility' );
58
+
59
+ return "<div class='updated'><p>" . $message . "</p>$notice</div>";
60
+ }
61
+ if ( isset( $_POST['action'] ) && $_POST['action'] == 'misc' ) {
62
+ $wpa_lang = ( isset( $_POST['wpa_lang'] ) ) ? 'on' : '';
63
+ $wpa_target = ( isset( $_POST['wpa_target'] ) ) ? 'on' : '';
64
+ $wpa_labels = ( isset( $_POST['wpa_labels'] ) ) ? 'on' : '';
65
+ $wpa_search = ( isset( $_POST['wpa_search'] ) ) ? 'on' : '';
66
+ $wpa_tabindex = ( isset( $_POST['wpa_tabindex'] ) ) ? 'on' : '';
67
+ $wpa_underline = ( isset( $_POST['wpa_underline'] ) ) ? 'on' : '';
68
+ $wpa_longdesc = ( isset( $_POST['wpa_longdesc'] ) ) ? esc_attr( $_POST['wpa_longdesc'] ) : 'false';
69
+ $wpa_longdesc_featured = ( isset( $_POST['wpa_longdesc_featured'] ) ) ? esc_attr( $_POST['wpa_longdesc_featured'] ) : 'false';
70
+ $wpa_image_titles = ( isset( $_POST['wpa_image_titles'] ) ) ? 'on' : '';
71
+ $wpa_more = ( isset( $_POST['wpa_more'] ) ) ? 'on' : '';
72
+ $wpa_focus = ( isset( $_POST['wpa_focus'] ) ) ? 'on' : '';
73
+ $wpa_focus_color = ( isset( $_POST['wpa_focus_color'] ) ) ? str_replace( '#', '', $_POST['wpa_focus_color'] ) : '';
74
+ $wpa_continue = ( isset( $_POST['wpa_continue'] ) ) ? $_POST['wpa_continue'] : 'Continue Reading';
75
+ $wpa_admin_css = ( isset( $_POST['wpa_admin_css'] ) ) ? 'on' : '';
76
+ $wpa_row_actions = ( isset( $_POST['wpa_row_actions'] ) ) ? 'on' : '';
77
+ $wpa_diagnostics = ( isset( $_POST['wpa_diagnostics'] ) ) ? 'on' : '';
78
+ $wpa_insert_roles = ( isset( $_POST['wpa_insert_roles'] ) ) ? 'on' : '';
79
+ $wpa_complementary_container = ( isset( $_POST['wpa_complementary_container'] ) ) ? str_replace( '#', '', $_POST['wpa_complementary_container'] ) : '';
80
+ update_option( 'wpa_lang', $wpa_lang );
81
+ update_option( 'wpa_target', $wpa_target );
82
+ update_option( 'wpa_labels', $wpa_labels );
83
+ update_option( 'wpa_search', $wpa_search );
84
+ update_option( 'wpa_tabindex', $wpa_tabindex );
85
+ update_option( 'wpa_underline', $wpa_underline );
86
+ update_option( 'wpa_longdesc', $wpa_longdesc );
87
+ update_option( 'wpa_longdesc_featured', $wpa_longdesc_featured );
88
+ update_option( 'wpa_image_titles', $wpa_image_titles );
89
+ update_option( 'wpa_more', $wpa_more );
90
+ update_option( 'wpa_focus', $wpa_focus );
91
+ update_option( 'wpa_focus_color', $wpa_focus_color );
92
+ update_option( 'wpa_continue', $wpa_continue );
93
+ update_option( 'wpa_admin_css', $wpa_admin_css );
94
+ update_option( 'wpa_row_actions', $wpa_row_actions );
95
+ update_option( 'wpa_diagnostics', $wpa_diagnostics );
96
+ update_option( 'wpa_insert_roles', $wpa_insert_roles );
97
+ update_option( 'wpa_complementary_container', $wpa_complementary_container );
98
+ $message = __( "Miscellaneous Accessibility Settings Updated", 'wp-accessibility' );
99
+
100
+ return "<div class='updated'><p>" . $message . "</p></div>";
101
+ }
102
+
103
+ if ( isset( $_POST['action'] ) && $_POST['action'] == 'toolbar' ) {
104
+ $wpa_toolbar = ( isset( $_POST['wpa_toolbar'] ) ) ? 'on' : '';
105
+ $wpa_toolbar_size = ( isset( $_POST['wpa_toolbar_size'] ) ) ? $_POST['wpa_toolbar_size'] : '';
106
+ $wpa_alternate_fontsize = ( isset( $_POST['wpa_alternate_fontsize'] ) ) ? 'on' : '';
107
+ $wpa_widget_toolbar = ( isset( $_POST['wpa_widget_toolbar'] ) ) ? 'on' : '';
108
+ $wpa_toolbar_gs = ( isset( $_POST['wpa_toolbar_gs'] ) ) ? 'on' : '';
109
+ $wpa_toolbar_fs = ( isset( $_POST['wpa_toolbar_fs'] ) ) ? 'off' : '';
110
+ $wpa_toolbar_ct = ( isset( $_POST['wpa_toolbar_ct'] ) ) ? 'off' : '';
111
+ $wpa_toolbar_default = ( isset( $_POST['wpa_toolbar_default'] ) ) ? $_POST['wpa_toolbar_default'] : '';
112
+ $wpa_toolbar_right = ( isset( $_POST['wpa_toolbar_right'] ) ) ? 'on' : '';
113
+ $wpa_toolbar_mobile = ( isset( $_POST['wpa_toolbar_mobile'] ) ) ? 'on' : '';
114
+ update_option( 'wpa_toolbar', $wpa_toolbar );
115
+ update_option( 'wpa_toolbar_size', $wpa_toolbar_size );
116
+ update_option( 'wpa_alternate_fontsize', $wpa_alternate_fontsize );
117
+ update_option( 'wpa_widget_toolbar', $wpa_widget_toolbar );
118
+ update_option( 'wpa_toolbar_gs', $wpa_toolbar_gs );
119
+ update_option( 'wpa_toolbar_fs', $wpa_toolbar_fs );
120
+ update_option( 'wpa_toolbar_ct', $wpa_toolbar_ct );
121
+ update_option( 'wpa_toolbar_default', $wpa_toolbar_default );
122
+ update_option( 'wpa_toolbar_right', $wpa_toolbar_right );
123
+ update_option( 'wpa_toolbar_mobile', $wpa_toolbar_mobile );
124
+ $message = __( "Toolbar Settings Updated", 'wp-accessibility' );
125
+
126
+ return "<div class='updated'><p>" . $message . "</p></div>";
127
+ }
128
+ } else {
129
+ return;
130
+ }
131
+ }
132
+
133
+ function wpa_admin_menu() {
134
+ echo wpa_update_settings(); ?>
135
+ <div class="wrap">
136
+ <h2><?php _e( 'WP Accessibility: Settings', 'wp-accessibility' ); ?></h2>
137
+
138
+ <div id="wpa_settings_page" class="postbox-container" style="width: 70%">
139
+ <div class="metabox-holder">
140
+ <div class="ui-sortable meta-box-sortables">
141
+ <div class="postbox">
142
+ <h3><?php _e( 'Add Skiplinks', 'wp-accessibility' ); ?></h3>
143
+
144
+ <div class="inside">
145
+ <?php if ( wpa_accessible_theme() && get_option( 'asl_enable' ) != 'on' ) { ?>
146
+ <p>
147
+ <?php _e( 'Your <code>accessibility-ready</code> theme has skip links built in.', 'wp-accessibility' ); ?>
148
+ </p>
149
+ <?php } else { ?>
150
+ <form method="post"
151
+ action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
152
+ <fieldset>
153
+ <legend><?php _e( 'Configure Skiplinks', 'wp-accessibility' ); ?></legend>
154
+ <ul>
155
+ <li><input type="checkbox" id="asl_enable"
156
+ name="asl_enable" <?php if ( get_option( 'asl_enable' ) == "on" ) {
157
+ echo 'checked="checked" ';
158
+ } ?>/> <label
159
+ for="asl_enable"><?php _e( 'Enable Skiplinks', 'wp-accessibility' ); ?></label>
160
+ </li>
161
+ <li><input type="checkbox" id="asl_visible"
162
+ name="asl_visible" <?php if ( get_option( 'asl_visible' ) == "on" ) {
163
+ echo 'checked="checked" ';
164
+ } ?>/> <label
165
+ for="asl_visible"><?php _e( 'Skiplinks always visible', 'wp-accessibility' ); ?></label>
166
+ </li>
167
+ <li><label
168
+ for="asl_content"><?php _e( 'Skip to Content link target (ID of your main content container)', 'wp-accessibility' ); ?></label>
169
+ <input type="text" id="asl_content" name="asl_content"
170
+ value="<?php esc_attr_e( get_option( 'asl_content' ) ); ?>"/></li>
171
+ <li><label
172
+ for="asl_navigation"><?php _e( 'Skip to Navigation link target (ID of your main navigation container)', 'wp-accessibility' ); ?></label>
173
+ <input type="text" id="asl_navigation" name="asl_navigation"
174
+ value="<?php esc_attr_e( get_option( 'asl_navigation' ) ); ?>"/></li>
175
+ <li><label
176
+ for="asl_sitemap"><?php _e( 'Site Map link target (URL for your site map)', 'wp-accessibility' ); ?></label><input
177
+ type="text" id="asl_sitemap" name="asl_sitemap" size="44"
178
+ value="<?php esc_attr_e( get_option( 'asl_sitemap' ) ); ?>"/></li>
179
+ <li><label
180
+ for="asl_extra_target"><?php _e( 'Add your own link (link or container ID)', 'wp-accessibility' ); ?></label>
181
+ <input type="text" id="asl_extra_target" name="asl_extra_target"
182
+ value="<?php esc_attr_e( get_option( 'asl_extra_target' ) ); ?>"/> <label
183
+ for="asl_extra_text"><?php _e( 'Link text for your link', 'wp-accessibility' ); ?></label>
184
+ <input type="text" id="asl_extra_text" name="asl_extra_text"
185
+ value="<?php esc_attr_e( get_option( 'asl_extra_text' ) ); ?>"/></li>
186
+ <li><label
187
+ for="asl_styles_focus"><?php _e( 'Styles for Skiplinks when they have focus', 'wp-accessibility' ); ?></label><br/>
188
+ <textarea name='asl_styles_focus' id='asl_styles_focus' cols='60'
189
+ rows='4'><?php esc_attr_e( stripslashes( get_option( 'asl_styles_focus' ) ) ); ?></textarea>
190
+ </li>
191
+ <?php if ( get_option( 'asl_visible' ) != 'on' ) {
192
+ $disabled = " disabled='disabled' style='background: #eee;'";
193
+ $note = ' ' . __( '(Not currently visible)', 'wp-accessibility' );
194
+ } else {
195
+ $disabled = $note = '';
196
+ } ?>
197
+ <li><label
198
+ for="asl_styles_passive"><?php _e( 'Styles for Skiplinks without focus', 'wp-accessibility' );
199
+ echo $note; ?></label><br/>
200
+ <textarea name='asl_styles_passive' id='asl_styles_passive' cols='60'
201
+ rows='4'<?php echo $disabled; ?>><?php echo stripslashes( get_option( 'asl_styles_passive' ) ); ?></textarea>
202
+ </li>
203
+ </ul>
204
+ </fieldset>
205
+ <p>
206
+ <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
207
+ <input type="hidden" name="action" value="asl"/>
208
+ </p>
209
+
210
+ <p><input type="submit" name="wpa-settings" class="button-primary"
211
+ value="<?php _e( 'Update Skiplink Settings', 'wp-accessibility' ) ?>"/></p>
212
+ </form>
213
+ <?php } ?>
214
+ </div>
215
+ </div>
216
+ <div class="postbox">
217
+ <h3 id="toolbar"><?php _e( 'Accessibility Toolbar Settings', 'wp-accessibility' ); ?></h3>
218
+ <div class="inside">
219
+ <form method="post" action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
220
+ <ul>
221
+ <li><input type="checkbox" id="wpa_toolbar"
222
+ name="wpa_toolbar" <?php if ( get_option( 'wpa_toolbar' ) == "on" ) {
223
+ echo 'checked="checked" ';
224
+ } ?>/> <label
225
+ for="wpa_toolbar"><?php _e( 'Add Accessibility toolbar with fontsize adjustment and contrast toggle', 'wp-accessibility' ); ?></label>
226
+ <ul>
227
+ <li><input type="checkbox" id="wpa_toolbar_fs"
228
+ name="wpa_toolbar_fs" <?php if ( get_option( 'wpa_toolbar_fs' ) == "off" ) {
229
+ echo 'checked="checked" ';
230
+ } ?>/> <label
231
+ for="wpa_toolbar_fs"><?php _e( 'Exclude font size toggle from Accessibility toolbar', 'wp-accessibility' ); ?></label>
232
+ </li>
233
+ <li><input type="checkbox" id="wpa_toolbar_ct"
234
+ name="wpa_toolbar_ct" <?php if ( get_option( 'wpa_toolbar_ct' ) == "on" ) {
235
+ echo 'checked="checked" ';
236
+ } ?>/> <label
237
+ for="wpa_toolbar_ct"><?php _e( 'Exclude contrast toggle from Accessibility toolbar', 'wp-accessibility' ); ?></label>
238
+ </li>
239
+ <li><input type="checkbox" id="wpa_toolbar_gs"
240
+ name="wpa_toolbar_gs" <?php if ( get_option( 'wpa_toolbar_gs' ) == "on" ) {
241
+ echo 'checked="checked" ';
242
+ } ?>/> <label
243
+ for="wpa_toolbar_gs"><?php _e( 'Include grayscale toggle with Accessibility toolbar', 'wp-accessibility' ); ?></label>
244
+ </li>
245
+ </ul>
246
+ </li>
247
+ <li>
248
+ <label for="wpa_toolbar_default"><?php _e( 'Toolbar location (ID attribute)', 'wp-accessibility' ); ?></label> <input type="text" id="wpa_toolbar_default" name="wpa_toolbar_default" value="<?php esc_attr_e( get_option( 'wpa_toolbar_default' ) ); ?>" />
249
+ </li>
250
+ <?php
251
+ $size = get_option( 'wpa_toolbar_size' );
252
+ ?>
253
+ <li><label
254
+ for="wpa_toolbar_size"><?php _e( 'Toolbar font size', 'wp-accessibility' ); ?></label>
255
+ <select name='wpa_toolbar_size' id='wpa_toolbar_size'>
256
+ <option value=''><?php _e( 'Default size', 'wp-accessibility' ); ?></option>
257
+ <?php
258
+ for ( $i = 1; $i <= 2.5; ) {
259
+ $current = $i . 'em';
260
+ $selected_size = ( $current == $size ) ? ' selected="selected"' : '';
261
+ echo "<option value='$i" . "em'$selected_size>$i em</option>";
262
+ $i = $i + .1;
263
+ }
264
+ ?>
265
+ </select>
266
+ </li>
267
+ <li><input type="checkbox" id="wpa_alternate_fontsize"
268
+ name="wpa_alternate_fontsize" <?php if ( get_option( 'wpa_alternate_fontsize' ) == "on" ) {
269
+ echo 'checked="checked" ';
270
+ } ?>/> <label
271
+ for="wpa_alternate_fontsize"><?php _e( 'Use alternate font resizing stylesheet', 'wp-accessibility' ); ?></label>
272
+ </li>
273
+ <li><input type="checkbox" id="wpa_widget_toolbar"
274
+ name="wpa_widget_toolbar" <?php if ( get_option( 'wpa_widget_toolbar' ) == "on" ) {
275
+ echo 'checked="checked" ';
276
+ } ?>/> <label
277
+ for="wpa_widget_toolbar"><?php _e( 'Support Accessibility toolbar as shortcode or widget', 'wp-accessibility' ); ?></label>
278
+ </li>
279
+ <li><input type="checkbox" id="wpa_toolbar_right"
280
+ name="wpa_toolbar_right" <?php if ( get_option( 'wpa_toolbar_right' ) == "on" ) {
281
+ echo 'checked="checked" ';
282
+ } ?>/> <label
283
+ for="wpa_toolbar_right"><?php _e( 'Place toolbar on right side of screen.', 'wp-accessibility' ); ?></label>
284
+ </li>
285
+ <li><input type="checkbox" id="wpa_toolbar_mobile"
286
+ name="wpa_toolbar_mobile" <?php if ( get_option( 'wpa_toolbar_mobile' ) == "on" ) {
287
+ echo 'checked="checked" ';
288
+ } ?>/> <label
289
+ for="wpa_toolbar_mobile"><?php _e( 'Hide toolbar on small screens.', 'wp-accessibility' ); ?></label>
290
+ </li>
291
+ </ul>
292
+ <p>
293
+ <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
294
+ <input type="hidden" name="action" value="toolbar" />
295
+ </p>
296
+
297
+ <p><input type="submit" name="wpa-settings" class="button-primary"
298
+ value="<?php _e( 'Update Toolbar Settings', 'wp-accessibility' ) ?>"/></p>
299
+ </form>
300
+ </div>
301
+ </div>
302
+ <div class="postbox">
303
+ <h3 id="contrast"><?php _e( 'Miscellaneous Accessibility Settings', 'wp-accessibility' ); ?></h3>
304
+
305
+ <div class="inside">
306
+ <form method="post" action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
307
+ <ul>
308
+ <?php if ( !wpa_accessible_theme() ) { ?>
309
+ <li><input type="checkbox" id="wpa_lang"
310
+ name="wpa_lang" <?php if ( get_option( 'wpa_lang' ) == "on" ) {
311
+ echo 'checked="checked" ';
312
+ } ?>/> <label
313
+ for="wpa_lang"><?php _e( 'Add Site Language and text direction to HTML element', 'wp-accessibility' ); ?></label>
314
+ </li>
315
+ <li><input type="checkbox" id="wpa_more"
316
+ name="wpa_more" <?php if ( get_option( 'wpa_more' ) == "on" ) {
317
+ echo 'checked="checked" ';
318
+ } ?>/> <label
319
+ for="wpa_more"><?php _e( 'Add post title to "more" links.', 'wp-accessibility' ); ?></label>
320
+ <label for="wpa_continue"><?php _e( 'Continue reading text', 'wp-accessibility' ); ?></label>
321
+ <input type="text" id="wpa_continue" name="wpa_continue" value="<?php esc_attr_e( get_option( 'wpa_continue' ) ); ?>"/></li>
322
+ <li><input type="checkbox" id="wpa_insert_roles"
323
+ name="wpa_insert_roles" <?php if ( get_option( 'wpa_insert_roles' ) == "on" ) {
324
+ echo 'checked="checked" ';
325
+ } ?>/> <label
326
+ for="wpa_insert_roles"><?php _e( 'Add landmark roles to HTML5 structural elements', 'wp-accessibility' ); ?></label><br/><label
327
+ for="wpa_complementary_container"><?php _e( 'ID for complementary role', 'wp-accessibility' ); ?></label><input
328
+ type="text" id="wpa_complementary_container" name="wpa_complementary_container"
329
+ value="#<?php esc_attr_e( get_option( 'wpa_complementary_container' ) ); ?>"/>
330
+ </li>
331
+ <li>
332
+ <input type="checkbox" id="wpa_labels" name="wpa_labels" <?php checked( get_option( 'wpa_labels'), 'on' ); ?> /> <label for='wpa_labels'><?php _e( 'Automatically Label WordPress search form and comment forms', 'wp-accessibility' ); ?></label>
333
+ </li>
334
+ <?php } else { ?>
335
+ <li><?php _e( '<strong>Four disabled features:</strong> Site language, continue reading text, landmark roles and standard form labels are defined in your <code>accessibility-ready</code> theme.', 'wp-accessibility' ); ?></li>
336
+ <?php } ?>
337
+ <li><input type="checkbox" id="wpa_target"
338
+ name="wpa_target" <?php if ( get_option( 'wpa_target' ) == "on" ) {
339
+ echo 'checked="checked" ';
340
+ } ?>/> <label
341
+ for="wpa_target"><?php _e( 'Remove target attribute from links', 'wp-accessibility' ); ?></label>
342
+ </li>
343
+ <li><input type="checkbox" id="wpa_search"
344
+ name="wpa_search" <?php if ( get_option( 'wpa_search' ) == "on" ) {
345
+ echo 'checked="checked" ';
346
+ } ?>/> <label
347
+ for="wpa_search"><?php _e( 'Force search error on empty search submission (theme must have search.php template)', 'wp-accessibility' ); ?></label>
348
+ </li>
349
+ <li><input type="checkbox" id="wpa_tabindex"
350
+ name="wpa_tabindex" <?php if ( get_option( 'wpa_tabindex' ) == "on" ) {
351
+ echo 'checked="checked" ';
352
+ } ?>/> <label
353
+ for="wpa_tabindex"><?php _e( 'Remove tabindex from focusable elements', 'wp-accessibility' ); ?></label>
354
+ </li>
355
+ <li><input type="checkbox" id="wpa_underline"
356
+ name="wpa_underline" <?php if ( get_option( 'wpa_underline' ) == "on" ) {
357
+ echo 'checked="checked" ';
358
+ } ?>/> <label
359
+ for="wpa_underline"><?php _e( 'Force underline on all links', 'wp-accessibility' ); ?></label>
360
+ </li>
361
+ <li><label
362
+ for="wpa_longdesc"><?php _e( 'Long Description UI', 'wp-accessibility' ); ?></label>
363
+ <select id="wpa_longdesc" name="wpa_longdesc">
364
+ <option value='link'<?php if ( get_option( 'wpa_longdesc' ) == "link" ) {
365
+ echo 'selected="selected" ';
366
+ } ?>><?php _e( 'Link to description', 'wp-accessibility' ); ?></option>
367
+ <option value='jquery'<?php if ( get_option( 'wpa_longdesc' ) == "jquery" ) {
368
+ echo 'selected="selected" ';
369
+ } ?>><?php _e( 'Button trigger to overlay image', 'wp-accessibility' ); ?></option>
370
+ <option value='false'
371
+ <?php if ( get_option( 'wpa_longdesc' ) == "false" || ! get_option( 'wpa_longdesc' ) ) {
372
+ echo 'selected="selected"';
373
+ } ?>><?php _e( 'Browser defaults only', 'wp-accessibility' ); ?></option>
374
+ </select>
375
+ </li>
376
+ <li><input type="checkbox" id="wpa_longdesc_featured"
377
+ name="wpa_longdesc_featured" <?php if ( get_option( 'wpa_longdesc_featured' ) == "on" ) {
378
+ echo 'checked="checked" ';
379
+ } ?>/> <label
380
+ for="wpa_longdesc_featured"><?php _e( 'Support <code>longdesc</code> on featured images', 'wp-accessibility' ); ?></label>
381
+ </li>
382
+ <li><input type="checkbox" id="wpa_admin_css"
383
+ name="wpa_admin_css" <?php if ( get_option( 'wpa_admin_css' ) == "on" ) {
384
+ echo 'checked="checked" ';
385
+ } ?>/> <label
386
+ for="wpa_admin_css"><?php _e( 'Enable WordPress Admin stylesheet', 'wp-accessibility' ); ?></label>
387
+ </li>
388
+ <li><input type="checkbox" id="wpa_row_actions"
389
+ name="wpa_row_actions" <?php if ( get_option( 'wpa_row_actions' ) == "on" ) {
390
+ echo 'checked="checked" ';
391
+ } ?>/> <label
392
+ for="wpa_row_actions"><?php _e( 'Make row actions always visible', 'wp-accessibility' ); ?></label>
393
+ </li>
394
+ <li><input type="checkbox" id="wpa_image_titles"
395
+ name="wpa_image_titles" <?php if ( get_option( 'wpa_image_titles' ) == "on" ) {
396
+ echo 'checked="checked" ';
397
+ } ?>/> <label
398
+ for="wpa_image_titles"><?php _e( 'Remove title attributes inserted into post content and featured images.', 'wp-accessibility' ); ?></label>
399
+ </li>
400
+ <li><input type="checkbox" id="wpa_diagnostics"
401
+ name="wpa_diagnostics" <?php if ( get_option( 'wpa_diagnostics' ) == "on" ) {
402
+ echo 'checked="checked" ';
403
+ } ?>/> <label
404
+ for="wpa_diagnostics"><?php _e( 'Enable diagnostic CSS', 'wp-accessibility' ); ?></label>
405
+ </li>
406
+ <li><input type="checkbox" id="wpa_focus"
407
+ name="wpa_focus" <?php if ( get_option( 'wpa_focus' ) == "on" ) {
408
+ echo 'checked="checked" ';
409
+ } ?>/> <label
410
+ for="wpa_focus"><?php _e( 'Add outline to elements on keyboard focus', 'wp-accessibility' ); ?></label>
411
+ <label
412
+ for="wpa_focus_color"><?php _e( 'Outline color (hexadecimal, optional)', 'wp-accessibility' ); ?></label><input
413
+ type="text" id="wpa_focus_color" name="wpa_focus_color"
414
+ value="#<?php esc_attr_e( get_option( 'wpa_focus_color' ) ); ?>"/></li>
415
+ </ul>
416
+ <p>
417
+ <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
418
+ <input type="hidden" name="action" value="misc"/>
419
+ </p>
420
+
421
+ <p><input type="submit" name="wpa-settings" class="button-primary"
422
+ value="<?php _e( 'Update Miscellaneous Settings', 'wp-accessibility' ) ?>"/></p>
423
+ </form>
424
+ </div>
425
+ </div>
426
+ <div class="postbox">
427
+ <h3><?php _e( 'Remove Title Attributes', 'wp-accessibility' ); ?></h3>
428
+
429
+ <div class="inside">
430
+ <?php wpa_accessible_theme(); ?>
431
+ <p>
432
+ <?php _e( 'As of WordPress 4.0, the only globally added title attributes are in the WordPress tag cloud, showing the number of posts with that tag, and on the categories list, if the category has a term description.', 'wp-accessibility' ); ?>
433
+ </p>
434
+ <form method="post"
435
+ action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
436
+ <fieldset>
437
+ <legend><?php _e( 'Remove title attributes from:', 'wp-accessibility' ); ?></legend>
438
+ <ul>
439
+ <?php if ( version_compare( get_bloginfo( 'version' ), '3.8', '<' ) ) { ?>
440
+ <li>
441
+ <input type="checkbox" id="rta_from_nav_menu"
442
+ name="rta_from_nav_menu" <?php if ( get_option( 'rta_from_nav_menu' ) == "on" ) {
443
+ echo 'checked="checked" ';
444
+ } ?>/> <label
445
+ for="rta_from_nav_menu"><?php _e( 'Nav menus', 'wp-accessibility' ); ?>
446
+ (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
447
+ )</label></li>
448
+ <li>
449
+ <input type="checkbox" id="rta_from_page_lists"
450
+ name="rta_from_page_lists" <?php if ( get_option( 'rta_from_page_lists' ) == "on" ) {
451
+ echo 'checked="checked" ';
452
+ } ?>/> <label
453
+ for="rta_from_page_lists"><?php _e( 'Page lists', 'wp-accessibility' ); ?>
454
+ (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
455
+ )</label></li>
456
+ <li>
457
+ <input type="checkbox" id="rta_from_category_links"
458
+ name="rta_from_category_links" <?php if ( get_option( 'rta_from_category_links' ) == "on" ) {
459
+ echo 'checked="checked" ';
460
+ } ?>/> <label
461
+ for="rta_from_category_links"><?php _e( 'Category links', 'wp-accessibility' ); ?>
462
+ (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
463
+ )</label></li>
464
+ <li>
465
+ <input type="checkbox" id="rta_from_post_edit_links"
466
+ name="rta_from_post_edit_links" <?php if ( get_option( 'rta_from_post_edit_links' ) == "on" ) {
467
+ echo 'checked="checked" ';
468
+ } ?>/> <label
469
+ for="rta_from_post_edit_links"><?php _e( 'Post edit links', 'wp-accessibility' ); ?>
470
+ (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
471
+ )</label></li>
472
+ <li>
473
+ <input type="checkbox" id="rta_from_edit_comment_links"
474
+ name="rta_from_edit_comment_links" <?php if ( get_option( 'rta_from_edit_comment_links' ) == "on" ) {
475
+ echo 'checked="checked" ';
476
+ } ?>/> <label
477
+ for="rta_from_edit_comment_links"><?php _e( 'Edit comment links', 'wp-accessibility' ); ?>
478
+ (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
479
+ )</label></li>
480
+ <?php } ?>
481
+ <?php if ( version_compare( get_bloginfo( 'version' ), '4.0', '<' ) ) { ?>
482
+ <li><input type="checkbox" id="rta_from_category_lists"
483
+ name="rta_from_category_lists" <?php if ( get_option( 'rta_from_category_lists' ) == "on" ) {
484
+ echo 'checked="checked" ';
485
+ } ?>/> <label
486
+ for="rta_from_category_lists"><?php _e( 'Category lists', 'wp-accessibility' ); ?></label>
487
+ </li>
488
+
489
+ <?php } ?>
490
+ <li><input type="checkbox" id="rta_from_tag_clouds"
491
+ name="rta_from_tag_clouds" <?php if ( get_option( 'rta_from_tag_clouds' ) == "on" ) {
492
+ echo 'checked="checked" ';
493
+ } ?>/> <label
494
+ for="rta_from_tag_clouds"><?php _e( 'Tag clouds', 'wp-accessibility' ); ?></label>
495
+ </li>
496
+ <li><input type="checkbox" id="rta_from_archive_links"
497
+ name="rta_from_archive_links" <?php if ( get_option( 'rta_from_archive_links' ) == "on" ) {
498
+ echo 'checked="checked" ';
499
+ } ?>/> <label
500
+ for="rta_from_archive_links"><?php _e( 'Archive links', 'wp-accessibility' ); ?></label>
501
+ </li>
502
+ </ul>
503
+ </fieldset>
504
+ <p>
505
+ <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
506
+ <input type="hidden" name="action" value="rta"/>
507
+ </p>
508
+
509
+ <p><input type="submit" name="wpa-settings" class="button-primary"
510
+ value="<?php _e( 'Update Title Attribute Settings', 'wp-accessibility' ) ?>"/></p>
511
+ </form>
512
+ </div>
513
+ </div>
514
+ <div class="postbox">
515
+ <h3><?php _e( 'Color Contrast Tester', 'wp-accessibility' ); ?></h3>
516
+
517
+ <div class="inside">
518
+ <?php
519
+ $colors = wpa_contrast();
520
+ if ( $colors ) {
521
+ $l_contrast = wpa_luminosity( $colors['red1'], $colors['red2'], $colors['green1'], $colors['green2'], $colors['blue1'], $colors['blue2'] ) . ':1';
522
+ $luminance_raw = wpa_luminosity( $colors['red1'], $colors['red2'], $colors['green1'], $colors['green2'], $colors['blue1'], $colors['blue2'] );
523
+ $hex1 = esc_attr( $colors['hex1'] );
524
+ $hex2 = esc_attr( $colors['hex2'] );
525
+ } else {
526
+ $hex1 = '';
527
+ $hex2 = '';
528
+ $l_contrast = false;
529
+ }
530
+ if ( $l_contrast ) {
531
+ $results = "
532
+ <div class='updated notice'>";
533
+ $results .= "<p class=\"stats wcag2\">" . sprintf( __( 'Luminosity Contrast Ratio for <code>#%2$s</code> and <code>#%3$s</code> is <strong>%1$s</strong> (Threshold: greater than 7:1 for AAA, 4.5:1 for AA)', 'wp-accessibility' ), $l_contrast, $hex1, $hex2 ) . "</p><p>";
534
+ if ( $luminance_raw >= 7 ) {
535
+ $results .= __( "The colors compared <strong>pass</strong> the relative luminosity test at level AAA.", 'wp-accessibility' );
536
+ }
537
+ if ( $luminance_raw >= 4.5 && $luminance_raw < 7 ) {
538
+ $results .= __( "The colors compared <strong>pass</strong> the relative luminosity test at level AA.", 'wp-accessibility' );
539
+ }
540
+ if ( $luminance_raw >= 3 && $luminance_raw < 4.5 ) {
541
+ $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' );
542
+ }
543
+ if ( $luminance_raw < 3 ) {
544
+ $results .= __( "The colors compared <strong>do not pass</strong> the relative luminosity test.", 'wp-accessibility' );
545
+ }
546
+ $results .= " <a href='#contrast'>" . __( 'Test another set of colors', 'wp-accessibility' ) . "</a>";
547
+ $results .= "</p>";
548
+ $results .= "
549
+ <div class=\"views\">
550
+ <p class='large' style=\"font-size: 2em; line-height: 1.4;color: #$hex1;background: #$hex2;border: 3px solid #$hex1\">Large Print Example</p>
551
+ <p class='small' style=\"font-size: .9em;color: #$hex1;background: #$hex2;border: 3px solid #$hex1\">Small Print Example</p>
552
+ <p class='large' style=\"font-size: 2em; line-height: 1.4;color: #$hex2;background: #$hex1;border: 3px solid #$hex2\">Large Print Example (Inverted)</p>
553
+ <p class='small' style=\"font-size: .9em;color: #$hex2;background: #$hex1;border: 3px solid #$hex2\">Small Print Example (Inverted)</p>
554
+ </div>
555
+ </div>";
556
+ echo $results;
557
+ }
558
+ ?>
559
+ <form method="post"
560
+ action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
561
+ <fieldset>
562
+ <legend><?php _e( 'Test of relative luminosity', 'wp-accessibility' ); ?></legend>
563
+ <ul>
564
+ <li class='fore'>
565
+ <div id="fore"></div>
566
+ <label
567
+ for="color1"><?php _e( 'Foreground color', 'wp-accessibility' ); ?></label><br/><input
568
+ type="text" name="color" value="#<?php esc_attr_e( $hex1 ); ?>" size="34" id="color1"/>
569
+ </li>
570
+ <li class='back'>
571
+ <div id="back"></div>
572
+ <label
573
+ for="color2"><?php _e( 'Background color', 'wp-accessibility' ); ?></label><br/><input
574
+ type="text" name="color2" value="#<?php esc_attr_e( $hex2 ); ?>" size="34" id="color2"/>
575
+ </li>
576
+ </ul>
577
+ </fieldset>
578
+ <p>
579
+ <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
580
+ <input type="hidden" name="action" value="contrast"/>
581
+ </p>
582
+
583
+ <p><input type="submit" name="wpa-settings" class="button-primary"
584
+ value="<?php _e( 'Check Color Contrast', 'wp-accessibility' ) ?>"/></p>
585
+ </form>
586
+ </div>
587
+ </div>
588
+ <div class="postbox" id="get-support">
589
+ <h3><?php _e( 'Get Plug-in Support', 'wp-accessibility' ); ?></h3>
590
+
591
+ <div class="inside">
592
+ <div class='wpa-support-me'>
593
+ <p>
594
+ <?php printf(
595
+ __( 'Please, consider <a href="%s">making a donation</a> to support WP Accessibility!', 'wp-accessibility' )
596
+ , "https://www.joedolson.com/donate/" ); ?>
597
+ </p>
598
+ </div>
599
+ <?php wpa_get_support_form(); ?>
600
+ </div>
601
+ </div>
602
+ </div>
603
+ </div>
604
+ </div>
605
+
606
+ <div class="postbox-container" style="width:20%">
607
+ <div class="metabox-holder">
608
+ <div class="ui-sortable meta-box-sortables">
609
+ <div class="postbox">
610
+ <h3><?php _e( 'Support this Plugin', 'wp-accessibility' ); ?></h3>
611
+
612
+ <div class="inside">
613
+ <p>
614
+ <a href="https://twitter.com/intent/follow?screen_name=joedolson" class="twitter-follow-button"
615
+ data-size="small" data-related="joedolson">Follow @joedolson</a>
616
+ <script>!function (d, s, id) {
617
+ var js, fjs = d.getElementsByTagName(s)[0];
618
+ if (!d.getElementById(id)) {
619
+ js = d.createElement(s);
620
+ js.id = id;
621
+ js.src = "https://platform.twitter.com/widgets.js";
622
+ fjs.parentNode.insertBefore(js, fjs);
623
+ }
624
+ }(document, "script", "twitter-wjs");</script>
625
+ </p>
626
+ <p><?php _e( "If you've found WP Accessibility useful, then please consider <a href='http://wordpress.org/extend/plugins/wp-accessibility/'>rating it five stars</a>, <a href='http://www.joedolson.com/donate/'>making a donation</a>, or <a href='https://translate.wordpress.org/projects/wp-plugins/wp-accessibility'>helping with translation</a>.", 'wp-accessibility' ); ?></p>
627
+
628
+ <div>
629
+ <p><?php _e( '<a href="http://www.joedolson.com/donate/">Make a donation today!</a> Your donation counts - donate $5, $20, or $100 and help me keep this plug-in running!', 'wp-accessibility' ); ?></p>
630
+
631
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
632
+ <div>
633
+ <input type="hidden" name="cmd" value="_s-xclick"/>
634
+ <input type="hidden" name="hosted_button_id" value="QK9MXYGQKYUZY"/>
635
+ <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif"
636
+ name="submit" alt="Donate"/>
637
+ <img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/>
638
+ </div>
639
+ </form>
640
+ </div>
641
+ </div>
642
+ </div>
643
+ </div>
644
+
645
+ <div class="ui-sortable meta-box-sortables">
646
+ <div class="postbox">
647
+ <h3><?php _e( 'Accessibility References', 'wp-accessibility' ); ?></h3>
648
+
649
+ <div class="inside">
650
+ <ul>
651
+ <li><a href="http://make.wordpress.org/accessibility/">Make WordPress: Accessibility</a></li>
652
+ <li><a href="https://make.wordpress.org/themes/handbook/review/accessibility/">WordPress Theme Accessibility Guidelines</a></li>
653
+ <li><a href="http://make.wordpress.org/support/user-manual/web-publishing/accessibility/">WordPress
654
+ User Manual: Accessibility</a></li>
655
+ <li><a href="https://www.joedolson.com/tools/color-contrast.php">Test Color Contrast</a></li>
656
+ <li><a href="http://wave.webaim.org/">WAVE: Web accessibility evaluation tool</a></li>
657
+ </ul>
658
+ </div>
659
+ </div>
660
+ </div>
661
+
662
+ <div class="ui-sortable meta-box-sortables">
663
+ <div class="postbox">
664
+ <h3><?php _e( 'Contributing References', 'wp-accessibility' ); ?></h3>
665
+
666
+ <div class="inside">
667
+ <ul>
668
+ <li><a href="http://www.accessibleculture.org/articles/2010/08/continue-reading-links-in-wordpress/">Continue Reading Links in WordPress</a></li>
669
+ <li><a href="http://www.mothereffingtoolconfuser.com">Mother Effing Tool Confuser</a></li>
670
+ <li><a href="http://wordpress.org/extend/plugins/remove-title-attributes/">Remove Title Attributes</a></li>
671
+ <li><a href="http://accessites.org/site/2008/11/wordpress-and-accessibility/#comment-2926">WordPress and Accessibility (Comment)</a></li>
672
+ <li><a href="http://wordpress.org/extend/plugins/img-title-removal/">IMG Title Removal</a></li>
673
+ <li><a href="https://github.com/clrux/a11y">Accessibility Toolbar</a></li>
674
+ <li><a href="https://wordpress.org/plugins/long-description-for-image-attachments/">WordPress Long Description</a></li>
675
+ </ul>
676
+ </div>
677
+ </div>
678
+ </div>
679
+
680
+ <div class="ui-sortable meta-box-sortables">
681
+ <div class="postbox">
682
+ <h3><?php _e( 'Customization Notes', 'wp-accessibility' ); ?></h3>
683
+
684
+ <div class="inside">
685
+ <p>
686
+ <?php _e( 'It is almost impossible for the Accessibility Toolbar to guarantee a good result for large text or high contrast modes. Author your own high-contrast styles by placing a stylesheet called <code>a11y-contrast.css</code> in your Theme\'s stylesheet directory.', 'wp-accessibility' ); ?>
687
+ </p>
688
+
689
+ <p>
690
+ <?php _e( 'Define custom styles for large print by assigning them in the body class <code>.fontsize</code> in your theme stylesheet.', 'wp-accessibility' ); ?>
691
+ </p>
692
+
693
+ <p>
694
+ <?php _e( 'Define a custom long description template by adding the template "longdesc-template.php" to your theme directory.', 'wp-accessibility' ); ?>
695
+ </p>
696
+
697
+ <p>
698
+ <?php _e( 'The <a href="#wpa_widget_toolbar">shortcode for the Accessibility toolbar</a> (if enabled) is <code>[wpa_toolbar]</code>', 'wp-accessibility' ); ?>
699
+ </p>
700
+ </div>
701
+ </div>
702
+ </div>
703
+
704
+ <?php if ( wpa_accessible_theme() ) { ?>
705
+ <div class="ui-sortable meta-box-sortables">
706
+ <div class="postbox">
707
+ <h3><?php _e( 'Your Theme', 'wp-accessibility' ); ?></h3>
708
+
709
+ <div class="inside">
710
+ <p>
711
+ <?php _e( "You're using a theme reviewed as <code>accessibility-ready</code> by the WordPress theme review team. Some options have been disabled in WP Accessibility because your theme has taken care of that issue.", 'wp-accessibility' ); ?>
712
+ </p>
713
+ <p>
714
+ <?php printf( __( 'Read more about the <a href="%s">WordPress accessibility-ready tag</a>', 'wp-accessibility' ), "https://make.wordpress.org/themes/handbook/review/accessibility/" ); ?>
715
+ </p>
716
+ </div>
717
+ </div>
718
+ </div>
719
+ <?php } ?>
720
+
721
+ </div>
722
+ </div>
723
+
724
+ </div><?php
725
+ }
wp-accessibility.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Accessibility
4
  Plugin URI: http://www.joedolson.com/wp-accessibility/
5
  Description: Helps improve accessibility in your WordPress site, like removing title attributes.
6
- Version: 1.5.0
7
  Author: Joe Dolson
8
  Text Domain: wp-accessibility
9
  Domain Path: /lang
@@ -26,6 +26,7 @@ Author URI: http://www.joedolson.com/
26
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
  */
28
 
 
29
  register_activation_hook( __FILE__, 'wpa_install' );
30
 
31
  // Enable internationalisation
@@ -43,7 +44,7 @@ function add_wpa_admin_menu() {
43
 
44
  // ACTIVATION
45
  function wpa_install() {
46
- $wpa_version = '1.5.0';
47
  if ( get_option( 'wpa_installed' ) != 'true' ) {
48
  add_option( 'rta_from_nav_menu', 'on' );
49
  add_option( 'rta_from_page_lists', 'on' );
@@ -53,7 +54,7 @@ function wpa_install() {
53
  add_option( 'rta_from_category_links', 'on' );
54
  add_option( 'rta_from_post_edit_links', 'on' );
55
  add_option( 'rta_from_edit_comment_links', 'on' );
56
- add_option( 'asl_styles_focus', 'left: 1em; top: 1em; background: #f6f3fa; color: #00c; padding: 5px; border: 1px solid #357; box-shadow: 2px 2px 2px #777; border-radius: 5px; font-size: 1.4em' );
57
  add_option( 'asl_styles_passive', '' );
58
  add_option( 'wpa_target', 'on' );
59
  add_option( 'wpa_search', 'on' );
@@ -90,6 +91,9 @@ add_filter( 'plugin_action_links', 'wpa_plugin_action', 10, 2 );
90
  add_action( 'wp_enqueue_scripts', 'wpa_register_scripts' );
91
  add_action( 'admin_menu', 'wpa_javascript' );
92
 
 
 
 
93
  function wpa_javascript() {
94
  if ( isset( $_GET['page'] ) && $_GET['page'] == 'wp-accessibility/wp-accessibility.php' ) {
95
  wp_enqueue_script( 'farbtastic' );
@@ -203,7 +207,7 @@ function wpacc_enqueue_scripts() {
203
  add_action( 'widgets_init', create_function( '', 'return register_widget("wp_accessibility_toolbar");' ) );
204
  class wp_accessibility_toolbar extends WP_Widget {
205
  function __construct() {
206
- parent::__construct( false, $name = __( 'Accessibility Toolbar', 'wp-accessibility' ) );
207
  }
208
 
209
  function widget( $args, $instance ) {
@@ -213,6 +217,7 @@ class wp_accessibility_toolbar extends WP_Widget {
213
  echo $before_widget;
214
  echo ( $title ) ? $before_title . $title . $after_title : '';
215
  echo wpa_toolbar_html();
 
216
  }
217
 
218
  function form( $instance ) {
@@ -239,15 +244,23 @@ function wpa_toolbar_html() {
239
  $grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
240
  $fontsize = __( 'Toggle Font size', 'wp-accessibility' );
241
  $enable_grayscale = ( get_option( 'wpa_toolbar_gs' ) == 'on' ) ? true : false;
 
 
 
242
  $toolbar = '
243
  <!-- a11y toolbar widget -->
244
- <div class="a11y-toolbar-widget">
245
- <ul>
246
- <li><a href="#" class="a11y-toggle-contrast toggle-contrast" id="is_normal_contrast"><span class="offscreen">'.$contrast.'</span><span class="aticon aticon-adjust"></span></a></li>';
 
 
247
  if ( $enable_grayscale ) {
248
  $toolbar .= '<li><a href="#" class="a11y-toggle-grayscale toggle-grayscale" id="is_normal_color"><span class="offscreen">'.$grayscale.'</span><span class="aticon aticon-tint"></span></a></li>';
249
  }
250
- $toolbar .= '<li><a href="#" class="a11y-toggle-fontsize toggle-fontsize" id="is_normal_fontsize"><span class="offscreen">'.$fontsize.'</span><span class="aticon aticon-font"></span></a></li>
 
 
 
251
  </ul>
252
  </div>
253
  <!-- // a11y toolbar widget -->';
@@ -260,24 +273,31 @@ function wpa_toolbar_js() {
260
  $grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
261
  $fontsize = __( 'Toggle Font size', 'wp-accessibility' );
262
  $enable_grayscale = ( get_option( 'wpa_toolbar_gs' ) == 'on' ) ? true : false;
 
 
263
  $default = ( get_option( 'wpa_toolbar_default' ) != '' ) ? get_option( 'wpa_toolbar_default' ) : 'body';
264
  $location = apply_filters( 'wpa_move_toolbar', $default );
265
  $is_rtl = ( is_rtl() ) ? ' rtl' : ' ltr';
266
  $is_right = ( get_option( 'wpa_toolbar_right' ) == 'on' ) ? ' right' : '';
 
267
  echo
268
  "
269
  <script type='text/javascript'>
270
  //<![CDATA[
271
  (function( $ ) { 'use strict';
272
  var insert_a11y_toolbar = '<!-- a11y toolbar -->';
273
- insert_a11y_toolbar += '<div class=\"a11y-toolbar$is_rtl$is_right\">';
274
- insert_a11y_toolbar += '<ul>';
275
- insert_a11y_toolbar += '<li><button type=\"button\" class=\"a11y-toggle-contrast toggle-contrast\" id=\"is_normal_contrast\"><span class=\"offscreen\">$contrast</span><span class=\"aticon aticon-adjust\" aria-hidden=\"true\"></span></button></li>';";
 
 
276
  if ( get_option( 'wpa_toolbar' ) == 'on' && $enable_grayscale ) {
277
- echo "insert_a11y_toolbar += '<li><button type=\"button\" class=\"a11y-toggle-grayscale toggle-grayscale\" id=\"is_normal_color\"><span class=\"offscreen\">$grayscale</span><span class=\"aticon aticon-tint\" aria-hidden=\"true\"></span></button></li>';";
 
 
 
278
  }
279
  echo "
280
- insert_a11y_toolbar += '<li><button type=\"button\" class=\"a11y-toggle-fontsize toggle-fontsize\" id=\"is_normal_fontsize\"><span class=\"offscreen\">$fontsize</span><span class=\"aticon aticon-font\" aria-hidden=\"true\"></span></button></li>';
281
  insert_a11y_toolbar += '</ul>';
282
  insert_a11y_toolbar += '</div>';
283
  insert_a11y_toolbar += '<!-- // a11y toolbar -->';
@@ -291,8 +311,12 @@ function wpa_css() {
291
  $styles = '';
292
  if ( get_option( 'asl_enable' ) == 'on' ) {
293
  $focus = get_option( 'asl_styles_focus' );
 
 
294
  if ( ! $focus ) {
295
- $focus = "background-color: #f1f1f1; border-radius: 3px; box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6); clip: auto; color: #21759b; display: block; font-size: 14px; font-weight: bold; height: auto; line-height: normal; padding: 15px 23px 14px; position: absolute; left: 5px; top: 5px; text-decoration: none; text-transform: none; width: auto; z-index: 100000;";
 
 
296
  }
297
  $passive = get_option( 'asl_styles_passive' );
298
  $vis = $invis = '';
@@ -302,9 +326,12 @@ function wpa_css() {
302
  } else {
303
  $invis = '#skiplinks a:hover,';
304
  }
 
 
 
305
  $styles .= "
306
- #skiplinks a, $invis #skiplinks a:visited { $passive }
307
- #skiplinks a:active, $vis #skiplinks a:focus { $focus }
308
  ";
309
  }
310
  if ( get_option( 'wpa_focus' ) == 'on' ) {
@@ -345,7 +372,8 @@ function wpa_jquery_asl() {
345
  $html .= ( $sitemap != '' ) ? "<a href=\"$sitemap\">" . __( 'Site map', 'wp-accessibility' ) . "</a> " : '';
346
  $html .= ( $extra != '' && $extra_text != '' ) ? "<a href=\"$extra\">$extra_text</a> " : '';
347
  $is_rtl = ( is_rtl() ) ? '-rtl' : '-ltr';
348
- $output = ( $html != '' ) ? "<div class=\"$visibility$is_rtl\" id=\"skiplinks\" role=\"navigation\">$html</div>" : '';
 
349
  // attach skiplinks HTML; set tabindex on #content area to -1
350
  $focusable = ( $content != '' ) ? "$('#$content').attr('tabindex','-1');" : '';
351
  $focusable .= ( $nav != '' ) ? "$('#$nav').attr('tabindex','-1');" : '';
@@ -358,9 +386,10 @@ function wpa_jquery_asl() {
358
  $lang_js = "$('html').attr( 'lang','$lang' ); $('html').attr( 'dir','$dir' )";
359
  }
360
  // force links to open in the same window
 
361
  $targets = ( get_option( 'wpa_target' ) == 'on' ) ? "$('a').removeAttr('target');" : '';
362
  $tabindex = ( get_option( 'wpa_tabindex' ) == 'on' ) ? "$('input,a,select,textarea,button').removeAttr('tabindex');" : '';
363
- $underlines = ( get_option( 'wpa_underline' ) == 'on' ) ? "$('a').css( 'text-decoration','underline' );$('a').on( 'focusin mouseenter', function() { $(this).css( 'text-decoration','none' ); });$('a').on( 'focusout mouseleave', function() { $(this).css( 'text-decoration','underline' ); } );" : '';
364
 
365
  $display = ( $skiplinks_js || $targets || $lang_js || $tabindex || $longdesc ) ? true : false;
366
  if ( $display ) {
@@ -384,6 +413,10 @@ function wpa_jquery_asl() {
384
  // http://www.coolfields.co.uk/2013/02/wordpress-permanently-visible-log-out-link-plugin-version-0-1/
385
  add_action( 'admin_bar_menu', 'wpa_logout_item', 11 );
386
  function wpa_logout_item( $admin_bar ) {
 
 
 
 
387
  $args = array(
388
  'id' => 'wpa-logout',
389
  'title' => 'Log Out',
@@ -398,7 +431,8 @@ function wpa_stylesheet() {
398
  wp_register_style( 'ui-font.css', plugins_url( 'toolbar/fonts/css/a11y-toolbar.css', __FILE__ ) );
399
  $toolbar = apply_filters( 'wpa_toolbar_css', plugins_url( 'toolbar/css/a11y.css', __FILE__ ) );
400
  wp_register_style( 'ui-a11y.css', $toolbar, array( 'ui-font.css' ) );
401
- $fontsize = apply_filters( 'wpa_fontsize_css', plugins_url( 'toolbar/css/a11y-fontsize.css', __FILE__ ) );
 
402
  wp_register_style( 'ui-fontsize.css', $fontsize );
403
  // only enable styles when required by options
404
  if ( get_option( 'wpa_toolbar_size' ) && get_option( 'wpa_toolbar' ) == 'on' ) {
@@ -558,122 +592,13 @@ function wpa_contrast() {
558
  return false;
559
  }
560
 
561
- function wpa_update_settings() {
562
- wpa_check_version();
563
- if ( ! empty( $_POST ) ) {
564
- $nonce = $_REQUEST['_wpnonce'];
565
- if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
566
- die( "Security check failed" );
567
- }
568
- if ( isset( $_POST['action'] ) && $_POST['action'] == 'rta' ) {
569
- $rta_from_nav_menu = ( isset( $_POST['rta_from_nav_menu'] ) ) ? 'on' : '';
570
- $rta_from_page_lists = ( isset( $_POST['rta_from_page_lists'] ) ) ? 'on' : '';
571
- $rta_from_category_lists = ( isset( $_POST['rta_from_category_lists'] ) ) ? 'on' : '';
572
- $rta_from_archive_links = ( isset( $_POST['rta_from_archive_links'] ) ) ? 'on' : '';
573
- $rta_from_tag_clouds = ( isset( $_POST['rta_from_tag_clouds'] ) ) ? 'on' : '';
574
- $rta_from_category_links = ( isset( $_POST['rta_from_category_links'] ) ) ? 'on' : '';
575
- $rta_from_post_edit_links = ( isset( $_POST['rta_from_post_edit_links'] ) ) ? 'on' : '';
576
- $rta_from_edit_comment_links = ( isset( $_POST['rta_from_edit_comment_links'] ) ) ? 'on' : '';
577
- update_option( 'rta_from_nav_menu', $rta_from_nav_menu );
578
- update_option( 'rta_from_page_lists', $rta_from_page_lists );
579
- update_option( 'rta_from_category_lists', $rta_from_category_lists );
580
- update_option( 'rta_from_archive_links', $rta_from_archive_links );
581
- update_option( 'rta_from_tag_clouds', $rta_from_tag_clouds );
582
- update_option( 'rta_from_category_links', $rta_from_category_links );
583
- update_option( 'rta_from_post_edit_links', $rta_from_post_edit_links );
584
- update_option( 'rta_from_edit_comment_links', $rta_from_edit_comment_links );
585
- $message = __( "Remove Title Attributes Settings Updated", 'wp-accessibility' );
586
-
587
- return "<div class='updated'><p>" . $message . "</p></div>";
588
- }
589
- if ( isset( $_POST['action'] ) && $_POST['action'] == 'asl' ) {
590
- $asl_enable = ( isset( $_POST['asl_enable'] ) ) ? 'on' : '';
591
- $asl_content = ( isset( $_POST['asl_content'] ) ) ? $_POST['asl_content'] : '';
592
- $asl_navigation = ( isset( $_POST['asl_navigation'] ) ) ? $_POST['asl_navigation'] : '';
593
- $asl_sitemap = ( isset( $_POST['asl_sitemap'] ) ) ? $_POST['asl_sitemap'] : '';
594
- $asl_extra_target = ( isset( $_POST['asl_extra_target'] ) ) ? $_POST['asl_extra_target'] : '';
595
- $asl_extra_text = ( isset( $_POST['asl_extra_text'] ) ) ? $_POST['asl_extra_text'] : '';
596
- $asl_visible = ( isset( $_POST['asl_visible'] ) ) ? 'on' : '';
597
- $asl_styles_focus = ( isset( $_POST['asl_styles_focus'] ) ) ? $_POST['asl_styles_focus'] : '';
598
- $asl_styles_passive = ( isset( $_POST['asl_styles_passive'] ) ) ? $_POST['asl_styles_passive'] : '';
599
- update_option( 'asl_enable', $asl_enable );
600
- update_option( 'asl_content', $asl_content );
601
- update_option( 'asl_navigation', $asl_navigation );
602
- update_option( 'asl_sitemap', $asl_sitemap );
603
- update_option( 'asl_extra_target', $asl_extra_target );
604
- update_option( 'asl_extra_text', $asl_extra_text );
605
- update_option( 'asl_visible', $asl_visible );
606
- $notice = ( $asl_visible == 'on' ) ? "<p>" . __( 'WP Accessibility does not provide any styles for visible skiplinks. You can still set the look of the links using the textareas provided, but all other layout must be assigned in your theme.', 'wp-accessibility' ) . "</p>" : '';
607
-
608
- update_option( 'asl_styles_focus', $asl_styles_focus );
609
- update_option( 'asl_styles_passive', $asl_styles_passive );
610
- $message = __( "Add Skiplinks Settings Updated", 'wp-accessibility' );
611
-
612
- return "<div class='updated'><p>" . $message . "</p>$notice</div>";
613
- }
614
- if ( isset( $_POST['action'] ) && $_POST['action'] == 'misc' ) {
615
- $wpa_lang = ( isset( $_POST['wpa_lang'] ) ) ? 'on' : '';
616
- $wpa_target = ( isset( $_POST['wpa_target'] ) ) ? 'on' : '';
617
- $wpa_labels = ( isset( $_POST['wpa_labels'] ) ) ? 'on' : '';
618
- $wpa_search = ( isset( $_POST['wpa_search'] ) ) ? 'on' : '';
619
- $wpa_tabindex = ( isset ( $_POST['wpa_tabindex'] ) ) ? 'on' : '';
620
- $wpa_underline = ( isset ( $_POST['wpa_underline'] ) ) ? 'on' : '';
621
- $wpa_longdesc = ( isset ( $_POST['wpa_longdesc'] ) ) ? esc_attr( $_POST['wpa_longdesc'] ) : 'false';
622
- $wpa_image_titles = ( isset ( $_POST['wpa_image_titles'] ) ) ? 'on' : '';
623
- $wpa_more = ( isset ( $_POST['wpa_more'] ) ) ? 'on' : '';
624
- $wpa_focus = ( isset ( $_POST['wpa_focus'] ) ) ? 'on' : '';
625
- $wpa_focus_color = ( isset( $_POST['wpa_focus_color'] ) ) ? str_replace( '#', '', $_POST['wpa_focus_color'] ) : '';
626
- $wpa_continue = ( isset( $_POST['wpa_continue'] ) ) ? $_POST['wpa_continue'] : 'Continue Reading';
627
- $wpa_toolbar = ( isset( $_POST['wpa_toolbar'] ) ) ? 'on' : '';
628
- $wpa_toolbar_size = ( isset( $_POST['wpa_toolbar_size'] ) ) ? $_POST['wpa_toolbar_size'] : '';
629
- $wpa_widget_toolbar = ( isset( $_POST['wpa_widget_toolbar'] ) ) ? 'on' : '';
630
- $wpa_toolbar_gs = ( isset( $_POST['wpa_toolbar_gs'] ) ) ? 'on' : '';
631
- $wpa_toolbar_default = ( isset( $_POST['wpa_toolbar_default'] ) ) ? $_POST['wpa_toolbar_default'] : '';
632
- $wpa_toolbar_right = ( isset( $_POST['wpa_toolbar_right'] ) ) ? 'on' : '';
633
- $wpa_admin_css = ( isset( $_POST['wpa_admin_css'] ) ) ? 'on' : '';
634
- $wpa_row_actions = ( isset( $_POST['wpa_row_actions'] ) ) ? 'on' : '';
635
- $wpa_diagnostics = ( isset( $_POST['wpa_diagnostics'] ) ) ? 'on' : '';
636
- $wpa_insert_roles = ( isset( $_POST['wpa_insert_roles'] ) ) ? 'on' : '';
637
- $wpa_complementary_container = ( isset( $_POST['wpa_complementary_container'] ) ) ? str_replace( '#', '', $_POST['wpa_complementary_container'] ) : '';
638
- update_option( 'wpa_lang', $wpa_lang );
639
- update_option( 'wpa_target', $wpa_target );
640
- update_option( 'wpa_labels', $wpa_labels );
641
- update_option( 'wpa_search', $wpa_search );
642
- update_option( 'wpa_tabindex', $wpa_tabindex );
643
- update_option( 'wpa_underline', $wpa_underline );
644
- update_option( 'wpa_longdesc', $wpa_longdesc );
645
- update_option( 'wpa_image_titles', $wpa_image_titles );
646
- update_option( 'wpa_more', $wpa_more );
647
- update_option( 'wpa_focus', $wpa_focus );
648
- update_option( 'wpa_toolbar', $wpa_toolbar );
649
- update_option( 'wpa_toolbar_size', $wpa_toolbar_size );
650
- update_option( 'wpa_widget_toolbar', $wpa_widget_toolbar );
651
- update_option( 'wpa_toolbar_gs', $wpa_toolbar_gs );
652
- update_option( 'wpa_toolbar_default', $wpa_toolbar_default );
653
- update_option( 'wpa_toolbar_right', $wpa_toolbar_right );
654
- update_option( 'wpa_focus_color', $wpa_focus_color );
655
- update_option( 'wpa_continue', $wpa_continue );
656
- update_option( 'wpa_admin_css', $wpa_admin_css );
657
- update_option( 'wpa_row_actions', $wpa_row_actions );
658
- update_option( 'wpa_diagnostics', $wpa_diagnostics );
659
- update_option( 'wpa_insert_roles', $wpa_insert_roles );
660
- update_option( 'wpa_complementary_container', $wpa_complementary_container );
661
- $message = __( "Miscellaneous Accessibility Settings Updated", 'wp-accessibility' );
662
-
663
- return "<div class='updated'><p>" . $message . "</p></div>";
664
- }
665
- } else {
666
- return;
667
- }
668
- }
669
-
670
- if ( get_option( 'wpa_search' ) == 'on' ) {
671
  add_filter( 'pre_get_posts', 'wpa_filter' );
672
  }
673
 
674
  function wpa_filter( $query ) {
675
  if ( ! is_admin() ) {
676
- if ( isset( $_GET['s'] ) && $_GET['s'] == '' ) {
677
  $query->query_vars['s'] = '&#32;';
678
  $query->set( 'is_search', 1 );
679
  add_action( 'template_include', 'wpa_search_error' );
@@ -748,566 +673,6 @@ function wpa_admin_styles() {
748
  }
749
  }
750
 
751
- function wpa_admin_menu() {
752
- ?>
753
- <?php echo wpa_update_settings(); ?>
754
- <div class="wrap">
755
- <h2><?php _e( 'WP Accessibility: Settings', 'wp-accessibility' ); ?></h2>
756
-
757
- <div id="wpa_settings_page" class="postbox-container" style="width: 70%">
758
- <div class="metabox-holder">
759
- <div class="ui-sortable meta-box-sortables">
760
- <div class="postbox">
761
- <h3><?php _e( 'Remove Title Attributes', 'wp-accessibility' ); ?></h3>
762
-
763
- <div class="inside">
764
- <?php wpa_accessible_theme(); ?>
765
- <p>
766
- <?php _e( 'As of WordPress 4.0, the only globally added title attributes are in the WordPress tag cloud, showing the number of posts with that tag, and on the categories list, if the category has a term description.', 'wp-accessibility' ); ?>
767
- </p>
768
- <form method="post"
769
- action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
770
- <fieldset>
771
- <legend><?php _e( 'Remove title attributes from:', 'wp-accessibility' ); ?></legend>
772
- <ul>
773
- <?php if ( version_compare( get_bloginfo( 'version' ), '3.8', '<' ) ) { ?>
774
- <li>
775
- <input type="checkbox" id="rta_from_nav_menu"
776
- name="rta_from_nav_menu" <?php if ( get_option( 'rta_from_nav_menu' ) == "on" ) {
777
- echo 'checked="checked" ';
778
- } ?>/> <label
779
- for="rta_from_nav_menu"><?php _e( 'Nav menus', 'wp-accessibility' ); ?>
780
- (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
781
- )</label></li>
782
- <li>
783
- <input type="checkbox" id="rta_from_page_lists"
784
- name="rta_from_page_lists" <?php if ( get_option( 'rta_from_page_lists' ) == "on" ) {
785
- echo 'checked="checked" ';
786
- } ?>/> <label
787
- for="rta_from_page_lists"><?php _e( 'Page lists', 'wp-accessibility' ); ?>
788
- (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
789
- )</label></li>
790
- <li>
791
- <input type="checkbox" id="rta_from_category_links"
792
- name="rta_from_category_links" <?php if ( get_option( 'rta_from_category_links' ) == "on" ) {
793
- echo 'checked="checked" ';
794
- } ?>/> <label
795
- for="rta_from_category_links"><?php _e( 'Category links', 'wp-accessibility' ); ?>
796
- (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
797
- )</label></li>
798
- <li>
799
- <input type="checkbox" id="rta_from_post_edit_links"
800
- name="rta_from_post_edit_links" <?php if ( get_option( 'rta_from_post_edit_links' ) == "on" ) {
801
- echo 'checked="checked" ';
802
- } ?>/> <label
803
- for="rta_from_post_edit_links"><?php _e( 'Post edit links', 'wp-accessibility' ); ?>
804
- (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
805
- )</label></li>
806
- <li>
807
- <input type="checkbox" id="rta_from_edit_comment_links"
808
- name="rta_from_edit_comment_links" <?php if ( get_option( 'rta_from_edit_comment_links' ) == "on" ) {
809
- echo 'checked="checked" ';
810
- } ?>/> <label
811
- for="rta_from_edit_comment_links"><?php _e( 'Edit comment links', 'wp-accessibility' ); ?>
812
- (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
813
- )</label></li>
814
- <?php } ?>
815
- <?php if ( version_compare( get_bloginfo( 'version' ), '4.0', '<' ) ) { ?>
816
- <li><input type="checkbox" id="rta_from_category_lists"
817
- name="rta_from_category_lists" <?php if ( get_option( 'rta_from_category_lists' ) == "on" ) {
818
- echo 'checked="checked" ';
819
- } ?>/> <label
820
- for="rta_from_category_lists"><?php _e( 'Category lists', 'wp-accessibility' ); ?></label>
821
- </li>
822
-
823
- <?php } ?>
824
- <li><input type="checkbox" id="rta_from_tag_clouds"
825
- name="rta_from_tag_clouds" <?php if ( get_option( 'rta_from_tag_clouds' ) == "on" ) {
826
- echo 'checked="checked" ';
827
- } ?>/> <label
828
- for="rta_from_tag_clouds"><?php _e( 'Tag clouds', 'wp-accessibility' ); ?></label>
829
- </li>
830
- <li><input type="checkbox" id="rta_from_archive_links"
831
- name="rta_from_archive_links" <?php if ( get_option( 'rta_from_archive_links' ) == "on" ) {
832
- echo 'checked="checked" ';
833
- } ?>/> <label
834
- for="rta_from_archive_links"><?php _e( 'Archive links', 'wp-accessibility' ); ?></label>
835
- </li>
836
- </ul>
837
- </fieldset>
838
- <p>
839
- <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
840
- <input type="hidden" name="action" value="rta"/>
841
- </p>
842
-
843
- <p><input type="submit" name="wpa-settings" class="button-primary"
844
- value="<?php _e( 'Update Title Attribute Settings', 'wp-accessibility' ) ?>"/></p>
845
- </form>
846
- </div>
847
- </div>
848
-
849
-
850
- <div class="postbox">
851
- <h3><?php _e( 'Add Skiplinks', 'wp-accessibility' ); ?></h3>
852
-
853
- <div class="inside">
854
- <?php if ( wpa_accessible_theme() && get_option( 'asl_enable' ) != 'on' ) { ?>
855
- <p>
856
- <?php _e( 'Your <code>accessibility-ready</code> theme has skip links built in.', 'wp-accessibility' ); ?>
857
- </p>
858
- <?php } else { ?>
859
- <form method="post"
860
- action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
861
- <fieldset>
862
- <legend><?php _e( 'Configure Skiplinks', 'wp-accessibility' ); ?></legend>
863
- <ul>
864
- <li><input type="checkbox" id="asl_enable"
865
- name="asl_enable" <?php if ( get_option( 'asl_enable' ) == "on" ) {
866
- echo 'checked="checked" ';
867
- } ?>/> <label
868
- for="asl_enable"><?php _e( 'Enable Skiplinks', 'wp-accessibility' ); ?></label>
869
- </li>
870
- <li><input type="checkbox" id="asl_visible"
871
- name="asl_visible" <?php if ( get_option( 'asl_visible' ) == "on" ) {
872
- echo 'checked="checked" ';
873
- } ?>/> <label
874
- for="asl_visible"><?php _e( 'Skiplinks always visible', 'wp-accessibility' ); ?></label>
875
- </li>
876
- <li><label
877
- for="asl_content"><?php _e( 'Skip to Content link target (ID of your main content container)', 'wp-accessibility' ); ?></label>
878
- <input type="text" id="asl_content" name="asl_content"
879
- value="<?php esc_attr_e( get_option( 'asl_content' ) ); ?>"/></li>
880
- <li><label
881
- for="asl_navigation"><?php _e( 'Skip to Navigation link target (ID of your main navigation container)', 'wp-accessibility' ); ?></label>
882
- <input type="text" id="asl_navigation" name="asl_navigation"
883
- value="<?php esc_attr_e( get_option( 'asl_navigation' ) ); ?>"/></li>
884
- <li><label
885
- for="asl_sitemap"><?php _e( 'Site Map link target (URL for your site map)', 'wp-accessibility' ); ?></label><input
886
- type="text" id="asl_sitemap" name="asl_sitemap" size="44"
887
- value="<?php esc_attr_e( get_option( 'asl_sitemap' ) ); ?>"/></li>
888
- <li><label
889
- for="asl_extra_target"><?php _e( 'Add your own link (link or container ID)', 'wp-accessibility' ); ?></label>
890
- <input type="text" id="asl_extra_target" name="asl_extra_target"
891
- value="<?php esc_attr_e( get_option( 'asl_extra_target' ) ); ?>"/> <label
892
- for="asl_extra_text"><?php _e( 'Link text for your link', 'wp-accessibility' ); ?></label>
893
- <input type="text" id="asl_extra_text" name="asl_extra_text"
894
- value="<?php esc_attr_e( get_option( 'asl_extra_text' ) ); ?>"/></li>
895
- <li><label
896
- for="asl_styles_focus"><?php _e( 'Styles for Skiplinks when they have focus', 'wp-accessibility' ); ?></label><br/>
897
- <textarea name='asl_styles_focus' id='asl_styles_focus' cols='60'
898
- rows='4'><?php esc_attr_e( stripslashes( get_option( 'asl_styles_focus' ) ) ); ?></textarea>
899
- </li>
900
- <?php if ( get_option( 'asl_visible' ) != 'on' ) {
901
- $disabled = " disabled='disabled' style='background: #eee;'";
902
- $note = ' ' . __( '(Not currently visible)', 'wp-accessibility' );
903
- } else {
904
- $disabled = $note = '';
905
- } ?>
906
- <li><label
907
- for="asl_styles_passive"><?php _e( 'Styles for Skiplinks without focus', 'wp-accessibility' );
908
- echo $note; ?></label><br/>
909
- <textarea name='asl_styles_passive' id='asl_styles_passive' cols='60'
910
- rows='4'<?php echo $disabled; ?>><?php echo stripslashes( get_option( 'asl_styles_passive' ) ); ?></textarea>
911
- </li>
912
- </ul>
913
- </fieldset>
914
- <p>
915
- <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
916
- <input type="hidden" name="action" value="asl"/>
917
- </p>
918
-
919
- <p><input type="submit" name="wpa-settings" class="button-primary"
920
- value="<?php _e( 'Update Skiplink Settings', 'wp-accessibility' ) ?>"/></p>
921
- </form>
922
- <?php } ?>
923
- </div>
924
- </div>
925
- <div class="postbox">
926
- <h3 id="contrast"><?php _e( 'Miscellaneous Accessibility Settings', 'wp-accessibility' ); ?></h3>
927
-
928
- <div class="inside">
929
- <form method="post"
930
- action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
931
- <fieldset>
932
- <legend><?php _e( 'Miscellaneous', 'wp-accessibility' ); ?></legend>
933
- <ul>
934
- <?php if ( !wpa_accessible_theme() ) { ?>
935
- <li><input type="checkbox" id="wpa_lang"
936
- name="wpa_lang" <?php if ( get_option( 'wpa_lang' ) == "on" ) {
937
- echo 'checked="checked" ';
938
- } ?>/> <label
939
- for="wpa_lang"><?php _e( 'Add Site Language and text direction to HTML element', 'wp-accessibility' ); ?></label>
940
- </li>
941
- <li><input type="checkbox" id="wpa_more"
942
- name="wpa_more" <?php if ( get_option( 'wpa_more' ) == "on" ) {
943
- echo 'checked="checked" ';
944
- } ?>/> <label
945
- for="wpa_more"><?php _e( 'Add post title to "more" links.', 'wp-accessibility' ); ?></label>
946
- <label
947
- for="wpa_continue"><?php _e( 'Continue reading text', 'wp-accessibility' ); ?></label>
948
- <input type="text" id="wpa_continue" name="wpa_continue"
949
- value="<?php esc_attr_e( get_option( 'wpa_continue' ) ); ?>"/></li>
950
- <li><input type="checkbox" id="wpa_insert_roles"
951
- name="wpa_insert_roles" <?php if ( get_option( 'wpa_insert_roles' ) == "on" ) {
952
- echo 'checked="checked" ';
953
- } ?>/> <label
954
- for="wpa_insert_roles"><?php _e( 'Add landmark roles to HTML5 structural elements', 'wp-accessibility' ); ?></label><br/><label
955
- for="wpa_complementary_container"><?php _e( 'ID for complementary role', 'wp-accessibility' ); ?></label><input
956
- type="text" id="wpa_complementary_container" name="wpa_complementary_container"
957
- value="#<?php esc_attr_e( get_option( 'wpa_complementary_container' ) ); ?>"/>
958
- </li>
959
- <li>
960
- <input type="checkbox" id="wpa_labels" name="wpa_labels" <?php checked( get_option( 'wpa_labels'), 'on' ); ?> /> <label for='wpa_labels'><?php _e( 'Automatically Label WordPress search form and comment forms', 'wp-accessibility' ); ?></label>
961
- </li>
962
- <?php } else { ?>
963
- <li><?php _e( '<strong>Four disabled features:</strong> Site language, continue reading text, landmark roles and standard form labels are defined in your <code>accessibility-ready</code> theme.', 'wp-accessibility' ); ?></li>
964
- <?php } ?>
965
- <li><input type="checkbox" id="wpa_target"
966
- name="wpa_target" <?php if ( get_option( 'wpa_target' ) == "on" ) {
967
- echo 'checked="checked" ';
968
- } ?>/> <label
969
- for="wpa_target"><?php _e( 'Remove target attribute from links', 'wp-accessibility' ); ?></label>
970
- </li>
971
- <li><input type="checkbox" id="wpa_search"
972
- name="wpa_search" <?php if ( get_option( 'wpa_search' ) == "on" ) {
973
- echo 'checked="checked" ';
974
- } ?>/> <label
975
- for="wpa_search"><?php _e( 'Force search error on empty search submission (theme must have search.php template)', 'wp-accessibility' ); ?></label>
976
- </li>
977
- <li><input type="checkbox" id="wpa_tabindex"
978
- name="wpa_tabindex" <?php if ( get_option( 'wpa_tabindex' ) == "on" ) {
979
- echo 'checked="checked" ';
980
- } ?>/> <label
981
- for="wpa_tabindex"><?php _e( 'Remove tabindex from focusable elements', 'wp-accessibility' ); ?></label>
982
- </li>
983
- <li><input type="checkbox" id="wpa_underline"
984
- name="wpa_underline" <?php if ( get_option( 'wpa_underline' ) == "on" ) {
985
- echo 'checked="checked" ';
986
- } ?>/> <label
987
- for="wpa_underline"><?php _e( 'Force underline on all links', 'wp-accessibility' ); ?></label>
988
- </li>
989
- <li><label
990
- for="wpa_longdesc"><?php _e( 'Long Description UI', 'wp-accessibility' ); ?></label>
991
- <select id="wpa_longdesc" name="wpa_longdesc">
992
- <option value='link'<?php if ( get_option( 'wpa_longdesc' ) == "link" ) {
993
- echo 'selected="selected" ';
994
- } ?>><?php _e( 'Link to description', 'wp-accessibility' ); ?></option>
995
- <option value='jquery'<?php if ( get_option( 'wpa_longdesc' ) == "jquery" ) {
996
- echo 'selected="selected" ';
997
- } ?>><?php _e( 'Button trigger to overlay image', 'wp-accessibility' ); ?></option>
998
- <option value='false'
999
- <?php if ( get_option( 'wpa_longdesc' ) == "false" || ! get_option( 'wpa_longdesc' ) ) {
1000
- echo 'selected="selected"';
1001
- } ?>><?php _e( 'Browser defaults only', 'wp-accessibility' ); ?></option>
1002
- </select>
1003
- </li>
1004
- <li><input type="checkbox" id="wpa_admin_css"
1005
- name="wpa_admin_css" <?php if ( get_option( 'wpa_admin_css' ) == "on" ) {
1006
- echo 'checked="checked" ';
1007
- } ?>/> <label
1008
- for="wpa_admin_css"><?php _e( 'Enable WordPress Admin stylesheet', 'wp-accessibility' ); ?></label>
1009
- </li>
1010
- <li><input type="checkbox" id="wpa_row_actions"
1011
- name="wpa_row_actions" <?php if ( get_option( 'wpa_row_actions' ) == "on" ) {
1012
- echo 'checked="checked" ';
1013
- } ?>/> <label
1014
- for="wpa_row_actions"><?php _e( 'Make row actions always visible', 'wp-accessibility' ); ?></label>
1015
- </li>
1016
- <li><input type="checkbox" id="wpa_image_titles"
1017
- name="wpa_image_titles" <?php if ( get_option( 'wpa_image_titles' ) == "on" ) {
1018
- echo 'checked="checked" ';
1019
- } ?>/> <label
1020
- for="wpa_image_titles"><?php _e( 'Remove title attribute from images inserted into post content and featured images.', 'wp-accessibility' ); ?></label>
1021
- </li>
1022
- <li><input type="checkbox" id="wpa_diagnostics"
1023
- name="wpa_diagnostics" <?php if ( get_option( 'wpa_diagnostics' ) == "on" ) {
1024
- echo 'checked="checked" ';
1025
- } ?>/> <label
1026
- for="wpa_diagnostics"><?php _e( 'Enable diagnostic CSS', 'wp-accessibility' ); ?></label>
1027
- </li>
1028
- <li><input type="checkbox" id="wpa_focus"
1029
- name="wpa_focus" <?php if ( get_option( 'wpa_focus' ) == "on" ) {
1030
- echo 'checked="checked" ';
1031
- } ?>/> <label
1032
- for="wpa_focus"><?php _e( 'Add outline to elements on keyboard focus', 'wp-accessibility' ); ?></label>
1033
- <label
1034
- for="wpa_focus_color"><?php _e( 'Outline color (hexadecimal, optional)', 'wp-accessibility' ); ?></label><input
1035
- type="text" id="wpa_focus_color" name="wpa_focus_color"
1036
- value="#<?php esc_attr_e( get_option( 'wpa_focus_color' ) ); ?>"/></li>
1037
- </ul>
1038
- </fieldset>
1039
- <fieldset>
1040
- <legend><?php _e( 'Accessibility Toolbar Settings', 'wp-accessibility' ); ?></legend>
1041
- <ul>
1042
- <li><input type="checkbox" id="wpa_toolbar"
1043
- name="wpa_toolbar" <?php if ( get_option( 'wpa_toolbar' ) == "on" ) {
1044
- echo 'checked="checked" ';
1045
- } ?>/> <label
1046
- for="wpa_toolbar"><?php _e( 'Add Accessibility toolbar with fontsize adjustment and contrast toggle', 'wp-accessibility' ); ?></label>
1047
- </li>
1048
- <li>
1049
- <label for="wpa_toolbar_default"><?php _e( 'Toolbar location (ID attribute)', 'wp-accessibility' ); ?></label> <input type="text" id="wpa_toolbar_default" name="wpa_toolbar_default" value="<?php esc_attr_e( get_option( 'wpa_toolbar_default' ) ); ?>" />
1050
- </li>
1051
- <?php
1052
- $size = get_option( 'wpa_toolbar_size' );
1053
- ?>
1054
- <li><label
1055
- for="wpa_toolbar_size"><?php _e( 'Toolbar font size', 'wp-accessibility' ); ?></label>
1056
- <select name='wpa_toolbar_size' id='wpa_toolbar_size'>
1057
- <option value=''><?php _e( 'Default size', 'wp-accessibility' ); ?></option>
1058
- <?php
1059
- for ( $i = 1; $i <= 2.5; ) {
1060
- $current = $i . 'em';
1061
- $selected_size = ( $current == $size ) ? ' selected="selected"' : '';
1062
- echo "<option value='$i" . "em'$selected_size>$i em</option>";
1063
- $i = $i + .1;
1064
- }
1065
- ?>
1066
- </select>
1067
- </li>
1068
- <li><input type="checkbox" id="wpa_widget_toolbar"
1069
- name="wpa_widget_toolbar" <?php if ( get_option( 'wpa_widget_toolbar' ) == "on" ) {
1070
- echo 'checked="checked" ';
1071
- } ?>/> <label
1072
- for="wpa_widget_toolbar"><?php _e( 'Support Accessibility toolbar as shortcode or widget', 'wp-accessibility' ); ?></label>
1073
- </li>
1074
- <li><input type="checkbox" id="wpa_toolbar_gs"
1075
- name="wpa_toolbar_gs" <?php if ( get_option( 'wpa_toolbar_gs' ) == "on" ) {
1076
- echo 'checked="checked" ';
1077
- } ?>/> <label
1078
- for="wpa_toolbar_gs"><?php _e( 'Include grayscale toggle with Accessibility toolbar', 'wp-accessibility' ); ?></label>
1079
- </li>
1080
- <li><input type="checkbox" id="wpa_toolbar_right"
1081
- name="wpa_toolbar_right" <?php if ( get_option( 'wpa_toolbar_right' ) == "on" ) {
1082
- echo 'checked="checked" ';
1083
- } ?>/> <label
1084
- for="wpa_toolbar_right"><?php _e( 'Place toolbar on right side of screen.', 'wp-accessibility' ); ?></label>
1085
- </li>
1086
- </ul>
1087
- </fieldset>
1088
- <p>
1089
- <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
1090
- <input type="hidden" name="action" value="misc"/>
1091
- </p>
1092
-
1093
- <p><input type="submit" name="wpa-settings" class="button-primary"
1094
- value="<?php _e( 'Update Miscellaneous Settings', 'wp-accessibility' ) ?>"/></p>
1095
- </form>
1096
- </div>
1097
- </div>
1098
- <div class="postbox">
1099
- <h3><?php _e( 'Color Contrast Tester', 'wp-accessibility' ); ?></h3>
1100
-
1101
- <div class="inside">
1102
- <?php
1103
- $colors = wpa_contrast();
1104
- if ( $colors ) {
1105
- $l_contrast = wpa_luminosity( $colors['red1'], $colors['red2'], $colors['green1'], $colors['green2'], $colors['blue1'], $colors['blue2'] ) . ':1';
1106
- $luminance_raw = wpa_luminosity( $colors['red1'], $colors['red2'], $colors['green1'], $colors['green2'], $colors['blue1'], $colors['blue2'] );
1107
- $hex1 = esc_attr( $colors['hex1'] );
1108
- $hex2 = esc_attr( $colors['hex2'] );
1109
- } else {
1110
- $hex1 = '';
1111
- $hex2 = '';
1112
- $l_contrast = false;
1113
- }
1114
- if ( $l_contrast ) {
1115
- $results = "
1116
- <div class='updated notice'>";
1117
- $results .= "<p class=\"stats wcag2\">" . sprintf( __( 'Luminosity Contrast Ratio for <code>#%2$s</code> and <code>#%3$s</code> is <strong>%1$s</strong> (Threshold: greater than 7:1 for AAA, 4.5:1 for AA)', 'wp-accessibility' ), $l_contrast, $hex1, $hex2 ) . "</p><p>";
1118
- if ( $luminance_raw >= 7 ) {
1119
- $results .= __( "The colors compared <strong>pass</strong> the relative luminosity test at level AAA.", 'wp-accessibility' );
1120
- }
1121
- if ( $luminance_raw >= 4.5 && $luminance_raw < 7 ) {
1122
- $results .= __( "The colors compared <strong>pass</strong> the relative luminosity test at level AA.", 'wp-accessibility' );
1123
- }
1124
- if ( $luminance_raw >= 3 && $luminance_raw < 4.5 ) {
1125
- $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' );
1126
- }
1127
- if ( $luminance_raw < 3 ) {
1128
- $results .= __( "The colors compared <strong>do not pass</strong> the relative luminosity test.", 'wp-accessibility' );
1129
- }
1130
- $results .= " <a href='#contrast'>" . __( 'Test another set of colors', 'wp-accessibility' ) . "</a>";
1131
- $results .= "</p>";
1132
- $results .= "
1133
- <div class=\"views\">
1134
- <p class='large' style=\"font-size: 2em; line-height: 1.4;color: #$hex1;background: #$hex2;border: 3px solid #$hex1\">Large Print Example</p>
1135
- <p class='small' style=\"font-size: .9em;color: #$hex1;background: #$hex2;border: 3px solid #$hex1\">Small Print Example</p>
1136
- <p class='large' style=\"font-size: 2em; line-height: 1.4;color: #$hex2;background: #$hex1;border: 3px solid #$hex2\">Large Print Example (Inverted)</p>
1137
- <p class='small' style=\"font-size: .9em;color: #$hex2;background: #$hex1;border: 3px solid #$hex2\">Small Print Example (Inverted)</p>
1138
- </div>
1139
- </div>";
1140
- echo $results;
1141
- }
1142
- ?>
1143
- <form method="post"
1144
- action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
1145
- <fieldset>
1146
- <legend><?php _e( 'Test of relative luminosity', 'wp-accessibility' ); ?></legend>
1147
- <ul>
1148
- <li class='fore'>
1149
- <div id="fore"></div>
1150
- <label
1151
- for="color1"><?php _e( 'Foreground color', 'wp-accessibility' ); ?></label><br/><input
1152
- type="text" name="color" value="#<?php esc_attr_e( $hex1 ); ?>" size="34" id="color1"/>
1153
- </li>
1154
- <li class='back'>
1155
- <div id="back"></div>
1156
- <label
1157
- for="color2"><?php _e( 'Background color', 'wp-accessibility' ); ?></label><br/><input
1158
- type="text" name="color2" value="#<?php esc_attr_e( $hex2 ); ?>" size="34" id="color2"/>
1159
- </li>
1160
- </ul>
1161
- </fieldset>
1162
- <p>
1163
- <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
1164
- <input type="hidden" name="action" value="contrast"/>
1165
- </p>
1166
-
1167
- <p><input type="submit" name="wpa-settings" class="button-primary"
1168
- value="<?php _e( 'Check Color Contrast', 'wp-accessibility' ) ?>"/></p>
1169
- </form>
1170
- </div>
1171
- </div>
1172
- <div class="postbox" id="get-support">
1173
- <h3><?php _e( 'Get Plug-in Support', 'wp-accessibility' ); ?></h3>
1174
-
1175
- <div class="inside">
1176
- <?php wpa_get_support_form(); ?>
1177
- </div>
1178
- </div>
1179
- </div>
1180
- </div>
1181
- </div>
1182
-
1183
- <div class="postbox-container" style="width:20%">
1184
- <div class="metabox-holder">
1185
- <div class="ui-sortable meta-box-sortables">
1186
- <div class="postbox">
1187
- <h3><?php _e( 'Support this Plugin', 'wp-accessibility' ); ?></h3>
1188
-
1189
- <div class="inside">
1190
- <p>
1191
- <a href="https://twitter.com/intent/follow?screen_name=joedolson" class="twitter-follow-button"
1192
- data-size="small" data-related="joedolson">Follow @joedolson</a>
1193
- <script>!function (d, s, id) {
1194
- var js, fjs = d.getElementsByTagName(s)[0];
1195
- if (!d.getElementById(id)) {
1196
- js = d.createElement(s);
1197
- js.id = id;
1198
- js.src = "https://platform.twitter.com/widgets.js";
1199
- fjs.parentNode.insertBefore(js, fjs);
1200
- }
1201
- }(document, "script", "twitter-wjs");</script>
1202
- </p>
1203
- <p><?php _e( "If you've found WP Accessibility useful, then please consider <a href='http://wordpress.org/extend/plugins/wp-accessibility/'>rating it five stars</a>, <a href='http://www.joedolson.com/donate/'>making a donation</a>, or <a href='http://translate.joedolson.com/projects/wp-accessibility'>helping with translation</a>.", 'wp-accessibility' ); ?></p>
1204
-
1205
- <div>
1206
- <p><?php _e( '<a href="http://www.joedolson.com/donate/">Make a donation today!</a> Your donation counts - donate $5, $20, or $100 and help me keep this plug-in running!', 'wp-to-twitter' ); ?></p>
1207
-
1208
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
1209
- <div>
1210
- <input type="hidden" name="cmd" value="_s-xclick"/>
1211
- <input type="hidden" name="hosted_button_id" value="QK9MXYGQKYUZY"/>
1212
- <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif"
1213
- name="submit" alt="Donate"/>
1214
- <img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/>
1215
- </div>
1216
- </form>
1217
- </div>
1218
- </div>
1219
- </div>
1220
- </div>
1221
-
1222
- <?php if ( wpa_accessible_theme() ) { ?>
1223
- <div class="ui-sortable meta-box-sortables">
1224
- <div class="postbox">
1225
- <h3><?php _e( 'Your Theme', 'wp-accessibility' ); ?></h3>
1226
-
1227
- <div class="inside">
1228
- <p>
1229
- <?php _e( "You're using a theme reviewed as <code>accessibility-ready</code> by the WordPress theme review team. Some options have been disabled in WP Accessibility because your theme has taken care of that issue.", 'wp-accessibility' ); ?>
1230
- </p>
1231
- <p>
1232
- <?php printf( __( 'Read more about the <a href="%s">WordPress accessibility-ready tag</a>', 'wp-accessibility' ), "https://make.wordpress.org/themes/handbook/review/accessibility/" ); ?>
1233
- </p>
1234
- </div>
1235
- </div>
1236
- </div>
1237
- <?php } ?>
1238
-
1239
- <div class="ui-sortable meta-box-sortables">
1240
- <div class="postbox">
1241
- <h3><?php _e( 'Accessibility References', 'wp-accessibility' ); ?></h3>
1242
-
1243
- <div class="inside">
1244
- <ul>
1245
- <li><a href="http://make.wordpress.org/accessibility/">Make WordPress: Accessibility</a></li>
1246
- <li><a href="http://codex.wordpress.org/Accessibility">WordPress Codex on Accessibility</a></li>
1247
- <li><a href="http://make.wordpress.org/support/user-manual/web-publishing/accessibility/">WordPress
1248
- User Manual: Accessibility</a></li>
1249
- <li><a href="https://www.joedolson.com/tools/color-contrast.php">Test Color Contrast</a></li>
1250
- <li><a href="http://wave.webaim.org/">WAVE: Web accessibility evaluation tool</a></li>
1251
- </ul>
1252
- </div>
1253
- </div>
1254
- </div>
1255
-
1256
- <div class="ui-sortable meta-box-sortables">
1257
- <div class="postbox">
1258
- <h3><?php _e( 'Contributing References', 'wp-accessibility' ); ?></h3>
1259
-
1260
- <div class="inside">
1261
- <ul>
1262
- <li>
1263
- <a href="http://www.accessibleculture.org/articles/2010/08/continue-reading-links-in-wordpress/">Continue
1264
- Reading Links in WordPress</a></li>
1265
- <li><a href="http://urbanfuturistic.net/weblog/2012/02/27/incredible-failing-accesskey/">The
1266
- Incredible Failing AccessKey</a></li>
1267
- <li><a href="http://www.mothereffingtoolconfuser.com">Mother Effing Tool Confuser</a></li>
1268
- <li><a href="http://wordpress.org/extend/plugins/remove-title-attributes/">Remove Title
1269
- Attributes</a></li>
1270
- <li><a href="http://accessites.org/site/2008/11/wordpress-and-accessibility/#comment-2926">WordPress
1271
- and Accessibility (Comment)</a></li>
1272
- <li><a href="http://wordpress.org/extend/plugins/img-title-removal/">IMG Title Removal</a></li>
1273
- <li><a href="http://www.usableinteractions.com/2012/11/accessibility-toolbar/">Accessibility
1274
- Toolbar</a></li>
1275
- <li><a href="https://wordpress.org/plugins/long-description-for-image-attachments/">WordPress
1276
- Long Description</a></li>
1277
- </ul>
1278
- </div>
1279
- </div>
1280
- </div>
1281
-
1282
- <div class="ui-sortable meta-box-sortables">
1283
- <div class="postbox">
1284
- <h3><?php _e( 'Customization Notes', 'wp-accessibility' ); ?></h3>
1285
-
1286
- <div class="inside">
1287
- <p>
1288
- <?php _e( 'It is almost impossible for the Accessibility Toolbar to guarantee a good result for large text or high contrast modes. Author your own high-contrast styles by placing a stylesheet called <code>a11y-contrast.css</code> in your Theme\'s stylesheet directory.', 'wp-accessibility' ); ?>
1289
- </p>
1290
-
1291
- <p>
1292
- <?php _e( 'Define custom styles for large print by assigning them in the body class <code>.fontsize</code> in your theme stylesheet.', 'wp-accessibility' ); ?>
1293
- </p>
1294
-
1295
- <p>
1296
- <?php _e( 'Define a custom long description template by adding the template "longdesc-template.php" to your theme directory.', 'wp-accessibility' ); ?>
1297
- </p>
1298
-
1299
- <p>
1300
- <?php _e( 'The <a href="#wpa_widget_toolbar">shortcode for the Accessibility toolbar</a> (if enabled) is <code>[wpa_toolbar]</code>', 'wp-accessibility' ); ?>
1301
- </p>
1302
- </div>
1303
- </div>
1304
- </div>
1305
- </div>
1306
- </div>
1307
-
1308
- </div><?php
1309
- }
1310
-
1311
  // Obsolete with 3.8: (nav menus, page lists, edit post links, edit comment links, category links)
1312
  if ( get_option( 'rta_from_nav_menu' ) == 'on' && version_compare( get_bloginfo( 'version' ), '3.8.0', '<' ) ) {
1313
  add_filter( 'wp_nav_menu', 'wpa_remove_title_attributes' );
@@ -1360,7 +725,7 @@ function wpa_deprecated_warning( $context ) {
1360
 
1361
  function wpa_get_support_form() {
1362
  global $current_user, $wpa_version;
1363
- get_currentuserinfo();
1364
  $request = '';
1365
  $version = $wpa_version;
1366
  // send fields for all plugins
@@ -1418,7 +783,7 @@ Version: $theme_version
1418
  ==Active Plugins:==
1419
  $plugins_string
1420
  ";
1421
- if ( isset( $_POST['wpt_support'] ) ) {
1422
  $nonce = $_REQUEST['_wpnonce'];
1423
  if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
1424
  die( "Security check failed" );
@@ -1455,10 +820,6 @@ $plugins_string
1455
  <form method='post' action='$admin_url'>
1456
  <div><input type='hidden' name='_wpnonce' value='" . wp_create_nonce( 'wpa-nonce' ) . "' /></div>
1457
  <div>";
1458
- echo "
1459
- <p>" .
1460
- __( '<strong>Please note</strong>: I do keep records of those who have donated, but if your donation came from somebody other than your account at this web site, you must note this in your message.', 'wp-accessibility' )
1461
- . "</p>";
1462
  echo "
1463
  <p>
1464
  <code>" . __( 'From:', 'wp-accessibility' ) . " \"$current_user->display_name\" &lt;$current_user->user_email&gt;</code>
@@ -1473,7 +834,7 @@ $plugins_string
1473
  <label for='support_request'>" . __( 'Support Request:', 'wp-accessibility' ) . "</label><br /><textarea name='support_request' required aria-required='true' id='support_request' cols='80' rows='10'>" . stripslashes( $request ) . "</textarea>
1474
  </p>
1475
  <p>
1476
- <input type='submit' value='" . __( 'Send Support Request', 'wp-accessibility' ) . "' name='wpt_support' class='button-primary' />
1477
  </p>
1478
  <p>" .
1479
  __( 'The following additional information will be sent with your support request:', 'wp-accessibility' )
@@ -1486,6 +847,28 @@ $plugins_string
1486
  }
1487
 
1488
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1489
  /* longdesc support, based on work by Michael Fields (http://wordpress.org/plugins/long-description-for-image-attachments/) */
1490
 
1491
  define( 'WPA_TEMPLATES', trailingslashit( dirname( __FILE__ ) ) . 'templates/' );
@@ -1592,14 +975,14 @@ function longdesc_add_attr( $html, $id, $caption, $title, $align, $url, $size, $
1592
  if ( isset( $image->ID ) && ! empty( $image->ID ) ) {
1593
  $args = array( 'longdesc' => $image->ID );
1594
  /* The referrer is the post that the image is inserted into. */
1595
- if ( isset( $_REQUEST['post_id'] ) ) {
1596
- $args['referrer'] = (int) $_REQUEST['post_id'];
 
1597
  }
1598
  if ( ! empty( $image->post_content ) ) {
1599
- $search = '<img';
1600
- $replace = $search . ' longdesc="' . esc_url( add_query_arg( $args, home_url() ) ) . '"';
1601
  $html = str_replace( $search, $replace, $html );
1602
- $html .= '<a id="' . esc_attr( longdesc_return_anchor( $image->ID ) ) . '"></a>';
1603
  }
1604
  }
1605
 
3
  Plugin Name: WP Accessibility
4
  Plugin URI: http://www.joedolson.com/wp-accessibility/
5
  Description: Helps improve accessibility in your WordPress site, like removing title attributes.
6
+ Version: 1.5.6
7
  Author: Joe Dolson
8
  Text Domain: wp-accessibility
9
  Domain Path: /lang
26
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
  */
28
 
29
+ include( dirname( __FILE__ ) . '/wp-accessibility-settings.php' );
30
  register_activation_hook( __FILE__, 'wpa_install' );
31
 
32
  // Enable internationalisation
44
 
45
  // ACTIVATION
46
  function wpa_install() {
47
+ $wpa_version = '1.5.6';
48
  if ( get_option( 'wpa_installed' ) != 'true' ) {
49
  add_option( 'rta_from_nav_menu', 'on' );
50
  add_option( 'rta_from_page_lists', 'on' );
54
  add_option( 'rta_from_category_links', 'on' );
55
  add_option( 'rta_from_post_edit_links', 'on' );
56
  add_option( 'rta_from_edit_comment_links', 'on' );
57
+ add_option( 'asl_styles_focus', '' );
58
  add_option( 'asl_styles_passive', '' );
59
  add_option( 'wpa_target', 'on' );
60
  add_option( 'wpa_search', 'on' );
91
  add_action( 'wp_enqueue_scripts', 'wpa_register_scripts' );
92
  add_action( 'admin_menu', 'wpa_javascript' );
93
 
94
+ /**
95
+ * Enqueue color picker for contrast testing
96
+ **/
97
  function wpa_javascript() {
98
  if ( isset( $_GET['page'] ) && $_GET['page'] == 'wp-accessibility/wp-accessibility.php' ) {
99
  wp_enqueue_script( 'farbtastic' );
207
  add_action( 'widgets_init', create_function( '', 'return register_widget("wp_accessibility_toolbar");' ) );
208
  class wp_accessibility_toolbar extends WP_Widget {
209
  function __construct() {
210
+ parent::__construct( false, $name = __( 'Accessibility Toolbar', 'wp-accessibility' ), array( 'customize_selective_refresh' => true ) );
211
  }
212
 
213
  function widget( $args, $instance ) {
217
  echo $before_widget;
218
  echo ( $title ) ? $before_title . $title . $after_title : '';
219
  echo wpa_toolbar_html();
220
+ echo $after_widget;
221
  }
222
 
223
  function form( $instance ) {
244
  $grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
245
  $fontsize = __( 'Toggle Font size', 'wp-accessibility' );
246
  $enable_grayscale = ( get_option( 'wpa_toolbar_gs' ) == 'on' ) ? true : false;
247
+ $enable_contrast = ( get_option( 'wpa_toolbar_fs' ) == 'off' ) ? false : true;
248
+ $enable_fontsize = ( get_option( 'wpa_toolbar_ct' ) == 'off' ) ? false : true;
249
+ $responsive = ( get_option( 'wpa_toolbar_mobile' ) == 'on' ) ? 'a11y-responsive ' : '';
250
  $toolbar = '
251
  <!-- a11y toolbar widget -->
252
+ <div class="' . $responsive . 'a11y-toolbar-widget">
253
+ <ul>';
254
+ if ( $enable_contrast ) {
255
+ $toolbar .= '<li><a href="#" class="a11y-toggle-contrast toggle-contrast" id="is_normal_contrast"><span class="offscreen">'.$contrast.'</span><span class="aticon aticon-adjust"></span></a></li>';
256
+ }
257
  if ( $enable_grayscale ) {
258
  $toolbar .= '<li><a href="#" class="a11y-toggle-grayscale toggle-grayscale" id="is_normal_color"><span class="offscreen">'.$grayscale.'</span><span class="aticon aticon-tint"></span></a></li>';
259
  }
260
+ if ( $enable_fontsize ) {
261
+ $toolbar .= '<li><a href="#" class="a11y-toggle-fontsize toggle-fontsize" id="is_normal_fontsize"><span class="offscreen">'.$fontsize.'</span><span class="aticon aticon-font"></span></a></li>';
262
+ }
263
+ $toolbar .= '
264
  </ul>
265
  </div>
266
  <!-- // a11y toolbar widget -->';
273
  $grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
274
  $fontsize = __( 'Toggle Font size', 'wp-accessibility' );
275
  $enable_grayscale = ( get_option( 'wpa_toolbar_gs' ) == 'on' ) ? true : false;
276
+ $enable_fontsize = ( get_option( 'wpa_toolbar_fs' ) == 'off' ) ? false : true;
277
+ $enable_contrast = ( get_option( 'wpa_toolbar_ct' ) == 'off' ) ? false : true;
278
  $default = ( get_option( 'wpa_toolbar_default' ) != '' ) ? get_option( 'wpa_toolbar_default' ) : 'body';
279
  $location = apply_filters( 'wpa_move_toolbar', $default );
280
  $is_rtl = ( is_rtl() ) ? ' rtl' : ' ltr';
281
  $is_right = ( get_option( 'wpa_toolbar_right' ) == 'on' ) ? ' right' : '';
282
+ $responsive = ( get_option( 'wpa_toolbar_mobile' ) == 'on' ) ? 'a11y-responsive' : '';
283
  echo
284
  "
285
  <script type='text/javascript'>
286
  //<![CDATA[
287
  (function( $ ) { 'use strict';
288
  var insert_a11y_toolbar = '<!-- a11y toolbar -->';
289
+ insert_a11y_toolbar += '<div class=\"$responsive a11y-toolbar$is_rtl$is_right\" role=\"menu\">';
290
+ insert_a11y_toolbar += '<ul class=\"a11y-toolbar-list\">';";
291
+ if ( get_option( 'wpa_toolbar' ) == 'on' && $enable_fontsize ) {
292
+ echo "insert_a11y_toolbar += '<li class=\"a11y-toolbar-list-item\" role=\"menuitem\"><button type=\"button\" class=\"a11y-toggle-contrast toggle-contrast\" id=\"is_normal_contrast\" aria-pressed=\"false\"><span class=\"offscreen\">$contrast</span><span class=\"aticon aticon-adjust\" aria-hidden=\"true\"></span></button></li>';";
293
+ }
294
  if ( get_option( 'wpa_toolbar' ) == 'on' && $enable_grayscale ) {
295
+ echo "insert_a11y_toolbar += '<li class=\"a11y-toolbar-list-item\" role=\"menuitem\"><button type=\"button\" 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></button></li>';";
296
+ }
297
+ if ( get_option( 'wpa_toolbar' ) == 'on' && $enable_contrast ) {
298
+ echo "insert_a11y_toolbar += '<li class=\"a11y-toolbar-list-item\" role=\"menuitem\"><button type=\"button\" class=\"a11y-toggle-fontsize toggle-fontsize\" id=\"is_normal_fontsize\" aria-pressed=\"false\"><span class=\"offscreen\">$fontsize</span><span class=\"aticon aticon-font\" aria-hidden=\"true\"></span></button></li>';";
299
  }
300
  echo "
 
301
  insert_a11y_toolbar += '</ul>';
302
  insert_a11y_toolbar += '</div>';
303
  insert_a11y_toolbar += '<!-- // a11y toolbar -->';
311
  $styles = '';
312
  if ( get_option( 'asl_enable' ) == 'on' ) {
313
  $focus = get_option( 'asl_styles_focus' );
314
+ // these styles are derived from the WordPress skip link defaults
315
+ $default_focus = "background-color: #f1f1f1; box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6); clip: auto; color: #21759b; display: block; font-size: 14px; font-weight: bold; height: auto; line-height: normal; padding: 15px 23px 14px; position: absolute; left: 5px; top: 5px; text-decoration: none; text-transform: none; width: auto; z-index: 100000;";
316
  if ( ! $focus ) {
317
+ $focus = $default_focus;
318
+ } else {
319
+ $focus = $default_focus . $focus;
320
  }
321
  $passive = get_option( 'asl_styles_passive' );
322
  $vis = $invis = '';
326
  } else {
327
  $invis = '#skiplinks a:hover,';
328
  }
329
+ $visibility = ( get_option( 'asl_visible' ) == 'on' ) ? 'wpa-visible' : 'wpa-hide';
330
+ $is_rtl = ( is_rtl() ) ? '-rtl' : '-ltr';
331
+ $class = '.' . $visibility . $is_rtl;
332
  $styles .= "
333
+ $class#skiplinks a, $invis $class#skiplinks a:visited { $passive }
334
+ $class#skiplinks a:active, $vis $class#skiplinks a:focus { $focus }
335
  ";
336
  }
337
  if ( get_option( 'wpa_focus' ) == 'on' ) {
372
  $html .= ( $sitemap != '' ) ? "<a href=\"$sitemap\">" . __( 'Site map', 'wp-accessibility' ) . "</a> " : '';
373
  $html .= ( $extra != '' && $extra_text != '' ) ? "<a href=\"$extra\">$extra_text</a> " : '';
374
  $is_rtl = ( is_rtl() ) ? '-rtl' : '-ltr';
375
+ $skiplinks = __( 'Skip links', 'wp-accessibility' );
376
+ $output = ( $html != '' ) ? "<div class=\"$visibility$is_rtl\" id=\"skiplinks\" role=\"navigation\" aria-label=\"$skiplinks\">$html</div>" : '';
377
  // attach skiplinks HTML; set tabindex on #content area to -1
378
  $focusable = ( $content != '' ) ? "$('#$content').attr('tabindex','-1');" : '';
379
  $focusable .= ( $nav != '' ) ? "$('#$nav').attr('tabindex','-1');" : '';
386
  $lang_js = "$('html').attr( 'lang','$lang' ); $('html').attr( 'dir','$dir' )";
387
  }
388
  // force links to open in the same window
389
+ $underline_target = apply_filters( 'wpa_underline_target', 'a' );
390
  $targets = ( get_option( 'wpa_target' ) == 'on' ) ? "$('a').removeAttr('target');" : '';
391
  $tabindex = ( get_option( 'wpa_tabindex' ) == 'on' ) ? "$('input,a,select,textarea,button').removeAttr('tabindex');" : '';
392
+ $underlines = ( get_option( 'wpa_underline' ) == 'on' ) ? "$('$underline_target').css( 'text-decoration','underline' );$('$underline_target').on( 'focusin mouseenter', function() { $(this).css( 'text-decoration','none' ); });$('$underline_target').on( 'focusout mouseleave', function() { $(this).css( 'text-decoration','underline' ); } );" : '';
393
 
394
  $display = ( $skiplinks_js || $targets || $lang_js || $tabindex || $longdesc ) ? true : false;
395
  if ( $display ) {
413
  // http://www.coolfields.co.uk/2013/02/wordpress-permanently-visible-log-out-link-plugin-version-0-1/
414
  add_action( 'admin_bar_menu', 'wpa_logout_item', 11 );
415
  function wpa_logout_item( $admin_bar ) {
416
+ if ( ! is_user_logged_in() ) {
417
+ return;
418
+ }
419
+
420
  $args = array(
421
  'id' => 'wpa-logout',
422
  'title' => 'Log Out',
431
  wp_register_style( 'ui-font.css', plugins_url( 'toolbar/fonts/css/a11y-toolbar.css', __FILE__ ) );
432
  $toolbar = apply_filters( 'wpa_toolbar_css', plugins_url( 'toolbar/css/a11y.css', __FILE__ ) );
433
  wp_register_style( 'ui-a11y.css', $toolbar, array( 'ui-font.css' ) );
434
+ $fontsize_stylesheet = ( get_option( 'wpa_alternate_fontsize' ) == 'on' ) ? 'a11y-fontsize-alt' : 'a11y-fontsize';
435
+ $fontsize = apply_filters( 'wpa_fontsize_css', plugins_url( 'toolbar/css/'. $fontsize_stylesheet . '.css', __FILE__ ) );
436
  wp_register_style( 'ui-fontsize.css', $fontsize );
437
  // only enable styles when required by options
438
  if ( get_option( 'wpa_toolbar_size' ) && get_option( 'wpa_toolbar' ) == 'on' ) {
592
  return false;
593
  }
594
 
595
+ if ( 'on' == get_option( 'wpa_search' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
596
  add_filter( 'pre_get_posts', 'wpa_filter' );
597
  }
598
 
599
  function wpa_filter( $query ) {
600
  if ( ! is_admin() ) {
601
+ if ( isset( $_GET['s'] ) && NULL == trim( $_GET['s'] ) && ( $query->is_main_query() ) ) {
602
  $query->query_vars['s'] = '&#32;';
603
  $query->set( 'is_search', 1 );
604
  add_action( 'template_include', 'wpa_search_error' );
673
  }
674
  }
675
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
676
  // Obsolete with 3.8: (nav menus, page lists, edit post links, edit comment links, category links)
677
  if ( get_option( 'rta_from_nav_menu' ) == 'on' && version_compare( get_bloginfo( 'version' ), '3.8.0', '<' ) ) {
678
  add_filter( 'wp_nav_menu', 'wpa_remove_title_attributes' );
725
 
726
  function wpa_get_support_form() {
727
  global $current_user, $wpa_version;
728
+ $current_user = wp_get_current_user();
729
  $request = '';
730
  $version = $wpa_version;
731
  // send fields for all plugins
783
  ==Active Plugins:==
784
  $plugins_string
785
  ";
786
+ if ( isset( $_POST['wpa_support'] ) ) {
787
  $nonce = $_REQUEST['_wpnonce'];
788
  if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
789
  die( "Security check failed" );
820
  <form method='post' action='$admin_url'>
821
  <div><input type='hidden' name='_wpnonce' value='" . wp_create_nonce( 'wpa-nonce' ) . "' /></div>
822
  <div>";
 
 
 
 
823
  echo "
824
  <p>
825
  <code>" . __( 'From:', 'wp-accessibility' ) . " \"$current_user->display_name\" &lt;$current_user->user_email&gt;</code>
834
  <label for='support_request'>" . __( 'Support Request:', 'wp-accessibility' ) . "</label><br /><textarea name='support_request' required aria-required='true' id='support_request' cols='80' rows='10'>" . stripslashes( $request ) . "</textarea>
835
  </p>
836
  <p>
837
+ <input type='submit' value='" . __( 'Send Support Request', 'wp-accessibility' ) . "' name='wpa_support' class='button-primary' />
838
  </p>
839
  <p>" .
840
  __( 'The following additional information will be sent with your support request:', 'wp-accessibility' )
847
  }
848
 
849
 
850
+ add_filter( 'wp_get_attachment_image_attributes', 'wpa_featured_longdesc', 10, 3 );
851
+ function wpa_featured_longdesc( $attr, $attachment, $size ) {
852
+ if ( get_option( 'wpa_longdesc_featured' ) == 'on' ) {
853
+ $attachment_id = $attachment->ID;
854
+ $args = array( 'longdesc' => $attachment_id );
855
+ /* The referrer is the post that the image is inserted into. */
856
+ if ( isset( $_REQUEST['post_id'] ) || get_the_ID() ) {
857
+ $id = ( isset( $_REQUEST['post_id'] ) ) ? $_REQUEST['post_id'] : get_the_ID();
858
+ $args['referrer'] = intval( $id );
859
+ }
860
+
861
+ $target = add_query_arg( $args, home_url() );
862
+ $id = longdesc_return_anchor( $attachment_id );
863
+
864
+ $attr['longdesc'] = $target;
865
+ $attr['id'] = $id;
866
+ }
867
+
868
+ return $attr;
869
+ }
870
+
871
+
872
  /* longdesc support, based on work by Michael Fields (http://wordpress.org/plugins/long-description-for-image-attachments/) */
873
 
874
  define( 'WPA_TEMPLATES', trailingslashit( dirname( __FILE__ ) ) . 'templates/' );
975
  if ( isset( $image->ID ) && ! empty( $image->ID ) ) {
976
  $args = array( 'longdesc' => $image->ID );
977
  /* The referrer is the post that the image is inserted into. */
978
+ if ( isset( $_REQUEST['post_id'] ) || get_the_ID() ) {
979
+ $id = ( isset( $_REQUEST['post_id'] ) ) ? $_REQUEST['post_id'] : get_the_ID();
980
+ $args['referrer'] = intval( $id );
981
  }
982
  if ( ! empty( $image->post_content ) ) {
983
+ $search = '<img ';
984
+ $replace = '<img tabindex="-1" id="' . esc_attr( longdesc_return_anchor( $image->ID ) ) . '" longdesc="' . esc_url( add_query_arg( $args, home_url() ) ) . '"';
985
  $html = str_replace( $search, $replace, $html );
 
986
  }
987
  }
988