@@ -247,7 +247,7 @@ public function admin_page() {
247247 $ message = sprintf (
248248 /* translators: %s: URL to background image configuration in Customizer. */
249249 __ ( 'You can now manage and live-preview Custom Backgrounds in the <a href="%s">Customizer</a>. ' ),
250- admin_url ( 'customize.php?autofocus[control]=background_image ' )
250+ esc_url ( admin_url ( 'customize.php?autofocus[control]=background_image ' ) )
251251 );
252252 wp_admin_notice (
253253 $ message ,
@@ -308,7 +308,7 @@ public function admin_page() {
308308 . " background-attachment: $ background_attachment; " ;
309309 }
310310 ?>
311- <div id="custom-background-image" style="<?php echo $ background_styles ; ?> "><?php // Must be double quote, see above. ?>
311+ <div id="custom-background-image" style="<?php echo esc_attr ( $ background_styles ) ; ?> "><?php // Must be double quote, see above. ?>
312312 <?php if ( $ background_image_thumb ) { ?>
313313 <img class="custom-background-image" src="<?php echo $ background_image_thumb ; ?> " style="visibility:hidden;" alt="" /><br />
314314 <img class="custom-background-image" src="<?php echo $ background_image_thumb ; ?> " style="visibility:hidden;" alt="" />
@@ -431,16 +431,16 @@ public function admin_page() {
431431 );
432432 ?>
433433<tr>
434- <th scope="row"><?php echo $ background_position_title ; ?> </th>
435- <td><fieldset><legend class="screen-reader-text"><span><?php echo $ background_position_title ; ?> </span></legend>
434+ <th scope="row"><?php echo esc_html ( $ background_position_title ) ; ?> </th>
435+ <td><fieldset><legend class="screen-reader-text"><span><?php echo esc_html ( $ background_position_title ) ; ?> </span></legend>
436436<div class="background-position-control">
437437 <?php foreach ( $ background_position_options as $ group ) : ?>
438438 <div class="button-group">
439439 <?php foreach ( $ group as $ value => $ input ) : ?>
440440 <label>
441441 <input class="ui-helper-hidden-accessible" name="background-position" type="radio" value="<?php echo esc_attr ( $ value ); ?> "<?php checked ( $ value , $ background_position ); ?> >
442442 <span class="button display-options position"><span class="<?php echo esc_attr ( $ input ['icon ' ] ); ?> " aria-hidden="true"></span></span>
443- <span class="screen-reader-text"><?php echo $ input ['label ' ]; ?> </span>
443+ <span class="screen-reader-text"><?php echo esc_html ( $ input ['label ' ] ) ; ?> </span>
444444 </label>
445445 <?php endforeach ; ?>
446446 </div>
@@ -451,8 +451,8 @@ public function admin_page() {
451451
452452 <?php $ image_size_title = __ ( 'Image Size ' ); ?>
453453<tr>
454- <th scope="row"><label for="background-size"><?php echo $ image_size_title ; ?> </label></th>
455- <td><fieldset><legend class="screen-reader-text"><span><?php echo $ image_size_title ; ?> </span></legend>
454+ <th scope="row"><label for="background-size"><?php echo esc_html ( $ image_size_title ) ; ?> </label></th>
455+ <td><fieldset><legend class="screen-reader-text"><span><?php echo esc_html ( $ image_size_title ) ; ?> </span></legend>
456456<select id="background-size" name="background-size">
457457<option value="auto"<?php selected ( 'auto ' , get_theme_mod ( 'background_size ' , get_theme_support ( 'custom-background ' , 'default-size ' ) ) ); ?> ><?php _ex ( 'Original ' , 'Original Size ' ); ?> </option>
458458<option value="contain"<?php selected ( 'contain ' , get_theme_mod ( 'background_size ' , get_theme_support ( 'custom-background ' , 'default-size ' ) ) ); ?> ><?php _e ( 'Fit to Screen ' ); ?> </option>
@@ -463,17 +463,17 @@ public function admin_page() {
463463
464464 <?php $ background_repeat_title = _x ( 'Repeat ' , 'Background Repeat ' ); ?>
465465<tr>
466- <th scope="row"><?php echo $ background_repeat_title ; ?> </th>
467- <td><fieldset><legend class="screen-reader-text"><span><?php echo $ background_repeat_title ; ?> </span></legend>
466+ <th scope="row"><?php echo esc_html ( $ background_repeat_title ) ; ?> </th>
467+ <td><fieldset><legend class="screen-reader-text"><span><?php echo esc_html ( $ background_repeat_title ) ; ?> </span></legend>
468468<input name="background-repeat" type="hidden" value="no-repeat">
469469<label><input type="checkbox" name="background-repeat" value="repeat"<?php checked ( 'repeat ' , get_theme_mod ( 'background_repeat ' , get_theme_support ( 'custom-background ' , 'default-repeat ' ) ) ); ?> > <?php _e ( 'Repeat Background Image ' ); ?> </label>
470470</fieldset></td>
471471</tr>
472472
473473 <?php $ background_scroll_title = _x ( 'Scroll ' , 'Background Scroll ' ); ?>
474474<tr>
475- <th scope="row"><?php echo $ background_scroll_title ; ?> </th>
476- <td><fieldset><legend class="screen-reader-text"><span><?php echo $ background_scroll_title ; ?> </span></legend>
475+ <th scope="row"><?php echo esc_html ( $ background_scroll_title ) ; ?> </th>
476+ <td><fieldset><legend class="screen-reader-text"><span><?php echo esc_html ( $ background_scroll_title ) ; ?> </span></legend>
477477<input name="background-attachment" type="hidden" value="fixed">
478478<label><input name="background-attachment" type="checkbox" value="scroll" <?php checked ( 'scroll ' , get_theme_mod ( 'background_attachment ' , get_theme_support ( 'custom-background ' , 'default-attachment ' ) ) ); ?> > <?php _e ( 'Scroll with Page ' ); ?> </label>
479479</fieldset></td>
@@ -487,10 +487,10 @@ public function admin_page() {
487487 <?php
488488 $ default_color = '' ;
489489 if ( current_theme_supports ( 'custom-background ' , 'default-color ' ) ) {
490- $ default_color = ' data-default-color="# ' . esc_attr ( get_theme_support ( 'custom-background ' , 'default-color ' ) ) . ' " ' ;
490+ $ default_color = get_theme_support ( 'custom-background ' , 'default-color ' );
491491 }
492492 ?>
493- <input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr ( get_background_color () ); ?> "<?php echo $ default_color ; ?> >
493+ <input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr ( get_background_color () ); ?> "<?php if ( $ default_color ) : ?> data-default-color="# <?php echo esc_attr ( $ default_color ); ?> " <?php endif ; ?> >
494494</fieldset></td>
495495</tr>
496496</tbody>
0 commit comments