Coding Standards: Use Yoda conditions in some wp-admin files.

Props subrataemfluence, marcio-zebedeu, bookdude13, 1naveengiri, alishankhan.
Fixes #44365, #48455.

git-svn-id: https://develop.svn.wordpress.org/trunk@47218 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-02-09 16:51:22 +00:00
parent 43fb40739d
commit 40ffe0ef06
9 changed files with 38 additions and 38 deletions
+5 -5
View File
@@ -55,8 +55,8 @@ if ( isset( $_POST['deletepost'] ) ) {
$sendback = wp_get_referer();
if ( ! $sendback ||
strpos( $sendback, 'post.php' ) !== false ||
strpos( $sendback, 'post-new.php' ) !== false ) {
false !== strpos( $sendback, 'post.php' ) ||
false !== strpos( $sendback, 'post-new.php' ) ) {
if ( 'attachment' == $post_type ) {
$sendback = admin_url( 'upload.php' );
} else {
@@ -160,7 +160,7 @@ switch ( $action ) {
$submenu_file = 'upload.php';
$post_new_file = 'media-new.php';
} else {
if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) {
if ( isset( $post_type_object ) && $post_type_object->show_in_menu && true !== $post_type_object->show_in_menu ) {
$parent_file = $post_type_object->show_in_menu;
} else {
$parent_file = "edit.php?post_type=$post_type";
@@ -179,7 +179,7 @@ switch ( $action ) {
* @param bool $replace Whether to replace the editor. Default false.
* @param WP_Post $post Post object.
*/
if ( apply_filters( 'replace_editor', false, $post ) === true ) {
if ( true === apply_filters( 'replace_editor', false, $post ) ) {
break;
}
@@ -309,7 +309,7 @@ switch ( $action ) {
wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
}
if ( $post->post_type == 'attachment' ) {
if ( 'attachment' === $post->post_type ) {
$force = ( ! MEDIA_TRASH );
if ( ! wp_delete_attachment( $post_id, $force ) ) {
wp_die( __( 'Error in deleting.' ) );