Changes from branches/2.2/wp-admin/custom-header.php at r5386 to trunk/wp-admin/custom-header.php at r4673
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/custom-header.php
- Property svn:eol-style deleted
r5386 r4673 18 18 function js_includes() { 19 19 wp_enqueue_script('cropper'); 20 wp_enqueue_script('colorpicker'); 20 wp_enqueue_script('colorpicker'); 21 21 } 22 22 … … 24 24 25 25 if ( isset( $_POST['textcolor'] ) ) { 26 check_admin_referer('custom-header');27 26 if ( 'blank' == $_POST['textcolor'] ) { 28 27 set_theme_mod('header_textcolor', 'blank'); … … 33 32 } 34 33 } 35 if ( isset($_POST['resetheader']) ) { 36 check_admin_referer('custom-header'); 34 if ( isset($_POST['resetheader']) ) 37 35 remove_theme_mods(); 38 }39 36 ?> 40 37 <script type="text/javascript"> … … 119 116 pickColor('<?php echo HEADER_TEXTCOLOR; ?>'); 120 117 } 121 118 122 119 function hide_text() { 123 120 $('name').style.display = 'none'; … … 130 127 Event.observe( $('hidetext'), 'click', show_text ); 131 128 } 132 129 133 130 function show_text() { 134 131 $('name').style.display = 'block'; … … 138 135 $('textcolor').value = '<?php echo HEADER_TEXTCOLOR; ?>'; 139 136 $('hidetext').value = '<?php _e('Hide Text'); ?>'; 140 Event.stopObserving( $('hidetext'), 'click', show_text ); 137 Event.stopObserving( $('hidetext'), 'click', show_text ); 141 138 Event.observe( $('hidetext'), 'click', hide_text ); 142 139 } … … 161 158 <p><?php _e('This is your header image. You can change the text color or upload and crop a new image.'); ?></p> 162 159 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;"> 164 161 <h1><a onclick="return false;" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" id="name"><?php bloginfo('name'); ?></a></h1> 165 162 <div id="desc"><?php bloginfo('description');?></div> … … 169 166 <input type="button" value="<?php _e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" /> 170 167 <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'); ?> »" /></form> 168 <input type="hidden" name="textcolor" id="textcolor" value="#<?php header_textcolor() ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes'); ?> »" /></form> 173 169 <?php } ?> 174 170 … … 179 175 <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> 180 176 181 <form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo a ttribute_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%;"> 182 178 <label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" /> 183 179 <input type="hidden" name="action" value="save" /> 184 <?php wp_nonce_field('custom-header') ?>185 180 <p class="submit"> 186 181 <input type="submit" value="<?php _e('Upload'); ?> »" /> … … 194 189 <h2><?php _e('Reset Header Image and Color'); ?></h2> 195 190 <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 a ttribute_escape(add_query_arg('step', 1)) ?>">191 <form method="post" action="<?php echo add_query_arg('step', 1) ?>"> 197 192 <input type="submit" name="resetheader" value="<?php _e('Restore Original Header'); ?>" /> 198 193 </form> … … 203 198 204 199 function step_2() { 205 check_admin_referer('custom-header');206 200 $overrides = array('test_form' => false); 207 201 $file = wp_handle_upload($_FILES['import'], $overrides); … … 229 223 230 224 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 replication225 set_theme_mod('header_image', $url); 226 $header = apply_filters('wp_create_file_in_uploads', $header); // For replication 233 227 return $this->finished(); 234 228 } elseif ( $width > HEADER_IMAGE_WIDTH ) { 235 229 $oitar = $width / HEADER_IMAGE_WIDTH; 236 230 $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 replication231 $image = apply_filters('wp_create_file_in_uploads', $image); // For replication 238 232 239 233 $url = str_replace(basename($url), basename($image), $url); … … 247 241 <div class="wrap"> 248 242 249 <form method="POST" action="<?php echo a ttribute_escape(add_query_arg('step', 3)) ?>">243 <form method="POST" action="<?php echo add_query_arg('step', 3) ?>"> 250 244 251 245 <p><?php _e('Choose the part of the image you want to use as your header.'); ?></p> … … 263 257 <input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $id; ?>" /> 264 258 <input type="hidden" name="oitar" id="oitar" value="<?php echo $oitar; ?>" /> 265 <?php wp_nonce_field('custom-header') ?>266 259 <input type="submit" value="<?php _e('Crop Header »'); ?>" /> 267 260 </p> … … 273 266 274 267 function step_3() { 275 check_admin_referer('custom-header');276 268 if ( $_POST['oitar'] > 1 ) { 277 269 $_POST['x1'] = $_POST['x1'] * $_POST['oitar']; … … 295 287 $file = get_attached_file( $_POST['attachment_id'] ); 296 288 $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 ); 298 291 wp_delete_attachment( $_POST['attachment_id'] ); 299 292
Note: See TracChangeset
for help on using the changeset viewer.