Changeset 14684 for trunk/wp-admin/custom-background.php
- Timestamp:
- 05/16/2010 05:17:57 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/custom-background.php
r14670 r14684 92 92 return; 93 93 } 94 94 95 if ( isset($_POST['remove-background']) ) { 95 96 // @TODO: Uploaded files are not removed here. … … 108 109 set_theme_mod('background_repeat', $repeat); 109 110 } 110 if ( isset($_POST['background-position']) ) { 111 112 if ( isset($_POST['background-position-x']) ) { 111 113 check_admin_referer('custom-background'); 112 if ( in_array($_POST['background-position '], array('center', 'right', 'left')) )113 $position = $_POST['background-position '];114 if ( in_array($_POST['background-position-x'], array('center', 'right', 'left')) ) 115 $position = $_POST['background-position-x']; 114 116 else 115 117 $position = 'left'; 116 set_theme_mod('background_position', $position); 117 } 118 set_theme_mod('background_position_x', $position); 119 } 120 118 121 if ( isset($_POST['background-attachment']) ) { 119 122 check_admin_referer('custom-background'); … … 124 127 set_theme_mod('background_attachment', $attachment); 125 128 } 129 126 130 if ( isset($_POST['background-color']) ) { 127 131 check_admin_referer('custom-background'); … … 156 160 } else { 157 161 ?> 158 <h3><?php _e('Background Preview'); ?></h3>162 <h3><?php _e('Background Image'); ?></h3> 159 163 <table class="form-table"> 160 164 <tbody> 161 165 <tr valign="top"> 162 <th scope="row"><?php _e(' Current Background'); ?></th>166 <th scope="row"><?php _e('Preview'); ?></th> 163 167 <td> 164 168 <?php 165 169 $background_styles = ''; 166 if ( $bgcolor = get_background_color() ) { 167 $background_styles .= "background-color: #{$bgcolor};"; 168 } 169 170 if ( get_background_image() ) { 171 $background_styles .= " 172 background-image: url(" . get_theme_mod('background_image_thumb', '') . "); 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') . "; 176 "; 170 if ( $bgcolor = get_background_color() ) 171 $background_styles .= 'background-color: #' . $bgcolor . ';'; 172 173 if ( get_background_image() ) { 174 // background-image URL must be single quote, see below 175 $background_styles .= ' background-image: url(\'' . get_theme_mod('background_image_thumb', '') . '\');' 176 . ' background-repeat: ' . get_theme_mod('background_repeat', 'repeat') . ';' 177 . ' background-position: top ' . get_theme_mod('background_position_x', 'left'); 177 178 } 178 179 ?> 179 <div id="custom-background-image" style="<?php echo $background_styles; ?>"> 180 <div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?> 180 181 <?php if ( get_background_image() ) { ?> 181 182 <img class="custom-background-image" src="<?php echo get_theme_mod('background_image_thumb', ''); ?>" style="visibility:hidden;" alt="" /><br /> 182 183 <img class="custom-background-image" src="<?php echo get_theme_mod('background_image_thumb', ''); ?>" style="visibility:hidden;" alt="" /> 183 184 <?php } ?> 184 <br class="clear" />185 185 </div> 186 186 <?php } ?> … … 190 190 <tr valign="top"> 191 191 <th scope="row"><?php _e('Remove Image'); ?></th> 192 <td> <p><?php _e('This will remove the background image. You will not be able to restore any customizations.') ?></p>192 <td> 193 193 <form method="post" action=""> 194 194 <?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'); ?>" /> 195 <input type="submit" class="button" name="remove-background" value="<?php esc_attr_e('Remove Background Image'); ?>" /><br/> 196 <?php _e('This will remove the background image. You will not be able to restore any customizations.') ?> 196 197 </form> 197 198 </td> … … 202 203 <tr valign="top"> 203 204 <th scope="row"><?php _e('Restore Original Image'); ?></th> 204 <td> <p><?php _e('This will restore the original background image. You will not be able to restore any customizations.') ?></p>205 <td> 205 206 <form method="post" action=""> 206 207 <?php wp_nonce_field('custom-background-reset', '_wpnonce-custom-background-reset'); ?> 207 <input type="submit" class="button" name="reset-background" value="<?php esc_attr_e('Restore Original Image'); ?>" /> 208 <input type="submit" class="button" name="reset-background" value="<?php esc_attr_e('Restore Original Image'); ?>" /><br/> 209 <?php _e('This will restore the original background image. You will not be able to restore any customizations.') ?> 208 210 </form> 209 211 </td> … … 217 219 <input type="hidden" name="action" value="save" /> 218 220 <?php wp_nonce_field('custom-background-upload', '_wpnonce-custom-background-upload') ?> 219 <p class="submit"> 220 <input type="submit" value="<?php esc_attr_e('Upload'); ?>" /> 221 <input type="submit" class="button" value="<?php esc_attr_e('Upload'); ?>" /> 221 222 </p> 222 223 </form> … … 231 232 <tbody> 232 233 <tr valign="top"> 233 <th scope="row"><?php _e( ' BackgroundColor' ); ?></th>234 <th scope="row"><?php _e( 'Color' ); ?></th> 234 235 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend> 235 236 <input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr(get_background_color()) ?>" /> 236 237 <input type="button" class="button" value="<?php esc_attr_e('Select a Color'); ?>" id="pickcolor" /> 237 238 238 <div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div> 239 239 </fieldset></td> 240 240 </tr> 241 242 <tr valign="top"> 243 <th scope="row"><?php _e( ' BackgroundPosition' ); ?></th>241 <?php if ( get_background_image() ) : ?> 242 <tr valign="top"> 243 <th scope="row"><?php _e( 'Position' ); ?></th> 244 244 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend> 245 245 <label> 246 <input name="background-position " type="radio" value="left" <?php checked('left', get_theme_mod('background_position', 'left')); ?> />246 <input name="background-position-x" type="radio" value="left"<?php checked('left', get_theme_mod('background_position_x', 'left')); ?> /> 247 247 <?php _e('Left') ?> 248 248 </label> 249 249 <label> 250 <input name="background-position " type="radio" value="center" <?php checked('center', get_theme_mod('background_position', 'left')); ?> />250 <input name="background-position-x" type="radio" value="center"<?php checked('center', get_theme_mod('background_position_x', 'left')); ?> /> 251 251 <?php _e('Center') ?> 252 252 </label> 253 253 <label> 254 <input name="background-position " type="radio" value="right" <?php checked('right', get_theme_mod('background_position', 'left')); ?> />254 <input name="background-position-x" type="radio" value="right"<?php checked('right', get_theme_mod('background_position_x', 'left')); ?> /> 255 255 <?php _e('Right') ?> 256 256 </label> … … 263 263 <label> 264 264 <select name="background-repeat"> 265 <option value="no-repeat" 266 <option value="repeat" 267 <option value="repeat-x" 268 <option value="repeat-y" 265 <option value="no-repeat"<?php selected('no-repeat', get_theme_mod('background_repeat', 'repeat')); ?> ><?php _e('No repeat'); ?></option> 266 <option value="repeat"<?php selected('repeat', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile'); ?></option> 267 <option value="repeat-x"<?php selected('repeat-x', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile Horizontally'); ?></option> 268 <option value="repeat-y"<?php selected('repeat-y', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile Vertically'); ?></option> 269 269 </select> 270 270 </label> … … 285 285 </fieldset></td> 286 286 </tr> 287 287 <?php endif; // get_background_image() ?> 288 288 </tbody> 289 289 </table>
Note: See TracChangeset
for help on using the changeset viewer.