Plugin Directory

Changeset 2218372


Ignore:
Timestamp:
12/26/2019 08:48:04 PM (7 years ago)
Author:
joedolson
Message:

Remove 1.6.9; add 1.7.0; change stable tag.

1.7.0

  • Add: test for specific common types of invalid alt attribute and label as invalid.
  • Change: Remove webkit skiplink polyfill (obsolete)
  • Change: Move toolbar JS to external file.
  • Change: Use wp inline style method for toolbar size.
  • Bug fix: Incorrect variable type matching in toolbar size setting.
  • Security: Minor authenticated XSS vulnerability in custom CSS.
Location:
wp-accessibility
Files:
69 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • wp-accessibility/trunk/readme.txt

    r2096734 r2218372  
    55Requires at least: 3.4.2
    66Requires PHP: 5.3
    7 Tested up to: 5.2
    8 Stable tag: 1.6.10
     7Tested up to: 5.3
     8Stable tag: 1.7.0
    99Text Domain: wp-accessibility
    1010License: GPLv2 or later
    … …  
    2727* Add a long description to images. Use the image's "Description" field to add long descriptions.
    2828* Enforcement for alt attributes on images.
     29* Easily identify images without alt attributes in the Media Library
    2930
    3031= Accessibility Issues fixed by WP Accessibility: =
    … …  
    6566[Suggest a change!](https://github.com/joedolson/wp-accessibility/issues/)
    6667* Conflict with NextGen gallery to explore
     68
     69= 1.7.0 =
     70
     71* Add: test for specific common types of invalid alt attribute and label as invalid.
     72* Change: Remove webkit skiplink polyfill (obsolete)
     73* Change: Move toolbar JS to external file.
     74* Change: Use wp inline style method for toolbar size.
     75* Bug fix: Incorrect variable type matching in toolbar size setting.
     76* Security: Minor authenticated XSS vulnerability in custom CSS.
    6777
    6878= 1.6.10 =
  • wp-accessibility/trunk/wp-accessibility-alt.php

    r2095288 r2218372  
    3939function wpa_media_value( $column, $id ) {
    4040        if ( 'wpa_data' === $column ) {
    41                 $mime = get_post_mime_type( $id );
     41                $mime           = get_post_mime_type( $id );
     42                $invalid_values = array(
     43                        '""',
     44                        "''",
     45                );
    4246                switch ( $mime ) {
    4347                        case 'image/jpeg':
    … …  
    5155                                        if ( true === $no_alt ) {
    5256                                                echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> ' . __( 'Decorative', 'wp-accessibility' ) . '</span>';
     57                                        } elseif ( in_array( $alt, $invalid_values, true ) ) {
     58                                                echo '<span class="missing"><span class="dashicons dashicons-no" aria-hidden="true"></span> ' . __( 'Invalid', 'wp-accessibility' ) . '</span>';
    5359                                        } else {
    5460                                                echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> ' . __( 'Has <code>alt</code>', 'wp-accessibility' ) . '</span>';
  • wp-accessibility/trunk/wp-accessibility-settings.php

    r2095288 r2218372  
    301301                                                                        for ( $i = 1.2; $i <= 3.8; ) {
    302302                                                                                $val           = ( $i * 10 ) + 2;
    303                                                                                 $current       = $val;
     303                                                                                $current       = absint( $val );
    304304                                                                                $selected_size = ( $current === $size ) ? ' selected="selected"' : '';
    305305                                                                                echo "<option value='$val'$selected_size>$val px</option>";
  • wp-accessibility/trunk/wp-accessibility-toolbar.php

    r2095288 r2218372  
    7575
    7676/**
    77  * Generate Toolbar as JS.
     77 * Generate Toolbar variables for localization in JS.
    7878 */
    7979function wpa_toolbar_js() {
    … …  
    8181        $default    = ( false !== (bool) get_option( 'wpa_toolbar_default' ) ) ? get_option( 'wpa_toolbar_default' ) : 'body';
    8282        $location   = apply_filters( 'wpa_move_toolbar', $default );
    83         $user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? $_SERVER['HTTP_USER_AGENT'] : '';
    8483        $is_rtl     = ( is_rtl() ) ? ' rtl' : ' ltr';
    8584        $is_right   = ( 'on' === get_option( 'wpa_toolbar_right' ) ) ? ' right' : ' left';
    8685        $responsive = ( 'on' === get_option( 'wpa_toolbar_mobile' ) ) ? 'a11y-responsive ' : 'a11y-non-responsive ';
    8786
    88         if ( preg_match( '/Edge/i', $user_agent ) ) {
    89                 echo wpa_toolbar_html( 'js', 'a' );
    90                 echo "
    91 <script type='text/javascript'>
    92 //<![CDATA[
    93 (function( $ ) { 'use strict';
    94         var toolbar = $( '.a11y-toolbar-widget' );
    95         toolbar.removeClass( 'a11y-toolbar-widget' );
    96         $( document ).find( '$location' ).prepend( toolbar );
    97 }(jQuery));
    98 //]]>
    99 </script>";
    100         } else {
    101                 $contrast         = __( 'Toggle High Contrast', 'wp-accessibility' );
    102                 $grayscale        = __( 'Toggle Grayscale', 'wp-accessibility' );
    103                 $fontsize         = __( 'Toggle Font size', 'wp-accessibility' );
    104                 $enable_grayscale = ( 'on' === get_option( 'wpa_toolbar_gs' ) && current_user_can( 'manage_options' ) ) ? true : false;
    105                 $enable_fontsize  = ( 'off' === get_option( 'wpa_toolbar_fs' ) ) ? false : true;
    106                 $enable_contrast  = ( 'off' === get_option( 'wpa_toolbar_ct' ) ) ? false : true;
     87        $contrast         = __( 'Toggle High Contrast', 'wp-accessibility' );
     88        $grayscale        = __( 'Toggle Grayscale', 'wp-accessibility' );
     89        $fontsize         = __( 'Toggle Font size', 'wp-accessibility' );
     90        $enable_grayscale = ( 'on' === get_option( 'wpa_toolbar_gs' ) && current_user_can( 'manage_options' ) ) ? 'true' : 'false';
     91        $enable_fontsize  = ( 'off' === get_option( 'wpa_toolbar_fs' ) ) ? 'false' : 'true';
     92        $enable_contrast  = ( 'off' === get_option( 'wpa_toolbar_ct' ) ) ? 'false' : 'true';
    10793
    108                 echo
    109                 "
    110 <script type='text/javascript'>
    111 //<![CDATA[
    112 (function( $ ) { 'use strict';
    113         var insert_a11y_toolbar = '<!-- a11y toolbar -->';
    114         insert_a11y_toolbar += '<div class=\"" . $responsive . "a11y-toolbar$is_rtl$is_right\">';
    115         insert_a11y_toolbar += '<ul class=\"a11y-toolbar-list\">';";
    116                 if ( get_option( 'wpa_toolbar' ) === 'on' && $enable_contrast ) {
    117                         echo "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\">$contrast</span><span class=\"aticon aticon-adjust\" aria-hidden=\"true\"></span></button></li>';";
    118                 }
    119                 if ( get_option( 'wpa_toolbar' ) === 'on' && $enable_grayscale ) {
    120                         echo "insert_a11y_toolbar += '<li class=\"a11y-toolbar-list-item\"><button type=\"button\" class=\"a11y-toggle-grayscale toggle-grayscale\" id=\"is_normal_color\" aria-pressed=\"false\"><span class=\"offscreen\">$grayscale</span><span class=\"aticon aticon-tint\" aria-hidden=\"true\"></span></button></li>';";
    121                 }
    122                 if ( get_option( 'wpa_toolbar' ) === 'on' && $enable_fontsize ) {
    123                         echo "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\">$fontsize</span><span class=\"aticon aticon-font\" aria-hidden=\"true\"></span></button></li>';";
    124                 }
    125                 echo "
    126         insert_a11y_toolbar += '</ul>';
    127         insert_a11y_toolbar += '</div>';
    128         insert_a11y_toolbar += '<!-- // a11y toolbar -->';
    129         $( document ).find( '$location' ).prepend( insert_a11y_toolbar );
    130 }(jQuery));
    131 //]]>
    132 </script>";
    133         }
     94        return array(
     95                'location'         => $location,
     96                'is_rtl'           => $is_rtl,
     97                'is_right'         => $is_right,
     98                'responsive'       => $responsive,
     99                'contrast'         => $contrast,
     100                'grayscale'        => $grayscale,
     101                'fontsize'         => $fontsize,
     102                'enable_grayscale' => $enable_grayscale,
     103                'enable_fontsize'  => $enable_fontsize,
     104                'enable_contrast'  => $enable_contrast,
     105        );
    134106}
  • wp-accessibility/trunk/wp-accessibility.php

    r2096734 r2218372  
    1818 * License:     GPL-2.0+
    1919 * License URI: http://www.gnu.org/license/gpl-2.0.txt
    20  * Version: 1.6.10
     20 * Version: 1.7.0
    2121 */
    2222
    … …  
    6969 */
    7070function wpa_install() {
    71         $wpa_version = '1.6.10';
     71        $wpa_version = '1.7.0';
    7272        if ( 'true' !== get_option( 'wpa_installed' ) ) {
    7373                add_option( 'rta_from_nav_menu', 'on' );
    … …  
    126126 */
    127127function wpa_register_scripts() {
    128         wp_register_script( 'skiplinks.webkit', plugins_url( 'wp-accessibility/js/skiplinks.webkit.js' ) );
     128        wp_register_script( 'wpa-toolbar', plugins_url( 'wp-accessibility/js/wpa-toolbar.js' ), array( 'jquery' ), '1.0', true );
    129129        wp_register_script( 'ui-a11y.js', plugins_url( 'wp-accessibility/toolbar/js/a11y.js' ), array( 'jquery' ), '1.0', true );
    130130}
    … …  
    136136function wpacc_enqueue_scripts() {
    137137        wp_enqueue_script( 'jquery' );
    138         if ( 'on' === get_option( 'asl_enable' ) ) {
    139                 wp_enqueue_script( 'skiplinks.webkit' );
    140         }
    141138        if ( 'on' === get_option( 'wpa_toolbar' ) || 'on' === get_option( 'wpa_widget_toolbar' ) ) {
     139                if ( 'on' === get_option( 'wpa_toolbar' ) ) {
     140                        // Enqueue Toolbar JS if enabled.
     141                        wp_enqueue_script( 'wpa-toolbar' );
     142                        wp_localize_script( 'wpa-toolbar', 'wpa', wpa_toolbar_js() );
     143                }
    142144                wp_enqueue_script( 'ui-a11y.js' );
    143145                $plugin_path = plugins_url( 'wp-accessibility/toolbar/css/a11y-contrast.css' );
    … …  
    166168                );
    167169                wp_localize_script( 'wpa-labels', 'wpalabels', $labels );
    168         }
    169         if ( 'on' === get_option( 'wpa_toolbar' ) ) {
    170                 add_action( 'wp_footer', 'wpa_toolbar_js' );
    171170        }
    172171        if ( 'link' === get_option( 'wpa_longdesc' ) ) {
    … …  
    196195        // Only enable styles when required by options.
    197196        if ( get_option( 'wpa_toolbar_size' ) && 'on' === get_option( 'wpa_toolbar' ) ) {
    198                 echo "
    199 <style type='text/css'>
    200 .a11y-toolbar ul li button {
    201         font-size: " . $toolbar_size . ' !important;
    202 }
    203 </style>';
     197                wp_add_inline_style( 'ui-a11y.css', '.a11y-toolbar ul li button { font-size: ' . $toolbar_size . ' !important; }' );
    204198        }
    205199        if ( 'link' === get_option( 'wpa_longdesc' ) || 'jquery' === get_option( 'wpa_longdesc' ) || 'on' === get_option( 'asl_enable' ) ) {
    … …  
    248242        $styles = '';
    249243        if ( get_option( 'asl_enable' ) === 'on' ) {
    250                 $focus = get_option( 'asl_styles_focus' );
     244                $focus = wp_kses( get_option( 'asl_styles_focus' ), array(), array() );
    251245                // these styles are derived from the WordPress skip link defaults.
    252246                $top = '7px';
    … …  
    263257                $default_passive = 'background-color: #fff; box-shadow:  0 0 2px 2px rgba(0, 0, 0, 0.2); clip: auto; color: #333; display: block; font-weight: 600; height: auto; line-height: normal; padding: 15px 23px 14px; position: absolute; left: 6px; top: ' . $top . '; text-decoration: none; text-transform: none; width: auto; z-index: 100000;';
    264258
    265                 $passive = get_option( 'asl_styles_passive' );
     259                $passive = wp_kses( get_option( 'asl_styles_passive' ), array(), array() );
    266260                $vis     = '';
    267261                $invis   = '';
    … …  
    623617                }
    624618                $from_email = 'wordpress@' . $sitename;
    625                 $from       = "From: \"$current_user->display_name\" <$from_email>\r\nReply-to: \"$current_user->display_name\" <$current_user->user_email>\r\n";
     619                $from       = "From: $current_user->display_name <$from_email>\r\nReply-to: $current_user->display_name <$current_user->user_email>\r\n";
    626620
    627621                if ( ! $has_read_faq ) {
Note: See TracChangeset for help on using the changeset viewer.