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

See #49542.

git-svn-id: https://develop.svn.wordpress.org/trunk@48041 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling 2020-06-14 16:29:33 +00:00
parent 9c0fd94558
commit 5b31b4eee4

View File

@ -30,6 +30,7 @@
function post_submit_meta_box( $post, $args = array() ) {
global $action;
$post_id = (int) $post->ID;
$post_type = $post->post_type;
$post_type_object = get_post_type_object( $post_type );
$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>
<?php } ?>
</div>
<?php if ( is_post_type_viewable( $post_type_object ) ) : ?>
<?php
if ( is_post_type_viewable( $post_type_object ) ) :
?>
<div id="preview-action">
<?php
$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)' )
);
?>
<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="" />
</div>
<?php endif; // is_post_type_viewable() ?>
<?php
endif;
/**
* 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 );
?>
<div class="clear"></div>
</div><!-- #minor-publishing-actions -->
</div>
<div id="misc-publishing-actions">
<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
switch ( $post->post_status ) {
case 'private':
_e( 'Privately Published' );
@ -119,6 +123,7 @@ function post_submit_meta_box( $post, $args = array() ) {
}
?>
</span>
<?php
if ( 'publish' === $post->post_status || 'private' === $post->post_status || $can_publish ) {
$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="cancel-post-status hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a>
</div>
<?php } ?>
</div><!-- .misc-pub-section -->
<?php
}
?>
</div>
<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
if ( 'private' === $post->post_status ) {
$post->post_password = '';
$visibility = 'private';
@ -164,7 +170,7 @@ function post_submit_meta_box( $post, $args = array() ) {
} elseif ( ! empty( $post->post_password ) ) {
$visibility = 'password';
$visibility_trans = __( 'Password protected' );
} elseif ( 'post' === $post_type && is_sticky( $post->ID ) ) {
} elseif ( 'post' === $post_type && is_sticky( $post_id ) ) {
$visibility = 'public';
$visibility_trans = __( 'Public, Sticky' );
} else {
@ -175,21 +181,26 @@ function post_submit_meta_box( $post, $args = array() ) {
echo esc_html( $visibility_trans );
?>
</span>
<?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>
<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 ); ?>" />
<?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; ?>
<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 />
<?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; ?>
<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>
<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>
@ -198,8 +209,7 @@ function post_submit_meta_box( $post, $args = array() ) {
</p>
</div>
<?php } ?>
</div><!-- .misc-pub-section -->
</div>
<?php
/* 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 */
$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.
/* translators: Post date information. %s: Date on which the post is currently scheduled to be published. */
$stamp = __( 'Scheduled for: %s' );
@ -265,20 +275,22 @@ endif;
<legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
<?php touch_time( ( 'edit' === $action ), 1 ); ?>
</fieldset>
</div><?php // /misc-pub-section ?>
<?php endif; ?>
</div>
<?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">
<p>
<?php
echo sprintf(
printf(
/* 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.' ),
esc_url(
add_query_arg(
'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' )
)
)
@ -286,9 +298,9 @@ endif;
?>
</p>
</div>
<?php endif; ?>
<?php
endif;
/**
* Fires after the post time/date setting in the Publish meta box.
*
@ -318,14 +330,14 @@ endif;
?>
<div id="delete-action">
<?php
if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( current_user_can( 'delete_post', $post_id ) ) {
if ( ! EMPTY_TRASH_DAYS ) {
$delete_text = __( 'Delete Permanently' );
} else {
$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
}
?>
@ -334,13 +346,15 @@ endif;
<div id="publishing-action">
<span class="spinner"></span>
<?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 ( ! 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' ); ?>" />
<?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' ); ?>" />
<?php submit_button( __( 'Publish' ), 'primary large', 'publish', false ); ?>
<?php
@ -354,15 +368,15 @@ endif;
} else {
?>
<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
}
?>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<?php
}