WP Accessibility - Version 1.4.6

Version Description

  • Bug fix: Don't create a duplicate ID when multiple longdesc attributes used on one page
Download this release

Release Info

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

Code changes from version 1.4.0 to 1.4.6

css/editor-style.css CHANGED
@@ -1,5 +1,4 @@
1
  .wpa-image-missing-alt {
2
  border: 2px solid red;
3
- display: inline-block;
4
- padding: .5em;
5
  }
1
  .wpa-image-missing-alt {
2
  border: 2px solid red;
3
+ box-shadow: 0 0 2px 2px #ffa;
 
4
  }
css/wpa-style.css CHANGED
@@ -108,4 +108,6 @@ div.aligncenter {
108
  color: #333;
109
  box-shadow: 0 0 5px;
110
  font-size: 1.4em;
111
- }
 
 
108
  color: #333;
109
  box-shadow: 0 0 5px;
110
  font-size: 1.4em;
111
+ }
112
+
113
+ label.wpa-screen-reader-text { position: absolute!important; clip: rect(1px,1px,1px,1px); overflow: hidden; color: #000; background: #fff; width: 1px; height: 1px; }
imgs/alt-missing.png ADDED
Binary file
imgs/alt-same.png ADDED
Binary file
js/longdesc.button.js CHANGED
@@ -4,18 +4,25 @@
4
  var longdesc = $(this).attr('longdesc');
5
  var text = '<span>Long Description</span>';
6
  var classes = $(this).attr('class');
7
- $(this).attr('class', '');
8
- $(this).wrap('<div class="wpa-ld" />')
9
- $(this).parent('.wpa-ld').addClass(classes);
10
- $(this).parent('.wpa-ld').append('<div class="longdesc" aria-live="assertive"></div>'); // better supported
11
- $(this).parent('.wpa-ld').append('<button>' + text + '</button>');
12
- $(this).parent('.wpa-ld').children('.longdesc').hide();
13
- $(this).parent('.wpa-ld').children('.longdesc').load(longdesc + ' #desc');
14
- $(this).parent('.wpa-ld').children('button').toggle(function () {
15
- $(this).parent('.wpa-ld').children('.longdesc').show(150);
16
- }, function () {
17
- $(this).parent('.wpa-ld').children('.longdesc').hide();
18
- });
 
 
 
 
 
 
 
19
  });
20
  }(jQuery));
21
 
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 ) ) {
11
+ image_id = value;
12
+ }
13
+ });
14
+ $(this).attr('class', '');
15
+ $(this).wrap('<div class="wpa-ld" />')
16
+ $(this).parent('.wpa-ld').addClass(classes);
17
+ $(this).parent('.wpa-ld').append('<div class="longdesc" aria-live="assertive"></div>');
18
+ $(this).parent('.wpa-ld').append('<button>' + text + '</button>');
19
+ $(this).parent('.wpa-ld').children('.longdesc').hide();
20
+ $(this).parent('.wpa-ld').children('.longdesc').load( longdesc + ' #desc_' + image_id );
21
+ $(this).parent('.wpa-ld').children('button').toggle(function () {
22
+ $(this).parent('.wpa-ld').children('.longdesc').show(150);
23
+ }, function () {
24
+ $(this).parent('.wpa-ld').children('.longdesc').hide();
25
+ });
26
  });
27
  }(jQuery));
28
 
js/wpa.labels.js ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function( $ ) { 'use strict';
2
+ var wpa_names = [ 's', 'author', 'email', 'url', 'comment' ];
3
+ $.each( wpa_names, function( index, value ) {
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
+ if ( form_id ) {
11
+ var label = $( 'label[for=' + form_id + ']' );
12
+ var implicit = $( field ).parent( 'label' );
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
+ field.attr( 'id', 'wpa_label_' + value ).before( "<label for='wpa_label_" + value + "' class='wpa-screen-reader-text'>" + wpalabels[value] + "</label>" );
18
+ }
19
+ });
20
+ }(jQuery));
lang/wp-accessibility-en_AU.mo ADDED
Binary file
lang/wp-accessibility-es_ES.mo CHANGED
Binary file
lang/wp-accessibility-he_IL.mo CHANGED
Binary file
lang/wp-accessibility-hu_HU.mo ADDED
Binary file
lang/wp-accessibility-pl_PL.mo CHANGED
Binary file
readme.txt CHANGED
@@ -1,10 +1,11 @@
1
  === WP Accessibility ===
2
  Contributors: joedolson
3
  Donate link: http://www.joedolson.com/donate.php
4
- Tags: title, accessibility, accessible, navigation, wcag, a11y, section508, focus, alt text
5
  Requires at least: 3.4.2
6
- Tested up to: 4.1.1
7
- Stable tag: 1.3.11
 
8
  License: GPLv2 or later
9
 
10
  WP Accessibility fixes common accessibility issues in your WordPress site.
@@ -34,6 +35,7 @@ All features can be disabled according to your theme's needs. For advanced users
34
  * Remove redundant title attributes from page lists, category lists, and archive menus.
35
  * Add post titles to standard "read more" links.
36
  * Address some accessibility issues in the WordPress admin styles
 
37
 
38
  = Accessibility Tools built into WP Accessibility: =
39
 
