WP Accessibility - Version 1.7.13

Version Description

  • Bug fix: empty space in toolbar attachment point field created uncaught exception in JS.
Download this release

Release Info

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

Code changes from version 1.7.7 to 1.7.13

css/wp-admin-row-actions.css DELETED
@@ -1,14 +0,0 @@
1
- /*
2
- Make Row Actions permanently visible - provided by WP Accessibility / Joe Dolson
3
- */
4
- .row-actions {
5
- visibility: visible;
6
- }
7
-
8
- .row-actions a {
9
- opacity: .8;
10
- }
11
-
12
- .row-actions a:hover, .row-actions a:focus {
13
- opacity: 1;
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/wpa-style.css CHANGED
@@ -1,114 +1,148 @@
 
1
  .wpa-hide-rtl#skiplinks a, .wpa-hide-rtl#skiplinks a:hover, .wpa-hide-rtl#skiplinks a:visited {
2
- position: absolute !important;
3
- right: -999em;
4
- }
5
-
6
- .wpa-hide-ltr#skiplinks a, .wpa-hide-ltr#skiplinks a:hover, .wpa-hide-ltr#skiplinks a:visited {
7
- position: absolute !important;
8
- left: -999em;
9
- }
10
-
11
- .wpa-hide#skiplinks a:active, .wpa-hide#skiplinks a:focus {
12
- position: absolute;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  }
14
 
15
  .wpa-ld {
16
- display: inline-block;
17
- position: relative;
18
  }
19
 
20
  /* basic support for themes that don't define alignleft and alignright for non-image elements. */
21
  div.alignleft {
22
- float: left;
23
  }
24
 
25
  div.alignright {
26
- float: right;
27
  }
28
 
29
  div.aligncenter {
30
- display: block;
31
- margin: 0 auto;
32
  width: fit-content;
33
  }
34
 
35
  .wpa-ld a, .wpa-ld button {
36
- bottom: 2px;
37
- left: 2px;
38
- position: absolute;
39
- line-height: 1;
40
- min-width: 1em;
41
  }
42
 
43
  .wpa-ld img {
44
- display: block;
45
  }
46
 
47
  .wpa-ld button, .wpa-ld button:active, .wpa-ld button:focus, .wpa-ld button:hover {
48
- border: 1px solid #777;
49
- border-radius: 2px;
50
- z-index: 10;
51
  }
52
 
53
  .wpa-ld .longdesc {
54
- position: absolute;
55
- width: 100%;
56
- height: 100%;
57
- top: 0;
58
- overflow-y: scroll;
59
- -moz-box-sizing: border-box;
60
- -webkit-box-sizing: border-box;
61
- box-sizing: border-box;
62
- background: rgba(255, 255, 255, .95);
63
- padding: 1.5em;
 
 
 
 
 
64
  }
65
 
66
  .wpa-ld button, .wpa-ld button:active, .wpa-ld button:focus, .wpa-ld button:hover, .wpa-ld a {
67
- font-size: .9em;
68
- font-weight: 400;
69
- background: rgba(255, 255, 255, .7) !important;
70
- padding: 0;
71
- color: #000 !important;
72
- text-shadow: 1px 1px #ccc;
73
  }
74
 
75
  .wpa-ld button:before {
76
- content: 'i';
77
- font-style: italic;
78
- font-family: serif;
79
- }
80
 
81
  .wpa-ld button:focus, .wpa-ld button:hover {
82
- background: rgba(0, 0, 0, .75) !important;
83
- color: #fff !important;
84
- border: 1px solid #000 !important;
85
- cursor: pointer;
86
  }
87
 
88
  .wpa-ld button:focus {
89
- padding: 6px;
90
  }
91
 
92
  .wpa-ld button span, .longdesc-link span {
93
- position: absolute !important;
94
- height: 1px;
95
- width: 1px;
96
- overflow: hidden;
97
- clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
98
- clip: rect(1px, 1px, 1px, 1px);
99
  }
100
 
101
  .template-longdesc {
102
- text-align: left;
103
- line-height: 1.5;
104
- width: 100%;
105
- max-width: 50em;
106
- padding: 2em;
107
- margin: 1em auto;
108
- background: #fdfdfd;
109
- color: #333;
110
- box-shadow: 0 0 5px;
111
- font-size: 1.4em;
112
- }
113
-
114
- label.wpa-screen-reader-text { position: absolute!important; clip: rect(1px,1px,1px,1px); overflow: hidden; color: #000; background: #fff; width: 1px; height: 1px; }
 
 
 
 
 
 
 
 
 
 
 
1
+ .wpa-hide-ltr#skiplinks a, .wpa-hide-ltr#skiplinks a:hover, .wpa-hide-ltr#skiplinks a:visited,
2
  .wpa-hide-rtl#skiplinks a, .wpa-hide-rtl#skiplinks a:hover, .wpa-hide-rtl#skiplinks a:visited {
3
+ border: 0;
4
+ clip: rect(1px, 1px, 1px, 1px);
5
+ clip-path: inset(50%);
6
+ height: 1px;
7
+ margin: -1px;
8
+ overflow: hidden;
9
+ padding: 0;
10
+ position: absolute;
11
+ width: 1px;
12
+ word-wrap: normal !important;
13
+ }
14
+
15
+ .wpa-hide-ltr#skiplinks a:focus,
16
+ .wpa-hide-rtl#skiplinks a:focus {
17
+ background-color: #eee;
18
+ clip: auto !important;
19
+ clip-path: none;
20
+ color: #444;
21
+ display: block;
22
+ font-size: 1em;
23
+ height: auto;
24
+ left: 5px;
25
+ line-height: normal;
26
+ padding: 15px 23px 14px;
27
+ text-decoration: none;
28
+ top: 5px;
29
+ width: auto;
30
+ z-index: 100000; /* Above WP toolbar. */
31
  }
32
 
33
  .wpa-ld {
34
+ display: inline-block;
35
+ position: relative;
36
  }
37
 
38
  /* basic support for themes that don't define alignleft and alignright for non-image elements. */
39
  div.alignleft {
40
+ float: left;
41
  }
42
 
43
  div.alignright {
44
+ float: right;
45
  }
46
 
47
  div.aligncenter {
48
+ display: block;
49
+ margin: 0 auto;
50
  width: fit-content;
51
  }
52
 
53
  .wpa-ld a, .wpa-ld button {
54
+ bottom: 2px;
55
+ left: 2px;
56
+ position: absolute;
57
+ line-height: 1;
58
+ min-width: 1em;
59
  }
60
 
61
  .wpa-ld img {
62
+ display: block;
63
  }
64
 
65
  .wpa-ld button, .wpa-ld button:active, .wpa-ld button:focus, .wpa-ld button:hover {
66
+ border: 1px solid #777;
67
+ border-radius: 2px;
68
+ z-index: 10;
69
  }
70
 
71
  .wpa-ld .longdesc {
72
+ position: absolute;
73
+ width: 100%;
74
+ height: 100%;
75
+ top: 0;
76
+ overflow-y: scroll;
77
+ -moz-box-sizing: border-box;
78
+ -webkit-box-sizing: border-box;
79
+ box-sizing: border-box;
80
+ background: rgba(255, 255, 255, .95);
81
+ padding: 1.5em;
82
+ text-align: left;
83
+ }
84
+
85
+ .rtl .wpa-ld .longdesc {
86
+ text-align: right;
87
  }
88
 
89
  .wpa-ld button, .wpa-ld button:active, .wpa-ld button:focus, .wpa-ld button:hover, .wpa-ld a {
90
+ font-size: .9em;
91
+ font-weight: 400;
92
+ background: rgba(255, 255, 255, .7) !important;
93
+ padding: 0;
94
+ color: #000 !important;
95
+ text-shadow: 1px 1px #ccc;
96
  }
97
 
98
  .wpa-ld button:before {
99
+ content: 'i';
100
+ font-style: italic;
101
+ font-family: serif;
102
+ }
103
 
104
  .wpa-ld button:focus, .wpa-ld button:hover {
105
+ background: rgba(0, 0, 0, .75) !important;
106
+ color: #fff !important;
107
+ border: 1px solid #000 !important;
108
+ cursor: pointer;
109
  }
110
 
111
  .wpa-ld button:focus {
112
+ padding: 6px;
113
  }
114
 
115
  .wpa-ld button span, .longdesc-link span {
116
+ position: absolute !important;
117
+ height: 1px;
118
+ width: 1px;
119
+ overflow: hidden;
120
+ clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
121
+ clip: rect(1px, 1px, 1px, 1px);
122
  }
123
 
124
  .template-longdesc {
125
+ text-align: left;
126
+ line-height: 1.5;
127
+ width: 100%;
128
+ max-width: 50em;
129
+ padding: 2em;
130
+ margin: 1em auto;
131
+ background: #fdfdfd;
132
+ color: #333;
133
+ box-shadow: 0 0 5px;
134
+ font-size: 1.4em;
135
+ }
136
+
137
+ label.wpa-screen-reader-text {
138
+ border: 0;
139
+ clip: rect(1px, 1px, 1px, 1px);
140
+ clip-path: inset(50%);
141
+ height: 1px;
142
+ margin: -1px;
143
+ overflow: hidden;
144
+ padding: 0;
145
+ position: absolute;
146
+ width: 1px;
147
+ word-wrap: normal !important;
148
+ }
css/wpa-styles.css CHANGED
@@ -11,6 +11,33 @@
11
  font-weight: 700;
12
  }
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  li.fore {
15
  float: left;
16
  width: 200px;
11
  font-weight: 700;
12
  }
13
 
