Changeset 24414
- Timestamp:
- 06/06/2013 02:39:08 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/post.php
r24408 r24414 1353 1353 1354 1354 if ( 'page' == $post->post_type ) { 1355 if ( ! current_user_can('edit_page', $post_ID) )1356 wp_die( __('You are not allowed to edit this page.'));1355 if ( ! current_user_can('edit_page', $post_ID) ) 1356 wp_die( __('You are not allowed to edit this page.') ); 1357 1357 } else { 1358 if ( ! current_user_can('edit_post', $post_ID) )1359 wp_die( __('You are not allowed to edit this post.'));1358 if ( ! current_user_can('edit_post', $post_ID) ) 1359 wp_die( __('You are not allowed to edit this post.') ); 1360 1360 } 1361 1361 1362 1362 $user_id = get_current_user_id(); 1363 if ( 'draft' == $post->post_status && $user_id == $post->post_author ) { 1363 $locked = wp_check_post_lock( $post->ID ); 1364 if ( ! $locked && 'draft' == $post->post_status && $user_id == $post->post_author ) { 1364 1365 $id = edit_post(); 1365 1366 } else { // Non drafts are not overwritten. The autosave is stored in a special post revision. … … 1372 1373 wp_die( $id->get_error_message() ); 1373 1374 1374 if ( $_POST['post_status'] == 'draft' && $user_id == $post->post_author ) {1375 if ( ! $locked && $_POST['post_status'] == 'draft' && $user_id == $post->post_author ) { 1375 1376 $url = add_query_arg( 'preview', 'true', get_permalink($id) ); 1376 1377 } else { 1377 1378 $nonce = wp_create_nonce('post_preview_' . $id); 1378 $url = add_query_arg( array( 'preview' => 'true', 'preview_id' => $id, 'preview_nonce' => $nonce ), get_permalink($id) ); 1379 $args = array( 1380 'preview' => 'true', 1381 'preview_id' => $id, 1382 'preview_nonce' => $nonce, 1383 ); 1384 1385 if ( isset( $_POST['post_format'] ) ) 1386 $args['post_format'] = empty( $_POST['post_format'] ) ? 'standard' : sanitize_key( $_POST['post_format'] ); 1387 1388 $url = add_query_arg( $args, get_permalink($id) ); 1379 1389 } 1380 1390 -
trunk/wp-admin/js/post.js
r24304 r24414 899 899 }); 900 900 }); 901 902 // When changing post formats, change the editor body class 903 $('#post-formats-select input.post-format').on( 'change.set-editor-class', function( event ) { 904 var editor, body, format = this.id; 905 906 if ( format && $( this ).prop('checked') ) { 907 editor = tinymce.get( 'content' ); 908 909 if ( editor ) { 910 body = editor.getBody(); 911 body.className = body.className.replace( /\bpost-format-[^ ]+/, '' ); 912 editor.dom.addClass( body, format == 'post-format-0' ? 'post-format-standard' : format ); 913 } 914 } 915 }); 901 916 } 902 917 }); -
trunk/wp-includes/revision.php
r24397 r24414 445 445 $post->post_excerpt = $preview->post_excerpt; 446 446 447 add_filter( 'get_the_terms', '_wp_preview_terms_filter', 10, 3 ); 448 447 449 return $post; 448 450 } … … 464 466 add_filter('the_preview', '_set_preview'); 465 467 } 468 } 469 470 /** 471 * Filters terms lookup to set the post format. 472 * 473 * @since 3.6.0 474 * @access private 475 */ 476 function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) { 477 if ( ! $post = get_post() ) 478 return $terms; 479 480 if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type ) 481 return $terms; 482 483 if ( 'standard' == $_REQUEST['post_format'] ) 484 $terms = array(); 485 elseif ( $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ) ) 486 $terms = array( $term ); // Can only have one post format 487 488 return $terms; 466 489 } 467 490
Note: See TracChangeset
for help on using the changeset viewer.