Make WordPress Core

Ticket #48455: 48455.1.patch

File 48455.1.patch, 5.6 KB (added by Marcio Zebedeu, 4 years ago)

adding Yoda conditions

  • install.php

     
    386386                        $error = true;
    387387                }
    388388
    389                 if ( $error === false ) {
     389                if ( false === $error ) {
    390390                        $wpdb->show_errors();
    391391                        $result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loaded_language );
    392392                        ?>
  • media-upload.php

     
    3333$post_id = isset( $post_id ) ? (int) $post_id : 0;
    3434
    3535// Require an ID for the edit screen.
    36 if ( isset( $action ) && $action == 'edit' && ! $ID ) {
     36if ( isset( $action ) && 'edit' == $action && ! $ID ) {
    3737        wp_die(
    3838                '<h1>' . __( 'Something went wrong.' ) . '</h1>' .
    3939                '<p>' . __( 'Invalid item ID.' ) . '</p>',
     
    8181$body_id = 'media-upload';
    8282
    8383// Let the action code decide how to handle the request.
    84 if ( $tab == 'type' || $tab == 'type_url' || ! array_key_exists( $tab, media_upload_tabs() ) ) {
     84if ( 'type' == $tab || 'type_url' == $tab || ! array_key_exists( $tab, media_upload_tabs() ) ) {
    8585        /**
    8686         * Fires inside specific upload-type views in the legacy (pre-3.5.0)
    8787         * media popup based on the current tab.
  • media.php

     
    6969                if ( 'attachment' !== $att->post_type ) {
    7070                        wp_die( __( 'You attempted to edit an item that isn&#8217;t an attachment. Please go back and try again.' ) );
    7171                }
    72                 if ( $att->post_status == 'trash' ) {
     72                if ( 'trash' == $att->post_status ) {
    7373                        wp_die( __( 'You can&#8217;t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.' ) );
    7474                }
    7575
  • ms-delete-site.php

     
    4242echo '<div class="wrap">';
    4343echo '<h1>' . esc_html( $title ) . '</h1>';
    4444
    45 if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) {
     45if ( isset( $_POST['action'] ) && 'deleteblog' == $_POST['action'] && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) {
    4646        check_admin_referer( 'delete-blog' );
    4747
    4848        $hash = wp_generate_password( 20, false );
  • options.php

     
    333333
    334334foreach ( (array) $options as $option ) :
    335335        $disabled = false;
    336         if ( $option->option_name == '' ) {
     336        if ( '' == $option->option_name ) {
    337337                continue;
    338338        }
    339339        if ( is_serialized( $option->option_value ) ) {
  • post.php

     
    301301                        wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
    302302                }
    303303
    304                 if ( $post->post_type == 'attachment' ) {
     304                if ( 'attachment' == $post->post_type ) {
    305305                        $force = ( ! MEDIA_TRASH );
    306306                        if ( ! wp_delete_attachment( $post_id, $force ) ) {
    307307                                wp_die( __( 'Error in deleting.' ) );
  • update-core.php

     
    164164                echo '<p class="hint">' . sprintf(
    165165                        /* translators: %s: WordPress version. */
    166166                        __( 'You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.' ),
    167                         $update->response != 'development' ? $update->current : ''
     167                        'development' != $update->response ? $update->current : ''
    168168                ) . '</p>';
    169169        }
    170170        echo '</form>';
     
    252252                echo '</h2>';
    253253        }
    254254
    255         if ( isset( $updates[0] ) && $updates[0]->response == 'development' ) {
     255        if ( isset( $updates[0] ) && 'development' == $updates[0]->response ) {
    256256                require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    257257                $upgrader = new WP_Automatic_Updater;
    258258                if ( wp_http_supports( 'ssl' ) && $upgrader->should_update( 'core', $updates[0], ABSPATH ) ) {
     
    688688$upgrade_error = false;
    689689if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) )
    690690        && ! isset( $_POST['checked'] ) ) {
    691         $upgrade_error = $action == 'do-theme-upgrade' ? 'themes' : 'plugins';
     691        $upgrade_error = 'do-theme-upgrade' == $action ? 'themes' : 'plugins';
    692692        $action        = 'upgrade-core';
    693693}
    694694
     
    739739        <?php
    740740        if ( $upgrade_error ) {
    741741                echo '<div class="error"><p>';
    742                 if ( $upgrade_error == 'themes' ) {
     742                if ( 'themes' == $upgrade_error ) {
    743743                        _e( 'Please select one or more themes to update.' );
    744744                } else {
    745745                        _e( 'Please select one or more plugins to update.' );
  • user-new.php

     
    6363        $redirect       = 'user-new.php';
    6464        $username       = $user_details->user_login;
    6565        $user_id        = $user_details->ID;
    66         if ( $username != null && array_key_exists( $blog_id, get_blogs_of_user( $user_id ) ) ) {
     66        if ( null != $username && array_key_exists( $blog_id, get_blogs_of_user( $user_id ) ) ) {
    6767                $redirect = add_query_arg( array( 'update' => 'addexisting' ), 'user-new.php' );
    6868        } else {
    6969                if ( isset( $_POST['noconfirmation'] ) && current_user_can( 'manage_network_users' ) ) {