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.

git-svn-id: https://develop.svn.wordpress.org/trunk@35952 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia 2015-12-15 22:17:40 +00:00
parent 333f1c38ea
commit e7296c25b9

View File

@ -307,12 +307,28 @@ function list_plugin_updates() {
/* translators: 1: Plugin name 2: Plugin version */ /* translators: 1: Plugin name 2: Plugin version */
$details_text = sprintf( __( 'View %1$s version %2$s details.' ), $details_name, $plugin_data->update->new_version ); $details_text = sprintf( __( 'View %1$s version %2$s details.' ), $details_name, $plugin_data->update->new_version );
$details = sprintf( '<a href="%1$s" class="thickbox">%2$s</a>', esc_url( $details_url ), $details_text ); $details = sprintf( '<a href="%1$s" class="thickbox">%2$s</a>', esc_url( $details_url ), $details_text );
$checkbox_id = "checkbox_" . md5( $plugin_data->Name );
echo " ?>
<tr> <tr>
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th> <th scope="row" class="check-column">
<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> <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php
</tr>"; /* translators: %s: plugin name */
printf( __( 'Select %s' ),
$plugin_data->Name
);
?></label>
<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" />
</th>
<td><p><strong><?php echo $plugin_data->Name; ?></strong><br /><?php
/* translators: 1: plugin version, 2: new version */
printf( __( 'You have version %1$s installed. Update to %2$s.' ),
$plugin_data->Version,
$plugin_data->update->new_version
);
echo ' ' . $details . $compat . $upgrade_notice;
?></p></td>
</tr>
<?php
} }
?> ?>
</tbody> </tbody>
@ -359,11 +375,31 @@ function list_theme_updates() {
<tbody class="plugins"> <tbody class="plugins">
<?php <?php
foreach ( $themes as $stylesheet => $theme ) { foreach ( $themes as $stylesheet => $theme ) {
echo " $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
?>
<tr> <tr>
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr( $stylesheet ) . "' /></th> <th scope="row" class="check-column">
<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> <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php
</tr>"; /* translators: %s: theme name */
printf( __( 'Select %s' ),
$theme->display( 'Name' )
);
?></label>
<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" />
</th>
<td class="plugin-title">
<img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" style="float:left; padding: 0 5px 5px" alt="" />
<strong><?php echo $theme->display( 'Name' ); ?></strong>
<?php
/* translators: 1: theme version, 2: new version */
printf( __( 'You have version %1$s installed. Update to %2$s.' ),
$theme->display( 'Version' ),
$theme->update['new_version']
);
?>
</td>
</tr>
<?php
} }
?> ?>
</tbody> </tbody>