diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-admin/edit-form-advanced.php --- a/wp/wp-admin/edit-form-advanced.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-admin/edit-form-advanced.php Tue Dec 15 13:49:49 2020 +0100 @@ -6,7 +6,7 @@ * @subpackage Administration */ -// don't load directly +// Don't load directly. if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } @@ -14,7 +14,7 @@ /** * @global string $post_type * @global WP_Post_Type $post_type_object - * @global WP_Post $post + * @global WP_Post $post Global post object. */ global $post_type, $post_type_object, $post; @@ -40,7 +40,9 @@ } wp_enqueue_script( 'post' ); -$_wp_editor_expand = $_content_editor_dfw = false; + +$_wp_editor_expand = false; +$_content_editor_dfw = false; /** * Filters whether to enable the 'expand' functionality in the post editor. @@ -57,7 +59,7 @@ wp_enqueue_script( 'editor-expand' ); $_content_editor_dfw = true; - $_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' ); + $_wp_editor_expand = ( 'on' === get_user_setting( 'editor_expand', 'on' ) ); } if ( wp_is_mobile() ) { @@ -74,7 +76,7 @@ $user_ID = isset( $user_ID ) ? (int) $user_ID : 0; $action = isset( $action ) ? $action : ''; -if ( $post_ID == get_option( 'page_for_posts' ) && empty( $post->post_content ) ) { +if ( (int) get_option( 'page_for_posts' ) === $post_ID && empty( $post->post_content ) ) { add_action( 'edit_form_after_title', '_wp_posts_page_notice' ); remove_post_type_support( $post_type, 'editor' ); } @@ -93,7 +95,7 @@ wp_enqueue_media( array( 'post' => $post_ID ) ); } -// Add the local autosave notice HTML +// Add the local autosave notice HTML. add_action( 'admin_footer', '_local_storage_notice' ); /* @@ -106,8 +108,13 @@ $messages = array(); -$preview_post_link_html = $scheduled_post_link_html = $view_post_link_html = ''; -$preview_page_link_html = $scheduled_page_link_html = $view_page_link_html = ''; +$preview_post_link_html = ''; +$scheduled_post_link_html = ''; +$view_post_link_html = ''; + +$preview_page_link_html = ''; +$scheduled_page_link_html = ''; +$view_page_link_html = ''; $preview_url = get_preview_post_link( $post ); @@ -159,8 +166,14 @@ } -/* translators: Publish box date format, see https://secure.php.net/date */ -$scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) ); +$scheduled_date = sprintf( + /* translators: Publish box date string. 1: Date, 2: Time. */ + __( '%1$s at %2$s' ), + /* translators: Publish box date format, see https://www.php.net/date */ + date_i18n( _x( 'M j, Y', 'publish box date format' ), strtotime( $post->post_date ) ), + /* translators: Publish box time format, see https://www.php.net/date */ + date_i18n( _x( 'H:i', 'publish box time format' ), strtotime( $post->post_date ) ) +); $messages['post'] = array( 0 => '', // Unused. Messages start at index 1. @@ -168,11 +181,12 @@ 2 => __( 'Custom field updated.' ), 3 => __( 'Custom field deleted.' ), 4 => __( 'Post updated.' ), - /* translators: %s: date and time of the revision */ + /* translators: %s: Date and time of the revision. */ 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Post restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => __( 'Post published.' ) . $view_post_link_html, 7 => __( 'Post saved.' ), 8 => __( 'Post submitted.' ) . $preview_post_link_html, + /* translators: %s: Scheduled date for the post. */ 9 => sprintf( __( 'Post scheduled for: %s.' ), '' . $scheduled_date . '' ) . $scheduled_post_link_html, 10 => __( 'Post draft updated.' ) . $preview_post_link_html, ); @@ -182,11 +196,12 @@ 2 => __( 'Custom field updated.' ), 3 => __( 'Custom field deleted.' ), 4 => __( 'Page updated.' ), - /* translators: %s: date and time of the revision */ + /* translators: %s: Date and time of the revision. */ 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Page restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => __( 'Page published.' ) . $view_page_link_html, 7 => __( 'Page saved.' ), 8 => __( 'Page submitted.' ) . $preview_page_link_html, + /* translators: %s: Scheduled date for the page. */ 9 => sprintf( __( 'Page scheduled for: %s.' ), '' . $scheduled_date . '' ) . $scheduled_page_link_html, 10 => __( 'Page draft updated.' ) . $preview_page_link_html, ); @@ -213,8 +228,8 @@ $notice = false; $form_extra = ''; -if ( 'auto-draft' == $post->post_status ) { - if ( 'edit' == $action ) { +if ( 'auto-draft' === $post->post_status ) { + if ( 'edit' === $action ) { $post->post_title = ''; } $autosave = false; @@ -227,11 +242,15 @@ $nonce_action = 'update-post_' . $post_ID; $form_extra .= ""; -// Detect if there exists an autosave newer than the post and if that autosave is different than the post +// Detect if there exists an autosave newer than the post and if that autosave is different than the post. if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) { - if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) { - $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. View the autosave' ), get_edit_post_link( $autosave->ID ) ); + if ( normalize_whitespace( $autosave->$autosave_field ) !== normalize_whitespace( $post->$autosave_field ) ) { + $notice = sprintf( + /* translators: %s: URL to view the autosave. */ + __( 'There is an autosave of this post that is more recent than the version below. View the autosave' ), + get_edit_post_link( $autosave->ID ) + ); break; } } @@ -245,7 +264,7 @@ $post_type_object = get_post_type_object( $post_type ); // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). -require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' ); +require_once ABSPATH . 'wp-admin/includes/meta-boxes.php'; register_and_do_post_meta_boxes( $post ); @@ -257,7 +276,7 @@ ) ); -if ( 'post' == $post_type ) { +if ( 'post' === $post_type ) { $customize_display = '
' . __( '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.' ) . '
'; get_current_screen()->add_help_tab( @@ -274,7 +293,11 @@ $title_and_editor .= '' . __( 'The Text mode allows you to enter HTML along with your post text. Note that <p> and <br> tags are converted to line breaks when switching to the Text editor to make it less cluttered. When you type, a single line break can be used instead of typing <br>, and two line breaks instead of paragraph tags. The line breaks are converted back to tags automatically.' ) . '
'; $title_and_editor .= '' . __( 'You can insert media files by clicking the button above the post editor and following the directions. You can align or edit images using the inline formatting toolbar available in Visual mode.' ) . '
'; $title_and_editor .= '' . __( 'You can enable distraction-free writing mode using the icon to the right. This feature is not available for old browsers or devices with small screens, and requires that the full-height editor be enabled in Screen Options.' ) . '
'; - $title_and_editor .= '' . __( 'Keyboard users: When you’re working in the visual editor, you can use Alt + F10 to access the toolbar.' ) . '
'; + $title_and_editor .= '' . sprintf( + /* translators: %s: Alt + F10 */ + __( 'Keyboard users: When you’re working in the visual editor, you can use %s to access the toolbar.' ), + 'Alt + F10' + ) . '
'; get_current_screen()->add_help_tab( array( @@ -285,12 +308,16 @@ ); get_current_screen()->set_help_sidebar( - '' . sprintf( __( 'You can also create posts with the Press This bookmarklet.' ), 'tools.php' ) . '
' . + '' . sprintf( + /* translators: %s: URL to Press This bookmarklet. */ + __( 'You can also create posts with the Press This bookmarklet.' ), + 'tools.php' + ) . '
' . '' . __( 'For more information:' ) . '
' . - '' . __( 'Documentation on Writing and Editing Posts' ) . '
' . + '' . __( 'Documentation on Writing and Editing Posts' ) . '
' . '' . __( 'Support' ) . '
' ); -} elseif ( 'page' == $post_type ) { +} elseif ( 'page' === $post_type ) { $about_pages = '' . __( '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.' ) . '
' . '' . __( '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.' ) . '
'; @@ -304,17 +331,17 @@ get_current_screen()->set_help_sidebar( '' . __( 'For more information:' ) . '
' . - '' . __( 'Documentation on Adding New Pages' ) . '
' . - '' . __( 'Documentation on Editing Pages' ) . '
' . + '' . __( 'Documentation on Adding New Pages' ) . '
' . + '' . __( 'Documentation on Editing Pages' ) . '
' . '' . __( 'Support' ) . '
' ); -} elseif ( 'attachment' == $post_type ) { +} elseif ( 'attachment' === $post_type ) { get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => - '' . __( 'This screen allows you to edit four fields for metadata in a file within the media library.' ) . '
' . + '' . __( 'This screen allows you to edit fields for metadata in a file within the media library.' ) . '
' . '' . __( 'For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.' ) . '
' . '' . __( 'Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.' ) . '
' . '' . __( 'Remember to click Update Media to save metadata entered or changed.' ) . '
', @@ -323,14 +350,14 @@ get_current_screen()->set_help_sidebar( '' . __( 'For more information:' ) . '
' . - '' . __( 'Documentation on Edit Media' ) . '
' . + '' . __( 'Documentation on Edit Media' ) . '
' . '' . __( 'Support' ) . '
' ); } -if ( 'post' == $post_type || 'page' == $post_type ) { +if ( 'post' === $post_type || 'page' === $post_type ) { $inserting_media = '' . __( '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.' ) . '
'; - $inserting_media .= '' . __( '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. Please refer to the Codex to learn more about embeds.' ) . '
'; + $inserting_media .= '' . __( '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. Learn more about embeds.' ) . '
'; get_current_screen()->add_help_tab( array( @@ -341,19 +368,22 @@ ); } -if ( 'post' == $post_type ) { +if ( 'post' === $post_type ) { $publish_box = '' . __( 'Several boxes on this screen contain settings for how your content will be published, including:' ) . '
'; $publish_box .= '' . __( 'Parent — 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.' ) . '
' . '' . __( 'Template — 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.' ) . '
' . '' . __( 'Order — Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.' ) . '
'; @@ -390,7 +420,7 @@ ); } -require_once( ABSPATH . 'wp-admin/admin-header.php' ); +require_once ABSPATH . 'wp-admin/admin-header.php'; ?>