mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-28 23:27:39 +02:00
Coding Standards: Use strict comparison in wp-admin/includes/post.php
.
Follow-up to [2718], [7103], [7338], [8857], [9036], [9103], [11807], [11908], [15315], [16901], [17078], [23725], [23735], [44141], [45583]. Props aristath, poena, afercia, SergeyBiryukov. See #60700. Built from https://develop.svn.wordpress.org/trunk@58360 git-svn-id: http://core.svn.wordpress.org/trunk@57809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a902954f81
commit
f6e876199a
@ -72,7 +72,7 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $post_data['user_ID'] ) && ( $post_data['post_author'] != $post_data['user_ID'] )
|
||||
if ( isset( $post_data['user_ID'] ) && ( $post_data['post_author'] !== $post_data['user_ID'] )
|
||||
&& ! current_user_can( $ptype->cap->edit_others_posts ) ) {
|
||||
|
||||
if ( $update ) {
|
||||
@ -165,7 +165,7 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
|
||||
}
|
||||
|
||||
foreach ( array( 'aa', 'mm', 'jj', 'hh', 'mn' ) as $timeunit ) {
|
||||
if ( ! empty( $post_data[ 'hidden_' . $timeunit ] ) && $post_data[ 'hidden_' . $timeunit ] != $post_data[ $timeunit ] ) {
|
||||
if ( ! empty( $post_data[ 'hidden_' . $timeunit ] ) && $post_data[ 'hidden_' . $timeunit ] !== $post_data[ $timeunit ] ) {
|
||||
$post_data['edit_date'] = '1';
|
||||
break;
|
||||
}
|
||||
@ -375,7 +375,7 @@ function edit_post( $post_data = null ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $meta->post_id != $post_id ) {
|
||||
if ( (int) $meta->post_id !== $post_id ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ function edit_post( $post_data = null ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $meta->post_id != $post_id ) {
|
||||
if ( (int) $meta->post_id !== $post_id ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -516,7 +516,7 @@ function bulk_edit_posts( $post_data = null ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( -1 == $post_data['_status'] ) {
|
||||
if ( '-1' === $post_data['_status'] ) {
|
||||
$post_data['post_status'] = null;
|
||||
unset( $post_data['post_status'] );
|
||||
} else {
|
||||
@ -550,7 +550,7 @@ function bulk_edit_posts( $post_data = null ) {
|
||||
);
|
||||
|
||||
foreach ( $reset as $field ) {
|
||||
if ( isset( $post_data[ $field ] ) && ( '' === $post_data[ $field ] || -1 == $post_data[ $field ] ) ) {
|
||||
if ( isset( $post_data[ $field ] ) && ( '' === $post_data[ $field ] || '-1' === $post_data[ $field ] ) ) {
|
||||
unset( $post_data[ $field ] );
|
||||
}
|
||||
}
|
||||
@ -1404,7 +1404,7 @@ function wp_edit_attachments_query( $q = false ) {
|
||||
* @return string Space-separated string of class names.
|
||||
*/
|
||||
function postbox_classes( $box_id, $screen_id ) {
|
||||
if ( isset( $_GET['edit'] ) && $_GET['edit'] == $box_id ) {
|
||||
if ( isset( $_GET['edit'] ) && $_GET['edit'] === $box_id ) {
|
||||
$classes = array( '' );
|
||||
} elseif ( get_user_option( 'closedpostboxes_' . $screen_id ) ) {
|
||||
$closed = get_user_option( 'closedpostboxes_' . $screen_id );
|
||||
@ -1577,7 +1577,7 @@ function get_sample_permalink_html( $post, $new_title = null, $new_slug = null )
|
||||
|
||||
// Encourage a pretty permalink setting.
|
||||
if ( ! get_option( 'permalink_structure' ) && current_user_can( 'manage_options' )
|
||||
&& ! ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID )
|
||||
&& ! ( 'page' === get_option( 'show_on_front' ) && (int) get_option( 'page_on_front' ) === $post->ID )
|
||||
) {
|
||||
$return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small">' . __( 'Change Permalink Structure' ) . "</a></span>\n";
|
||||
}
|
||||
@ -1713,7 +1713,7 @@ function wp_check_post_lock( $post ) {
|
||||
|
||||
$lock = explode( ':', $lock );
|
||||
$time = $lock[0];
|
||||
$user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true );
|
||||
$user = isset( $lock[1] ) ? (int) $lock[1] : (int) get_post_meta( $post->ID, '_edit_last', true );
|
||||
|
||||
if ( ! get_userdata( $user ) ) {
|
||||
return false;
|
||||
@ -1722,7 +1722,7 @@ function wp_check_post_lock( $post ) {
|
||||
/** This filter is documented in wp-admin/includes/ajax-actions.php */
|
||||
$time_window = apply_filters( 'wp_check_post_lock_window', 150 );
|
||||
|
||||
if ( $time && $time > time() - $time_window && get_current_user_id() != $user ) {
|
||||
if ( $time && $time > time() - $time_window && get_current_user_id() !== $user ) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
@ -1752,7 +1752,7 @@ function wp_set_post_lock( $post ) {
|
||||
|
||||
$user_id = get_current_user_id();
|
||||
|
||||
if ( 0 == $user_id ) {
|
||||
if ( 0 === $user_id ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1829,7 +1829,7 @@ function _admin_notice_post_locked() {
|
||||
if ( $locked ) {
|
||||
$query_args = array();
|
||||
if ( get_post_type_object( $post->post_type )->public ) {
|
||||
if ( 'publish' === $post->post_status || $user->ID != $post->post_author ) {
|
||||
if ( 'publish' === $post->post_status || $user->ID !== (int) $post->post_author ) {
|
||||
// Latest content is in autosave.
|
||||
$nonce = wp_create_nonce( 'post_preview_' . $post->ID );
|
||||
$query_args['preview_id'] = $post->ID;
|
||||
@ -2081,7 +2081,7 @@ function post_preview() {
|
||||
|
||||
$is_autosave = false;
|
||||
|
||||
if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author
|
||||
if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() === (int) $post->post_author
|
||||
&& ( 'draft' === $post->post_status || 'auto-draft' === $post->post_status )
|
||||
) {
|
||||
$saved_post_id = edit_post();
|
||||
@ -2156,7 +2156,7 @@ function wp_autosave( $post_data ) {
|
||||
$post_data['post_category'] = explode( ',', $post_data['catslist'] );
|
||||
}
|
||||
|
||||
if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author
|
||||
if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() === (int) $post->post_author
|
||||
&& ( 'auto-draft' === $post->post_status || 'draft' === $post->post_status )
|
||||
) {
|
||||
// Drafts and auto-drafts are just overwritten by autosave for the same user if the post is not locked.
|
||||
@ -2408,7 +2408,7 @@ function the_block_editor_meta_boxes() {
|
||||
|
||||
$meta_boxes = (array) $wp_meta_boxes[ $current_screen->id ][ $location ][ $priority ];
|
||||
foreach ( $meta_boxes as $meta_box ) {
|
||||
if ( false == $meta_box || ! $meta_box['title'] ) {
|
||||
if ( false === $meta_box || ! $meta_box['title'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.6-beta1-58356';
|
||||
$wp_version = '6.6-beta1-58360';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user