Make WordPress Core

Changeset 13765


Ignore:
Timestamp:
03/19/2010 09:33:29 AM (17 years ago)
Author:
dd32
Message:

Show Background preview and options when no Image is uploaded. Display "Updated" div upon updates. Fix Colour Picker not loading after uploading a background image. See #12186

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/custom-background.php

    r13764 r13765  
    9090         */
    9191        function js_includes() {
    92                 $step = $this->step();
    93 
    94                 if ( 1 == $step )
    95                         wp_enqueue_script('farbtastic');
     92                wp_enqueue_script('farbtastic');
    9693        }
    9794
    … …  
    10299         */
    103100        function css_includes() {
    104                 $step = $this->step();
    105 
    106                 if ( 1 == $step )
    107                         wp_enqueue_style('farbtastic');
     101                wp_enqueue_style('farbtastic');
    108102        }
    109103
    … …  
    154148                                set_theme_mod('background_color', '');
    155149                }
     150
     151                $this->updated = true;
    156152        }
    157153
    … …  
    162158         */
    163159        function js() {
    164                 $step = $this->step();
    165                 if ( 1 == $step )
    166                         $this->js_1();
     160                $this->js_1();
    167161        }
    168162
    … …  
    235229<?php screen_icon(); ?>
    236230<h2><?php _e('Custom Background'); ?></h2>
    237 <?php if ( isset($_GET['updated']) && $_GET['updated'] ) { ?>
     231<?php if ( !empty($this->updated) ) { ?>
    238232<div id="message" class="updated">
    239233<p><?php printf(__('Background updated. <a href="%s">Visit your site</a> to see how it looks.'), home_url()); ?></p>
    240234</div>
    241 <?php }
    242 
    243 if ( get_background_image() || get_background_color() ) { ?>
     235<?php } ?>
    244236<p><?php _e('This is your current background.'); ?></p>
    245237<?php
    … …  
    257249<?php } ?>
    258250</div>
    259 <?php }
    260 } else { ?>
    261 <p><?php _e('There is currently no background image.'); ?></p> <?php
    262 }
    263 
    264 if ( get_background_image() ) : ?>
    265 
     251<?php } ?>
    266252<h3><?php _e('Change Display Options') ?></h3>
    267253<form method="post" action="<?php echo esc_attr(add_query_arg('step', 1)) ?>">
    … …  
    328314</form>
    329315
    330 <?php endif; ?>
    331 
    332316<h3><?php _e('Upload New Background Image'); ?></h3>
    333317<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo esc_attr(add_query_arg('step', 2)) ?>">
    … …  
    364348
    365349                if ( isset($file['error']) )
    366                         die( $file['error'] );
     350                        wp_die( $file['error'] );
    367351
    368352                $url = $file['url'];
    … …  
    373357                // Construct the object array
    374358                $object = array(
    375                 'post_title' => $filename,
    376                 'post_content' => $url,
    377                 'post_mime_type' => $type,
    378                 'guid' => $url);
     359                        'post_title' => $filename,
     360                        'post_content' => $url,
     361                        'post_mime_type' => $type,
     362                        'guid' => $url
     363                );
    379364
    380365                // Save the data
    … …  
    386371                set_theme_mod('background_image', esc_url($url));
    387372                do_action('wp_create_file_in_uploads', $file, $id); // For replication
     373                $this->updated = true;
    388374                return $this->finished();
    389375        }
    … …  
    395381         */
    396382        function finished() {
    397                 $_GET['updated'] = 1;
    398           $this->step_1();
     383                $this->step_1();
    399384        }
    400385
Note: See TracChangeset for help on using the changeset viewer.