Coding Standards: Fix code indentation in post_submit_meta_box() to improve readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@48041


git-svn-id: http://core.svn.wordpress.org/trunk@47808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2020-06-14 16:31:08 +00:00
parent d776a4d15e
commit 9f7a7f8d57
2 changed files with 298 additions and 284 deletions

View File

@ -30,6 +30,7 @@
function post_submit_meta_box( $post, $args = array() ) { function post_submit_meta_box( $post, $args = array() ) {
global $action; global $action;
$post_id = (int) $post->ID;
$post_type = $post->post_type; $post_type = $post->post_type;
$post_type_object = get_post_type_object( $post_type ); $post_type_object = get_post_type_object( $post_type );
$can_publish = current_user_can( $post_type_object->cap->publish_posts ); $can_publish = current_user_can( $post_type_object->cap->publish_posts );
@ -59,7 +60,10 @@ function post_submit_meta_box( $post, $args = array() ) {
<span class="spinner"></span> <span class="spinner"></span>
<?php } ?> <?php } ?>
</div> </div>
<?php if ( is_post_type_viewable( $post_type_object ) ) : ?>
<?php
if ( is_post_type_viewable( $post_type_object ) ) :
?>
<div id="preview-action"> <div id="preview-action">
<?php <?php
$preview_link = esc_url( get_preview_post_link( $post ) ); $preview_link = esc_url( get_preview_post_link( $post ) );
@ -76,11 +80,12 @@ function post_submit_meta_box( $post, $args = array() ) {
__( '(opens in a new tab)' ) __( '(opens in a new tab)' )
); );
?> ?>
<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo (int) $post->ID; ?>" id="post-preview"><?php echo $preview_button; ?></a> <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo $post_id; ?>" id="post-preview"><?php echo $preview_button; ?></a>
<input type="hidden" name="wp-preview" id="wp-preview" value="" /> <input type="hidden" name="wp-preview" id="wp-preview" value="" />
</div> </div>
<?php endif; // is_post_type_viewable() ?>
<?php <?php
endif;
/** /**
* Fires before the post time/date setting in the Publish meta box. * Fires before the post time/date setting in the Publish meta box.
* *
@ -91,14 +96,13 @@ function post_submit_meta_box( $post, $args = array() ) {
do_action( 'post_submitbox_minor_actions', $post ); do_action( 'post_submitbox_minor_actions', $post );
?> ?>
<div class="clear"></div> <div class="clear"></div>
</div><!-- #minor-publishing-actions --> </div>
<div id="misc-publishing-actions"> <div id="misc-publishing-actions">
<div class="misc-pub-section misc-pub-post-status"> <div class="misc-pub-section misc-pub-post-status">
<?php _e( 'Status:' ); ?> <span id="post-status-display"> <?php _e( 'Status:' ); ?>
<span id="post-status-display">
<?php <?php
switch ( $post->post_status ) { switch ( $post->post_status ) {
case 'private': case 'private':
_e( 'Privately Published' ); _e( 'Privately Published' );
@ -119,6 +123,7 @@ function post_submit_meta_box( $post, $args = array() ) {
} }
?> ?>
</span> </span>
<?php <?php
if ( 'publish' === $post->post_status || 'private' === $post->post_status || $can_publish ) { if ( 'publish' === $post->post_status || 'private' === $post->post_status || $can_publish ) {
$private_style = ''; $private_style = '';
@ -149,14 +154,15 @@ function post_submit_meta_box( $post, $args = array() ) {
<a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e( 'OK' ); ?></a> <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e( 'OK' ); ?></a>
<a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a> <a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a>
</div> </div>
<?php
<?php } ?> }
</div><!-- .misc-pub-section --> ?>
</div>
<div class="misc-pub-section misc-pub-visibility" id="visibility"> <div class="misc-pub-section misc-pub-visibility" id="visibility">
<?php _e( 'Visibility:' ); ?> <span id="post-visibility-display"> <?php _e( 'Visibility:' ); ?>
<span id="post-visibility-display">
<?php <?php
if ( 'private' === $post->post_status ) { if ( 'private' === $post->post_status ) {
$post->post_password = ''; $post->post_password = '';
$visibility = 'private'; $visibility = 'private';
@ -164,7 +170,7 @@ function post_submit_meta_box( $post, $args = array() ) {
} elseif ( ! empty( $post->post_password ) ) { } elseif ( ! empty( $post->post_password ) ) {
$visibility = 'password'; $visibility = 'password';
$visibility_trans = __( 'Password protected' ); $visibility_trans = __( 'Password protected' );
} elseif ( 'post' === $post_type && is_sticky( $post->ID ) ) { } elseif ( 'post' === $post_type && is_sticky( $post_id ) ) {
$visibility = 'public'; $visibility = 'public';
$visibility_trans = __( 'Public, Sticky' ); $visibility_trans = __( 'Public, Sticky' );
} else { } else {
@ -175,21 +181,26 @@ function post_submit_meta_box( $post, $args = array() ) {
echo esc_html( $visibility_trans ); echo esc_html( $visibility_trans );
?> ?>
</span> </span>
<?php if ( $can_publish ) { ?> <?php if ( $can_publish ) { ?>
<a href="#visibility" class="edit-visibility hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a> <a href="#visibility" class="edit-visibility hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a>
<div id="post-visibility-select" class="hide-if-js"> <div id="post-visibility-select" class="hide-if-js">
<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr( $post->post_password ); ?>" /> <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr( $post->post_password ); ?>" />
<?php if ( 'post' === $post_type ) : ?> <?php if ( 'post' === $post_type ) : ?>
<input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked( is_sticky( $post_id ) ); ?> />
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" /> <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e( 'Public' ); ?></label><br /> <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e( 'Public' ); ?></label><br />
<?php if ( 'post' === $post_type && current_user_can( 'edit_others_posts' ) ) : ?> <?php if ( 'post' === $post_type && current_user_can( 'edit_others_posts' ) ) : ?>
<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span> <span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post_id ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span>
<?php endif; ?> <?php endif; ?>
<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e( 'Password protected' ); ?></label><br /> <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e( 'Password protected' ); ?></label><br />
<span id="password-span"><label for="post_password"><?php _e( 'Password:' ); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr( $post->post_password ); ?>" maxlength="255" /><br /></span> <span id="password-span"><label for="post_password"><?php _e( 'Password:' ); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr( $post->post_password ); ?>" maxlength="255" /><br /></span>
<input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e( 'Private' ); ?></label><br /> <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e( 'Private' ); ?></label><br />
<p> <p>
@ -198,8 +209,7 @@ function post_submit_meta_box( $post, $args = array() ) {
</p> </p>
</div> </div>
<?php } ?> <?php } ?>
</div>
</div><!-- .misc-pub-section -->
<?php <?php
/* translators: Publish box date string. 1: Date, 2: Time. See https://www.php.net/date */ /* translators: Publish box date string. 1: Date, 2: Time. See https://www.php.net/date */
@ -209,7 +219,7 @@ function post_submit_meta_box( $post, $args = array() ) {
/* translators: Publish box time format, see https://www.php.net/date */ /* translators: Publish box time format, see https://www.php.net/date */
$time_format = _x( 'H:i', 'publish box time format' ); $time_format = _x( 'H:i', 'publish box time format' );
if ( 0 != $post->ID ) { if ( 0 !== $post_id ) {
if ( 'future' === $post->post_status ) { // Scheduled for publishing at a future date. if ( 'future' === $post->post_status ) { // Scheduled for publishing at a future date.
/* translators: Post date information. %s: Date on which the post is currently scheduled to be published. */ /* translators: Post date information. %s: Date on which the post is currently scheduled to be published. */
$stamp = __( 'Scheduled for: %s' ); $stamp = __( 'Scheduled for: %s' );
@ -265,20 +275,22 @@ endif;
<legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend> <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
<?php touch_time( ( 'edit' === $action ), 1 ); ?> <?php touch_time( ( 'edit' === $action ), 1 ); ?>
</fieldset> </fieldset>
</div><?php // /misc-pub-section ?> </div>
<?php endif; ?> <?php
endif;
<?php if ( 'draft' === $post->post_status && get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) : ?> if ( 'draft' === $post->post_status && get_post_meta( $post_id, '_customize_changeset_uuid', true ) ) :
?>
<div class="notice notice-info notice-alt inline"> <div class="notice notice-info notice-alt inline">
<p> <p>
<?php <?php
echo sprintf( printf(
/* translators: %s: URL to the Customizer. */ /* translators: %s: URL to the Customizer. */
__( 'This draft comes from your <a href="%s">unpublished customization changes</a>. You can edit, but there&#8217;s no need to publish now. It will be published automatically with those changes.' ), __( 'This draft comes from your <a href="%s">unpublished customization changes</a>. You can edit, but there&#8217;s no need to publish now. It will be published automatically with those changes.' ),
esc_url( esc_url(
add_query_arg( add_query_arg(
'changeset_uuid', 'changeset_uuid',
rawurlencode( get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ), rawurlencode( get_post_meta( $post_id, '_customize_changeset_uuid', true ) ),
admin_url( 'customize.php' ) admin_url( 'customize.php' )
) )
) )
@ -286,9 +298,9 @@ endif;
?> ?>
</p> </p>
</div> </div>
<?php endif; ?>
<?php <?php
endif;
/** /**
* Fires after the post time/date setting in the Publish meta box. * Fires after the post time/date setting in the Publish meta box.
* *
@ -318,14 +330,14 @@ endif;
?> ?>
<div id="delete-action"> <div id="delete-action">
<?php <?php
if ( current_user_can( 'delete_post', $post->ID ) ) { if ( current_user_can( 'delete_post', $post_id ) ) {
if ( ! EMPTY_TRASH_DAYS ) { if ( ! EMPTY_TRASH_DAYS ) {
$delete_text = __( 'Delete Permanently' ); $delete_text = __( 'Delete Permanently' );
} else { } else {
$delete_text = __( 'Move to Trash' ); $delete_text = __( 'Move to Trash' );
} }
?> ?>
<a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>"><?php echo $delete_text; ?></a> <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post_id ); ?>"><?php echo $delete_text; ?></a>
<?php <?php
} }
?> ?>
@ -334,13 +346,15 @@ endif;
<div id="publishing-action"> <div id="publishing-action">
<span class="spinner"></span> <span class="spinner"></span>
<?php <?php
if ( ! in_array( $post->post_status, array( 'publish', 'future', 'private' ), true ) || 0 == $post->ID ) { if ( ! in_array( $post->post_status, array( 'publish', 'future', 'private' ), true ) || 0 === $post_id ) {
if ( $can_publish ) : if ( $can_publish ) :
if ( ! empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : if ( ! empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) :
?> ?>
<input name="original_publish" type="hidden" id="original_publish" value="<?php echo esc_attr_x( 'Schedule', 'post action/button label' ); ?>" /> <input name="original_publish" type="hidden" id="original_publish" value="<?php echo esc_attr_x( 'Schedule', 'post action/button label' ); ?>" />
<?php submit_button( _x( 'Schedule', 'post action/button label' ), 'primary large', 'publish', false ); ?> <?php submit_button( _x( 'Schedule', 'post action/button label' ), 'primary large', 'publish', false ); ?>
<?php else : ?> <?php
else :
?>
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Publish' ); ?>" /> <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Publish' ); ?>" />
<?php submit_button( __( 'Publish' ), 'primary large', 'publish', false ); ?> <?php submit_button( __( 'Publish' ), 'primary large', 'publish', false ); ?>
<?php <?php
@ -354,15 +368,15 @@ endif;
} else { } else {
?> ?>
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ); ?>" /> <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ); ?>" />
<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ); ?>" /> <?php submit_button( __( 'Update' ), 'primary large', 'save', false, array( 'id' => 'publish' ) ); ?>
<?php <?php
} }
?> ?>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div>
</div> </div>
</div>
<?php <?php
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.5-alpha-48040'; $wp_version = '5.5-alpha-48041';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.