WP Accessibility - Version 1.4.0

Version Description

  • Added enforcement tools for alt attribute usage in images.
  • Media lists indicate whether an image is marked as decorative, has an alt attribute, or needs an alt attribute.
  • Media editor shows checkbox to mark as decorative when editing image media types.
  • If an image is inserted into a post without either being marked as decorative or having an alt attribute provided, HTML will also insert a notice indicating that the image needs an alt attribute.
  • If an image is inserted and is checked as decorative, the alt attribute will be set to an empty value.
  • Language update: Spanish
Download this release

Release Info

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

Code changes from version 1.3.11 to 1.4.0

css/editor-style.css ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ .wpa-image-missing-alt {
2
+ border: 2px solid red;
3
+ display: inline-block;
4
+ padding: .5em;
5
+ }
lang/wp-accessibility-es_ES.mo CHANGED
Binary file
readme.txt CHANGED
@@ -1,10 +1,10 @@
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
5
  Requires at least: 3.4.2
6
- Tested up to: 4.1
7
- Stable tag: 1.3.10
8
  License: GPLv2 or later
9
 
10
  WP Accessibility fixes common accessibility issues in your WordPress site.
@@ -23,6 +23,7 @@ All features can be disabled according to your theme's needs. For advanced users
23
  * Add an outline to the keyboard focus state for focusable elements.
24
  * Add a toolbar toggling between high contrast, large print, and desaturated (grayscale) views of your theme.
25
  * Add a long description to images. Use the image's "Description" field to add long descriptions.
 
26
 
27
  = Accessibility Issues fixed by WP Accessibility: =
28
 
@@ -46,7 +47,7 @@ The plug-in is intended to help with deficiencies commonly found in themes and t
46
  Translating my plug-ins is always appreciated. Visit <a href="http://translate.joedolson.com">my translations site</a> to start getting your language into shape!
47
 
48
  Available translations (in order of completeness):
49
- Dutch, Finnish, French, Portuguese (Brazil), Bulgarian, Greek, Portuguese (Portugal), Italian, Russian, Romanian, German, Spanish, Polish, Hebrew, Slovenian
50
 
51
  Visit the [WP Accessibility translations site](http://translate.joedolson.com/projects/wp-accessibility/) to check the progress of a translation.
52
 
@@ -58,13 +59,14 @@ Visit the [WP Accessibility translations site](http://translate.joedolson.com/pr
58
 
59
  == Changelog ==
60
 
61
- = 1.x.x =
62
 
63
- These are potential future features.
64
-
65
- * Auto configuration of settings based on Tenon results. (Whoa. Can I do that?)
66
- * Front End Tenon reporting
67
- * Provide ability for themes to pass default settings within that theme.
 
68
 
69
  = 1.3.11 =
70
 
@@ -258,4 +260,4 @@ Even if WP Accessibility is running correctly, not all accessibility testing too
258
 
259
  == Upgrade Notice ==
260
 
261
- * 1.3.9 Lots of translation updates.
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.
23
  * Add an outline to the keyboard focus state for focusable elements.
24
  * Add a toolbar toggling between high contrast, large print, and desaturated (grayscale) views of your theme.
25
  * Add a long description to images. Use the image's "Description" field to add long descriptions.
26
+ * Enforcement for alt attributes on images.
27
 
28
  = Accessibility Issues fixed by WP Accessibility: =
29
 
47
  Translating my plug-ins is always appreciated. Visit <a href="http://translate.joedolson.com">my translations site</a> to start getting your language into shape!
48
 
49
  Available translations (in order of completeness):
50
+ Dutch, Finnish, French, Portuguese (Brazil), Bulgarian, Greek, Spanish, Portuguese (Portugal), Italian, Russian, Romanian, German, Polish, Hebrew, Slovenian
51
 
52
  Visit the [WP Accessibility translations site](http://translate.joedolson.com/projects/wp-accessibility/) to check the progress of a translation.
53
 
59
 
60
  == Changelog ==
61
 
62
+ = 1.4.0 =
63
 
64
+ * Added enforcement tools for alt attribute usage in images.
65
+ * Media lists indicate whether an image is marked as decorative, has an alt attribute, or needs an alt attribute.
66
+ * Media editor shows checkbox to mark as decorative when editing image media types.
67
+ * If an image is inserted into a post without either being marked as decorative or having an alt attribute provided, HTML will also insert a notice indicating that the image needs an alt attribute.
68
+ * If an image is inserted and is checked as decorative, the alt attribute will be set to an empty value.
69
+ * Language update: Spanish
70
 
71
  = 1.3.11 =
72
 
260
 
261
  == Upgrade Notice ==
262
 
263
+ * 1.3.11 - Aware of accessibility-ready themes; notice about Access Monitor; bug fix
toolbar/css/a11y.css CHANGED
@@ -117,7 +117,7 @@
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: 125% !important;
121
  line-height: 1.4;
122
  }
123
 
@@ -125,6 +125,10 @@
125
  font-size: 110% !important;
126
  }
127
 
 
 
 
 
128
  .fontsize .a11y-toolbar ul li {
129
- font-size: 75% !important;
130
  }
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
 
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
  }
