Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    • Property svn:eol-style deleted
    r5386 r4673  
    1818    function js_includes() {
    1919        wp_enqueue_script('cropper');
    20         wp_enqueue_script('colorpicker');
     20        wp_enqueue_script('colorpicker');   
    2121    }
    2222
     
    2424
    2525        if ( isset( $_POST['textcolor'] ) ) {
    26             check_admin_referer('custom-header');
    2726            if ( 'blank' == $_POST['textcolor'] ) {
    2827                set_theme_mod('header_textcolor', 'blank');
     
    3332            }
    3433        }
    35         if ( isset($_POST['resetheader']) ) {
    36             check_admin_referer('custom-header');
     34        if ( isset($_POST['resetheader']) )
    3735            remove_theme_mods();
    38         }
    3936    ?>
    4037<script type="text/javascript">
     
    119116        pickColor('<?php echo HEADER_TEXTCOLOR; ?>');
    120117    }
    121 
     118   
    122119    function hide_text() {
    123120        $('name').style.display = 'none';
     
    130127        Event.observe( $('hidetext'), 'click', show_text );
    131128    }
    132 
     129   
    133130    function show_text() {
    134131        $('name').style.display = 'block';
     
    138135        $('textcolor').value = '<?php echo HEADER_TEXTCOLOR; ?>';
    139136        $('hidetext').value = '<?php _e('Hide Text'); ?>';
    140         Event.stopObserving( $('hidetext'), 'click', show_text );
     137        Event.stopObserving( $('hidetext'), 'click', show_text );   
    141138        Event.observe( $('hidetext'), 'click', hide_text );
    142139    }
     
    161158<p><?php _e('This is your header image. You can change the text color or upload and crop a new image.'); ?></p>
    162159
    163 <div id="headimg" style="background: url(<?php clean_url(header_image()) ?>) no-repeat;">
     160<div id="headimg" style="background: url(<?php header_image() ?>) no-repeat;">
    164161<h1><a onclick="return false;" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" id="name"><?php bloginfo('name'); ?></a></h1>
    165162<div id="desc"><?php bloginfo('description');?></div>
     
    169166<input type="button" value="<?php _e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" />
    170167<input type="button" value="<?php _e('Select a Text Color'); ?>" onclick="colorSelect($('textcolor'), 'pickcolor')" id="pickcolor" /><input type="button" value="<?php _e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" />
    171 <?php wp_nonce_field('custom-header') ?>
    172 <input type="hidden" name="textcolor" id="textcolor" value="#<?php attribute_escape(header_textcolor()) ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes'); ?> &raquo;" /></form>
     168<input type="hidden" name="textcolor" id="textcolor" value="#<?php header_textcolor() ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes'); ?> &raquo;" /></form>
    173169<?php } ?>
    174170
     
    179175<p><?php printf(__('Images of exactly <strong>%1$d x %2$d pixels</strong> will be used as-is.'), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT); ?></p>
    180176
    181 <form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo attribute_escape(add_query_arg('step', 2)) ?>" style="margin: auto; width: 50%;">
     177<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo add_query_arg('step', 2) ?>" style="margin: auto; width: 50%;">
    182178<label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" />
    183179<input type="hidden" name="action" value="save" />
    184 <?php wp_nonce_field('custom-header') ?>
    185180<p class="submit">
    186181<input type="submit" value="<?php _e('Upload'); ?> &raquo;" />
     
    194189<h2><?php _e('Reset Header Image and Color'); ?></h2>
    195190<p><?php _e('This will restore the original header image and color. You will not be able to retrieve any customizations.') ?></p>
    196 <form method="post" action="<?php echo attribute_escape(add_query_arg('step', 1)) ?>">
     191<form method="post" action="<?php echo add_query_arg('step', 1) ?>">
    197192<input type="submit" name="resetheader" value="<?php _e('Restore Original Header'); ?>" />
    198193</form>
     
    203198
    204199    function step_2() {
    205         check_admin_referer('custom-header');
    206200        $overrides = array('test_form' => false);
    207201        $file = wp_handle_upload($_FILES['import'], $overrides);
     
    229223
    230224        if ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT ) {
    231             set_theme_mod('header_image', clean_url($url));
    232             $header = apply_filters('wp_create_file_in_uploads', $file, $id); // For replication
     225            set_theme_mod('header_image', $url);
     226            $header = apply_filters('wp_create_file_in_uploads', $header); // For replication
    233227            return $this->finished();
    234228        } elseif ( $width > HEADER_IMAGE_WIDTH ) {
    235229            $oitar = $width / HEADER_IMAGE_WIDTH;
    236230            $image = wp_crop_image($file, 0, 0, $width, $height, HEADER_IMAGE_WIDTH, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file));
    237             $image = apply_filters('wp_create_file_in_uploads', $image, $id); // For replication
     231            $image = apply_filters('wp_create_file_in_uploads', $image); // For replication
    238232
    239233            $url = str_replace(basename($url), basename($image), $url);
     
    247241<div class="wrap">
    248242
    249 <form method="POST" action="<?php echo attribute_escape(add_query_arg('step', 3)) ?>">
     243<form method="POST" action="<?php echo add_query_arg('step', 3) ?>">
    250244
    251245<p><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
     
    263257<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $id; ?>" />
    264258<input type="hidden" name="oitar" id="oitar" value="<?php echo $oitar; ?>" />
    265 <?php wp_nonce_field('custom-header') ?>
    266259<input type="submit" value="<?php _e('Crop Header &raquo;'); ?>" />
    267260</p>
     
    273266
    274267    function step_3() {
    275         check_admin_referer('custom-header');
    276268        if ( $_POST['oitar'] > 1 ) {
    277269            $_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
     
    295287        $file = get_attached_file( $_POST['attachment_id'] );
    296288        $medium = str_replace(basename($file), 'midsize-'.basename($file), $file);
    297         @unlink( apply_filters( 'wp_delete_file', $medium ) );
     289        @unlink( $medium );
     290        apply_filters( 'wp_delete_file', $medium );
    298291        wp_delete_attachment( $_POST['attachment_id'] );
    299292
Note: See TracChangeset for help on using the changeset viewer.