Make WordPress Core


Ignore:
Timestamp:
12/15/2015 10:17:40 PM (11 years ago)
Author:
afercia
Message:

Accessibility: add missing labels for Plugins and Themes checkboxes in the Updates screen.

Also, adds translator comments and improves readability.

Props SergeyBiryukov, afercia, oaron for the initial patch.
Fixes #34774.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/update-core.php

    r35866 r35952  
    308308                $details_text = sprintf( __( 'View %1$s version %2$s details.' ), $details_name, $plugin_data->update->new_version );
    309309                $details = sprintf( '<a href="%1$s" class="thickbox">%2$s</a>', esc_url( $details_url ), $details_text );
    310 
    311                 echo "
    312         <tr>
    313                 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>
    314                 <td><p><strong>{$plugin_data->Name}</strong><br />" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . ' ' . $details . $compat . $upgrade_notice . "</p></td>
    315         </tr>";
     310                $checkbox_id =  "checkbox_" . md5( $plugin_data->Name );
     311                ?>
     312                <tr>
     313                        <th scope="row" class="check-column">
     314                                <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php
     315                                        /* translators: %s: plugin name */
     316                                        printf( __( 'Select %s' ),
     317                                                $plugin_data->Name
     318                                        );
     319                                ?></label>
     320                                <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" />
     321                        </th>
     322                        <td><p><strong><?php echo $plugin_data->Name; ?></strong><br /><?php
     323                                /* translators: 1: plugin version, 2: new version */
     324                                printf( __( 'You have version %1$s installed. Update to %2$s.' ),
     325                                        $plugin_data->Version,
     326                                        $plugin_data->update->new_version
     327                                );
     328                                echo ' ' . $details . $compat . $upgrade_notice;
     329                        ?></p></td>
     330                </tr>
     331                <?php
    316332        }
    317333?>
     
    360376<?php
    361377        foreach ( $themes as $stylesheet => $theme ) {
    362                 echo "
    363         <tr>
    364                 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr( $stylesheet ) . "' /></th>
    365                 <td class='plugin-title'><img src='" . esc_url( $theme->get_screenshot() ) . "' width='85' height='64' style='float:left; padding: 0 5px 5px' alt='' /><strong>" . $theme->display('Name') . '</strong> ' . sprintf( __( 'You have version %1$s installed. Update to %2$s.' ), $theme->display('Version'), $theme->update['new_version'] ) . "</td>
    366         </tr>";
     378                $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
     379                ?>
     380                <tr>
     381                        <th scope="row" class="check-column">
     382                                <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php
     383                                        /* translators: %s: theme name */
     384                                        printf( __( 'Select %s' ),
     385                                                $theme->display( 'Name' )
     386                                        );
     387                                ?></label>
     388                                <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" />
     389                        </th>
     390                        <td class="plugin-title">
     391                                <img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" style="float:left; padding: 0 5px 5px" alt="" />
     392                                <strong><?php echo $theme->display( 'Name' ); ?></strong>
     393                                <?php
     394                                        /* translators: 1: theme version, 2: new version */
     395                                        printf( __( 'You have version %1$s installed. Update to %2$s.' ),
     396                                                $theme->display( 'Version' ),
     397                                                $theme->update['new_version']
     398                                        );
     399                                ?>
     400                        </td>
     401                </tr>
     402                <?php
    367403        }
    368404?>
Note: See TracChangeset for help on using the changeset viewer.