14
+ #wpa_settings_page label span {
15
+ background: #0000000a;
16
+ padding: 2px;
17
+ margin-left: .5em;
18
+ }
19
+
20
+ .wpa-donate a {
21
+ font-size: 1.2rem;
22
+ padding: .5rem .1rem .6rem;
23
+ background: #233c7f;
24
+ color: #fff;
25
+ border: 2px solid #79b3e1;
26
+ display: block;
27
+ text-align: center;
28
+ text-decoration: none;
29
+ border-radius: 5px;
30
+ }
31
+
32
+ .wpa-donate a:hover {
33
+ text-decoration: underline;
34
+ }
35
+
36
+ p.wpa-donate {
37
+ margin: 1em 0 0;
38
+ }
39
+
40
+
41
  li.fore {
42
  float: left;
43
  width: 200px;
js/longdesc.button.js CHANGED
@@ -11,6 +11,11 @@
11
  image_id = value;
12
  }
13
  });
 
 
 
 
 
14
  img.attr('class', '');
15
  img.wrap('<div class="wpa-ld" />')
16
  img.parent('.wpa-ld').addClass(classes);
@@ -46,7 +51,6 @@
46
  var container = img.parent('.wpa-ld').children('.longdesc');
47
  container.hide();
48
  container.load( longdesc + ' #desc_' + image_id );
49
- console.log( longdesc + ' #desc_' + image_id );
50
  img.parent('.wpa-ld').children('button').on( 'click', function(e) {
51
  e.preventDefault();
52
  var visible = container.is( ':visible' );
@@ -67,11 +71,14 @@
67
  var attachment = {
68
  attachment: response
69
  }
70
-
71
- var url = new URL( response.link );
72
- url.searchParams.set( 'longdesc', id );
73
- url.toString();
74
- wpa_draw_longdesc( img, id, url );
 
 
 
75
  })
76
  .fail( function() {
77
  alert( 'cannot load media' )
11
  image_id = value;
12
  }
13
  });
14
+ // Secondary check for image ID, if not in classes.
15
+ if ( '' === image_id ) {
16
+ var imgId = img.attr( 'id' );
17
+ image_id = imgId.replace( 'longdesc-return-', '' );
18
+ }
19
  img.attr('class', '');
20
  img.wrap('<div class="wpa-ld" />')
21
  img.parent('.wpa-ld').addClass(classes);
51
  var container = img.parent('.wpa-ld').children('.longdesc');
52
  container.hide();
53
  container.load( longdesc + ' #desc_' + image_id );
 
54
  img.parent('.wpa-ld').children('button').on( 'click', function(e) {
55
  e.preventDefault();
56
  var visible = container.is( ':visible' );
71
  var attachment = {
72
  attachment: response
73
  }
74
+ var rawdesc = response.description.rendered;
75
+ rawdesc = rawdesc.replace(/(<([^>]+)>)/gi, '').trim();
76
+ if ( '' !== rawdesc ) {
77
+ var url = new URL( response.link );
78
+ url.searchParams.set( 'longdesc', id );
79
+ url.toString();
80
+ wpa_draw_longdesc( img, id, url );
81
+ }
82
  })
83
  .fail( function() {
84
  alert( 'cannot load media' )
js/longdesc.link.js CHANGED
@@ -44,11 +44,14 @@
44
  var attachment = {
45
  attachment: response
46
  }
47
-
48
- var url = new URL( response.link );
49
- url.searchParams.set( 'longdesc', id );
50
- url.toString();
51
- wpa_draw_longdesc( img, id, url );
 
 
 
52
  })
53
  .fail( function() {
54
  alert( 'cannot load media' )
44
  var attachment = {
45
  attachment: response
46
  }
47
+ var rawdesc = response.description.rendered;
48
+ rawdesc = rawdesc.replace(/(<([^>]+)>)/gi, '').trim();
49
+ if ( '' !== rawdesc ) {
50
+ var url = new URL( response.link );
51
+ url.searchParams.set( 'longdesc', id );
52
+ url.toString();
53
+ wpa_draw_longdesc( img, id, url );
54
+ }
55
  })
56
  .fail( function() {
57
  alert( 'cannot load media' )
js/roles.jquery.js DELETED
@@ -1,21 +0,0 @@
1
- (function ($) {
2
- 'use strict';
3
- $('nav').each(function () {
4
- $(this).attr('role', 'navigation');
5
- });
6
- $('main').each(function () {
7
- $(this).attr('role', 'main');
8
- });
9
- $('header:first').each(function () {
10
- $(this).attr('role', 'banner');
11
- });
12
- $('footer:last').each(function () {
13
- $(this).attr('role', 'contentinfo');
14
- });
15
- $('input[name=s]').parents('form').attr('role', 'search');
16
- if (wpaComplementary.container != false) {
17
- $('#' + wpaComplementary.container).each(function () {
18
- $(this).attr('role', 'complementary');
19
- });
20
- }
21
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/wp-accessibility.js ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function( $ ) { 'use strict';
2
+
3
+ if ( wpa.skiplinks.enabled ) {
4
+ $('body').prepend( wpa.skiplinks.output );
5
+ }
6
+
7
+ var html = document.querySelector( 'html' );
8
+ var lang = html.getAttribute( 'lang' );
9
+ if ( ! lang ) {
10
+ $('html').attr( 'lang', wpa.lang );
11
+ }
12
+ var dir = html.getAttribute( 'dir' );
13
+ if ( ! dir ) {
14
+ $('html').attr( 'dir', wpa.dir );
15
+ }
16
+
17
+ var viewport = document.querySelector( 'meta[name="viewport"]' );
18
+ if ( viewport ) {
19
+ var conditions = viewport.getAttribute( 'content' );
20
+ if ( conditions.search(/user-scalable=no/g) ) {
21
+ conditions = conditions.replace( 'user-scalable=no', 'user-scalable=yes' );
22
+ viewport.setAttribute( 'content', conditions );
23
+ }
24
+ }
25
+ if ( wpa.target ) {
26
+ $('a:not(.wpa-allow-target)').removeAttr( 'target' );
27
+ }
28
+
29
+ if ( wpa.tabindex ) {
30
+ $('input,a,select,textarea,button').removeAttr('tabindex');
31
+ }
32
+
33
+ if ( wpa.underline.enabled ) {
34
+ $( wpa.underline.target ).css( 'text-decoration','underline' );
35
+ $( wpa.underline.target ).on( 'focusin mouseenter', function() {
36
+ $(this).css( 'text-decoration','none' );
37
+ });
38
+ $( wpa.underline.target ).on( 'focusout mouseleave', function() {
39
+ $(this).css( 'text-decoration','underline' );
40
+ });
41
+ }
42
+
43
+ }(jQuery));
js/wpa-toolbar.js CHANGED
@@ -1,6 +1,7 @@
1
- (function( $ ) { 'use strict';
2
- var insert_a11y_toolbar = '<!-- a11y toolbar -->';
3
- insert_a11y_toolbar += '<div class="' + wpa.responsive + 'a11y-toolbar' + wpa.is_rtl + wpa.is_right + '">';
 
4
  insert_a11y_toolbar += '<ul class="a11y-toolbar-list">';
5
  if ( wpa.enable_contrast == 'true' ) {
6
  insert_a11y_toolbar += '<li class="a11y-toolbar-list-item"><button type="button" class="a11y-toggle-contrast toggle-contrast" id="is_normal_contrast" aria-pressed="false"><span class=\"offscreen\">' + wpa.contrast + '</span><span class="aticon aticon-adjust" aria-hidden="true"></span></button></li>';
@@ -12,7 +13,13 @@
12
  insert_a11y_toolbar += '<li class="a11y-toolbar-list-item"><button type="button" class="a11y-toggle-fontsize toggle-fontsize" id="is_normal_fontsize" aria-pressed="false"><span class="offscreen">' + wpa.fontsize + '</span><span class="aticon aticon-font" aria-hidden="true"></span></button></li>';
13
  }
14
  insert_a11y_toolbar += '</ul>';
15
- insert_a11y_toolbar += '</div>';
16
- insert_a11y_toolbar += '<!-- // a11y toolbar -->';
17
- $( document ).find( wpa.location ).prepend( insert_a11y_toolbar );
18
- }(jQuery));
 
 
 
 
 
 
1
+ (function () {
2
+ var a11y_toolbar = document.createElement( 'div' );
3
+ var insert_a11y_toolbar = '';
4
+
5
  insert_a11y_toolbar += '<ul class="a11y-toolbar-list">';
6
  if ( wpa.enable_contrast == 'true' ) {
7
  insert_a11y_toolbar += '<li class="a11y-toolbar-list-item"><button type="button" class="a11y-toggle-contrast toggle-contrast" id="is_normal_contrast" aria-pressed="false"><span class=\"offscreen\">' + wpa.contrast + '</span><span class="aticon aticon-adjust" aria-hidden="true"></span></button></li>';
13
  insert_a11y_toolbar += '<li class="a11y-toolbar-list-item"><button type="button" class="a11y-toggle-fontsize toggle-fontsize" id="is_normal_fontsize" aria-pressed="false"><span class="offscreen">' + wpa.fontsize + '</span><span class="aticon aticon-font" aria-hidden="true"></span></button></li>';
14
  }
15
  insert_a11y_toolbar += '</ul>';
16
+ a11y_toolbar.classList.add( wpa.response, 'a11y-toolbar', wpa.is_rtl, wpa.is_right );
17
+ a11y_toolbar.innerHTML = insert_a11y_toolbar;
18
+
19
+ var insertionPoint = document.querySelector( wpa.location );
20
+ if ( null !== insertionPoint ) {
21
+ insertionPoint.insertAdjacentElement( 'afterbegin', a11y_toolbar );
22
+ } else {
23
+ console.log( 'WP Accessibility Toolbar insertion point not valid.' );
24
+ }
25
+ })();
js/wpa.labels.js CHANGED
@@ -4,18 +4,34 @@
4
  if ( value == 'comment' ) {
5
  var field = $( 'textarea[name=' + value + ']' );
6
  } else {
7
- var field = $( 'input[name=' + value + ']' );
8
  }
9
- var form_id = field.attr( 'id' );
10
- var implicit = $( field ).parent( 'label' );
11
- if ( form_id ) {
12
- var label = $( 'label[for=' + form_id + ']' );
13
- if ( !label.length && !implicit.length ) {
14
- field.before( "<label for='" + form_id + "' class='wpa-screen-reader-text'>" + wpalabels[value] + "</label>" );
 
 
15
  }
16
- } else {
17
- if ( !implicit.length ) {
18
- field.attr( 'id', 'wpa_label_' + value ).before( "<label for='wpa_label_" + value + "' class='wpa-screen-reader-text'>" + wpalabels[value] + "</label>" );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  }
20
  }
21
  });
4
  if ( value == 'comment' ) {
5
  var field = $( 'textarea[name=' + value + ']' );
6
  } else {
7
+ var field = $( 'input[name=' + value + ']' ).not( '#adminbar-search' );
8
  }
9
+ if ( 0 !== field.length ) {
10
+ var form_id = field.attr( 'id' );
11
+ var implicit = $( field ).parent( 'label' );
12
+ var aria = $( field ).attr( 'aria-label' );
13
+ var ariaId = $( field ).attr( 'aria-labelledby' );
14
+ var ariaTarget = {};
15
+ if ( ariaId ) {
16
+ ariaTarget = $( '#' + ariaId );
17
  }
18
+ var hasAria = ( '' == aria || 'undefined' == typeof( aria ) ) ? false : true;
19
+ var hasAriaId = ( '' == ariaId || 'undefined' == typeof( ariaId ) ) ? false : true;
20
+ // Add label if aria label empty, aria labelledby empty, or aria reference ID does not exist.
21
+ if ( ( ! hasAria && ! hasAriaId ) || ( ! hasAria && ( hasAriaId && 0 === ariaTarget.length ) ) ) {
22
+ if ( hasAriaId && 0 === ariaTarget.length ) {
23
+ console.log( 'aria-labelledby target ID does not exist: ', ariaId );
24
+ }
25
+ if ( form_id ) {
26
+ var label = $( 'label[for=' + form_id + ']' );
27
+ if ( !label.length && !implicit.length ) {
28
+ field.before( "<label for='" + form_id + "' class='wpa-screen-reader-text'>" + wpalabels[value] + "</label>" );
29
+ }
30
+ } else {
31
+ if ( !implicit.length ) {
32
+ field.attr( 'id', 'wpa_label_' + value ).before( "<label for='wpa_label_" + value + "' class='wpa-screen-reader-text'>" + wpalabels[value] + "</label>" );
33
+ }
34
+ }
35
  }
36
  }
37
  });
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: joedolson
3
  Donate link: http://www.joedolson.com/donate/
