Changeset 19381 for trunk/wp-admin/press-this.php
- Timestamp:
- 11/21/2011 06:32:39 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/press-this.php
r19229 r19381 28 28 function press_it() { 29 29 30 $post = get_default_post_to_edit( 'post', true);30 $post = get_default_post_to_edit(); 31 31 $post = get_object_vars($post); 32 $post_ID = $post['ID']; 33 $post['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : null; 34 $post['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : null; 32 $post_ID = $post['ID'] = (int) $_POST['post_id']; 33 34 if ( !current_user_can('edit_post', $post_ID) ) 35 wp_die(__('You are not allowed to edit this post.')); 36 37 $post['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : ''; 38 $post['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : ''; 35 39 $post['post_title'] = isset($_POST['title']) ? $_POST['title'] : ''; 36 $ post['post_content']= isset($_POST['content']) ? $_POST['content'] : '';40 $content = isset($_POST['content']) ? $_POST['content'] : ''; 37 41 38 42 $upload = false; … … 51 55 } 52 56 // set the post_content and status 57 $post['post_content'] = $content; 53 58 if ( isset( $_POST['publish'] ) && current_user_can( 'publish_posts' ) ) 54 59 $post['post_status'] = 'publish'; … … 71 76 } 72 77 73 wp_update_post($post);78 $post_ID = wp_update_post($post); 74 79 } 75 80 … … 82 87 $posted = $post_ID = press_it(); 83 88 } else { 84 $post_ID = 0; 89 $post = get_default_post_to_edit('post', true); 90 $post_ID = $post->ID; 85 91 } 86 92 … … 138 144 /* ]]> */ 139 145 </script> 140 <h3 class="tb"><label for="t his_photo_description"><?php _e('Description') ?></label></h3>146 <h3 class="tb"><label for="tb_this_photo_description"><?php _e('Description') ?></label></h3> 141 147 <div class="titlediv"> 142 148 <div class="titlewrap"> 143 <input id="t his_photo_description" name="photo_description" class="tbtitle text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo esc_attr($title);?>"/>149 <input id="tb_this_photo_description" name="photo_description" class="tbtitle text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo esc_attr($title);?>"/> 144 150 </div> 145 151 </div> 146 152 147 153 <p class="centered"> 148 <input type="hidden" name="this_photo" value="<?php echo esc_attr($image); ?>" id="t his_photo" />154 <input type="hidden" name="this_photo" value="<?php echo esc_attr($image); ?>" id="tb_this_photo" /> 149 155 <a href="#" class="select"> 150 156 <img src="<?php echo esc_url($image); ?>" alt="<?php echo esc_attr(__('Click to insert.')); ?>" title="<?php echo esc_attr(__('Click to insert.')); ?>" /> … … 266 272 267 273 function image_selector() { 274 var desc = jQuery('#tb_this_photo_description').val() || '', src = jQuery('#tb_this_photo').val() || ''; 275 268 276 tb_remove(); 269 desc = jQuery('#this_photo_description').val();270 src = jQuery('#this_photo').val();271 277 pick(src, desc); 272 278 jQuery('#extra-fields').hide(); … … 274 280 return false; 275 281 } 276 jQuery('#extra-fields').html('<div class="postbox"><h2><?php _e( 'Add Photos' ); ?> <small id="photo_directions">(<?php _e("click images to select") ?>)</small></h2><ul class="actions"><li><a href="#" id="photo-add-url" class="button"><?php _e("Add from URL") ?> +</a></li></ul><div class="inside"><div class="titlewrap"><div id="img_container"></div></div><p id="options"><a href="#" class="close button"><?php _e('Cancel'); ?></a><a href="#" class="refresh button"><?php _e('Refresh'); ?></a></p></div>'); 277 jQuery('#img_container').html(strtoappend); 282 283 jQuery('#extra-fields').html('<div class="postbox"><h2><?php _e( 'Add Photos' ); ?> <small id="photo_directions">(<?php _e("click images to select") ?>)</small></h2><ul class="actions"><li><a href="#" id="photo-add-url" class="button"><?php _e("Add from URL") ?> +</a></li></ul><div class="inside"><div class="titlewrap"><div id="img_container"></div></div><p id="options"><a href="#" class="close button"><?php _e('Cancel'); ?></a><a href="#" class="refresh button"><?php _e('Refresh'); ?></a></p></div>'); 284 jQuery('#img_container').html(strtoappend); 278 285 <?php break; 279 286 } … … 304 311 305 312 function insert_plain_editor(text) { 306 edInsertContent(text); 313 if ( typeof(QTags) != 'undefined' ) 314 QTags.insertContent(text); 307 315 } 308 316 function set_editor(text) { 309 if ( '' == text || '<p></p>' == text ) text = '<p><br /></p>'; 310 if ( tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, text); 317 if ( '' == text || '<p></p>' == text ) 318 text = '<p><br /></p>'; 319 320 if ( tinyMCE.activeEditor ) 321 tinyMCE.execCommand('mceSetContent', false, text); 311 322 } 312 323 function insert_editor(text) { … … 427 438 <input type="hidden" id="original_post_status" name="original_post_status" value="draft" /> 428 439 <input type="hidden" id="prev_status" name="prev_status" value="draft" /> 440 <input type="hidden" id="post_id" name="post_id" value="<?php echo (int) $post_ID; ?>" /> 429 441 430 442 <!-- This div holds the photo metadata -->
Note: See TracChangeset
for help on using the changeset viewer.