Ticket #49239: edit-form-advanced.php.patch
| File edit-form-advanced.php.patch, 8.0 KB (added by , 6 years ago) |
|---|
-
edit-form-advanced.php
76 76 $user_ID = isset( $user_ID ) ? (int) $user_ID : 0; 77 77 $action = isset( $action ) ? $action : ''; 78 78 79 if ( $post_ID == get_option( 'page_for_posts' ) && empty( $post->post_content ) ) {79 if ( $post_ID === get_option( 'page_for_posts' ) && empty( $post->post_content ) ) { 80 80 add_action( 'edit_form_after_title', '_wp_posts_page_notice' ); 81 81 remove_post_type_support( $post_type, 'editor' ); 82 82 } … … 228 228 229 229 $notice = false; 230 230 $form_extra = ''; 231 if ( 'auto-draft' == $post->post_status ) {232 if ( 'edit' == $action ) {231 if ( 'auto-draft' === $post->post_status ) { 232 if ( 'edit' === $action ) { 233 233 $post->post_title = ''; 234 234 } 235 235 $autosave = false; … … 245 245 // Detect if there exists an autosave newer than the post and if that autosave is different than the post 246 246 if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { 247 247 foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) { 248 if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {248 if ( normalize_whitespace( $autosave->$autosave_field ) !== normalize_whitespace( $post->$autosave_field ) ) { 249 249 $notice = sprintf( 250 250 /* translators: %s: URL to view the autosave. */ 251 251 __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), … … 276 276 ) 277 277 ); 278 278 279 if ( 'post' == $post_type ) {279 if ( 'post' === $post_type ) { 280 280 $customize_display = '<p>' . __( 'The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.' ) . '</p>'; 281 281 282 282 get_current_screen()->add_help_tab( … … 313 313 '<p>' . __( '<a href="https://wordpress.org/support/article/wordpress-editor/">Documentation on Writing and Editing Posts</a>' ) . '</p>' . 314 314 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' 315 315 ); 316 } elseif ( 'page' == $post_type ) {316 } elseif ( 'page' === $post_type ) { 317 317 $about_pages = '<p>' . __( 'Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the “Parent” of the other, creating a group of pages.' ) . '</p>' . 318 318 '<p>' . __( 'Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.' ) . '</p>'; 319 319 … … 331 331 '<p>' . __( '<a href="https://wordpress.org/support/article/pages-screen/">Documentation on Editing Pages</a>' ) . '</p>' . 332 332 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' 333 333 ); 334 } elseif ( 'attachment' == $post_type ) {334 } elseif ( 'attachment' === $post_type ) { 335 335 get_current_screen()->add_help_tab( 336 336 array( 337 337 'id' => 'overview', … … 351 351 ); 352 352 } 353 353 354 if ( 'post' == $post_type || 'page'== $post_type ) {354 if ( 'post' === $post_type || 'page' === $post_type ) { 355 355 $inserting_media = '<p>' . __( 'You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the “Create a new gallery” button.' ) . '</p>'; 356 356 $inserting_media .= '<p>' . __( 'You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. <a href="https://wordpress.org/support/article/embeds/">Learn more about embeds</a>.' ) . '</p>'; 357 357 … … 364 364 ); 365 365 } 366 366 367 if ( 'post' == $post_type ) {367 if ( 'post' === $post_type ) { 368 368 $publish_box = '<p>' . __( 'Several boxes on this screen contain settings for how your content will be published, including:' ) . '</p>'; 369 369 $publish_box .= '<ul><li>' . 370 370 __( '<strong>Publish</strong> — You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). The Password protected option allows you to set an arbitrary password for each post. The Private option hides the post from everyone except editors and administrators. Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.' ) . … … 402 402 'content' => $discussion_settings, 403 403 ) 404 404 ); 405 } elseif ( 'page' == $post_type ) {405 } elseif ( 'page' === $post_type ) { 406 406 $page_attributes = '<p>' . __( '<strong>Parent</strong> — You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.' ) . '</p>' . 407 407 '<p>' . __( '<strong>Template</strong> — Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.' ) . '</p>' . 408 408 '<p>' . __( '<strong>Order</strong> — Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.' ) . '</p>'; … … 471 471 <input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" /> 472 472 <?php 473 473 } 474 if ( 'draft' != get_post_status( $post ) ) {474 if ( 'draft' !== get_post_status( $post ) ) { 475 475 wp_original_referer_field( true, 'previous' ); 476 476 } 477 477 … … 539 539 } 540 540 } 541 541 542 if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) {543 $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;542 if ( $post_type_object->public && ! ( 'pending' === get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { 543 $has_sample_permalink = $sample_permalink_html && 'auto-draft' !== $post->post_status; 544 544 ?> 545 545 <div id="edit-slug-box" class="hide-if-no-js"> 546 546 <?php … … 608 608 <td class="autosave-info"> 609 609 <span class="autosave-message"> </span> 610 610 <?php 611 if ( 'auto-draft' != $post->post_status ) {611 if ( 'auto-draft' !== $post->post_status ) { 612 612 echo '<span id="last-edit">'; 613 613 $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ); 614 614 if ( $last_user ) { … … 642 642 <div id="postbox-container-1" class="postbox-container"> 643 643 <?php 644 644 645 if ( 'page' == $post_type ) {645 if ( 'page' === $post_type ) { 646 646 /** 647 647 * Fires before meta boxes with 'side' context are output for the 'page' post type. 648 648 * … … 676 676 677 677 do_meta_boxes( null, 'normal', $post ); 678 678 679 if ( 'page' == $post_type ) {679 if ( 'page' === $post_type ) { 680 680 /** 681 681 * Fires after 'normal' context meta boxes have been output for the 'page' post type. 682 682 *