Ticket #9471: 9471.diff
File 9471.diff, 5.4 KB (added by , 16 years ago) |
---|
-
wp-includes/post.php
1401 1401 if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) ) { 1402 1402 if ( $wp_error ) 1403 1403 return new WP_Error('empty_content', __('Content, title, and excerpt are empty.')); 1404 else 1404 elseif ( empty($force_autosave) ) 1405 1405 return 0; 1406 1406 } 1407 1407 -
wp-includes/js/autosave.dev.js
172 172 autosave = function() { 173 173 // (bool) is rich editor enabled and active 174 174 var rich = (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden(), post_data, doAutoSave, ed, origStatus, successCallback; 175 175 176 var force = jQuery("#force_autosave").size() && jQuery("#force_autosave").val(); 177 176 178 post_data = { 177 179 action: "autosave", 178 180 post_ID: jQuery("#post_ID").val() || 0, … … 208 210 post_data["post_name"] = jQuery('#post_name').val(); 209 211 210 212 // Nothing to save or no change. 211 if ( ( post_data["post_title"].length == 0 && post_data["content"].length == 0 ) || post_data["post_title"] + post_data["content"] == autosaveLast) {213 if ( !force && (( post_data["post_title"].length == 0 && post_data["content"].length == 0 ) || post_data["post_title"] + post_data["content"] == autosaveLast ) ) { 212 214 doAutoSave = false; 213 215 } 214 216 … … 232 234 if ( jQuery("#post_author").size() ) 233 235 post_data["post_author"] = jQuery("#post_author").val(); 234 236 post_data["user_ID"] = jQuery("#user-id").val(); 237 238 if ( force ) 239 post_data["force_autosave"] = 1; 235 240 236 241 // Don't run while the TinyMCE spellcheck is on. It resets all found words. 237 242 if ( rich && tinyMCE.activeEditor.plugins.spellchecker && tinyMCE.activeEditor.plugins.spellchecker.active ) { -
wp-admin/includes/media.php
358 358 $video_title = __('Add Video'); 359 359 $audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src&type=audio"); 360 360 $audio_title = __('Add Audio'); 361 362 $tb_class = $uploading_iframe_ID >= 0 ? ' class="thickbox"' : ''; 363 361 364 $out = <<<EOF 362 365 363 <a href="{$image_upload_iframe_src}&TB_iframe=true" id="add_image" class="thickbox" title='$image_title'onclick="return false;"><img src='images/media-button-image.gif' alt='$image_title' /></a>364 <a href="{$video_upload_iframe_src}&TB_iframe=true" id="add_video" class="thickbox" title='$video_title'onclick="return false;"><img src='images/media-button-video.gif' alt='$video_title' /></a>365 <a href="{$audio_upload_iframe_src}&TB_iframe=true" id="add_audio" class="thickbox" title='$audio_title'onclick="return false;"><img src='images/media-button-music.gif' alt='$audio_title' /></a>366 <a href="{$media_upload_iframe_src}&TB_iframe=true" id="add_media" class="thickbox" title='$media_title'onclick="return false;"><img src='images/media-button-other.gif' alt='$media_title' /></a>366 <a href="{$image_upload_iframe_src}&TB_iframe=true" id="add_image" title='$image_title' $tb_class onclick="return false;"><img src='images/media-button-image.gif' alt='$image_title' /></a> 367 <a href="{$video_upload_iframe_src}&TB_iframe=true" id="add_video" title='$video_title' $tb_class onclick="return false;"><img src='images/media-button-video.gif' alt='$video_title' /></a> 368 <a href="{$audio_upload_iframe_src}&TB_iframe=true" id="add_audio" title='$audio_title' $tb_class onclick="return false;"><img src='images/media-button-music.gif' alt='$audio_title' /></a> 369 <a href="{$media_upload_iframe_src}&TB_iframe=true" id="add_media" title='$media_title' $tb_class onclick="return false;"><img src='images/media-button-other.gif' alt='$media_title' /></a> 367 370 368 371 EOF; 369 372 printf($context, $out); -
wp-admin/edit-form-advanced.php
573 573 <input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post->post_type) ?>" /> 574 574 <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr($post->post_status) ?>" /> 575 575 <input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" /> 576 <input type="hidden" id="force_autosave" value="" /> 576 577 <?php 577 578 if ( 'draft' != $post->post_status ) 578 579 wp_original_referer_field(true, 'previous'); … … 661 662 <?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?> 662 663 <script type="text/javascript"> 663 664 try{document.post.title.focus();}catch(e){} 665 jQuery(function($) { 666 $("#add_image, #add_video, #add_audio, #add_media").click(function() { 667 var post_id = parseInt($("#post_ID").val(), 10); 668 669 if ( post_id > 0 ) 670 return false; 671 672 $("#force_autosave").val(1); 673 autosave(); 674 $("#force_autosave").val(''); 675 676 if ( !$(this).hasClass('thickbox') ) { 677 $(this).addClass('thickbox').hasClass('thickbox'); 678 tb_init(this); 679 return false; 680 } else { 681 return false; 682 } 683 }); 684 }); 664 685 </script> 665 686 <?php endif; ?>