WordPress.org

Make WordPress Core

Changeset 24630


Ignore:
Timestamp:
07/10/2013 04:42:03 AM (6 years ago)
Author:
nacin
Message:

When generating a background image thumbnail URL, escape percent signs for the eventual sprintf() call inside get_theme_mod().

props cfinke.
fixes #21241.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/custom-background.php

    r24621 r24630  
    204204
    205205if ( get_background_image() ) {
     206    $background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', get_background_image() ) ) ) );
    206207    // background-image URL must be single quote, see below
    207     $background_styles .= ' background-image: url(\'' . set_url_scheme( get_theme_mod( 'background_image_thumb', get_background_image() ) ) . '\');'
     208    $background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');'
    208209        . ' background-repeat: ' . get_theme_mod('background_repeat', 'repeat') . ';'
    209210        . ' background-position: top ' . get_theme_mod('background_position_x', 'left');
     
    212213<div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
    213214<?php if ( get_background_image() ) { ?>
    214 <img class="custom-background-image" src="<?php echo set_url_scheme( get_theme_mod( 'background_image_thumb', get_background_image() ) ); ?>" style="visibility:hidden;" alt="" /><br />
    215 <img class="custom-background-image" src="<?php echo set_url_scheme( get_theme_mod( 'background_image_thumb', get_background_image() ) ); ?>" style="visibility:hidden;" alt="" />
     215<img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" /><br />
     216<img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" />
    216217<?php } ?>
    217218</div>
Note: See TracChangeset for help on using the changeset viewer.