Skip to content

Commit

Permalink
Coding Standards: Consistently escape attribute in `wp-admin/themes.p…
Browse files Browse the repository at this point in the history
…hp`.

Follow-up to [27012], [38057], [47816], [51083].

Props sabbirshouvo, audrasjb.
Fixes #54256.

git-svn-id: https://develop.svn.wordpress.org/trunk@52020 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Nov 5, 2021
1 parent 68b5fff commit b64d06f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/wp-admin/themes.php
Expand Up @@ -363,8 +363,8 @@
*/

foreach ( $themes as $theme ) :
$aria_action = esc_attr( $theme['id'] . '-action' );
$aria_name = esc_attr( $theme['id'] . '-name' );
$aria_action = $theme['id'] . '-action';
$aria_name = $theme['id'] . '-name';

$active_class = '';
if ( $theme['active'] ) {
Expand All @@ -374,7 +374,7 @@
<div class="theme<?php echo $active_class; ?>">
<?php if ( ! empty( $theme['screenshot'][0] ) ) { ?>
<div class="theme-screenshot">
<img src="<?php echo $theme['screenshot'][0]; ?>" alt="" />
<img src="<?php echo esc_attr( $theme['screenshot'][0] ); ?>" alt="" />
</div>
<?php } else { ?>
<div class="theme-screenshot blank"></div>
Expand Down Expand Up @@ -508,7 +508,7 @@
/* translators: %s: Theme name. */
$details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), $theme['name'] );
?>
<button type="button" aria-label="<?php echo esc_attr( $details_aria_label ); ?>" class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Theme Details' ); ?></button>
<button type="button" aria-label="<?php echo esc_attr( $details_aria_label ); ?>" class="more-details" id="<?php echo esc_attr( $aria_action ); ?>"><?php _e( 'Theme Details' ); ?></button>
<div class="theme-author">
<?php
/* translators: %s: Theme author name. */
Expand All @@ -518,11 +518,11 @@

<div class="theme-id-container">
<?php if ( $theme['active'] ) { ?>
<h2 class="theme-name" id="<?php echo $aria_name; ?>">
<h2 class="theme-name" id="<?php echo esc_attr( $aria_name ); ?>">
<span><?php _ex( 'Active:', 'theme' ); ?></span> <?php echo $theme['name']; ?>
</h2>
<?php } else { ?>
<h2 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $theme['name']; ?></h2>
<h2 class="theme-name" id="<?php echo esc_attr( $aria_name ); ?>"><?php echo $theme['name']; ?></h2>
<?php } ?>

<div class="theme-actions">
Expand Down Expand Up @@ -899,7 +899,7 @@ function wp_theme_auto_update_setting_template() {
/* translators: %s: Theme name. */
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
?>
<a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
<a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
<?php
/* translators: %s: Theme name. */
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
Expand Down Expand Up @@ -1117,7 +1117,7 @@ function wp_theme_auto_update_setting_template() {
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
?>
<# if ( data.actions.activate ) { #>
<a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
<a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
<# } #>
<a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>
<# } else { #>
Expand All @@ -1126,7 +1126,7 @@ function wp_theme_auto_update_setting_template() {
$aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
?>
<# if ( data.actions.activate ) { #>
<a class="button disabled" aria-label="<?php echo $aria_label; ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
<a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
<# } #>
<a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
<# } #>
Expand All @@ -1137,7 +1137,7 @@ function wp_theme_auto_update_setting_template() {
/* translators: %s: Theme name. */
$aria_label = sprintf( _x( 'Delete %s', 'theme' ), '{{ data.name }}' );
?>
<a href="{{{ data.actions['delete'] }}}" class="button delete-theme" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Delete' ); ?></a>
<a href="{{{ data.actions['delete'] }}}" class="button delete-theme" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Delete' ); ?></a>
<# } #>
</div>
</div>
Expand Down

0 comments on commit b64d06f

Please sign in to comment.