4
  Tags: title, accessibility, accessible, navigation, wcag, a11y, section508, focus, alt text, labels, aria
5
  Requires at least: 3.4.2
6
- Requires PHP: 5.3
7
- Tested up to: 5.7
8
- Stable tag: 1.7.7
9
  Text Domain: wp-accessibility
10
  License: GPLv2 or later
11
 
@@ -32,14 +32,15 @@ These are features that address issues caused by inaccessible themes.
32
  * Add labels to standard WordPress form fields (search, comments)
33
  * Add post titles to "read more" links.
34
  * Remove tabindex from elements that are focusable. (Also fixes plugin-caused problems.)
 
35
 
36
  = WordPress Core Accessibility Issues fixed by WP Accessibility =
37
 
38
  These are features that address issues caused by current or past WordPress core accessibility issues. (Issues added in content, such as target or title attributes, are persistent even when WordPress is updated.)
39
 
40
  * Force a search page error when a search is made with an empty text string. (If your theme has a search.php template.)
41
- * Remove redundant title attributes from page lists, category lists, and archive menus.
42
- * Address some accessibility issues in the WordPress admin styles
43
 
44
  Content specific fixes:
45
 
@@ -51,7 +52,8 @@ Content specific fixes:
51
  These are tools provided to help you identify issues you may need to fix.
52
 
53
  * Test the color contrast between two provided hexadecimal color values.
54
- * Enable diagnostic CSS to show CSS-detectable problems in visual editor or on front-end of site.
 
55
 
56
  Learn more! <a href="http://make.wordpress.org/accessibility/wp-accessibility-plugin/">Read about the accessibility issues corrected</a> by WP Accessibility!
57
 
@@ -74,6 +76,43 @@ The plug-in is intended to help with deficiencies commonly found in themes and t
74
 
