<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[13769] trunk: Remove unnecessary ternary operators such as (expr) ? true :
false.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13769">13769</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-03-19 21:15:00 +0000 (Fri, 19 Mar 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Remove unnecessary ternary operators such as (expr) ? true : false.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminimportwordpressphp">trunk/wp-admin/import/wordpress.php</a></li>
<li><a href="#trunkwpadminincludesmediaphp">trunk/wp-admin/includes/media.php</a></li>
<li><a href="#trunkwpadminincludespluginphp">trunk/wp-admin/includes/plugin.php</a></li>
<li><a href="#trunkwpadminincludespostphp">trunk/wp-admin/includes/post.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminincludesupgradephp">trunk/wp-admin/includes/upgrade.php</a></li>
<li><a href="#trunkwpadmininstallphp">trunk/wp-admin/install.php</a></li>
<li><a href="#trunkwpappphp">trunk/wp-app.php</a></li>
<li><a href="#trunkwpincludescommenttemplatephp">trunk/wp-includes/comment-template.php</a></li>
<li><a href="#trunkwpincludesfunctionsphp">trunk/wp-includes/functions.php</a></li>
<li><a href="#trunkwpincludesmediaphp">trunk/wp-includes/media.php</a></li>
<li><a href="#trunkwpincludespluggablephp">trunk/wp-includes/pluggable.php</a></li>
<li><a href="#trunkwpincludesrewritephp">trunk/wp-includes/rewrite.php</a></li>
<li><a href="#trunkwpincludesuserphp">trunk/wp-includes/user.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminimportwordpressphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/import/wordpress.php (13768 => 13769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/import/wordpress.php        2010-03-19 20:48:59 UTC (rev 13768)
+++ trunk/wp-admin/import/wordpress.php        2010-03-19 21:15:00 UTC (rev 13769)
</span><span class="lines">@@ -866,7 +866,7 @@
</span><span class="cx">                                 break;
</span><span class="cx">                         case 2:
</span><span class="cx">                                 check_admin_referer('import-wordpress');
</span><del>-                                $fetch_attachments = (!empty($_POST['attachments'])) ? true : false;
</del><ins>+                                $fetch_attachments = ! empty( $_POST['attachments'] );
</ins><span class="cx">                                 $result = $this->import( $_GET['id'], $fetch_attachments);
</span><span class="cx">                                 if ( is_wp_error( $result ) )
</span><span class="cx">                                         echo $result->get_error_message();
</span></span></pre></div>
<a id="trunkwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/media.php (13768 => 13769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/media.php        2010-03-19 20:48:59 UTC (rev 13768)
+++ trunk/wp-admin/includes/media.php        2010-03-19 21:15:00 UTC (rev 13769)
</span><span class="lines">@@ -1191,7 +1191,7 @@
</span><span class="cx">         $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
</span><span class="cx">         $display_title = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60 ) . "</span></div>" : '';
</span><span class="cx">
</span><del>-        $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) ) ? true : false;
</del><ins>+        $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) );
</ins><span class="cx">         $order = '';
</span><span class="cx">
</span><span class="cx">         foreach ( $form_fields as $key => $val ) {
</span></span></pre></div>
<a id="trunkwpadminincludespluginphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/plugin.php (13768 => 13769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/plugin.php        2010-03-19 20:48:59 UTC (rev 13768)
+++ trunk/wp-admin/includes/plugin.php        2010-03-19 21:15:00 UTC (rev 13769)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx">                 _deprecated_argument( __FUNCTION__, '3.0', sprintf( __( 'The <code>%1$s</code> plugin header is deprecated. Use <code>%2$s</code> instead.' ), 'Site Wide Only: true', 'Network: true' ) );
</span><span class="cx">                 $plugin_data['Network'] = $plugin_data['_sitewide'];
</span><span class="cx">         }
</span><del>-        $plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) ) ? true : false;
</del><ins>+        $plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) );
</ins><span class="cx">         unset( $plugin_data['_sitewide'] );
</span><span class="cx">
</span><span class="cx">         //For backward compatibility by default Title is the same as Name.
</span></span></pre></div>
<a id="trunkwpadminincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/post.php (13768 => 13769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/post.php        2010-03-19 20:48:59 UTC (rev 13768)
+++ trunk/wp-admin/includes/post.php        2010-03-19 21:15:00 UTC (rev 13769)
</span><span class="lines">@@ -1457,7 +1457,7 @@
</span><span class="cx">                 $mce_buttons_4 = apply_filters('mce_buttons_4', array());
</span><span class="cx">                 $mce_buttons_4 = implode($mce_buttons_4, ',');
</span><span class="cx">         }
</span><del>-        $no_captions = ( apply_filters( 'disable_captions', '' ) ) ? true : false;
</del><ins>+        $no_captions = (bool) apply_filters( 'disable_captions', '' );
</ins><span class="cx">
</span><span class="cx">         // TinyMCE init settings
</span><span class="cx">         $initArray = array (
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (13768 => 13769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-03-19 20:48:59 UTC (rev 13768)
+++ trunk/wp-admin/includes/template.php        2010-03-19 21:15:00 UTC (rev 13769)
</span><span class="lines">@@ -2463,7 +2463,7 @@
</span><span class="cx">         global $wp_locale, $post, $comment;
</span><span class="cx">
</span><span class="cx">         if ( $for_post )
</span><del>-                $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;
</del><ins>+                $edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
</ins><span class="cx">
</span><span class="cx">         $tab_index_attribute = '';
</span><span class="cx">         if ( (int) $tab_index > 0 )
</span></span></pre></div>
<a id="trunkwpadminincludesupgradephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/upgrade.php (13768 => 13769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/upgrade.php        2010-03-19 20:48:59 UTC (rev 13768)
+++ trunk/wp-admin/includes/upgrade.php        2010-03-19 21:15:00 UTC (rev 13769)
</span><span class="lines">@@ -563,7 +563,7 @@
</span><span class="cx">         // Check if we already set the GMT fields (if we did, then
</span><span class="cx">         // MAX(post_date_gmt) can't be '0000-00-00 00:00:00'
</span><span class="cx">         // <michel_v> I just slapped myself silly for not thinking about it earlier
</span><del>-        $got_gmt_fields = ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $wpdb->posts") == '0000-00-00 00:00:00') ? false : true;
</del><ins>+        $got_gmt_fields = ! ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $wpdb->posts") == '0000-00-00 00:00:00');
</ins><span class="cx">
</span><span class="cx">         if (!$got_gmt_fields) {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadmininstallphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/install.php (13768 => 13769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/install.php        2010-03-19 20:48:59 UTC (rev 13768)
+++ trunk/wp-admin/install.php        2010-03-19 21:15:00 UTC (rev 13769)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> */
</span><span class="cx"> function display_setup_form( $error = null ) {
</span><span class="cx">         global $wpdb;
</span><del>-        $user_table = ( $wpdb->get_var("SHOW TABLES LIKE '$wpdb->users'") != null ) ? true : false;
</del><ins>+        $user_table = ( $wpdb->get_var("SHOW TABLES LIKE '$wpdb->users'") != null );
</ins><span class="cx">
</span><span class="cx">         // Ensure that Blogs appear in search engines by default
</span><span class="cx">         $blog_public = 1;
</span></span></pre></div>
<a id="trunkwpappphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-app.php (13768 => 13769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-app.php        2010-03-19 20:48:59 UTC (rev 13768)
+++ trunk/wp-app.php        2010-03-19 21:15:00 UTC (rev 13769)
</span><span class="lines">@@ -412,7 +412,7 @@
</span><span class="cx">                                 array_push($post_category, $cat->term_id);
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $publish = (isset($entry->draft) && trim($entry->draft) == 'yes') ? false : true;
</del><ins>+                $publish = ! ( isset( $entry->draft ) && 'yes' == trim( $entry->draft ) );
</ins><span class="cx">
</span><span class="cx">                 $cap = ($publish) ? 'publish_posts' : 'edit_posts';
</span><span class="cx">
</span><span class="lines">@@ -505,7 +505,7 @@
</span><span class="cx">                 if ( !current_user_can('edit_post', $entry['ID']) )
</span><span class="cx">                         $this->auth_required(__('Sorry, you do not have the right to edit this post.'));
</span><span class="cx">
</span><del>-                $publish = (isset($parsed->draft) && trim($parsed->draft) == 'yes') ? false : true;
</del><ins>+                $publish = ! ( isset($parsed->draft) && 'yes' == trim($parsed->draft) );
</ins><span class="cx">                 $post_status = ($publish) ? 'publish' : 'draft';
</span><span class="cx">
</span><span class="cx">                 extract($entry);
</span></span></pre></div>
<a id="trunkwpincludescommenttemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/comment-template.php (13768 => 13769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/comment-template.php        2010-03-19 20:48:59 UTC (rev 13768)
+++ trunk/wp-includes/comment-template.php        2010-03-19 21:15:00 UTC (rev 13769)
</span><span class="lines">@@ -1418,7 +1418,7 @@
</span><span class="cx">                 if ( empty($overridden_cpage) ) {
</span><span class="cx">                         $r['page'] = get_query_var('cpage');
</span><span class="cx">                 } else {
</span><del>-                        $threaded = ( -1 == $r['max_depth'] ) ? false : true;
</del><ins>+                        $threaded = ( -1 != $r['max_depth'] );
</ins><span class="cx">                         $r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($_comments, $r['per_page'], $threaded) : 1;
</span><span class="cx">                         set_query_var( 'cpage', $r['page'] );
</span><span class="cx">                 }
</span><span class="lines">@@ -1429,7 +1429,7 @@
</span><span class="cx">                 $r['page'] = 1;
</span><span class="cx">
</span><span class="cx">         if ( null === $r['reverse_top_level'] )
</span><del>-                $r['reverse_top_level'] = ( 'desc' == get_option('comment_order') ) ? TRUE : FALSE;
</del><ins>+                $r['reverse_top_level'] = ( 'desc' == get_option('comment_order') );
</ins><span class="cx">
</span><span class="cx">         extract( $r, EXTR_SKIP );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpincludesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.php (13768 => 13769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.php        2010-03-19 20:48:59 UTC (rev 13768)
+++ trunk/wp-includes/functions.php        2010-03-19 21:15:00 UTC (rev 13769)
</span><span class="lines">@@ -3829,13 +3829,13 @@
</span><span class="cx">
</span><span class="cx">                 // This determines what gets set and translated - we don't translate Etc/* strings here, they are done later
</span><span class="cx">                 $exists = array(
</span><del>-                        0 => ( isset( $zone[0] ) && $zone[0] ) ? true : false,
-                        1 => ( isset( $zone[1] ) && $zone[1] ) ? true : false,
-                        2 => ( isset( $zone[2] ) && $zone[2] ) ? true : false
</del><ins>+                        0 => ( isset( $zone[0] ) && $zone[0] ),
+                        1 => ( isset( $zone[1] ) && $zone[1] ),
+                        2 => ( isset( $zone[2] ) && $zone[2] ),
</ins><span class="cx">                 );
</span><del>-                $exists[3] = ( $exists[0] && 'Etc' !== $zone[0] ) ? true : false;
-                $exists[4] = ( $exists[1] && $exists[3] ) ? true : false;
-                $exists[5] = ( $exists[2] && $exists[3] ) ? true : false;
</del><ins>+                $exists[3] = ( $exists[0] && 'Etc' !== $zone[0] );
+                $exists[4] = ( $exists[1] && $exists[3] );
+                $exists[5] = ( $exists[2] && $exists[3] );
</ins><span class="cx">
</span><span class="cx">                 $zonen[] = array(
</span><span class="cx">                         'continent' => ( $exists[0] ? $zone[0] : '' ),
</span></span></pre></div>
<a id="trunkwpincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/media.php (13768 => 13769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/media.php        2010-03-19 20:48:59 UTC (rev 13768)
+++ trunk/wp-includes/media.php        2010-03-19 21:15:00 UTC (rev 13769)
</span><span class="lines">@@ -1116,7 +1116,7 @@
</span><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         // Use oEmbed to get the HTML
</span><del>-                        $attr['discover'] = ( apply_filters('embed_oembed_discover', false) && author_can( $post_ID, 'unfiltered_html' ) ) ? true : false;
</del><ins>+                        $attr['discover'] = ( apply_filters('embed_oembed_discover', false) && author_can( $post_ID, 'unfiltered_html' ) );
</ins><span class="cx">                         $html = wp_oembed_get( $url, $attr );
</span><span class="cx">
</span><span class="cx">                         // Cache the result
</span></span></pre></div>
<a id="trunkwpincludespluggablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/pluggable.php (13768 => 13769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/pluggable.php        2010-03-19 20:48:59 UTC (rev 13768)
+++ trunk/wp-includes/pluggable.php        2010-03-19 21:15:00 UTC (rev 13769)
</span><span class="lines">@@ -684,7 +684,7 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( '' === $secure )
</span><del>-                $secure = is_ssl() ? true : false;
</del><ins>+                $secure = is_ssl();
</ins><span class="cx">
</span><span class="cx">         if ( $secure ) {
</span><span class="cx">                 $auth_cookie_name = SECURE_AUTH_COOKIE;
</span><span class="lines">@@ -777,10 +777,7 @@
</span><span class="cx"> function auth_redirect() {
</span><span class="cx">         // Checks if a user is logged in, if not redirects them to the login page
</span><span class="cx">
</span><del>-        if ( is_ssl() || force_ssl_admin() )
-                $secure = true;
-        else
-                $secure = false;
</del><ins>+        $secure = ( is_ssl() || force_ssl_admin() );
</ins><span class="cx">
</span><span class="cx">         // If https is required and request is http, redirect
</span><span class="cx">         if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
</span></span></pre></div>
<a id="trunkwpincludesrewritephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/rewrite.php (13768 => 13769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/rewrite.php        2010-03-19 20:48:59 UTC (rev 13768)
+++ trunk/wp-includes/rewrite.php        2010-03-19 21:15:00 UTC (rev 13769)
</span><span class="lines">@@ -1958,7 +1958,7 @@
</span><span class="cx">                 unset($this->search_structure);
</span><span class="cx">                 unset($this->feed_structure);
</span><span class="cx">                 unset($this->comment_feed_structure);
</span><del>-                $this->use_trailing_slashes = ( substr($this->permalink_structure, -1, 1) == '/' ) ? true : false;
</del><ins>+                $this->use_trailing_slashes = ( '/' == substr($this->permalink_structure, -1, 1) );
</ins><span class="cx">
</span><span class="cx">                 // Enable generic rules for pages if permalink structure doesn't begin with a wildcard.
</span><span class="cx">                 if ( preg_match("/^[^%]*%(?:postname|category|tag|author)%/", $this->permalink_structure) )
</span></span></pre></div>
<a id="trunkwpincludesuserphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/user.php (13768 => 13769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/user.php        2010-03-19 20:48:59 UTC (rev 13768)
+++ trunk/wp-includes/user.php        2010-03-19 21:15:00 UTC (rev 13769)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx">         do_action_ref_array('wp_authenticate', array(&$credentials['user_login'], &$credentials['user_password']));
</span><span class="cx">
</span><span class="cx">         if ( '' === $secure_cookie )
</span><del>-                $secure_cookie = is_ssl() ? true : false;
</del><ins>+                $secure_cookie = is_ssl();
</ins><span class="cx">
</span><span class="cx">         global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
</span><span class="cx">         $auth_secure_cookie = $secure_cookie;
</span></span></pre>
</div>
</div>
</body>
</html>