Ticket #12186: background.2.patch
File background.2.patch, 7.0 KB (added by , 15 years ago) |
---|
-
wp-admin/custom-background.php
107 107 $repeat = 'repeat'; 108 108 set_theme_mod('background_repeat', $repeat); 109 109 } 110 if ( isset($_POST['background-position ']) ) {110 if ( isset($_POST['background-position-x']) ) { 111 111 check_admin_referer('custom-background'); 112 if ( in_array($_POST['background-position '], array('center', 'right', 'left')) )113 $position = $_POST['background-position '];112 if ( in_array($_POST['background-position-x'], array('center', 'right', 'left')) ) 113 $position = $_POST['background-position-x']; 114 114 else 115 115 $position = 'left'; 116 set_theme_mod('background_position ', $position);116 set_theme_mod('background_position_x', $position); 117 117 } 118 118 if ( isset($_POST['background-attachment']) ) { 119 119 check_admin_referer('custom-background'); … … 155 155 call_user_func($this->admin_image_div_callback); 156 156 } else { 157 157 ?> 158 <h3><?php _e('Background Preview'); ?></h3>158 <h3><?php _e('Background Image'); ?></h3> 159 159 <table class="form-table"> 160 160 <tbody> 161 161 <tr valign="top"> … … 171 171 $background_styles .= " 172 172 background-image: url(" . get_theme_mod('background_image_thumb', '') . "); 173 173 background-repeat: ". get_theme_mod('background_repeat', 'repeat') . "; 174 background-position: ". get_theme_mod('background_position', 'left') . " top; 175 background-attachment: " . get_theme_mod('background_attachment', 'fixed') . "; 174 background-position: ". get_theme_mod('background_position_x', 'left') . " top; 176 175 "; 177 176 } 178 177 ?> … … 192 191 <td><p><?php _e('This will remove the background image. You will not be able to restore any customizations.') ?></p> 193 192 <form method="post" action=""> 194 193 <?php wp_nonce_field('custom-background-remove', '_wpnonce-custom-background-remove'); ?> 195 <input type="submit" class="button" name="remove-background" value="<?php esc_attr_e('Remove Background '); ?>" />194 <input type="submit" class="button" name="remove-background" value="<?php esc_attr_e('Remove Background Image'); ?>" /> 196 195 </form> 197 196 </td> 198 197 </tr> … … 232 231 <tr valign="top"> 233 232 <th scope="row"><?php _e( 'Background Color' ); ?></th> 234 233 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend> 234 <p><label> 235 235 <input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr(get_background_color()) ?>" /> 236 <input type="button" class="button" value="<?php esc_attr_e('Select a Color'); ?>" id="pickcolor" /> 236 <input type="button" class="button hide-if-no-js" value="<?php esc_attr_e('Select a Color'); ?>" id="pickcolor" /> 237 <span class="description"><?php _e( 'Leave it blank to use no background color.' ); ?></span> 238 </label></p> 237 239 238 240 <div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div> 239 241 </fieldset></td> … … 243 245 <th scope="row"><?php _e( 'Background Position' ); ?></th> 244 246 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend> 245 247 <label> 246 <input name="background-position " type="radio" value="left" <?php checked('left', get_theme_mod('background_position', 'left')); ?> />248 <input name="background-position-x" type="radio" value="left" <?php checked('left', get_theme_mod('background_position_x', 'left')); ?> /> 247 249 <?php _e('Left') ?> 248 250 </label> 249 251 <label> 250 <input name="background-position " type="radio" value="center" <?php checked('center', get_theme_mod('background_position', 'left')); ?> />252 <input name="background-position-x" type="radio" value="center" <?php checked('center', get_theme_mod('background_position_x', 'left')); ?> /> 251 253 <?php _e('Center') ?> 252 254 </label> 253 255 <label> 254 <input name="background-position " type="radio" value="right" <?php checked('right', get_theme_mod('background_position', 'left')); ?> />256 <input name="background-position-x" type="radio" value="right" <?php checked('right', get_theme_mod('background_position_x', 'left')); ?> /> 255 257 <?php _e('Right') ?> 256 258 </label> 257 259 </fieldset></td> 258 260 </tr> 259 261 260 262 <tr valign="top"> 261 <th scope="row"><?php _e( ' Repeat' ); ?></th>263 <th scope="row"><?php _e( 'Background Repeat' ); ?></th> 262 264 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Repeat' ); ?></span></legend> 263 265 <label> 264 266 <select name="background-repeat"> … … 272 274 </tr> 273 275 274 276 <tr valign="top"> 275 <th scope="row"><?php _e( ' Attachment' ); ?></th>277 <th scope="row"><?php _e( 'Background Attachment' ); ?></th> 276 278 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Attachment' ); ?></span></legend> 277 279 <label> 278 280 <input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', 'fixed')); ?> /> -
wp-admin/js/custom-background.dev.js
23 23 pickColor( hex ); 24 24 }); 25 25 26 jQuery('input[name="background-position "]').change(function() {27 jQuery('#custom-background-image').css('background-position', 'top ' + jQuery(this).val());26 jQuery('input[name="background-position-x"]').change(function() { 27 jQuery('#custom-background-image').css('background-position', jQuery(this).val() + ' top'); 28 28 }); 29 29 30 30 jQuery('select[name="background-repeat"]').change(function() { 31 31 jQuery('#custom-background-image').css('background-repeat', jQuery(this).val()); 32 32 }); 33 34 jQuery('input[name="background-attachment"]').change(function() {35 jQuery('#custom-background-image').css('background-attachment', jQuery(this).val());36 });37 33 38 34 farbtastic = jQuery.farbtastic('#colorPickerDiv', function(color) { 39 35 pickColor(color); -
wp-includes/script-loader.php
529 529 'l10n_print_after' => 'try{convertEntities(autosaveL10n);}catch(e){};' 530 530 ) ); 531 531 532 wp_localize_script( 'custom-background', 'customBackgroundL10n', array(533 'backgroundcolor' => '#' . get_background_color(),534 ) );535 532 } 536 533 537 534 /** -
wp-includes/theme.php
1553 1553 $repeat = 'background-repeat: repeat;'; 1554 1554 } 1555 1555 1556 switch ( get_theme_mod('background_position ', 'left') ) {1556 switch ( get_theme_mod('background_position_x', 'left') ) { 1557 1557 case 'center': 1558 $position = 'background-position: top center;';1558 $position = 'background-position: center top;'; 1559 1559 break; 1560 1560 case 'right': 1561 $position = 'background-position: top right;';1561 $position = 'background-position: right top;'; 1562 1562 break; 1563 1563 default: 1564 $position = 'background-position: top left;';1564 $position = 'background-position: left top;'; 1565 1565 } 1566 1566 1567 1567 if ( 'scroll' == get_theme_mod('background_attachment', 'fixed') )