@@ -59,6 +61,41 @@ Visit the [WP Accessibility translations site](http://translate.joedolson.com/pr
59
 
60
  == Changelog ==
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  = 1.4.0 =
63
 
64
  * Added enforcement tools for alt attribute usage in images.
@@ -207,7 +244,7 @@ Visit the [WP Accessibility translations site](http://translate.joedolson.com/pr
207
  = 1.2.1 =
208
 
209
  * Disabled grayscale toggle in Accessibility toolbar by default due to poor browser support and low functional value. (Can still be enabled by user.)
210
- * Removed php notice in title-free recent posts widget
211
  * Updated German and added Polish translations
212
 
213
  = 1.2.0 =
@@ -260,4 +297,4 @@ Even if WP Accessibility is running correctly, not all accessibility testing too
260
 
261
  == Upgrade Notice ==
262
 
263
- * 1.3.11 - Aware of accessibility-ready themes; notice about Access Monitor; bug fix
1
  === WP Accessibility ===
2
  Contributors: joedolson
3
  Donate link: http://www.joedolson.com/donate.php
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.3.1
7
+ Stable tag: 1.4.5
8
+ Text Domain: wp-accessibility
9
  License: GPLv2 or later
10
 
11
  WP Accessibility fixes common accessibility issues in your WordPress site.
35
  * Remove redundant title attributes from page lists, category lists, and archive menus.
36
  * Add post titles to standard "read more" links.
37
  * Address some accessibility issues in the WordPress admin styles
38
+ * Add labels to standard WordPress form fields if missing
39
 
40
  = Accessibility Tools built into WP Accessibility: =
41
 
61
 
62
  == Changelog ==
63
 
64
+ = Future =
65
+
66
+ * Note: WP A11y recent posts widget will be removed in 1.5.0
67
+
68
+ = 1.4.6 =
69
+
70
+ * Bug fix: Don't create a duplicate ID when multiple longdesc attributes used on one page
71
+
72
+ = 1.4.5 =
73
+
74
+ * Add languages: Hungarian, English (Australian)
75
+ * Bug fix: Retain intended image when adding alt attribute missing warning.
76
+
77
+ = 1.4.4 =
78
+
79
+ * In WP 4.3, widgets with no settings are not saved. So...
80
+ * Added Title setting to WP Accessibility toolbar widget.
81
+
82
+ = 1.4.3 =
83
+
84
+ * Update widget constructors to use PHP5+ syntax.
85
+ * Add filter to disable or replace the fontsize styles for toolbar. 'wpa_fontsize_css'. Return false to disable; return stylesheet URL to replace.
86
+
87
+ = 1.4.2 =
88
+
89
+ * Language update: Norwegian
90
+ * New feature: Automatically add labels to WordPress standard search form & comment forms if missing.
91
+
92
+ = 1.4.1 =
93
+
94
+ * Bug fix: warning thrown if current theme does not have any tags.
95
+ * Change: Use image to show 'needs alt', for easier deletion.
96
+ * Fix: text_direction deprecated in bloginfo
97
+ * Language updates: Spanish, Polish
98
+
99
  = 1.4.0 =
100
 
101
  * Added enforcement tools for alt attribute usage in images.
244
  = 1.2.1 =
245
 
246
  * Disabled grayscale toggle in Accessibility toolbar by default due to poor browser support and low functional value. (Can still be enabled by user.)
247
+ * Removed php notice in title- recent posts widget
248
  * Updated German and added Polish translations
249
 
250
  = 1.2.0 =
297
 
298
  == Upgrade Notice ==
299
 
300
+ * 1.4.6 - Bug fix for duplicate IDs in longdesc implementation
templates/longdesc-template.php CHANGED
@@ -15,18 +15,20 @@
15
  </head>
16
  <body>
17
  <div id="longdesc" class="template-longdesc">
18
- <div id="desc">
19
- <?php the_content(); ?>
20
- </div>
21
- <?php
22
- if ( isset( $_GET['referrer'] ) ) {
23
- $uri = get_permalink( (int) $_GET['referrer'] );
24
- if ( ! empty( $uri ) ) {
25
- $uri .= '#' . longdesc_return_anchor( get_the_ID() );
26
- print '<p><a href="' . esc_url( $uri ) . '">' . esc_html__( 'Return to article.', 'wp-accessibility' ) . '</a></p>';
 
 
27
  }
28
- }
29
- ?>
30
  </div>
31
  </body>
32
  </html>
15
  </head>
16
  <body>
17
  <div id="longdesc" class="template-longdesc">
18
+ <div id="desc_">
19
+ <div id="desc_wp-image-<?php the_ID(); ?>">
20
+ <?php the_content(); ?>
21
+ </div>
22
+ <?php
23
+ if ( isset( $_GET['referrer'] ) ) {
24
+ $uri = get_permalink( (int) $_GET['referrer'] );
25
+ if ( ! empty( $uri ) ) {
26
+ $uri .= '#' . longdesc_return_anchor( get_the_ID() );
27
+ print '<p><a href="' . esc_url( $uri ) . '">' . esc_html__( 'Return to article.', 'wp-accessibility' ) . '</a></p>';
28
+ }
29
  }
30
+ ?>
31
+ </div>
32
  </div>
33
  </body>
34
  </html>
toolbar/css/a11y-fontsize.css CHANGED
@@ -1,27 +1,17 @@
1
- body, h4, h5, h6, p, li, label, input, select, textarea, legend, code, pre {
2
- font-size: 115% !important;
3
- line-height: 1.4 !important;
 
4
  }
5
 
6
- .navbar .nav li {
7
- font-size: 75% !important;
8
- line-height: 1.5 !important;
9
  }
10
 
11
- .navbar input {
12
- font-size: 75% !important;
13
- line-height: 1.5 !important;
14
  }
15
 
16
- .navbar .brand {
17
- line-height: 1 !important;
18
- }
19
-
20
- .a11y-toolbar ul li {
21
- line-height: 20px !important;
22
- font-size: 75% !important;
23
- }
24
-
25
- .a11y-toolbar ul li a {
26
- line-height: 24px !important;
27
  }
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
  }
6
 
7
+ .fontsize li li {
8
+ font-size: 110% !important;
 
9
  }
10
 
11
+ .fontsize li li li {
12
+ font-size: 100% !important;
 
13
  }
14
 
15
+ .fontsize .a11y-toolbar ul li {
16
+ font-size: auto !important;
 
 
 
 
 
 
 
 
 
17
  }
toolbar/css/a11y.css CHANGED
@@ -30,6 +30,8 @@
30
  }