75
  [Suggest a change!](https://github.com/joedolson/wp-accessibility/issues/)
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  = 1.7.7 =
78
 
79
  * Bug fix: Correct usage of wp_localize_script arguments.
3
  Donate link: http://www.joedolson.com/donate/
4
  Tags: title, accessibility, accessible, navigation, wcag, a11y, section508, focus, alt text, labels, aria
5
  Requires at least: 3.4.2
6
+ Requires PHP: 5.6
7
+ Tested up to: 5.9
8
+ Stable tag: 1.7.13
9
  Text Domain: wp-accessibility
10
  License: GPLv2 or later
11
 
32
  * Add labels to standard WordPress form fields (search, comments)
33
  * Add post titles to "read more" links.
34
  * Remove tabindex from elements that are focusable. (Also fixes plugin-caused problems.)
35
+ * Remove user-scalable=no to allow resizing.
36
 
37
  = WordPress Core Accessibility Issues fixed by WP Accessibility =
38
 
39
  These are features that address issues caused by current or past WordPress core accessibility issues. (Issues added in content, such as target or title attributes, are persistent even when WordPress is updated.)
40
 
41
  * Force a search page error when a search is made with an empty text string. (If your theme has a search.php template.)
42
+ * Remove redundant title attributes from tag clouds.
43
+ * Disable default enabling of full screen block editor.
44
 
45
  Content specific fixes:
46
 
52
  These are tools provided to help you identify issues you may need to fix.
53
 
54
  * Test the color contrast between two provided hexadecimal color values.
55
+ * Enable diagnostic CSS to show CSS-detectable problems in visual editor or on front-end of site.
56
+ * Search your media library on content in alt text fields.
57
 
58
  Learn more! <a href="http://make.wordpress.org/accessibility/wp-accessibility-plugin/">Read about the accessibility issues corrected</a> by WP Accessibility!
59
 
76
 
77
  [Suggest a change!](https://github.com/joedolson/wp-accessibility/issues/)
78
 
79
+ = 1.7.13 =
80
+
81
+ * Bug fix: empty space in toolbar attachment point field created uncaught exception in JS.
82
+
83
+ = 1.7.12 =
84
+
85
+ * Bug fix: Improved automatic labeling; checks for existing aria-label or aria-labelledby values.
86
+ * Improved escaping and sanitizing.
87
+ * Change: add 'no-scroll' to skip links to prevent enfold from scrolling.
88
+ * Feature: Option to search media library on alternative text.
89
+ * Feature: Detect and replace user-scalable=no if found.
90
+
91
+ = 1.7.11 =
92
+
93
+ * Bug fix: Better handling of invalid toolbar attachment points.
94
+ * Change: Use title casing for Skip to Content link to clarify pronunciation by JAWS.
95
+ * New: Option to disable full screen block editor by default.
96
+
97
+ = 1.7.10 =
98
+
99
+ * Bug fix: If attachment ID not in classes, get from img ID attribute.
100
+ * Insert toolbar without jQuery.
101
+
102
+ = 1.7.9 =
103
+
104
+ * Bug fix: potentially undeclared variable in 1.7.8.
105
+
106
+ = 1.7.8 =
107
+
108
+ * Bug fix: Avoid showing longdesc interface if no description defined.
109
+ * Bug fix: Update screen reader text classes from antiquated versions.
110
+ * Removal: Adding role attributes to HTML5 structures is no longer significant.
111
+ * Removal: Remove option to make row actions visible. Now available via screen options in core.
112
+ * Removal: Remove tabindex=-1 on skiplink targets. No longer required.
113
+ * Improvement: Catch more potentially invalid or suspicious alt text patterns.
114
+ * Refactor: Move footer scripts into external JS file.
115
+
116
  = 1.7.7 =
117
 
118
  * Bug fix: Correct usage of wp_localize_script arguments.
wp-accessibility-alt.php CHANGED
@@ -45,6 +45,7 @@ function wpa_media_value( $column, $id ) {
45
  '&nbsp;',
46
  ' ',
47
  '-',
 
48
  );
49
  switch ( $mime ) {
50
  case 'image/jpeg':
@@ -57,8 +58,10 @@ function wpa_media_value( $column, $id ) {
57
  } else {
58
  if ( true === $no_alt ) {
59
  echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> ' . __( 'Decorative', 'wp-accessibility' ) . '</span>';
60
- } elseif ( in_array( $alt, $invalid_values, true ) ) {
61
- echo '<span class="missing"><span class="dashicons dashicons-no" aria-hidden="true"></span> ' . __( 'Invalid', 'wp-accessibility' ) . '</span>';
 
 
62
  } else {
63
  echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> ' . __( 'Has <code>alt</code>', 'wp-accessibility' ) . '</span>';
64
  }
@@ -72,6 +75,38 @@ function wpa_media_value( $column, $id ) {
72
  return $column;
73
  }
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  add_filter( 'attachment_fields_to_edit', 'wpa_insert_alt_verification', 10, 2 );
76
  /**
77
  * Insert custom fields into attachment editor for alt verification.
45
  '&nbsp;',
46
  ' ',
47
  '-',
48
+ '--',
49
  );
50
  switch ( $mime ) {
51
  case 'image/jpeg':
58
  } else {
59
  if ( true === $no_alt ) {
60
  echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> ' . __( 'Decorative', 'wp-accessibility' ) . '</span>';
61
+ } elseif ( in_array( $alt, $invalid_values, true ) || ctype_punct( $alt ) || ctype_space( $alt ) ) {
62
+ echo '<span class="missing"><span class="dashicons dashicons-no" aria-hidden="true"></span> <a href="' . get_edit_post_link( $id ) . '#attachment_alt">' . __( 'Invalid <code>alt</code>', 'wp-accessibility' ) . '</a></span>';
63
+ } elseif ( wpa_suspicious_alt( $alt ) ) {
64
+ echo '<span class="missing"><span class="dashicons dashicons-no" aria-hidden="true"></span> <a href="' . get_edit_post_link( $id ) . '#attachment_alt">' . __( 'Suspicious <code>alt</code>', 'wp-accessibility' ) . '</a></span>';
65
  } else {
66
  echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> ' . __( 'Has <code>alt</code>', 'wp-accessibility' ) . '</span>';
67
  }
75
  return $column;
76
  }
77
 
78
+ /**
79
+ * Check whether an alt attribute contains suspect strings.
80
+ *
81
+ * @param string $alt Alt attribute.
82
+ *
83
+ * @return bool
84
+ */
85
+ function wpa_suspicious_alt( $alt ) {
86
+ $case_insensitive = array(
87
+ 'logo',
88
+ 'image',
89
+ );
90
+ $case_insensitive = apply_filters( 'wpa_case_insensitive', $case_insensitive );
91
+ $case_sensitive = array(
92
+ 'DSC',
93
+ 'IMG',
94
+ );
95
+ $case_sensitive = apply_filters( 'wpa_case_sensitive', $case_sensitive );
96
+ foreach ( $case_insensitive as $term ) {
97
+ if ( false !== stripos( $alt, $term ) ) {
98
+ return true;
99
+ }
100
+ }
101
+ foreach ( $case_sensitive as $term ) {
102
+ if ( false !== strpos( $alt, $term ) ) {
103
+ return true;
104
+ }
105
+ }
106
+
107
+ return false;
108
+ }
109
+
110
  add_filter( 'attachment_fields_to_edit', 'wpa_insert_alt_verification', 10, 2 );
111
  /**
112
  * Insert custom fields into attachment editor for alt verification.
wp-accessibility-longdesc.php CHANGED
@@ -160,7 +160,7 @@ function wpa_longdesc_add_attr( $html, $id, $caption, $title, $align, $url, $siz
160
  $id = ( isset( $_REQUEST['post_id'] ) ) ? $_REQUEST['post_id'] : get_the_ID();
161
  $args['referrer'] = intval( $id );
162
  }
163
- if ( false !== (bool) strip_tags( $image->post_content ) ) {
164
  $search = '<img ';
165
  $replace = '<img tabindex="-1" id="' . esc_attr( wpa_longdesc_return_anchor( $image->ID ) ) . '" longdesc="' . esc_url( add_query_arg( $args, home_url() ) ) . '" ';
166
  $html = str_replace( $search, $replace, $html );
160
  $id = ( isset( $_REQUEST['post_id'] ) ) ? $_REQUEST['post_id'] : get_the_ID();
161
  $args['referrer'] = intval( $id );
162
  }
163
+ if ( '' !== trim( strip_tags( $image->post_content ) ) ) {
164
  $search = '<img ';
165
  $replace = '<img tabindex="-1" id="' . esc_attr( wpa_longdesc_return_anchor( $image->ID ) ) . '" longdesc="' . esc_url( add_query_arg( $args, home_url() ) ) . '" ';
166
  $html = str_replace( $search, $replace, $html );
wp-accessibility-settings.php CHANGED
@@ -105,6 +105,7 @@ function wpa_update_settings() {
105
  $wpa_target = ( isset( $_POST['wpa_target'] ) ) ? 'on' : '';
106
  $wpa_labels = ( isset( $_POST['wpa_labels'] ) ) ? 'on' : '';
107
  $wpa_search = ( isset( $_POST['wpa_search'] ) ) ? 'on' : '';
 
108
  $wpa_tabindex = ( isset( $_POST['wpa_tabindex'] ) ) ? 'on' : '';
109
  $wpa_underline = ( isset( $_POST['wpa_underline'] ) ) ? 'on' : '';
110
  $wpa_longdesc = ( isset( $_POST['wpa_longdesc'] ) ) ? esc_attr( $_POST['wpa_longdesc'] ) : 'false';
@@ -114,14 +115,15 @@ function wpa_update_settings() {
114
  $wpa_focus = ( isset( $_POST['wpa_focus'] ) ) ? 'on' : '';
115
  $wpa_focus_color = ( isset( $_POST['wpa_focus_color'] ) ) ? str_replace( '#', '', $_POST['wpa_focus_color'] ) : '';
116
  $wpa_continue = ( isset( $_POST['wpa_continue'] ) ) ? $_POST['wpa_continue'] : 'Continue Reading';
117
- $wpa_row_actions = ( isset( $_POST['wpa_row_actions'] ) ) ? 'on' : '';
118
  $wpa_diagnostics = ( isset( $_POST['wpa_diagnostics'] ) ) ? 'on' : '';
 
119
  $wpa_insert_roles = ( isset( $_POST['wpa_insert_roles'] ) ) ? 'on' : '';
120
  $wpa_complementary_container = ( isset( $_POST['wpa_complementary_container'] ) ) ? str_replace( '#', '', $_POST['wpa_complementary_container'] ) : '';
121
  update_option( 'wpa_lang', $wpa_lang );
122
  update_option( 'wpa_target', $wpa_target );
123
  update_option( 'wpa_labels', $wpa_labels );
124
  update_option( 'wpa_search', $wpa_search );
 
125
  update_option( 'wpa_tabindex', $wpa_tabindex );
126
  update_option( 'wpa_underline', $wpa_underline );
127
  update_option( 'wpa_longdesc', $wpa_longdesc );
@@ -131,10 +133,8 @@ function wpa_update_settings() {
131
  update_option( 'wpa_focus', $wpa_focus );
132
  update_option( 'wpa_focus_color', $wpa_focus_color );
133
  update_option( 'wpa_continue', $wpa_continue );
134
- update_option( 'wpa_row_actions', $wpa_row_actions );
135
  update_option( 'wpa_diagnostics', $wpa_diagnostics );
136
- update_option( 'wpa_insert_roles', $wpa_insert_roles );
137
- update_option( 'wpa_complementary_container', $wpa_complementary_container );
138
  $message = __( 'Miscellaneous Accessibility Settings Updated', 'wp-accessibility' );
139
 
140
  return "<div class='updated'><p>" . $message . '</p></div>';
@@ -255,7 +255,7 @@ function wpa_admin_settings() {
255
  <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
256
  <input type="hidden" name="action" value="asl"/>
257
  </p>
258
- <p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Update Skiplink Settings', 'wp-accessibility' ); ?>"/></p>
259
  </form>
260
  <?php
261
  }
@@ -263,9 +263,9 @@ function wpa_admin_settings() {
263
  </div>
264
  </div>
265
  <div class="postbox">
266
- <h2 id="toolbar" class='hndle'><?php _e( 'Accessibility Toolbar Settings', 'wp-accessibility' ); ?></h2>
267
  <div class="inside">
268
- <form method="post" action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
269
  <ul>
270
  <li>
271
  <input type="checkbox" id="wpa_toolbar" name="wpa_toolbar" <?php checked( get_option( 'wpa_toolbar' ), 'on' ); ?>/>
@@ -352,12 +352,6 @@ function wpa_admin_settings() {
352
  <label for="wpa_continue"><?php _e( 'Continue reading text', 'wp-accessibility' ); ?></label>
353
  <input type="text" id="wpa_continue" name="wpa_continue" value="<?php echo esc_attr( get_option( 'wpa_continue' ) ); ?>"/>
354
  </li>
355
- <li>
356
- <input type="checkbox" id="wpa_insert_roles" name="wpa_insert_roles" <?php checked( get_option( 'wpa_insert_roles' ), 'on' ); ?>/>
357
- <label for="wpa_insert_roles"><?php _e( 'Add landmark roles to HTML5 structural elements', 'wp-accessibility' ); ?></label><br/>
358
- <label for="wpa_complementary_container"><?php _e( 'ID for complementary role', 'wp-accessibility' ); ?></label>
359
- <input type="text" id="wpa_complementary_container" name="wpa_complementary_container" value="#<?php echo esc_attr( get_option( 'wpa_complementary_container' ) ); ?>"/>
360
- </li>
361
  <li>
362
  <input type="checkbox" id="wpa_labels" name="wpa_labels" <?php checked( get_option( 'wpa_labels' ), 'on' ); ?> />
363
  <label for='wpa_labels'><?php _e( 'Automatically Label WordPress search form and comment forms', 'wp-accessibility' ); ?></label>
@@ -373,6 +367,10 @@ function wpa_admin_settings() {
373
  <input type="checkbox" id="wpa_target" name="wpa_target" <?php checked( get_option( 'wpa_target' ), 'on' ); ?>/>
374
  <label for="wpa_target"><?php _e( 'Remove target attribute from links', 'wp-accessibility' ); ?></label>
375
  </li>
 
 
 
 
376
  <li>
377
  <input type="checkbox" id="wpa_search" name="wpa_search" <?php checked( get_option( 'wpa_search' ), 'on' ); ?>/>
378
  <label for="wpa_search"><?php _e( 'Force search error on empty search submission (theme must have search.php template)', 'wp-accessibility' ); ?></label>
@@ -397,10 +395,6 @@ function wpa_admin_settings() {
397
  <input type="checkbox" id="wpa_longdesc_featured" name="wpa_longdesc_featured" <?php checked( get_option( 'wpa_longdesc_featured' ), 'on' ); ?>/>
398
  <label for="wpa_longdesc_featured"><?php _e( 'Support <code>longdesc</code> on featured images', 'wp-accessibility' ); ?></label>
399
  </li>
400
- <li>
401
- <input type="checkbox" id="wpa_row_actions" name="wpa_row_actions" <?php checked( get_option( 'wpa_row_actions' ), 'on' ); ?>/>
402
- <label for="wpa_row_actions"><?php _e( 'Make admin row actions always visible', 'wp-accessibility' ); ?></label>
403
- </li>
404
  <li>
405
  <input type="checkbox" id="wpa_image_titles" name="wpa_image_titles" <?php checked( get_option( 'wpa_image_titles' ), 'on' ); ?>/>
406
  <label for="wpa_image_titles"><?php _e( 'Remove title attributes inserted into post content and featured images.', 'wp-accessibility' ); ?></label>
@@ -409,6 +403,10 @@ function wpa_admin_settings() {
409
  <input type="checkbox" id="wpa_diagnostics" name="wpa_diagnostics" <?php checked( get_option( 'wpa_diagnostics' ), 'on' ); ?>/>
410
  <label for="wpa_diagnostics"><?php _e( 'Enable diagnostic CSS', 'wp-accessibility' ); ?></label>
411
  </li>
 
 
 
 
412
  <li>
413
  <input type="checkbox" id="wpa_focus" name="wpa_focus" <?php checked( get_option( 'wpa_focus' ), 'on' ); ?>/>
414
  <label for="wpa_focus"><?php _e( 'Add outline to elements on keyboard focus', 'wp-accessibility' ); ?></label>
@@ -416,8 +414,8 @@ function wpa_admin_settings() {
416
  <input type="text" id="wpa_focus_color" name="wpa_focus_color" value="#<?php echo esc_attr( get_option( 'wpa_focus_color' ) ); ?>"/></li>
417
  </ul>
418
  <p>
419
- <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
420
- <input type="hidden" name="action" value="misc"/>
421
  </p>
422
 
423
  <p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Update Miscellaneous Settings', 'wp-accessibility' ); ?>"/></p>
@@ -439,8 +437,8 @@ function wpa_admin_settings() {
439
  </ul>
440
  </fieldset>
441
  <p>
442
- <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
443
- <input type="hidden" name="action" value="rta"/>
444
  </p>
445
 
446
  <p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Update Title Attribute Settings', 'wp-accessibility' ); ?>"/></p>
@@ -509,8 +507,8 @@ function wpa_admin_settings() {
509
  </ul>
510
  </fieldset>
511
  <p>
512
- <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
513
- <input type="hidden" name="action" value="contrast"/>
514
  </p>
515
 
516
  <p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Check Color Contrast', 'wp-accessibility' ); ?>"/></p>
@@ -568,16 +566,9 @@ function wpa_admin_settings() {
568
  <p><?php _e( "If you've found WP Accessibility useful, then please <a href='https://wordpress.org/plugins/wp-accessibility/'>rate it five stars</a>, <a href='https://www.joedolson.com/donate/'>make a donation</a>, or <a href='https://translate.wordpress.org/projects/wp-plugins/wp-accessibility'>help with translation</a>.", 'wp-accessibility' ); ?></p>
569
 
570
  <div>
571
- <p><?php _e( '<a href="http://www.joedolson.com/donate/">Make a donation today!</a> Your donation counts - donate any amount to help keep this plug-in running!', 'wp-accessibility' ); ?></p>
572
-
573
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
574
- <div>
575
- <input type="hidden" name="cmd" value="_s-xclick"/>
576
- <input type="hidden" name="hosted_button_id" value="QK9MXYGQKYUZY"/>
577
- <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="Donate"/>
578
- <img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/>
579
- </div>
580
- </form>
581
  </div>
582
  </div>
583
  </div>
105
  $wpa_target = ( isset( $_POST['wpa_target'] ) ) ? 'on' : '';
106
  $wpa_labels = ( isset( $_POST['wpa_labels'] ) ) ? 'on' : '';
107
  $wpa_search = ( isset( $_POST['wpa_search'] ) ) ? 'on' : '';
108
+ $wpa_search_alt = ( isset( $_POST['wpa_search_alt'] ) ) ? 'on' : '';
109
  $wpa_tabindex = ( isset( $_POST['wpa_tabindex'] ) ) ? 'on' : '';
110
  $wpa_underline = ( isset( $_POST['wpa_underline'] ) ) ? 'on' : '';
111
  $wpa_longdesc = ( isset( $_POST['wpa_longdesc'] ) ) ? esc_attr( $_POST['wpa_longdesc'] ) : 'false';
115
  $wpa_focus = ( isset( $_POST['wpa_focus'] ) ) ? 'on' : '';
116
  $wpa_focus_color = ( isset( $_POST['wpa_focus_color'] ) ) ? str_replace( '#', '', $_POST['wpa_focus_color'] ) : '';
117
  $wpa_continue = ( isset( $_POST['wpa_continue'] ) ) ? $_POST['wpa_continue'] : 'Continue Reading';
 
118
  $wpa_diagnostics = ( isset( $_POST['wpa_diagnostics'] ) ) ? 'on' : '';
119
+ $wpa_disable_fullscreen = ( isset( $_POST['wpa_disable_fullscreen'] ) ) ? 'on' : '';
120
  $wpa_insert_roles = ( isset( $_POST['wpa_insert_roles'] ) ) ? 'on' : '';
121
  $wpa_complementary_container = ( isset( $_POST['wpa_complementary_container'] ) ) ? str_replace( '#', '', $_POST['wpa_complementary_container'] ) : '';
122
  update_option( 'wpa_lang', $wpa_lang );
123
  update_option( 'wpa_target', $wpa_target );
124
  update_option( 'wpa_labels', $wpa_labels );
125
  update_option( 'wpa_search', $wpa_search );
126
+ update_option( 'wpa_search_alt', $wpa_search_alt );
127
  update_option( 'wpa_tabindex', $wpa_tabindex );
128
  update_option( 'wpa_underline', $wpa_underline );
129
  update_option( 'wpa_longdesc', $wpa_longdesc );
133
  update_option( 'wpa_focus', $wpa_focus );
134
  update_option( 'wpa_focus_color', $wpa_focus_color );
135
  update_option( 'wpa_continue', $wpa_continue );
 
136
  update_option( 'wpa_diagnostics', $wpa_diagnostics );
137
+ update_option( 'wpa_disable_fullscreen', $wpa_disable_fullscreen );
 
138
  $message = __( 'Miscellaneous Accessibility Settings Updated', 'wp-accessibility' );
139
 
140
  return "<div class='updated'><p>" . $message . '</p></div>';
255
  <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
256
  <input type="hidden" name="action" value="asl"/>
257
  </p>
258
+ <p><input type="submit" name="wpa-settings" class="button-primary" value="<?php esc_html_e( 'Update Skiplink Settings', 'wp-accessibility' ); ?>"/></p>
259
  </form>
260
  <?php
261
  }
263
  </div>
264
  </div>
265
  <div class="postbox">
266
+ <h2 id="toolbar" class='hndle'><?php esc_html_e( 'Accessibility Toolbar Settings', 'wp-accessibility' ); ?></h2>
267
  <div class="inside">
268
+ <form method="post" action="<?php echo esc_url( admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ) ); ?>">
269
  <ul>
270
  <li>
271
  <input type="checkbox" id="wpa_toolbar" name="wpa_toolbar" <?php checked( get_option( 'wpa_toolbar' ), 'on' ); ?>/>
352
  <label for="wpa_continue"><?php _e( 'Continue reading text', 'wp-accessibility' ); ?></label>
353
  <input type="text" id="wpa_continue" name="wpa_continue" value="<?php echo esc_attr( get_option( 'wpa_continue' ) ); ?>"/>
354
  </li>
 
 
 
 
 
 
355
  <li>
356
  <input type="checkbox" id="wpa_labels" name="wpa_labels" <?php checked( get_option( 'wpa_labels' ), 'on' ); ?> />
357
  <label for='wpa_labels'><?php _e( 'Automatically Label WordPress search form and comment forms', 'wp-accessibility' ); ?></label>
367
  <input type="checkbox" id="wpa_target" name="wpa_target" <?php checked( get_option( 'wpa_target' ), 'on' ); ?>/>
368
  <label for="wpa_target"><?php _e( 'Remove target attribute from links', 'wp-accessibility' ); ?></label>
369
  </li>
370
+ <li>
371
+ <input type="checkbox" id="wpa_search_alt" name="wpa_search_alt" <?php checked( get_option( 'wpa_search_alt' ), 'on' ); ?>/>
372
+ <label for="wpa_search_alt"><?php _e( 'Include alt attribute in media library searches', 'wp-accessibility' ); ?><span><?php _e( '* May cause slow searches on very large media libraries.', 'wp-accessibility' ); ?></span></label>
373
+ </li>
374
  <li>
375
  <input type="checkbox" id="wpa_search" name="wpa_search" <?php checked( get_option( 'wpa_search' ), 'on' ); ?>/>
376
  <label for="wpa_search"><?php _e( 'Force search error on empty search submission (theme must have search.php template)', 'wp-accessibility' ); ?></label>
395
  <input type="checkbox" id="wpa_longdesc_featured" name="wpa_longdesc_featured" <?php checked( get_option( 'wpa_longdesc_featured' ), 'on' ); ?>/>
396
  <label for="wpa_longdesc_featured"><?php _e( 'Support <code>longdesc</code> on featured images', 'wp-accessibility' ); ?></label>
397
  </li>
 
 
 
 
398
  <li>
399
  <input type="checkbox" id="wpa_image_titles" name="wpa_image_titles" <?php checked( get_option( 'wpa_image_titles' ), 'on' ); ?>/>
400
  <label for="wpa_image_titles"><?php _e( 'Remove title attributes inserted into post content and featured images.', 'wp-accessibility' ); ?></label>
403
  <input type="checkbox" id="wpa_diagnostics" name="wpa_diagnostics" <?php checked( get_option( 'wpa_diagnostics' ), 'on' ); ?>/>
404
  <label for="wpa_diagnostics"><?php _e( 'Enable diagnostic CSS', 'wp-accessibility' ); ?></label>
405
  </li>
406
+ <li>
407
+ <input type="checkbox" id="wpa_disable_fullscreen" name="wpa_disable_fullscreen" <?php checked( get_option( 'wpa_disable_fullscreen' ), 'on' ); ?>/>
408
+ <label for="wpa_disable_fullscreen"><?php _e( 'Disable fullscreen block editor by default', 'wp-accessibility' ); ?></label>
409
+ </li>
410
  <li>
411
  <input type="checkbox" id="wpa_focus" name="wpa_focus" <?php checked( get_option( 'wpa_focus' ), 'on' ); ?>/>
412
  <label for="wpa_focus"><?php _e( 'Add outline to elements on keyboard focus', 'wp-accessibility' ); ?></label>
414
  <input type="text" id="wpa_focus_color" name="wpa_focus_color" value="#<?php echo esc_attr( 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" value="<?php _e( 'Update Miscellaneous Settings', 'wp-accessibility' ); ?>"/></p>
437
  </ul>
438
  </fieldset>
439
  <p>
440
+ <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>" />
441
+ <input type="hidden" name="action" value="rta" />
442
  </p>
443
 
444
  <p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Update Title Attribute Settings', 'wp-accessibility' ); ?>"/></p>
507
  </ul>
508
  </fieldset>
509
  <p>
510
+ <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>" />
511
+ <input type="hidden" name="action" value="contrast" />
512
  </p>
513
 
514
  <p><input type="submit" name="wpa-settings" class="button-primary" value="<?php _e( 'Check Color Contrast', 'wp-accessibility' ); ?>"/></p>
566
  <p><?php _e( "If you've found WP Accessibility useful, then please <a href='https://wordpress.org/plugins/wp-accessibility/'>rate it five stars</a>, <a href='https://www.joedolson.com/donate/'>make a donation</a>, or <a href='https://translate.wordpress.org/projects/wp-plugins/wp-accessibility'>help with translation</a>.", 'wp-accessibility' ); ?></p>
567
 
568
  <div>
569
+ <p class="wpa-donate">
570
+ <a href="https://www.joedolson.com/donate/"><?php _e( 'Support WP Accessibility', 'wp-accessibility' ); ?></a>
571
+ </p>
 
 
 
 
 
 
 
572
  </div>
573
  </div>
574
  </div>
wp-accessibility-toolbar.php CHANGED
@@ -27,7 +27,7 @@ add_action( 'wp_enqueue_scripts', 'wpa_register_scripts' );
27
  * Register jQuery scripts.
28
  */
29
  function wpa_register_scripts() {
30
- wp_register_script( 'wpa-toolbar', plugins_url( 'wp-accessibility/js/wpa-toolbar.js' ), array( 'jquery' ), '1.0', true );
31
  wp_register_script( 'ui-a11y', plugins_url( 'wp-accessibility/toolbar/js/a11y.js' ), array( 'jquery' ), '1.0', true );
32
  }
33
 
@@ -110,9 +110,9 @@ function wpa_toolbar_shortcode( $atts, $content ) {
110
  * @return string HTML.
111
  */
112
  function wpa_toolbar_html( $type = 'widget', $control = 'button' ) {
113
- $contrast = __( 'Toggle High Contrast', 'wp-accessibility' );
114
- $grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
115
- $fontsize = __( 'Toggle Font size', 'wp-accessibility' );
116
  $enable_grayscale = ( 'on' === get_option( 'wpa_toolbar_gs' ) && current_user_can( 'manage_options' ) ) ? true : false;
117
  $enable_contrast = ( 'off' === get_option( 'wpa_toolbar_ct' ) ) ? false : true;
118
  $enable_fontsize = ( 'off' === get_option( 'wpa_toolbar_fs' ) ) ? false : true;
@@ -147,16 +147,15 @@ function wpa_toolbar_html( $type = 'widget', $control = 'button' ) {
147
  * Generate Toolbar variables for localization in JS.
148
  */
149
  function wpa_toolbar_js() {
150
- // Toolbar does not work on Edge. Disable unless I solve the issue.
151
- $default = ( false !== (bool) get_option( 'wpa_toolbar_default' ) ) ? get_option( 'wpa_toolbar_default' ) : 'body';
152
  $location = apply_filters( 'wpa_move_toolbar', $default );
153
- $is_rtl = ( is_rtl() ) ? ' rtl' : ' ltr';
154
- $is_right = ( 'on' === get_option( 'wpa_toolbar_right' ) ) ? ' right' : ' left';
155
- $responsive = ( 'on' === get_option( 'wpa_toolbar_mobile' ) ) ? 'a11y-responsive ' : 'a11y-non-responsive ';
156
 
157
- $contrast = __( 'Toggle High Contrast', 'wp-accessibility' );
158
- $grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
159
- $fontsize = __( 'Toggle Font size', 'wp-accessibility' );
160
  $enable_grayscale = ( 'on' === get_option( 'wpa_toolbar_gs' ) && current_user_can( 'manage_options' ) ) ? 'true' : 'false';
161
  $enable_fontsize = ( 'off' === get_option( 'wpa_toolbar_fs' ) ) ? 'false' : 'true';
162
  $enable_contrast = ( 'off' === get_option( 'wpa_toolbar_ct' ) ) ? 'false' : 'true';
27
  * Register jQuery scripts.
28
  */
29
  function wpa_register_scripts() {
30
+ wp_register_script( 'wpa-toolbar', plugins_url( 'wp-accessibility/js/wpa-toolbar.js' ), array(), '1.1', true );
31
  wp_register_script( 'ui-a11y', plugins_url( 'wp-accessibility/toolbar/js/a11y.js' ), array( 'jquery' ), '1.0', true );
32
  }
33
 
110
  * @return string HTML.
111
  */
112
  function wpa_toolbar_html( $type = 'widget', $control = 'button' ) {
113
+ $contrast = esc_html__( 'Toggle High Contrast', 'wp-accessibility' );
114
+ $grayscale = esc_html__( 'Toggle Grayscale', 'wp-accessibility' );
115
+ $fontsize = esc_html__( 'Toggle Font size', 'wp-accessibility' );
116
  $enable_grayscale = ( 'on' === get_option( 'wpa_toolbar_gs' ) && current_user_can( 'manage_options' ) ) ? true : false;
117
  $enable_contrast = ( 'off' === get_option( 'wpa_toolbar_ct' ) ) ? false : true;
118
  $enable_fontsize = ( 'off' === get_option( 'wpa_toolbar_fs' ) ) ? false : true;
147
  * Generate Toolbar variables for localization in JS.
148
  */
149
  function wpa_toolbar_js() {
150
+ $default = ( false !== (bool) trim( get_option( 'wpa_toolbar_default' ) ) ) ? get_option( 'wpa_toolbar_default' ) : 'body';
 
151
  $location = apply_filters( 'wpa_move_toolbar', $default );
152
+ $is_rtl = ( is_rtl() ) ? 'rtl' : 'ltr';
153
+ $is_right = ( 'on' === get_option( 'wpa_toolbar_right' ) ) ? 'right' : 'left';
154
+ $responsive = ( 'on' === get_option( 'wpa_toolbar_mobile' ) ) ? 'a11y-responsive' : 'a11y-non-responsive';
155
 
156
+ $contrast = esc_html__( 'Toggle High Contrast', 'wp-accessibility' );
157
+ $grayscale = esc_html__( 'Toggle Grayscale', 'wp-accessibility' );
158
+ $fontsize = esc_html__( 'Toggle Font size', 'wp-accessibility' );
159
  $enable_grayscale = ( 'on' === get_option( 'wpa_toolbar_gs' ) && current_user_can( 'manage_options' ) ) ? 'true' : 'false';
160
  $enable_fontsize = ( 'off' === get_option( 'wpa_toolbar_fs' ) ) ? 'false' : 'true';
161
  $enable_contrast = ( 'off' === get_option( 'wpa_toolbar_ct' ) ) ? 'false' : 'true';
wp-accessibility.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WP Accessibility
6
  * @author Joe Dolson
7
- * @copyright 2012-2021 Joe Dolson
8
  * @license GPL-2.0+
9
  *
10
  * @wordpress-plugin
@@ -17,11 +17,11 @@
17
  * Domain Path: /lang
18
  * License: GPL-2.0+
19
  * License URI: http://www.gnu.org/license/gpl-2.0.txt
20
- * Version: 1.7.7
21
  */
22
 
23
  /*
24
- Copyright 2012-2021 Joe Dolson (email : joe@joedolson.com)
25
 
26
  This program is free software; you can redistribute it and/or modify
27
  it under the terms of the GNU General Public License as published by
@@ -69,16 +69,9 @@ function wpa_admin_menu() {
69
  * Install on activation.
70
  */
71
  function wpa_install() {
72
- $wpa_version = '1.7.7';
73
  if ( 'true' !== get_option( 'wpa_installed' ) ) {
74
- add_option( 'rta_from_nav_menu', 'on' );
75
- add_option( 'rta_from_page_lists', 'on' );
76
- add_option( 'rta_from_category_lists', 'on' );
77
- add_option( 'rta_from_archive_links', 'on' );
78
  add_option( 'rta_from_tag_clouds', 'on' );
79
- add_option( 'rta_from_category_links', 'on' );
80
- add_option( 'rta_from_post_edit_links', 'on' );
81
- add_option( 'rta_from_edit_comment_links', 'on' );
82
  add_option( 'asl_styles_focus', '' );
83
  add_option( 'asl_styles_passive', '' );
84
  add_option( 'wpa_target', 'on' );
@@ -126,19 +119,6 @@ add_action( 'wp_enqueue_scripts', 'wpacc_enqueue_scripts' );
126
  * Enqueue accessibility scripts dependent on options.
127
  */
128
  function wpacc_enqueue_scripts() {
129
- wp_enqueue_script( 'jquery' );
130
- if ( 'on' === get_option( 'wpa_insert_roles' ) ) {
131
- wp_enqueue_script( 'wpa-complementary', plugins_url( 'js/roles.jquery.js', __FILE__ ), array( 'jquery' ), '1.0', true );
132
- if ( get_option( 'wpa_complementary_container' ) ) {
133
- $wpa_comp = get_option( 'wpa_complementary_container' );
134
- } else {
135
- $wpa_comp = false;
136
- }
137
- $wpa_comp = array(
138
- 'container' => $wpa_comp,
139
- );
140
- wp_localize_script( 'wpa-complementary', 'wpaComplementary', $wpa_comp );
141
- }
142
  if ( 'on' === get_option( 'wpa_labels' ) ) {
143
  wp_enqueue_script( 'wpa-labels', plugins_url( 'js/wpa.labels.js', __FILE__ ), array( 'jquery' ), '1.0', true );
144
  $labels = array(
@@ -203,16 +183,6 @@ function wpa_admin_stylesheet() {
203
  wp_register_style( 'wp-a11y-css', $file );
204
  wp_enqueue_style( 'wp-a11y-css' );
205
  }
206
-
207
- if ( 'on' === get_option( 'wpa_row_actions' ) ) {
208
- if ( file_exists( get_stylesheet_directory() . '/wp-admin-row-actions.css' ) ) {
209
- $file = get_stylesheet_directory_uri() . '/wp-admin-row-actions.css';
210
- } else {
211
- $file = plugins_url( 'css/wp-admin-row-actions.css', __FILE__ );
212
- }
213
- wp_register_style( 'wp-row-actions', $file );
214
- wp_enqueue_style( 'wp-row-actions' );
215
- }
216
  }
217
 
218
  add_action( 'wp_head', 'wpa_css' );
@@ -282,20 +252,16 @@ function wpa_is_url( $url ) {
282
  return preg_match( '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url );
283
  }
284
 
285
- add_action( 'wp_footer', 'wpa_jquery_asl', 100 );
286
  /**
287
- * Generate JS needed for options.
288
  */
289
  function wpa_jquery_asl() {
290
- $skiplinks_js = false;
291
- $targets = false;
292
- $lang_js = false;
293
- $tabindex = false;
294
- $longdesc = false;
295
- $visibility = ( 'on' === get_option( 'asl_visible' ) ) ? 'wpa-visible' : 'wpa-hide';
296
  if ( 'on' === get_option( 'asl_enable' ) ) {
297
  $html = '';
298
- // set up skiplinks.
299
  $extra = (string) get_option( 'asl_extra_target' );
300
  $extra = ( wpa_is_url( $extra ) ) ? esc_url( $extra ) : str_replace( '#', '', esc_attr( $extra ) );
301
  if ( '' !== $extra && ! wpa_is_url( $extra ) ) {
@@ -305,46 +271,34 @@ function wpa_jquery_asl() {
305
  $content = str_replace( '#', '', esc_attr( get_option( 'asl_content' ) ) );
306
  $nav = str_replace( '#', '', esc_attr( get_option( 'asl_navigation' ) ) );
307
  $sitemap = esc_url( get_option( 'asl_sitemap' ) );
308
- $html .= ( '' !== $content ) ? "<a href=\"#$content\">" . __( 'Skip to content', 'wp-accessibility' ) . '</a> ' : '';
309
- $html .= ( '' !== $nav ) ? "<a href=\"#$nav\">" . __( 'Skip to navigation', 'wp-accessibility' ) . '</a> ' : '';
310
- $html .= ( '' !== $sitemap ) ? "<a href=\"$sitemap\">" . __( 'Site map', 'wp-accessibility' ) . '</a> ' : '';
311
- $html .= ( '' !== $extra && '' !== $extra_text ) ? "<a href=\"$extra\">$extra_text</a> " : '';
312
  $is_rtl = ( is_rtl() ) ? '-rtl' : '-ltr';
313
  $skiplinks = __( 'Skip links', 'wp-accessibility' );
314
- $output = ( '' !== $html ) ? "<div class=\"$visibility$is_rtl\" id=\"skiplinks\" role=\"navigation\" aria-label=\"$skiplinks\">$html</div>" : '';
315
- // Attach skiplinks HTML; set tab index on #content area to -1.
316
- $focusable = ( '' !== $content ) ? "$('#$content').attr('tabindex','-1');" : '';
317
- $focusable .= ( '' !== $nav ) ? "$('#$nav').attr('tabindex','-1');" : '';
318
- $skiplinks_js = ( $output ) ? "$('body').prepend('$output'); $focusable" : '';
319
- }
320
- // Attach language to html element.
321
- if ( 'on' === get_option( 'wpa_lang' ) ) {
322
- $lang = get_bloginfo( 'language' );
323
- $dir = ( is_rtl() ) ? 'rtl' : 'ltr';
324
- $lang_js = "$('html').attr( 'lang','$lang' ); $('html').attr( 'dir','$dir' )";
325
- }
326
- // Force links to open in the same window.
327
- $underline_target = apply_filters( 'wpa_underline_target', 'a' );
328
- $targets = ( 'on' === get_option( 'wpa_target' ) ) ? "$('a').removeAttr('target');" : '';
329
- $tabindex = ( 'on' === get_option( 'wpa_tabindex' ) ) ? "$('input,a,select,textarea,button').removeAttr('tabindex');" : '';
330
- $underlines = ( 'on' === get_option( 'wpa_underline' ) ) ? "$('$underline_target').css( 'text-decoration','underline' );$('$underline_target').on( 'focusin mouseenter', function() { $(this).css( 'text-decoration','none' ); });$('$underline_target').on( 'focusout mouseleave', function() { $(this).css( 'text-decoration','underline' ); } );" : '';
331
-
332
- $display = ( $skiplinks_js || $targets || $lang_js || $tabindex || $longdesc ) ? true : false;
333
- if ( $display ) {
334
- $script = "
335
- <script type='text/javascript'>
336
- //<![CDATA[
337
- (function( $ ) { 'use strict';
338
- $skiplinks_js
339
- $targets
340
- $lang_js
341
- $tabindex
342
- $underlines
343
- }(jQuery));
344
- //]]>
345
- </script>";
346
- echo $script;
347
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
348
  }
349
 
350
  // courtesy of Graham Armfield (modified).
@@ -368,6 +322,26 @@ function wpa_logout_item( $admin_bar ) {
368
  $admin_bar->add_node( $args );
369
  }
370
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
  add_filter( 'mce_css', 'wpa_diagnostic_css' );
372
  /**
373
  * Add diagnostic CSS.
@@ -460,7 +434,7 @@ if ( 'on' === get_option( 'wpa_more' ) ) {
460
  * @return string HTML link & text.
461
  */
462
  function wpa_continue_reading( $id ) {
463
- return '<a class="continue" href="' . get_permalink( $id ) . '">' . get_option( 'wpa_continue' ) . '<span> ' . get_the_title( $id ) . '</span></a>';
464
  }
465
 
466
  /**
@@ -586,13 +560,13 @@ $plugins_string
586
  if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
587
  die( 'Security check failed' );
588
  }
589
- $request = ( ! empty( $_POST['support_request'] ) ) ? stripslashes( $_POST['support_request'] ) : false;
590
  $has_donated = ( 'on' === $_POST['has_donated'] ) ? 'Donor' : 'No donation';
591
  $has_read_faq = ( 'on' === $_POST['has_read_faq'] ) ? 'Read FAQ' : false;
592
  $subject = "WP Accessibility support request. $has_donated";
593
  $message = $request . "\n\n" . $data;
594
  // Get the site domain and get rid of www. from pluggable.php.
595
- $sitename = strtolower( $_SERVER['SERVER_NAME'] );
596
  if ( 'www.' === substr( $sitename, 0, 4 ) ) {
597
  $sitename = substr( $sitename, 4 );
598
  }
@@ -615,7 +589,7 @@ $plugins_string
615
  $admin_url = admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' );
616
 
617
  echo "
618
- <form method='post' action='$admin_url'>
619
  <div><input type='hidden' name='_wpnonce' value='" . wp_create_nonce( 'wpa-nonce' ) . "' /></div>
620
  <div>";
621
  echo '
@@ -631,7 +605,7 @@ $plugins_string
631
  echo sprintf( __( 'I <a href="%s">made a donation</a> to help support this plugin', 'wp-accessibility' ), 'https://www.joedolson.com/donate/' ) . "</label>
632
  </p>
633
  <p>
634
- <label for='support_request'>" . __( 'Support Request:', 'wp-accessibility' ) . "</label><br /><textarea name='support_request' required id='support_request' cols='80' rows='10' class='widefat'>" . stripslashes( $request ) . "</textarea>
635
  </p>
636
  <p>
637
  <input type='submit' value='" . __( 'Send Support Request', 'wp-accessibility' ) . "' name='wpa_support' class='button-primary' />
@@ -657,3 +631,14 @@ function wpa_accessible_theme() {
657
  }
658
  return false;
659
  }
 
 
 
 
 
 
 
 
 
 
 
4
  *
5
  * @package WP Accessibility
6
  * @author Joe Dolson
7
+ * @copyright 2012-2022 Joe Dolson
8
  * @license GPL-2.0+
9
  *
10
  * @wordpress-plugin
17
  * Domain Path: /lang
18
  * License: GPL-2.0+
19
  * License URI: http://www.gnu.org/license/gpl-2.0.txt
20
+ * Version: 1.7.13
21
  */
22
 
23
  /*
24
+ Copyright 2012-2022 Joe Dolson (email : joe@joedolson.com)
25
 
26
  This program is free software; you can redistribute it and/or modify
27
  it under the terms of the GNU General Public License as published by
69
  * Install on activation.
70
  */
71
  function wpa_install() {
72
+ $wpa_version = '1.7.13';
73
  if ( 'true' !== get_option( 'wpa_installed' ) ) {
 
 
 
 
74
  add_option( 'rta_from_tag_clouds', 'on' );
 
 
 
75
  add_option( 'asl_styles_focus', '' );
76
  add_option( 'asl_styles_passive', '' );
77
  add_option( 'wpa_target', 'on' );
119
  * Enqueue accessibility scripts dependent on options.
120
  */
121
  function wpacc_enqueue_scripts() {
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  if ( 'on' === get_option( 'wpa_labels' ) ) {
123
  wp_enqueue_script( 'wpa-labels', plugins_url( 'js/wpa.labels.js', __FILE__ ), array( 'jquery' ), '1.0', true );
124
  $labels = array(
183
  wp_register_style( 'wp-a11y-css', $file );
184
  wp_enqueue_style( 'wp-a11y-css' );
185
  }
 
 
 
 
 
 
 
 
 
 
186
  }
187
 
188
  add_action( 'wp_head', 'wpa_css' );
252
  return preg_match( '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url );
253
  }
254
 
255
+ add_action( 'wp_enqueue_scripts', 'wpa_jquery_asl', 100 );
256
  /**
257
+ * Enqueue JS needed for WP Accessibility options.
258
  */
259
  function wpa_jquery_asl() {
260
+ $visibility = ( 'on' === get_option( 'asl_visible' ) ) ? 'wpa-visible' : 'wpa-hide';
261
+ $output = '';
 
 
 
 
262
  if ( 'on' === get_option( 'asl_enable' ) ) {
263
  $html = '';
264
+ // Build skiplinks.
265
  $extra = (string) get_option( 'asl_extra_target' );
266
  $extra = ( wpa_is_url( $extra ) ) ? esc_url( $extra ) : str_replace( '#', '', esc_attr( $extra ) );
267
  if ( '' !== $extra && ! wpa_is_url( $extra ) ) {
271
  $content = str_replace( '#', '', esc_attr( get_option( 'asl_content' ) ) );
272
  $nav = str_replace( '#', '', esc_attr( get_option( 'asl_navigation' ) ) );
273
  $sitemap = esc_url( get_option( 'asl_sitemap' ) );
274
+ $html .= ( '' !== $content ) ? "<a href=\"#$content\" class='no-scroll'>" . __( 'Skip to Content', 'wp-accessibility' ) . '</a> ' : '';
275
+ $html .= ( '' !== $nav ) ? "<a href=\"#$nav\" class='no-scroll'>" . __( 'Skip to navigation', 'wp-accessibility' ) . '</a> ' : '';
276
+ $html .= ( '' !== $sitemap ) ? "<a href=\"$sitemap\" class='no-scroll'>" . __( 'Site map', 'wp-accessibility' ) . '</a> ' : '';
277
+ $html .= ( '' !== $extra && '' !== $extra_text ) ? "<a href=\"$extra\" class='no-scroll'>$extra_text</a> " : '';
278
  $is_rtl = ( is_rtl() ) ? '-rtl' : '-ltr';
279
  $skiplinks = __( 'Skip links', 'wp-accessibility' );
280
+ $output = ( '' !== $html ) ? "<div class=\"$visibility$is_rtl\" id=\"skiplinks\" role=\"navigation\" aria-label=\"" . esc_attr( $skiplinks ) . "\">$html</div>" : '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  }
282
+
283
+ wp_enqueue_script( 'wp-accessibility', plugins_url( 'js/wp-accessibility.js', __FILE__ ), array( 'jquery' ), '1.0', true );
284
+ wp_localize_script(
285
+ 'wp-accessibility',
286
+ 'wpa',
287
+ array(
288
+ 'skiplinks' => array(
289
+ 'enabled' => ( 'on' === get_option( 'asl_enable' ) ) ? true : false,
290
+ 'output' => $output,
291
+ ),
292
+ 'target' => ( 'on' === get_option( 'wpa_target' ) ) ? true : false,
293
+ 'tabindex' => ( 'on' === get_option( 'wpa_tabindex' ) ) ? true : false,
294
+ 'underline' => array(
295
+ 'enabled' => ( 'on' === get_option( 'wpa_underline' ) ) ? true : false,
296
+ 'target' => apply_filters( 'wpa_underline_target', 'a' ),
297
+ ),
298
+ 'dir' => ( is_rtl() ) ? 'rtl' : 'ltr',
299
+ 'lang' => get_bloginfo( 'language' ),
300
+ )
301
+ );
302
  }
303
 
304
  // courtesy of Graham Armfield (modified).
322
  $admin_bar->add_node( $args );
323
  }
324
 
325
+ add_filter( 'posts_clauses', 'wpa_search_attachment_alt', 20, 2 );
326
+ /**
327
+ * Allow users to search alt attributes in the media library.
328
+ *
329
+ * @param array $clauses WordPress post query clauses.
330
+ * @param object $query WordPress query object.
331
+ *
332
+ * @return array
333
+ */
334
+ function wpa_search_attachment_alt( $clauses, $query ) {
335
+ if ( is_admin() && 'on' === get_option( 'wpa_search_alt' ) ) {
336
+ global $wpdb;
337
+ if ( 'attachment' === $query->query['post_type'] && '' !== $query->query_vars['s'] ) {
338
+ $clauses['join'] = " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND ( sq1.meta_key = '_wp_attached_file' OR sq1.meta_key = '_wp_attachment_image_alt' ) )";
339
+ }
340
+ }
341
+
342
+ return $clauses;
343
+ }
344
+
345
  add_filter( 'mce_css', 'wpa_diagnostic_css' );
346
  /**
347
  * Add diagnostic CSS.
434
  * @return string HTML link & text.
435
  */
436
  function wpa_continue_reading( $id ) {
437
+ return '<a class="continue" href="' . esc_url( get_permalink( $id ) ) . '">' . get_option( 'wpa_continue' ) . '<span> ' . get_the_title( $id ) . '</span></a>';
438
  }
439
 
440
  /**
560
  if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
561
  die( 'Security check failed' );
562
  }
563
+ $request = ( ! empty( $_POST['support_request'] ) ) ? sanitize_textarea_field( stripslashes( $_POST['support_request'] ) ) : false;
564
  $has_donated = ( 'on' === $_POST['has_donated'] ) ? 'Donor' : 'No donation';
565
  $has_read_faq = ( 'on' === $_POST['has_read_faq'] ) ? 'Read FAQ' : false;
566
  $subject = "WP Accessibility support request. $has_donated";
567
  $message = $request . "\n\n" . $data;
568
  // Get the site domain and get rid of www. from pluggable.php.
569
+ $sitename = sanitize_text_field( strtolower( $_SERVER['SERVER_NAME'] ) );
570
  if ( 'www.' === substr( $sitename, 0, 4 ) ) {
571
  $sitename = substr( $sitename, 4 );
572
  }
589
  $admin_url = admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' );
590
 
591
  echo "
592
+ <form method='post' action='" . esc_url( $admin_url ) . "'>
593
  <div><input type='hidden' name='_wpnonce' value='" . wp_create_nonce( 'wpa-nonce' ) . "' /></div>
594
  <div>";
595
  echo '
605
  echo sprintf( __( 'I <a href="%s">made a donation</a> to help support this plugin', 'wp-accessibility' ), 'https://www.joedolson.com/donate/' ) . "</label>
606
  </p>
607
  <p>
608
+ <label for='support_request'>" . __( 'Support Request:', 'wp-accessibility' ) . "</label><br /><textarea name='support_request' required id='support_request' cols='80' rows='10' class='widefat'>" . esc_textarea( stripslashes( $request ) ) . "</textarea>
609
  </p>
610
  <p>
611
  <input type='submit' value='" . __( 'Send Support Request', 'wp-accessibility' ) . "' name='wpa_support' class='button-primary' />
631
  }
632
  return false;
633
  }
634
+
635
+ /**
636
+ * Disable full screen block editor by default.
637
+ */
638
+ function wpa_disable_editor_fullscreen_by_default() {
639
+ if ( 'on' === get_option( 'wpa_disable_fullscreen' ) ) {
640
+ $script = "window.onload = function() { const isFullscreenMode = wp.data.select( 'core/edit-post' ).isFeatureActive( 'fullscreenMode' ); if ( isFullscreenMode ) { wp.data.dispatch( 'core/edit-post' ).toggleFeature( 'fullscreenMode' ); } }";
641
+ wp_add_inline_script( 'wp-blocks', $script );
642
+ }
643
+ }
644
+ add_action( 'enqueue_block_editor_assets', 'wpa_disable_editor_fullscreen_by_default' );