Ticket #20816: 20816.diff

File 20816.diff, 7.0 KB (added by obenland, 6 months ago)
Line 
1Index: wp-admin/custom-background.php
2===================================================================
3--- wp-admin/custom-background.php      (revision 22377)
4+++ wp-admin/custom-background.php      (working copy)
5@@ -212,8 +212,8 @@
6 if ( get_background_image() ) {
7        // background-image URL must be single quote, see below
8        $background_styles .= ' background-image: url(\'' . set_url_scheme( get_theme_mod( 'background_image_thumb', get_background_image() ) ) . '\');'
9-               . ' background-repeat: ' . get_theme_mod('background_repeat', 'repeat') . ';'
10-               . ' background-position: top ' . get_theme_mod('background_position_x', 'left');
11+               . ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) ) . ';'
12+               . ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'background-position' ) );
13 }
14 ?>
15 <div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
16@@ -286,15 +286,15 @@
17 <th scope="row"><?php _e( 'Position' ); ?></th>
18 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend>
19 <label>
20-<input name="background-position-x" type="radio" value="left"<?php checked('left', get_theme_mod('background_position_x', 'left')); ?> />
21+<input name="background-position-x" type="radio" value="left"<?php checked( 'left', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'background-position' ) ) ); ?> />
22 <?php _e('Left') ?>
23 </label>
24 <label>
25-<input name="background-position-x" type="radio" value="center"<?php checked('center', get_theme_mod('background_position_x', 'left')); ?> />
26+<input name="background-position-x" type="radio" value="center"<?php checked( 'center', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'background-position' ) ) ); ?> />
27 <?php _e('Center') ?>
28 </label>
29 <label>
30-<input name="background-position-x" type="radio" value="right"<?php checked('right', get_theme_mod('background_position_x', 'left')); ?> />
31+<input name="background-position-x" type="radio" value="right"<?php checked( 'right', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'background-position' ) ) ); ?> />
32 <?php _e('Right') ?>
33 </label>
34 </fieldset></td>
35@@ -303,10 +303,10 @@
36 <tr valign="top">
37 <th scope="row"><?php _e( 'Repeat' ); ?></th>
38 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Repeat' ); ?></span></legend>
39-<label><input type="radio" name="background-repeat" value="no-repeat"<?php checked('no-repeat', get_theme_mod('background_repeat', 'repeat')); ?> /> <?php _e('No Repeat'); ?></label>
40-       <label><input type="radio" name="background-repeat" value="repeat"<?php checked('repeat', get_theme_mod('background_repeat', 'repeat')); ?> /> <?php _e('Tile'); ?></label>
41-       <label><input type="radio" name="background-repeat" value="repeat-x"<?php checked('repeat-x', get_theme_mod('background_repeat', 'repeat')); ?> /> <?php _e('Tile Horizontally'); ?></label>
42-       <label><input type="radio" name="background-repeat" value="repeat-y"<?php checked('repeat-y', get_theme_mod('background_repeat', 'repeat')); ?> /> <?php _e('Tile Vertically'); ?></label>
43+<label><input type="radio" name="background-repeat" value="no-repeat"<?php checked( 'no-repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) ) ); ?> /> <?php _e('No Repeat'); ?></label>
44+       <label><input type="radio" name="background-repeat" value="repeat"<?php checked( 'repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) ) ); ?> /> <?php _e('Tile'); ?></label>
45+       <label><input type="radio" name="background-repeat" value="repeat-x"<?php checked( 'repeat-x', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) ) ); ?> /> <?php _e('Tile Horizontally'); ?></label>
46+       <label><input type="radio" name="background-repeat" value="repeat-y"<?php checked( 'repeat-y', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) ) ); ?> /> <?php _e('Tile Vertically'); ?></label>
47 </fieldset></td>
48 </tr>
49 
50@@ -314,11 +314,11 @@
51 <th scope="row"><?php _e( 'Attachment' ); ?></th>
52 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Attachment' ); ?></span></legend>
53 <label>
54-<input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', 'scroll')); ?> />
55+<input name="background-attachment" type="radio" value="scroll" <?php checked( 'scroll', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'background-attachment' ) ) ); ?> />
56 <?php _e('Scroll') ?>
57 </label>
58 <label>
59-<input name="background-attachment" type="radio" value="fixed" <?php checked('fixed', get_theme_mod('background_attachment', 'scroll')); ?> />
60+<input name="background-attachment" type="radio" value="fixed" <?php checked( 'fixed', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'background-attachment' ) ) ); ?> />
61 <?php _e('Fixed') ?>
62 </label>
63 </fieldset></td>
64Index: wp-includes/theme.php
65===================================================================
66--- wp-includes/theme.php       (revision 22377)
67+++ wp-includes/theme.php       (working copy)
68@@ -1134,17 +1134,17 @@
69        if ( $background ) {
70                $image = " background-image: url('$background');";
71 
72-               $repeat = get_theme_mod( 'background_repeat', 'repeat' );
73+               $repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) );
74                if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )
75                        $repeat = 'repeat';
76                $repeat = " background-repeat: $repeat;";
77 
78-               $position = get_theme_mod( 'background_position_x', 'left' );
79+               $position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'background-position' ) );
80                if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )
81                        $position = 'left';
82                $position = " background-position: top $position;";
83 
84-               $attachment = get_theme_mod( 'background_attachment', 'scroll' );
85+               $attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'background-attachment' ) );
86                if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )
87                        $attachment = 'scroll';
88                $attachment = " background-attachment: $attachment;";
89@@ -1322,10 +1322,13 @@
90                                $args = array( 0 => array() );
91 
92                        $defaults = array(
93-                               'default-image' => '',
94-                               'default-color' => '',
95-                               'wp-head-callback' => '_custom_background_cb',
96-                               'admin-head-callback' => '',
97+                               'default-image'          => '',
98+                               'background-repeat'      => 'repeat',
99+                               'background-position'    => 'left',
100+                               'background-attachment'  => 'scroll',
101+                               'default-color'          => '',
102+                               'wp-head-callback'       => '_custom_background_cb',
103+                               'admin-head-callback'    => '',
104                                'admin-preview-callback' => '',
105                        );
106