Skip to content

Commit

Permalink
When generating a background image thumbnail URL, escape percent sign…
Browse files Browse the repository at this point in the history
…s for the eventual sprintf() call inside get_theme_mod().

props cfinke.
fixes #21241.



git-svn-id: http://core.svn.wordpress.org/trunk@24630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed Jul 10, 2013
1 parent 8035bd8 commit 043f19b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions wp-admin/custom-background.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,17 @@ function admin_page() {
$background_styles .= 'background-color: #' . $bgcolor . ';';

if ( get_background_image() ) {
$background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', get_background_image() ) ) ) );
// background-image URL must be single quote, see below
$background_styles .= ' background-image: url(\'' . set_url_scheme( get_theme_mod( 'background_image_thumb', get_background_image() ) ) . '\');'
$background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');'
. ' background-repeat: ' . get_theme_mod('background_repeat', 'repeat') . ';'
. ' background-position: top ' . get_theme_mod('background_position_x', 'left');
}
?>
<div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
<?php if ( get_background_image() ) { ?>
<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 />
<img class="custom-background-image" src="<?php echo set_url_scheme( get_theme_mod( 'background_image_thumb', get_background_image() ) ); ?>" style="visibility:hidden;" alt="" />
<img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" /><br />
<img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" />
<?php } ?>
</div>
<?php } ?>
Expand Down

0 comments on commit 043f19b

Please sign in to comment.