Make WordPress Core


Ignore:
Timestamp:
02/22/2010 08:15:06 PM (15 years ago)
Author:
ryan
Message:

Grammar fix. Don't show empty img. Cleanup POST handler. see #12186

File:
1 edited

Legend:

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

    r13303 r13307  
    9090            return;
    9191
    92         if ( isset($_POST['reset-background']) ) {
    93             check_admin_referer('custom-background');
     92        if ( empty($_POST) )
     93            return;
     94
     95        check_admin_referer('custom-background');
     96
     97        if ( isset($_POST['reset-background']) )
    9498            remove_theme_mods();
    95         }
    9699        if ( isset($_POST['background-repeat']) ) {
    97             check_admin_referer('custom-background');
    98100            if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat')) )
    99101                $repeat = $_POST['background-repeat'];
     
    103105        }
    104106        if ( isset($_POST['background-position']) ) {
    105             check_admin_referer('custom-background');
    106107            if ( in_array($_POST['background-position'], array('center', 'right', 'left')) )
    107108                $position = $_POST['background-position'];
     
    111112        }
    112113        if ( isset($_POST['background-attachment']) ) {
    113             check_admin_referer('custom-background');
    114114            if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) )
    115115                $attachment = $_POST['background-attachment'];
     
    118118            set_theme_mod('background_attachment', $attachment);
    119119        }
    120         if ( isset($_POST['remove-background']) ) {
    121             check_admin_referer('custom-background');
     120        if ( isset($_POST['remove-background']) )
    122121            set_theme_mod('background_image', '');
    123         }
    124122    }
    125123
     
    142140<p><?php _e('This is your current background image.'); ?></p>
    143141<?php
    144 } else { ?>
    145 <p><?php _e('There is currently no background image.'); ?></p> <?php
    146 }
    147 
    148 if ( $this->admin_image_div_callback ) {
    149   call_user_func($this->admin_image_div_callback);
    150 } else {
     142    if ( $this->admin_image_div_callback ) {
     143        call_user_func($this->admin_image_div_callback);
     144    } else {
    151145?>
    152146<div id="custom-background-image">
    153147<img class="custom-background-image" src="<?php background_image(); ?>" />
    154148</div>
    155 <?php } ?>
    156 
    157 <?php if ( get_background_image() ) : ?>
     149<?php }
     150} else { ?>
     151<p><?php _e('There is currently no background image.'); ?></p> <?php
     152}
     153
     154if ( get_background_image() ) : ?>
    158155   
    159156<h2><?php _e('Change Display Options') ?></h2>
     
    227224<?php if ( get_background_image() ) : ?>
    228225<h2><?php _e('Remove Background Image'); ?></h2>
    229 <p><?php _e('This will remove background image. You will not be able to retrieve any customizations.') ?></p>
     226<p><?php _e('This will remove the background image. You will not be able to retrieve any customizations.') ?></p>
    230227<form method="post" action="<?php echo esc_attr(add_query_arg('step', 1)) ?>">
    231228<?php wp_nonce_field('custom-background'); ?>
Note: See TracChangeset for help on using the changeset viewer.