toolbar/js/a11y.js CHANGED
@@ -115,17 +115,4 @@ jQuery(document).ready(function ($) {
115
  }, 100);
116
  }
117
 
118
- // Focuses on the correct section of the page if we're in-page linking
119
- // Thanks to WebAIM.org for this idea
120
- // does not support 'name' targets
121
- /* Removed, because it conflicts with many other plug-ins.
122
- $('a[href^="#"]').click(function(event) {
123
- var inPageAnchor = "#" + this.href.split('#')[1];
124
- $(inPageAnchor).scrollTo({ duration: 1000 });
125
- setTimeout(function() {
126
- $(inPageAnchor).focus();
127
- }, 100);
128
- return false;
129
- });
130
- */
131
  });
115
  }, 100);
116
  }
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  });
wp-accessibility.php CHANGED
@@ -3,7 +3,7 @@
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.3.11
7
  Author: Joe Dolson
8
  Text Domain: wp-accessibility
9
  Author URI: http://www.joedolson.com/
@@ -37,7 +37,7 @@ function add_wpa_admin_menu() {
37
 
38
  // ACTIVATION
39
  function wpa_install() {
40
- $wpa_version = '1.3.11';
41
  if ( get_option( 'wpa_installed' ) != 'true' ) {
42
  add_option( 'rta_from_nav_menu', 'on' );
43
  add_option( 'rta_from_page_lists', 'on' );
@@ -1664,4 +1664,91 @@ function wpa_update_notice() {
1664
  $access_monitor = "https://wordpress.org/plugins/access-monitor/";
1665
  echo "<div class='updated fade'><p>" . sprintf( __( 'Have you seen my new accessibility plug-in? <a href="%1$s">Check out Access Monitor</a>! &nbsp; &nbsp; <a href="%2$s">Dismiss Notice<span class="dashicons dashicons-no" aria-hidden="true"></span></a>', 'wp-accessibility' ), $access_monitor, $dismiss ) . "</p></div>";
1666
  }
1667
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/
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' );
1664
  $access_monitor = "https://wordpress.org/plugins/access-monitor/";
1665
  echo "<div class='updated fade'><p>" . sprintf( __( 'Have you seen my new accessibility plug-in? <a href="%1$s">Check out Access Monitor</a>! &nbsp; &nbsp; <a href="%2$s">Dismiss Notice<span class="dashicons dashicons-no" aria-hidden="true"></span></a>', 'wp-accessibility' ), $access_monitor, $dismiss ) . "</p></div>";
1666
  }
1667
+ }
1668
+
1669
+ add_filter( 'manage_media_columns', 'wpa_media_columns' );
1670
+ add_action( 'manage_media_custom_column', 'wpa_media_value', 10, 2 );
1671
+
1672
+ function wpa_media_columns( $columns ) {
1673
+ $columns['wpa_data'] = __( 'Accessibility', 'wp-accessibility' );
1674
+ return $columns;
1675
+ }
1676
+
1677
+ function wpa_media_value( $column, $id ) {
1678
+ if ( $column == 'wpa_data' ) {
1679
+ $mime = get_post_mime_type( $id );
1680
+ switch ( $mime ) {
1681
+ case 'image/jpeg':
1682
+ case 'image/png':
1683
+ case 'image/gif':
1684
+ $alt = get_post_meta( $id, '_wp_attachment_image_alt', true );
1685
+ $no_alt = get_post_meta( $id, '_no_alt', true );
1686
+ if ( !$alt && !$no_alt ) {
1687
+ echo '<span class="missing"><span class="dashicons dashicons-no" aria-hidden="true"></span> <a href="'.get_edit_post_link( $id ).'#attachment_alt">'.__( 'Add <code>alt</code> text', 'wp-accessibility' ).'</a></span>';
1688
+ } else {
1689
+ if ( $no_alt == 1 ) {
1690
+ echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> '.__( 'Decorative', 'wp-accessibility' ).'</span>';
1691
+ } else {
1692
+ echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> '.__( 'Has <code>alt</code>', 'wp-accessibility' ).'</span>';
1693
+ }
1694
+ }
1695
+ break;
1696
+ default:
1697
+ echo '<span class="non-image">' . __( 'N/A', 'wp-accessibility' ) . '</span>';
1698
+ break;
1699
+ }
1700
+ }
1701
+ return $column;
1702
+ }
1703
+
1704
+ add_filter( 'attachment_fields_to_edit', 'wpa_insert_alt_verification', 10, 2 );
1705
+ function wpa_insert_alt_verification( $form_fields, $post ) {
1706
+ $mime = get_post_mime_type( $post->ID );
1707
+ if ( $mime == 'image/jpeg' || $mime == 'image/png' || $mime == 'image/gif' ) {
1708
+ $no_alt = get_post_meta( $post->ID, '_no_alt', true );
1709
+ $alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
1710
+ $checked = checked( $no_alt, 1, false );
1711
+ $form_fields['no_alt'] = array(
1712
+ 'label' => __( 'Decorative', 'wp-accessibility' ),
1713
+ 'input' => 'html',
1714
+ 'value' => 1,
1715
+ 'html' => "<input name='attachments[$post->ID][no_alt]' id='attachments-$post->ID-no_alt' value='1' type='checkbox' aria-describedby='wpa_help' $checked /> <em class='help' id='wpa_help'>" . __( 'All images must either have an alt attribute or be declared as decorative.', 'wp-accessibility' ) . "</em>"
1716
+ );
1717
+ }
1718
+ return $form_fields;
1719
+ }
1720
+
1721
+ add_filter( 'attachment_fields_to_save', 'wpa_save_alt_verification', 10, 2 );
1722
+ function wpa_save_alt_verification( $post, $attachment ) {
1723
+ if ( isset( $attachment['no_alt'] ) ) {
1724
+ update_post_meta( $post['ID'], '_no_alt', 1 );
1725
+ } else {
1726
+ delete_post_meta( $post['ID'], '_no_alt' );
1727
+ }
1728
+ return $post;
1729
+ }
1730
+
1731
+ add_filter( 'image_send_to_editor', 'wpa_alt_attribute', 10, 8 );
1732
+ function wpa_alt_attribute( $html, $id, $caption, $title, $align, $url, $size, $alt ) {
1733
+ /* Get data for the image attachment. */
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
+ }
1750
+
1751
+ add_action( 'init', 'wpa_add_editor_styles' );
1752
+ function wpa_add_editor_styles() {
1753
+ add_editor_style( plugins_url( 'css/editor-style.css', __FILE__ ) );
1754
+ }