Make WordPress Core

Changeset 13769


Ignore:
Timestamp:
03/19/2010 09:15:00 PM (15 years ago)
Author:
nacin
Message:

Remove unnecessary ternary operators such as (expr) ? true : false.

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/import/wordpress.php

    r13735 r13769  
    867867            case 2:
    868868                check_admin_referer('import-wordpress');
    869                 $fetch_attachments = (!empty($_POST['attachments'])) ? true : false;
     869                $fetch_attachments = ! empty( $_POST['attachments'] );
    870870                $result = $this->import( $_GET['id'], $fetch_attachments);
    871871                if ( is_wp_error( $result ) )
  • trunk/wp-admin/includes/media.php

    r13661 r13769  
    11921192    $display_title = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60 ) . "</span></div>" : '';
    11931193
    1194     $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) ) ? true : false;
     1194    $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) );
    11951195    $order = '';
    11961196
  • trunk/wp-admin/includes/plugin.php

    r13749 r13769  
    9393        $plugin_data['Network'] = $plugin_data['_sitewide'];
    9494    }
    95     $plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) ) ? true : false;
     95    $plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) );
    9696    unset( $plugin_data['_sitewide'] );
    9797
  • trunk/wp-admin/includes/post.php

    r13733 r13769  
    14581458        $mce_buttons_4 = implode($mce_buttons_4, ',');
    14591459    }
    1460     $no_captions = ( apply_filters( 'disable_captions', '' ) ) ? true : false;
     1460    $no_captions = (bool) apply_filters( 'disable_captions', '' );
    14611461
    14621462    // TinyMCE init settings
  • trunk/wp-admin/includes/template.php

    r13759 r13769  
    24642464
    24652465    if ( $for_post )
    2466         $edit = ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) ) ? false : true;
     2466        $edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
    24672467
    24682468    $tab_index_attribute = '';
  • trunk/wp-admin/includes/upgrade.php

    r13733 r13769  
    564564    // MAX(post_date_gmt) can't be '0000-00-00 00:00:00'
    565565    // <michel_v> I just slapped myself silly for not thinking about it earlier
    566     $got_gmt_fields = ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $wpdb->posts") == '0000-00-00 00:00:00') ? false : true;
     566    $got_gmt_fields = ! ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $wpdb->posts") == '0000-00-00 00:00:00');
    567567
    568568    if (!$got_gmt_fields) {
  • trunk/wp-admin/install.php

    r13696 r13769  
    7676function display_setup_form( $error = null ) {
    7777    global $wpdb;
    78     $user_table = ( $wpdb->get_var("SHOW TABLES LIKE '$wpdb->users'") != null ) ? true : false;
     78    $user_table = ( $wpdb->get_var("SHOW TABLES LIKE '$wpdb->users'") != null );
    7979
    8080    // Ensure that Blogs appear in search engines by default
  • trunk/wp-app.php

    r13427 r13769  
    413413        }
    414414
    415         $publish = (isset($entry->draft) && trim($entry->draft) == 'yes') ? false : true;
     415        $publish = ! ( isset( $entry->draft ) && 'yes' == trim( $entry->draft ) );
    416416
    417417        $cap = ($publish) ? 'publish_posts' : 'edit_posts';
     
    506506            $this->auth_required(__('Sorry, you do not have the right to edit this post.'));
    507507
    508         $publish = (isset($parsed->draft) && trim($parsed->draft) == 'yes') ? false : true;
     508        $publish = ! ( isset($parsed->draft) && 'yes' == trim($parsed->draft) );
    509509        $post_status = ($publish) ? 'publish' : 'draft';
    510510
  • trunk/wp-includes/comment-template.php

    r13396 r13769  
    14191419            $r['page'] = get_query_var('cpage');
    14201420        } else {
    1421             $threaded = ( -1 == $r['max_depth'] ) ? false : true;
     1421            $threaded = ( -1 != $r['max_depth'] );
    14221422            $r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($_comments, $r['per_page'], $threaded) : 1;
    14231423            set_query_var( 'cpage', $r['page'] );
     
    14301430
    14311431    if ( null === $r['reverse_top_level'] )
    1432         $r['reverse_top_level'] = ( 'desc' == get_option('comment_order') ) ? TRUE : FALSE;
     1432        $r['reverse_top_level'] = ( 'desc' == get_option('comment_order') );
    14331433
    14341434    extract( $r, EXTR_SKIP );
  • trunk/wp-includes/functions.php

    r13733 r13769  
    38303830        // This determines what gets set and translated - we don't translate Etc/* strings here, they are done later
    38313831        $exists = array(
    3832             0 => ( isset( $zone[0] ) && $zone[0] ) ? true : false,
    3833             1 => ( isset( $zone[1] ) && $zone[1] ) ? true : false,
    3834             2 => ( isset( $zone[2] ) && $zone[2] ) ? true : false
     3832            0 => ( isset( $zone[0] ) && $zone[0] ),
     3833            1 => ( isset( $zone[1] ) && $zone[1] ),
     3834            2 => ( isset( $zone[2] ) && $zone[2] ),
    38353835        );
    3836         $exists[3] = ( $exists[0] && 'Etc' !== $zone[0] ) ? true : false;
    3837         $exists[4] = ( $exists[1] && $exists[3] ) ? true : false;
    3838         $exists[5] = ( $exists[2] && $exists[3] ) ? true : false;
     3836        $exists[3] = ( $exists[0] && 'Etc' !== $zone[0] );
     3837        $exists[4] = ( $exists[1] && $exists[3] );
     3838        $exists[5] = ( $exists[2] && $exists[3] );
    38393839
    38403840        $zonen[] = array(
  • trunk/wp-includes/media.php

    r13382 r13769  
    11171117
    11181118            // Use oEmbed to get the HTML
    1119             $attr['discover'] = ( apply_filters('embed_oembed_discover', false) && author_can( $post_ID, 'unfiltered_html' ) ) ? true : false;
     1119            $attr['discover'] = ( apply_filters('embed_oembed_discover', false) && author_can( $post_ID, 'unfiltered_html' ) );
    11201120            $html = wp_oembed_get( $url, $attr );
    11211121
  • trunk/wp-includes/pluggable.php

    r13733 r13769  
    685685
    686686    if ( '' === $secure )
    687         $secure = is_ssl() ? true : false;
     687        $secure = is_ssl();
    688688
    689689    if ( $secure ) {
     
    778778    // Checks if a user is logged in, if not redirects them to the login page
    779779
    780     if ( is_ssl() || force_ssl_admin() )
    781         $secure = true;
    782     else
    783         $secure = false;
     780    $secure = ( is_ssl() || force_ssl_admin() );
    784781
    785782    // If https is required and request is http, redirect
  • trunk/wp-includes/rewrite.php

    r13733 r13769  
    19591959        unset($this->feed_structure);
    19601960        unset($this->comment_feed_structure);
    1961         $this->use_trailing_slashes = ( substr($this->permalink_structure, -1, 1) == '/' ) ? true : false;
     1961        $this->use_trailing_slashes = ( '/' == substr($this->permalink_structure, -1, 1) );
    19621962
    19631963        // Enable generic rules for pages if permalink structure doesn't begin with a wildcard.
  • trunk/wp-includes/user.php

    r13761 r13769  
    4242
    4343    if ( '' === $secure_cookie )
    44         $secure_cookie = is_ssl() ? true : false;
     44        $secure_cookie = is_ssl();
    4545
    4646    global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
Note: See TracChangeset for help on using the changeset viewer.