31
 
32
  .a11y-toolbar ul li {
 
 
33
  display: block;
34
  }
35
 
@@ -114,21 +116,4 @@
114
  -o-filter: grayscale(100%) !important;
115
  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;
116
  filter: gray !important;
117
- }
118
-
119
- .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 {
120
- font-size: 150% !important;
121
- line-height: 1.4;
122
- }
123
-
124
- .fontsize li li {
125
- font-size: 110% !important;
126
- }
127
-
128
- .fontsize li li li {
129
- font-size: 100% !important;
130
- }
131
-
132
- .fontsize .a11y-toolbar ul li {
133
- font-size: auto !important;
134
  }
30
  }
31
 
32
  .a11y-toolbar ul li {
33
+ margin: 0;
34
+ padding: 0;
35
  display: block;
36
  }
37
 
116
  -o-filter: grayscale(100%) !important;
117
  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;
118
  filter: gray !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  }
wp-accessibility.php CHANGED
@@ -2,17 +2,17 @@
2
  /*
3
  Plugin Name: WP Accessibility
4
  Plugin URI: http://www.joedolson.com/wp-accessibility/
5
- Description: Provides options to improve accessibility in your WordPress site, including removing title attributes.
6
- Version: 1.4.0
7
  Author: Joe Dolson
8
  Text Domain: wp-accessibility
9
  Author URI: http://www.joedolson.com/
10
 
11
  Copyright 2012-2015 Joe Dolson (joe@joedolson.com)
12
 
13
- This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License as published by
15
- the Free Software Foundation; either version 2 of the License, or
16
  (at your option) any later version.
17
 
18
  This program is distributed in the hope that it will be useful,
@@ -21,7 +21,7 @@ Author URI: http://www.joedolson.com/
21
  GNU General Public License for more details.
22
 
23
  You should have received a copy of the GNU General Public License
24
- along with this program; if not, write to the Free Software
25
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
 
@@ -37,7 +37,7 @@ function add_wpa_admin_menu() {
37
 
38
  // ACTIVATION
39
  function wpa_install() {
40
- $wpa_version = '1.4.0';
41
  if ( get_option( 'wpa_installed' ) != 'true' ) {
42
  add_option( 'rta_from_nav_menu', 'on' );
43
  add_option( 'rta_from_page_lists', 'on' );
@@ -172,6 +172,17 @@ function wpa_enqueue_scripts() {
172
  }
173
  wp_localize_script( 'wpa-complementary', 'wpaComplementary', $wpa_comp );
174
  }
 
 
 
 
 
 
 
 
 
 
 
175
  if ( get_option( 'wpa_toolbar' ) == 'on' ) {
176
  add_action( 'wp_footer', 'wpa_toolbar_js' );
177
  }
@@ -184,20 +195,35 @@ function wpa_enqueue_scripts() {
184
  }
185
 
186
  add_action( 'widgets_init', create_function( '', 'return register_widget("wp_accessibility_toolbar");' ) );
187
-
188
  class wp_accessibility_toolbar extends WP_Widget {
189
- function wp_accessibility_toolbar() {
190
- parent::WP_Widget( false, $name = __( 'Accessibility Toolbar', 'wp-accessibility' ) );
191
  }
192
 
193
  function widget( $args, $instance ) {
 
 
 
 
 
194
  echo wpa_toolbar_html();
195
  }
196
 
197
  function form( $instance ) {
 
 
 
 
 
 
 
198
  }
199
 
200
  function update( $new_instance, $old_instance ) {
 
 
 
 
201
  }
202
  }
203
 
@@ -320,14 +346,14 @@ function wpa_jquery_asl() {
320
  // attach language to html element
321
  if ( get_option( 'wpa_lang' ) == 'on' ) {
322
  $lang = get_bloginfo( 'language' );
323
- $dir = get_bloginfo( 'text_direction' );
324
  $lang_js = "$('html').attr( 'lang','$lang' ); $('html').attr( 'dir','$dir' )";
325
  }
326
  // force links to open in the same window
327
  $targets = ( get_option( 'wpa_target' ) == 'on' ) ? "$('a').removeAttr('target');" : '';
328
  $tabindex = ( get_option( 'wpa_tabindex' ) == 'on' ) ? "$('input,a,select,textarea,button').removeAttr('tabindex');" : '';
329
  $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' ); } );" : '';
330
-
331
  $display = ( $skiplinks_js || $targets || $lang_js || $tabindex || $longdesc ) ? true : false;
332
  if ( $display ) {
333
  $script = "
@@ -362,7 +388,10 @@ function wpa_stylesheet() {
362
  // Respects SSL, Style.css is relative to the current file
363
  wp_register_style( 'wpa-style', plugins_url( 'css/wpa-style.css', __FILE__ ) );
364
  wp_register_style( 'ui-font.css', plugins_url( 'toolbar/fonts/css/a11y-toolbar.css', __FILE__ ) );
365
- wp_register_style( 'ui-a11y.css', plugins_url( 'toolbar/css/a11y.css', __FILE__ ), array( 'ui-font.css' ) );
 
 
 
366
  // only enable styles when required by options
367
  if ( get_option( 'wpa_toolbar_size' ) && get_option( 'wpa_toolbar' ) == 'on' ) {
368
  echo "
@@ -375,8 +404,9 @@ function wpa_stylesheet() {
375
  if ( get_option( 'wpa_longdesc' ) == 'link' || get_option( 'wpa_longdesc' ) == 'jquery' || get_option( 'asl_enable' ) == 'on' ) {
376
  wp_enqueue_style( 'wpa-style' );
377
  }
378
- if ( get_option( 'wpa_toolbar' ) == 'on' || get_option( 'wpa_widget_toolbar' ) == 'on' ) {
379
  wp_enqueue_style( 'ui-a11y.css' );
 
380
  }
381
  if ( current_user_can( 'edit_files' ) && get_option( 'wpa_diagnostics' ) == 'on' ) {
382
  wp_register_style( 'diagnostic', plugins_url( 'css/diagnostic.css', __FILE__ ) );
@@ -576,6 +606,7 @@ function wpa_update_settings() {
576
  if ( isset( $_POST['action'] ) && $_POST['action'] == 'misc' ) {
577
  $wpa_lang = ( isset( $_POST['wpa_lang'] ) ) ? 'on' : '';
578
  $wpa_target = ( isset( $_POST['wpa_target'] ) ) ? 'on' : '';
 
579
  $wpa_search = ( isset( $_POST['wpa_search'] ) ) ? 'on' : '';
580
  $wpa_tabindex = ( isset ( $_POST['wpa_tabindex'] ) ) ? 'on' : '';
581
  $wpa_underline = ( isset ( $_POST['wpa_underline'] ) ) ? 'on' : '';
@@ -596,6 +627,7 @@ function wpa_update_settings() {
596
  $wpa_complementary_container = ( isset( $_POST['wpa_complementary_container'] ) ) ? str_replace( '#', '', $_POST['wpa_complementary_container'] ) : '';
597
  update_option( 'wpa_lang', $wpa_lang );
598
  update_option( 'wpa_target', $wpa_target );
 
599
  update_option( 'wpa_search', $wpa_search );
600
  update_option( 'wpa_tabindex', $wpa_tabindex );
601
  update_option( 'wpa_underline', $wpa_underline );
@@ -832,26 +864,26 @@ function wpa_admin_menu() {
832
  <li><label
833
  for="asl_content"><?php _e( 'Skip to Content link target (ID of your main content container)', 'wp-accessibility' ); ?></label>
834
  <input type="text" id="asl_content" name="asl_content"
835
- value="<?php echo esc_attr( get_option( 'asl_content' ) ); ?>"/></li>
836
  <li><label
837
  for="asl_navigation"><?php _e( 'Skip to Navigation link target (ID of your main navigation container)', 'wp-accessibility' ); ?></label>
838
  <input type="text" id="asl_navigation" name="asl_navigation"
839
- value="<?php echo esc_attr( get_option( 'asl_navigation' ) ); ?>"/></li>
840
  <li><label
841
  for="asl_sitemap"><?php _e( 'Site Map link target (URL for your site map)', 'wp-accessibility' ); ?></label><input
842
  type="text" id="asl_sitemap" name="asl_sitemap" size="44"
843
- value="<?php echo esc_attr( get_option( 'asl_sitemap' ) ); ?>"/></li>
844
  <li><label
845
  for="asl_extra_target"><?php _e( 'Add your own link (link or container ID)', 'wp-accessibility' ); ?></label>
846
  <input type="text" id="asl_extra_target" name="asl_extra_target"
847
- value="<?php echo esc_attr( get_option( 'asl_extra_target' ) ); ?>"/> <label
848
  for="asl_extra_text"><?php _e( 'Link text for your link', 'wp-accessibility' ); ?></label>
849
  <input type="text" id="asl_extra_text" name="asl_extra_text"
850
- value="<?php echo esc_attr( get_option( 'asl_extra_text' ) ); ?>"/></li>
851
  <li><label
852
  for="asl_styles_focus"><?php _e( 'Styles for Skiplinks when they have focus', 'wp-accessibility' ); ?></label><br/>
853
  <textarea name='asl_styles_focus' id='asl_styles_focus' cols='60'
854
- rows='4'><?php echo stripslashes( get_option( 'asl_styles_focus' ) ); ?></textarea>
855
  </li>
856
  <?php if ( get_option( 'asl_visible' ) != 'on' ) {
857
  $disabled = " disabled='disabled' style='background: #eee;'";
@@ -902,7 +934,7 @@ function wpa_admin_menu() {
902
  <label
903
  for="wpa_continue"><?php _e( 'Continue reading text', 'wp-accessibility' ); ?></label>
904
  <input type="text" id="wpa_continue" name="wpa_continue"
905
- value="<?php echo esc_attr( get_option( 'wpa_continue' ) ); ?>"/></li>
906
  <li><input type="checkbox" id="wpa_insert_roles"
907
  name="wpa_insert_roles" <?php if ( get_option( 'wpa_insert_roles' ) == "on" ) {
908
  echo 'checked="checked" ';
@@ -910,10 +942,13 @@ function wpa_admin_menu() {
910
  for="wpa_insert_roles"><?php _e( 'Add landmark roles to HTML5 structural elements', 'wp-accessibility' ); ?></label><br/><label
911
  for="wpa_complementary_container"><?php _e( 'ID for complementary role', 'wp-accessibility' ); ?></label><input
912
  type="text" id="wpa_complementary_container" name="wpa_complementary_container"
913
- value="#<?php echo esc_attr( get_option( 'wpa_complementary_container' ) ); ?>"/>
 
 
 
914
  </li>
915
  <?php } else { ?>
916
- <li><?php _e( '<strong>Three disabled features:</strong> Site language, continue reading text, and landmark roles are defined by your <code>accessibility-ready</code> theme.', 'wp-accessibility' ); ?></li>
917
  <?php } ?>
918
  <li><input type="checkbox" id="wpa_target"
919
  name="wpa_target" <?php if ( get_option( 'wpa_target' ) == "on" ) {
@@ -1021,7 +1056,7 @@ function wpa_admin_menu() {
1021
  <label
1022
  for="wpa_focus_color"><?php _e( 'Outline color (hexadecimal, optional)', 'wp-accessibility' ); ?></label><input
1023
  type="text" id="wpa_focus_color" name="wpa_focus_color"
1024
- value="#<?php echo esc_attr( get_option( 'wpa_focus_color' ) ); ?>"/></li>
1025
  </ul>
1026
  </fieldset>
1027
  <p>
@@ -1088,13 +1123,13 @@ function wpa_admin_menu() {
1088
  <div id="fore"></div>
1089
  <label
1090
  for="color1"><?php _e( 'Foreground color', 'wp-accessibility' ); ?></label><br/><input
1091
- type="text" name="color" value="#<?php echo $hex1; ?>" size="34" id="color1"/>
1092
  </li>
1093
  <li class='back'>
1094
  <div id="back"></div>
1095
  <label
1096
  for="color2"><?php _e( 'Background color', 'wp-accessibility' ); ?></label><br/><input
1097
- type="text" name="color2" value="#<?php echo $hex2; ?>" size="34" id="color2"/>
1098
  </li>
1099
  </ul>
1100
  </fieldset>
@@ -1282,8 +1317,8 @@ function wpa_remove_title_attributes( $output ) {
1282
  // The built-in Recent Posts widget hard-coded title attributes until 3.8.
1283
  class WP_Widget_Recent_Posts_No_Title_Attributes extends WP_Widget {
1284
 
1285
- function WP_Widget_Recent_Posts_No_Title_Attributes() {
1286
- parent::WP_Widget( false, $name = __( 'WP A11Y: Recent Posts', 'wp-accessibility' ) );
1287
  }
1288
 
1289
  function widget( $args, $instance ) {
@@ -1363,13 +1398,13 @@ class WP_Widget_Recent_Posts_No_Title_Attributes extends WP_Widget {
1363
  ?>
1364
  <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
1365
  <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>"
1366
- name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>"/>
1367
  </p>
1368
 
1369
  <p><label
1370
  for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:' ); ?></label>
1371
  <input id="<?php echo $this->get_field_id( 'number' ); ?>"
1372
- name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>"
1373
  size="3"/></p>
1374
  <?php
1375
  }
@@ -1477,7 +1512,7 @@ $plugins_string
1477
  if ( $has_donated == 'Donor' ) {
1478
  echo "<div class='message updated'><p>" . __( 'Thank you for supporting the continuing development of this plug-in! I\'ll get back to you as soon as I can.', 'wp-accessibility' ) . "</p></div>";
1479
  } else {
1480
- echo "<div class='message updated'><p>" . __( 'I cannot provide free support, but will treat your request as a bug report, and will incorporate any permanent solutions I discover into the plug-in.', 'wp-accessibility' ) . "</p></div>";
1481
  }
1482
  }
1483
  }
@@ -1644,7 +1679,7 @@ add_filter( 'image_send_to_editor', 'longdesc_add_attr', 10, 8 );
1644
  function wpa_accessible_theme() {
1645
  $theme = wp_get_theme();
1646
  $tags = $theme->get( 'Tags' );
1647
- if ( in_array( 'accessibility-ready', $tags ) ) {
1648
  return true;
1649
  }
1650
  return false;
@@ -1694,7 +1729,7 @@ function wpa_media_value( $column, $id ) {
1694
  }
1695
  break;
1696
  default:
1697
- echo '<span class="non-image">' . __( 'N/A', 'wp-accessibility' ) . '</span>';
1698
  break;
1699
  }
1700
  }
@@ -1734,16 +1769,21 @@ function wpa_alt_attribute( $html, $id, $caption, $title, $align, $url, $size, $
1734
  $noalt = get_post_meta( $id, '_no_alt', true );
1735
  /* Get the original title to compare to alt */
