wp/wp-admin/edit-form-advanced.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    10 if ( ! defined( 'ABSPATH' ) ) {
    10 if ( ! defined( 'ABSPATH' ) ) {
    11 	die( '-1' );
    11 	die( '-1' );
    12 }
    12 }
    13 
    13 
    14 /**
    14 /**
    15  * @global string       $post_type
    15  * @global string       $post_type        Global post type.
    16  * @global WP_Post_Type $post_type_object
    16  * @global WP_Post_Type $post_type_object Global post type object.
    17  * @global WP_Post      $post             Global post object.
    17  * @global WP_Post      $post             Global post object.
    18  */
    18  */
    19 global $post_type, $post_type_object, $post;
    19 global $post_type, $post_type_object, $post;
    20 
    20 
    21 // Flag that we're not loading the block editor.
    21 // Flag that we're not loading the block editor.
   314 			/* translators: %s: URL to Press This bookmarklet. */
   314 			/* translators: %s: URL to Press This bookmarklet. */
   315 			__( 'You can also create posts with the <a href="%s">Press This bookmarklet</a>.' ),
   315 			__( 'You can also create posts with the <a href="%s">Press This bookmarklet</a>.' ),
   316 			'tools.php'
   316 			'tools.php'
   317 		) . '</p>' .
   317 		) . '</p>' .
   318 			'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   318 			'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   319 			'<p>' . __( '<a href="https://wordpress.org/support/article/wordpress-editor/">Documentation on Writing and Editing Posts</a>' ) . '</p>' .
   319 			'<p>' . __( '<a href="https://wordpress.org/documentation/article/write-posts-classic-editor/">Documentation on Writing and Editing Posts</a>' ) . '</p>' .
   320 			'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   320 			'<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
   321 	);
   321 	);
   322 } elseif ( 'page' === $post_type ) {
   322 } elseif ( 'page' === $post_type ) {
   323 	$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 &#8220;Parent&#8221; of the other, creating a group of pages.' ) . '</p>' .
   323 	$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 &#8220;Parent&#8221; of the other, creating a group of pages.' ) . '</p>' .
   324 		'<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>';
   324 		'<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>';
   325 
   325 
   331 		)
   331 		)
   332 	);
   332 	);
   333 
   333 
   334 	get_current_screen()->set_help_sidebar(
   334 	get_current_screen()->set_help_sidebar(
   335 		'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   335 		'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   336 			'<p>' . __( '<a href="https://wordpress.org/support/article/pages-add-new-screen/">Documentation on Adding New Pages</a>' ) . '</p>' .
   336 			'<p>' . __( '<a href="https://wordpress.org/documentation/article/pages-add-new-screen/">Documentation on Adding New Pages</a>' ) . '</p>' .
   337 			'<p>' . __( '<a href="https://wordpress.org/support/article/pages-screen/">Documentation on Editing Pages</a>' ) . '</p>' .
   337 			'<p>' . __( '<a href="https://wordpress.org/documentation/article/pages-screen/">Documentation on Editing Pages</a>' ) . '</p>' .
   338 			'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   338 			'<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
   339 	);
   339 	);
   340 } elseif ( 'attachment' === $post_type ) {
   340 } elseif ( 'attachment' === $post_type ) {
   341 	get_current_screen()->add_help_tab(
   341 	get_current_screen()->add_help_tab(
   342 		array(
   342 		array(
   343 			'id'      => 'overview',
   343 			'id'      => 'overview',
   344 			'title'   => __( 'Overview' ),
   344 			'title'   => __( 'Overview' ),
   345 			'content' =>
   345 			'content' =>
   346 				'<p>' . __( 'This screen allows you to edit fields for metadata in a file within the media library.' ) . '</p>' .
   346 				'<p>' . __( 'This screen allows you to edit fields for metadata in a file within the media library.' ) . '</p>' .
   347 				'<p>' . __( '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.' ) . '</p>' .
   347 				'<p>' . __( '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.' ) . '</p>' .
   348 				'<p>' . __( '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.' ) . '</p>' .
   348 				'<p>' . __( '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.' ) . '</p>' .
   349 				'<p>' . __( 'Remember to click Update Media to save metadata entered or changed.' ) . '</p>',
   349 				'<p>' . __( 'Remember to click Update to save metadata entered or changed.' ) . '</p>',
   350 		)
   350 		)
   351 	);
   351 	);
   352 
   352 
   353 	get_current_screen()->set_help_sidebar(
   353 	get_current_screen()->set_help_sidebar(
   354 		'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   354 		'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   355 		'<p>' . __( '<a href="https://wordpress.org/support/article/edit-media/">Documentation on Edit Media</a>' ) . '</p>' .
   355 		'<p>' . __( '<a href="https://wordpress.org/documentation/article/edit-media/">Documentation on Edit Media</a>' ) . '</p>' .
   356 		'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   356 		'<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
   357 	);
   357 	);
   358 }
   358 }
   359 
   359 
   360 if ( 'post' === $post_type || 'page' === $post_type ) {
   360 if ( 'post' === $post_type || 'page' === $post_type ) {
   361 	$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 &#8220;Create a new gallery&#8221; button.' ) . '</p>';
   361 	$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 &#8220;Create a new gallery&#8221; button.' ) . '</p>';
   362 	$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>';
   362 	$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/documentation/article/embeds/">Learn more about embeds</a>.' ) . '</p>';
   363 
   363 
   364 	get_current_screen()->add_help_tab(
   364 	get_current_screen()->add_help_tab(
   365 		array(
   365 		array(
   366 			'id'      => 'inserting-media',
   366 			'id'      => 'inserting-media',
   367 			'title'   => __( 'Inserting Media' ),
   367 			'title'   => __( 'Inserting Media' ),
   375 	$publish_box .= '<ul><li>' .
   375 	$publish_box .= '<ul><li>' .
   376 		__( '<strong>Publish</strong> &mdash; 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.' ) .
   376 		__( '<strong>Publish</strong> &mdash; 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.' ) .
   377 	'</li>';
   377 	'</li>';
   378 
   378 
   379 	if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) {
   379 	if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) {
   380 		$publish_box .= '<li>' . __( '<strong>Format</strong> &mdash; Post Formats designate how your theme will display a specific post. For example, you could have a <em>standard</em> blog post with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Your theme could enable all or some of 10 possible formats. <a href="https://wordpress.org/support/article/post-formats/#supported-formats">Learn more about each post format</a>.' ) . '</li>';
   380 		$publish_box .= '<li>' . __( '<strong>Format</strong> &mdash; Post Formats designate how your theme will display a specific post. For example, you could have a <em>standard</em> blog post with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Your theme could enable all or some of 10 possible formats. <a href="https://developer.wordpress.org/advanced-administration/wordpress/post-formats/#supported-formats">Learn more about each post format</a>.' ) . '</li>';
   381 	}
   381 	}
   382 
   382 
   383 	if ( current_theme_supports( 'post-thumbnails' ) && post_type_supports( 'post', 'thumbnail' ) ) {
   383 	if ( current_theme_supports( 'post-thumbnails' ) && post_type_supports( 'post', 'thumbnail' ) ) {
   384 		$publish_box .= '<li>' . sprintf(
   384 		$publish_box .= '<li>' . sprintf(
   385 			/* translators: %s: Featured image. */
   385 			/* translators: %s: Featured image. */
   438 }
   438 }
   439 ?>
   439 ?>
   440 
   440 
   441 <hr class="wp-header-end">
   441 <hr class="wp-header-end">
   442 
   442 
   443 <?php if ( $notice ) : ?>
   443 <?php
   444 <div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice; ?></p></div>
   444 if ( $notice ) :
   445 <?php endif; ?>
   445 	wp_admin_notice(
   446 <?php if ( $message ) : ?>
   446 		'<p id="has-newer-autosave">' . $notice . '</p>',
   447 <div id="message" class="updated notice notice-success is-dismissible"><p><?php echo $message; ?></p></div>
   447 		array(
   448 <?php endif; ?>
   448 			'type'           => 'warning',
   449 <div id="lost-connection-notice" class="error hidden">
   449 			'id'             => 'notice',
   450 	<p><span class="spinner"></span> <?php _e( '<strong>Connection lost.</strong> Saving has been disabled until you are reconnected.' ); ?>
   450 			'paragraph_wrap' => false,
   451 	<span class="hide-if-no-sessionstorage"><?php _e( 'This post is being backed up in your browser, just in case.' ); ?></span>
   451 		)
   452 	</p>
   452 	);
   453 </div>
   453 endif;
       
   454 if ( $message ) :
       
   455 	wp_admin_notice(
       
   456 		$message,
       
   457 		array(
       
   458 			'type'               => 'success',
       
   459 			'dismissible'        => true,
       
   460 			'id'                 => 'message',
       
   461 			'additional_classes' => array( 'updated' ),
       
   462 		)
       
   463 	);
       
   464 endif;
       
   465 
       
   466 $connection_lost_message = sprintf(
       
   467 	'<span class="spinner"></span> %1$s <span class="hide-if-no-sessionstorage">%2$s</span>',
       
   468 	__( '<strong>Connection lost.</strong> Saving has been disabled until you are reconnected.' ),
       
   469 	__( 'This post is being backed up in your browser, just in case.' )
       
   470 );
       
   471 
       
   472 wp_admin_notice(
       
   473 	$connection_lost_message,
       
   474 	array(
       
   475 		'id'                 => 'lost-connection-notice',
       
   476 		'additional_classes' => array( 'error', 'hidden' ),
       
   477 	)
       
   478 );
       
   479 ?>
   454 <form name="post" action="post.php" method="post" id="post"
   480 <form name="post" action="post.php" method="post" id="post"
   455 <?php
   481 <?php
   456 /**
   482 /**
   457  * Fires inside the post editor form tag.
   483  * Fires inside the post editor form tag.
   458  *
   484  *
   621 	<?php
   647 	<?php
   622 	if ( 'auto-draft' !== $post->post_status ) {
   648 	if ( 'auto-draft' !== $post->post_status ) {
   623 		echo '<span id="last-edit">';
   649 		echo '<span id="last-edit">';
   624 		$last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) );
   650 		$last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) );
   625 		if ( $last_user ) {
   651 		if ( $last_user ) {
   626 			/* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time. */
   652 			printf(
   627 			printf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) );
   653 				/* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time. */
       
   654 				__( 'Last edited by %1$s on %2$s at %3$s' ),
       
   655 				esc_html( $last_user->display_name ),
       
   656 				mysql2date( __( 'F j, Y' ), $post->post_modified ),
       
   657 				mysql2date( __( 'g:i a' ), $post->post_modified )
       
   658 			);
   628 		} else {
   659 		} else {
   629 			/* translators: 1: Post edited date, 2: Post edited time. */
   660 			printf(
   630 			printf( __( 'Last edited on %1$s at %2$s' ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) );
   661 				/* translators: 1: Post edited date, 2: Post edited time. */
       
   662 				__( 'Last edited on %1$s at %2$s' ),
       
   663 				mysql2date( __( 'F j, Y' ), $post->post_modified ),
       
   664 				mysql2date( __( 'g:i a' ), $post->post_modified )
       
   665 			);
   631 		}
   666 		}
   632 		echo '</span>';
   667 		echo '</span>';
   633 	}
   668 	}
   634 	?>
   669 	?>
   635 	</td>
   670 	</td>