1736
  $title = get_the_title( $id );
1737
- $warning = '';
1738
  if ( $noalt == 1 ) {
1739
  $html = str_replace( 'alt="'.$alt.'"', 'alt=""', $html );
1740
  }
1741
  if ( ( $alt == '' || $alt == $title ) && $noalt != 1 ) {
1742
- $warning = __( 'This image requires an <code>alt</code> attribute.', 'wp-accessibility' );
 
 
 
 
 
 
1743
  }
1744
  if ( $warning ) {
1745
- $html = str_replace( 'alt="'.$alt.'"', 'alt=""', $html );
1746
- return "<div class='wpa-image-missing-alt'>" . $html . '<br />' . $warning . "</div>";
1747
  }
1748
  return $html;
1749
  }
2
  /*
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.4.6
7
  Author: Joe Dolson
8
  Text Domain: wp-accessibility
9
  Author URI: http://www.joedolson.com/
10
 
11
  Copyright 2012-2015 Joe Dolson (joe@joedolson.com)
12
 
13
+ This program is software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License as published by
15
+ the Software Foundation; either version 2 of the License, or
16
  (at your option) any later version.
17
 
18
  This program is distributed in the hope that it will be useful,
21
  GNU General Public License for more details.
22
 
23
  You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Software
25
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
 
37
 
38
  // ACTIVATION
39
  function wpa_install() {
40
+ $wpa_version = '1.4.6';
41
  if ( get_option( 'wpa_installed' ) != 'true' ) {
42
  add_option( 'rta_from_nav_menu', 'on' );
43
  add_option( 'rta_from_page_lists', 'on' );
172
  }
173
  wp_localize_script( 'wpa-complementary', 'wpaComplementary', $wpa_comp );
174
  }
175
+ if ( get_option( 'wpa_labels' ) == 'on' ) {
176
+ wp_enqueue_script( 'wpa-labels', plugins_url( 'js/wpa.labels.js', __FILE__ ), array( 'jquery' ), '1.0', true );
177
+ $labels = array(
178
+ 's' => __( 'Search', 'wp-accessibility' ),
179
+ 'author' => __( 'Name', 'wp-accessibility' ),
180
+ 'email' => __( 'Email', 'wp-accessibility' ),
181
+ 'url' => __( 'Website', 'wp-accessibility' ),
182
+ 'comment' => __( 'Comment', 'wp-accessibility' )
183
+ );
184
+ wp_localize_script( 'wpa-labels', 'wpalabels', $labels );
185
+ }
186
  if ( get_option( 'wpa_toolbar' ) == 'on' ) {
187
  add_action( 'wp_footer', 'wpa_toolbar_js' );
188
  }
195
  }
196
 
197
  add_action( 'widgets_init', create_function( '', 'return register_widget("wp_accessibility_toolbar");' ) );
 
198
  class wp_accessibility_toolbar extends WP_Widget {
199
+ function __construct() {
200
+ parent::__construct( false, $name = __( 'Accessibility Toolbar', 'wp-accessibility' ) );
201
  }
202
 
203
  function widget( $args, $instance ) {
204
+ extract( $args );
205
+
206
+ $title = apply_filters( 'widget_title', ( empty( $instance['title'] ) ? false : $instance['title'] ), $instance, $args );
207
+ echo $before_widget;
208
+ echo ( $title ) ? $before_title . $title . $after_title : '';
209
  echo wpa_toolbar_html();
210
  }
211
 
212
  function form( $instance ) {
213
+ $title = ( isset( $instance['title'] ) ) ? esc_attr( $instance['title'] ) : '';
214
+ ?>
215
+ <p>
216
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'wp-accessibility' ); ?></label>
217
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php esc_attr_e( $title ); ?>"/>
218
+ </p>
219
+ <?php
220
  }
221
 
222
  function update( $new_instance, $old_instance ) {
223
+ $instance = $old_instance;
224
+ $instance['title'] = strip_tags( $new_instance['title'] );
225
+
226
+ return $instance;
227
  }
228
  }
229
 
346
  // attach language to html element
347
  if ( get_option( 'wpa_lang' ) == 'on' ) {
348
  $lang = get_bloginfo( 'language' );
349
+ $dir = ( is_rtl() ) ? 'rtl' : 'ltr';
350
  $lang_js = "$('html').attr( 'lang','$lang' ); $('html').attr( 'dir','$dir' )";
351
  }
352
  // force links to open in the same window
353
  $targets = ( get_option( 'wpa_target' ) == 'on' ) ? "$('a').removeAttr('target');" : '';
354
  $tabindex = ( get_option( 'wpa_tabindex' ) == 'on' ) ? "$('input,a,select,textarea,button').removeAttr('tabindex');" : '';
355
  $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' ); } );" : '';
356
+
357
  $display = ( $skiplinks_js || $targets || $lang_js || $tabindex || $longdesc ) ? true : false;
358
  if ( $display ) {
359
  $script = "
388
  // Respects SSL, Style.css is relative to the current file
389
  wp_register_style( 'wpa-style', plugins_url( 'css/wpa-style.css', __FILE__ ) );
390
  wp_register_style( 'ui-font.css', plugins_url( 'toolbar/fonts/css/a11y-toolbar.css', __FILE__ ) );
391
+ $toolbar = apply_filters( 'wpa_toolbar_css', plugins_url( 'toolbar/css/a11y.css', __FILE__ ) );
392
+ wp_register_style( 'ui-a11y.css', $toolbar, array( 'ui-font.css' ) );
393
+ $fontsize = apply_filters( 'wpa_fontsize_css', plugins_url( 'toolbar/css/a11y-fontsize.css', __FILE__ ) );
394
+ wp_register_style( 'ui-fontsize.css', $fontsize );
395
  // only enable styles when required by options
396
  if ( get_option( 'wpa_toolbar_size' ) && get_option( 'wpa_toolbar' ) == 'on' ) {
397
  echo "
404
  if ( get_option( 'wpa_longdesc' ) == 'link' || get_option( 'wpa_longdesc' ) == 'jquery' || get_option( 'asl_enable' ) == 'on' ) {
405
  wp_enqueue_style( 'wpa-style' );
406
  }
407
+ if ( get_option( 'wpa_toolbar' ) == 'on' || get_option( 'wpa_widget_toolbar' ) == 'on' && ( $toolbar && $fontsize ) ) {
408
  wp_enqueue_style( 'ui-a11y.css' );
409
+ wp_enqueue_style( 'ui-fontsize.css' );
410
  }
411
  if ( current_user_can( 'edit_files' ) && get_option( 'wpa_diagnostics' ) == 'on' ) {
412
  wp_register_style( 'diagnostic', plugins_url( 'css/diagnostic.css', __FILE__ ) );
606
  if ( isset( $_POST['action'] ) && $_POST['action'] == 'misc' ) {
607
  $wpa_lang = ( isset( $_POST['wpa_lang'] ) ) ? 'on' : '';
608
  $wpa_target = ( isset( $_POST['wpa_target'] ) ) ? 'on' : '';
609
+ $wpa_labels = ( isset( $_POST['wpa_labels'] ) ) ? 'on' : '';
610
  $wpa_search = ( isset( $_POST['wpa_search'] ) ) ? 'on' : '';
611
  $wpa_tabindex = ( isset ( $_POST['wpa_tabindex'] ) ) ? 'on' : '';
612
  $wpa_underline = ( isset ( $_POST['wpa_underline'] ) ) ? 'on' : '';
627
  $wpa_complementary_container = ( isset( $_POST['wpa_complementary_container'] ) ) ? str_replace( '#', '', $_POST['wpa_complementary_container'] ) : '';
628
  update_option( 'wpa_lang', $wpa_lang );
629
  update_option( 'wpa_target', $wpa_target );
630
+ update_option( 'wpa_labels', $wpa_labels );
631
  update_option( 'wpa_search', $wpa_search );
632
  update_option( 'wpa_tabindex', $wpa_tabindex );
633
  update_option( 'wpa_underline', $wpa_underline );
864
  <li><label
865
  for="asl_content"><?php _e( 'Skip to Content link target (ID of your main content container)', 'wp-accessibility' ); ?></label>
866
  <input type="text" id="asl_content" name="asl_content"
867
+ value="<?php esc_attr_e( get_option( 'asl_content' ) ); ?>"/></li>
868
  <li><label
869
  for="asl_navigation"><?php _e( 'Skip to Navigation link target (ID of your main navigation container)', 'wp-accessibility' ); ?></label>
870
  <input type="text" id="asl_navigation" name="asl_navigation"
871
+ value="<?php esc_attr_e( get_option( 'asl_navigation' ) ); ?>"/></li>
872
  <li><label
873
  for="asl_sitemap"><?php _e( 'Site Map link target (URL for your site map)', 'wp-accessibility' ); ?></label><input
874
  type="text" id="asl_sitemap" name="asl_sitemap" size="44"
875
+ value="<?php esc_attr_e( get_option( 'asl_sitemap' ) ); ?>"/></li>
876
  <li><label
877
  for="asl_extra_target"><?php _e( 'Add your own link (link or container ID)', 'wp-accessibility' ); ?></label>
878
  <input type="text" id="asl_extra_target" name="asl_extra_target"
879
+ value="<?php esc_attr_e( get_option( 'asl_extra_target' ) ); ?>"/> <label
880
  for="asl_extra_text"><?php _e( 'Link text for your link', 'wp-accessibility' ); ?></label>
881
  <input type="text" id="asl_extra_text" name="asl_extra_text"
882
+ value="<?php esc_attr_e( get_option( 'asl_extra_text' ) ); ?>"/></li>
883
  <li><label
884
  for="asl_styles_focus"><?php _e( 'Styles for Skiplinks when they have focus', 'wp-accessibility' ); ?></label><br/>
885
  <textarea name='asl_styles_focus' id='asl_styles_focus' cols='60'
886
+ rows='4'><?php esc_attr_e( stripslashes( get_option( 'asl_styles_focus' ) ) ); ?></textarea>
887
  </li>
888
  <?php if ( get_option( 'asl_visible' ) != 'on' ) {
889
  $disabled = " disabled='disabled' style='background: #eee;'";
934
  <label
935
  for="wpa_continue"><?php _e( 'Continue reading text', 'wp-accessibility' ); ?></label>
936
  <input type="text" id="wpa_continue" name="wpa_continue"
937
+ value="<?php esc_attr_e( get_option( 'wpa_continue' ) ); ?>"/></li>
938
  <li><input type="checkbox" id="wpa_insert_roles"
939
  name="wpa_insert_roles" <?php if ( get_option( 'wpa_insert_roles' ) == "on" ) {
940
  echo 'checked="checked" ';
942
  for="wpa_insert_roles"><?php _e( 'Add landmark roles to HTML5 structural elements', 'wp-accessibility' ); ?></label><br/><label
943
  for="wpa_complementary_container"><?php _e( 'ID for complementary role', 'wp-accessibility' ); ?></label><input
944
  type="text" id="wpa_complementary_container" name="wpa_complementary_container"
945
+ value="#<?php esc_attr_e( get_option( 'wpa_complementary_container' ) ); ?>"/>
946
+ </li>
947
+ <li>
948
+ <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>
949
  </li>
950
  <?php } else { ?>
951
+ <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>
952
  <?php } ?>
953
  <li><input type="checkbox" id="wpa_target"
954
  name="wpa_target" <?php if ( get_option( 'wpa_target' ) == "on" ) {
1056
  <label
1057
  for="wpa_focus_color"><?php _e( 'Outline color (hexadecimal, optional)', 'wp-accessibility' ); ?></label><input
1058
  type="text" id="wpa_focus_color" name="wpa_focus_color"
1059
+ value="#<?php esc_attr_e( get_option( 'wpa_focus_color' ) ); ?>"/></li>
1060
  </ul>
1061
  </fieldset>
1062
  <p>
1123
  <div id="fore"></div>
1124
  <label
1125
  for="color1"><?php _e( 'Foreground color', 'wp-accessibility' ); ?></label><br/><input
1126
+ type="text" name="color" value="#<?php esc_attr_e( $hex1 ); ?>" size="34" id="color1"/>
1127
  </li>
1128
  <li class='back'>
1129
  <div id="back"></div>
1130
  <label
1131
  for="color2"><?php _e( 'Background color', 'wp-accessibility' ); ?></label><br/><input
1132
+ type="text" name="color2" value="#<?php esc_attr_e( $hex2 ); ?>" size="34" id="color2"/>
1133
  </li>
1134
  </ul>
1135
  </fieldset>
1317
  // The built-in Recent Posts widget hard-coded title attributes until 3.8.
1318
  class WP_Widget_Recent_Posts_No_Title_Attributes extends WP_Widget {
1319
 
1320
+ function __construct() {
1321
+ parent::__construct( false, $name = __( 'WP A11Y: Recent Posts', 'wp-accessibility' ) );
1322
  }
1323
 
1324
  function widget( $args, $instance ) {
1398
  ?>
1399
  <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
1400
  <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>"
1401
+ name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php esc_attr_e( $title ); ?>"/>
1402
  </p>
1403
 
1404
  <p><label
1405
  for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:' ); ?></label>
1406
  <input id="<?php echo $this->get_field_id( 'number' ); ?>"
1407
+ name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php esc_attr_e( $number ); ?>"
1408
  size="3"/></p>
1409
  <?php
1410
  }
1512
  if ( $has_donated == 'Donor' ) {
1513
  echo "<div class='message updated'><p>" . __( 'Thank you for supporting the continuing development of this plug-in! I\'ll get back to you as soon as I can.', 'wp-accessibility' ) . "</p></div>";
1514
  } else {
1515
+ echo "<div class='message updated'><p>" . __( 'I cannot provide support, but will treat your request as a bug report, and will incorporate any permanent solutions I discover into the plug-in.', 'wp-accessibility' ) . "</p></div>";
1516
  }
1517
  }
1518
  }
1679
  function wpa_accessible_theme() {
1680
  $theme = wp_get_theme();
1681
  $tags = $theme->get( 'Tags' );
1682
+ if ( is_array( $tags ) && in_array( 'accessibility-ready', $tags ) ) {
1683
  return true;
1684
  }
1685
  return false;
1729
  }
1730
  break;
1731
  default:
1732
+ echo '<span class="non-image">' . __( 'N/A', 'wp-accessibility' ) . '</span>';
1733
  break;
1734
  }
1735
  }
1769
  $noalt = get_post_meta( $id, '_no_alt', true );
1770
  /* Get the original title to compare to alt */
1771
  $title = get_the_title( $id );
1772
+ $warning = false;
1773
  if ( $noalt == 1 ) {
1774
  $html = str_replace( 'alt="'.$alt.'"', 'alt=""', $html );
1775
  }
1776
  if ( ( $alt == '' || $alt == $title ) && $noalt != 1 ) {
1777
+ if ( $alt == $title ) {
1778
+ $warning = __( 'The alt text for this image is the same as the title. In most cases, that means that the alt attribute has been automatically provided from the image file name.', 'wp-accessibility' );
1779
+ $image = 'alt-same.png';
1780
+ } else {
1781
+ $warning = __( 'This image requires alt text, but the alt text is currently blank. Either add alt text or mark the image as decorative.', 'wp-accessibility' );
1782
+ $image = 'alt-missing.png';
1783
+ }
1784
  }
1785
  if ( $warning ) {
1786
+ return $html . "<img class='wpa-image-missing-alt size-" . esc_attr( $size ) . ' ' . esc_attr( $align ) . "' src='" . plugins_url( "imgs/$image", __FILE__ ) . "' alt='" . esc_attr( $warning ) . "' />";
 
1787
  }
1788
  return $html;
1789
  }