Remove unnecessary ternary operators such as (expr) ? true : false.
git-svn-id: https://develop.svn.wordpress.org/trunk@13769 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2bcc218df8
commit
ddc506f01c
@ -866,7 +866,7 @@ class WP_Import {
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
check_admin_referer('import-wordpress');
|
check_admin_referer('import-wordpress');
|
||||||
$fetch_attachments = (!empty($_POST['attachments'])) ? true : false;
|
$fetch_attachments = ! empty( $_POST['attachments'] );
|
||||||
$result = $this->import( $_GET['id'], $fetch_attachments);
|
$result = $this->import( $_GET['id'], $fetch_attachments);
|
||||||
if ( is_wp_error( $result ) )
|
if ( is_wp_error( $result ) )
|
||||||
echo $result->get_error_message();
|
echo $result->get_error_message();
|
||||||
|
@ -1191,7 +1191,7 @@ function get_media_item( $attachment_id, $args = null ) {
|
|||||||
$display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
|
$display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
|
||||||
$display_title = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60 ) . "</span></div>" : '';
|
$display_title = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60 ) . "</span></div>" : '';
|
||||||
|
|
||||||
$gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) ) ? true : false;
|
$gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) );
|
||||||
$order = '';
|
$order = '';
|
||||||
|
|
||||||
foreach ( $form_fields as $key => $val ) {
|
foreach ( $form_fields as $key => $val ) {
|
||||||
|
@ -92,7 +92,7 @@ function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
|
|||||||
_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' ) );
|
_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' ) );
|
||||||
$plugin_data['Network'] = $plugin_data['_sitewide'];
|
$plugin_data['Network'] = $plugin_data['_sitewide'];
|
||||||
}
|
}
|
||||||
$plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) ) ? true : false;
|
$plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) );
|
||||||
unset( $plugin_data['_sitewide'] );
|
unset( $plugin_data['_sitewide'] );
|
||||||
|
|
||||||
//For backward compatibility by default Title is the same as Name.
|
//For backward compatibility by default Title is the same as Name.
|
||||||
|
@ -1457,7 +1457,7 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
|
|||||||
$mce_buttons_4 = apply_filters('mce_buttons_4', array());
|
$mce_buttons_4 = apply_filters('mce_buttons_4', array());
|
||||||
$mce_buttons_4 = implode($mce_buttons_4, ',');
|
$mce_buttons_4 = implode($mce_buttons_4, ',');
|
||||||
}
|
}
|
||||||
$no_captions = ( apply_filters( 'disable_captions', '' ) ) ? true : false;
|
$no_captions = (bool) apply_filters( 'disable_captions', '' );
|
||||||
|
|
||||||
// TinyMCE init settings
|
// TinyMCE init settings
|
||||||
$initArray = array (
|
$initArray = array (
|
||||||
|
@ -2463,7 +2463,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
|
|||||||
global $wp_locale, $post, $comment;
|
global $wp_locale, $post, $comment;
|
||||||
|
|
||||||
if ( $for_post )
|
if ( $for_post )
|
||||||
$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;
|
$edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
|
||||||
|
|
||||||
$tab_index_attribute = '';
|
$tab_index_attribute = '';
|
||||||
if ( (int) $tab_index > 0 )
|
if ( (int) $tab_index > 0 )
|
||||||
|
@ -563,7 +563,7 @@ function upgrade_110() {
|
|||||||
// Check if we already set the GMT fields (if we did, then
|
// Check if we already set the GMT fields (if we did, then
|
||||||
// MAX(post_date_gmt) can't be '0000-00-00 00:00:00'
|
// MAX(post_date_gmt) can't be '0000-00-00 00:00:00'
|
||||||
// <michel_v> I just slapped myself silly for not thinking about it earlier
|
// <michel_v> I just slapped myself silly for not thinking about it earlier
|
||||||
$got_gmt_fields = ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $wpdb->posts") == '0000-00-00 00:00:00') ? false : true;
|
$got_gmt_fields = ! ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $wpdb->posts") == '0000-00-00 00:00:00');
|
||||||
|
|
||||||
if (!$got_gmt_fields) {
|
if (!$got_gmt_fields) {
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ function display_header() {
|
|||||||
*/
|
*/
|
||||||
function display_setup_form( $error = null ) {
|
function display_setup_form( $error = null ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$user_table = ( $wpdb->get_var("SHOW TABLES LIKE '$wpdb->users'") != null ) ? true : false;
|
$user_table = ( $wpdb->get_var("SHOW TABLES LIKE '$wpdb->users'") != null );
|
||||||
|
|
||||||
// Ensure that Blogs appear in search engines by default
|
// Ensure that Blogs appear in search engines by default
|
||||||
$blog_public = 1;
|
$blog_public = 1;
|
||||||
|
@ -412,7 +412,7 @@ EOD;
|
|||||||
array_push($post_category, $cat->term_id);
|
array_push($post_category, $cat->term_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$publish = (isset($entry->draft) && trim($entry->draft) == 'yes') ? false : true;
|
$publish = ! ( isset( $entry->draft ) && 'yes' == trim( $entry->draft ) );
|
||||||
|
|
||||||
$cap = ($publish) ? 'publish_posts' : 'edit_posts';
|
$cap = ($publish) ? 'publish_posts' : 'edit_posts';
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ EOD;
|
|||||||
if ( !current_user_can('edit_post', $entry['ID']) )
|
if ( !current_user_can('edit_post', $entry['ID']) )
|
||||||
$this->auth_required(__('Sorry, you do not have the right to edit this post.'));
|
$this->auth_required(__('Sorry, you do not have the right to edit this post.'));
|
||||||
|
|
||||||
$publish = (isset($parsed->draft) && trim($parsed->draft) == 'yes') ? false : true;
|
$publish = ! ( isset($parsed->draft) && 'yes' == trim($parsed->draft) );
|
||||||
$post_status = ($publish) ? 'publish' : 'draft';
|
$post_status = ($publish) ? 'publish' : 'draft';
|
||||||
|
|
||||||
extract($entry);
|
extract($entry);
|
||||||
|
@ -1418,7 +1418,7 @@ function wp_list_comments($args = array(), $comments = null ) {
|
|||||||
if ( empty($overridden_cpage) ) {
|
if ( empty($overridden_cpage) ) {
|
||||||
$r['page'] = get_query_var('cpage');
|
$r['page'] = get_query_var('cpage');
|
||||||
} else {
|
} else {
|
||||||
$threaded = ( -1 == $r['max_depth'] ) ? false : true;
|
$threaded = ( -1 != $r['max_depth'] );
|
||||||
$r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($_comments, $r['per_page'], $threaded) : 1;
|
$r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($_comments, $r['per_page'], $threaded) : 1;
|
||||||
set_query_var( 'cpage', $r['page'] );
|
set_query_var( 'cpage', $r['page'] );
|
||||||
}
|
}
|
||||||
@ -1429,7 +1429,7 @@ function wp_list_comments($args = array(), $comments = null ) {
|
|||||||
$r['page'] = 1;
|
$r['page'] = 1;
|
||||||
|
|
||||||
if ( null === $r['reverse_top_level'] )
|
if ( null === $r['reverse_top_level'] )
|
||||||
$r['reverse_top_level'] = ( 'desc' == get_option('comment_order') ) ? TRUE : FALSE;
|
$r['reverse_top_level'] = ( 'desc' == get_option('comment_order') );
|
||||||
|
|
||||||
extract( $r, EXTR_SKIP );
|
extract( $r, EXTR_SKIP );
|
||||||
|
|
||||||
|
@ -3829,13 +3829,13 @@ function wp_timezone_choice( $selected_zone ) {
|
|||||||
|
|
||||||
// This determines what gets set and translated - we don't translate Etc/* strings here, they are done later
|
// This determines what gets set and translated - we don't translate Etc/* strings here, they are done later
|
||||||
$exists = array(
|
$exists = array(
|
||||||
0 => ( isset( $zone[0] ) && $zone[0] ) ? true : false,
|
0 => ( isset( $zone[0] ) && $zone[0] ),
|
||||||
1 => ( isset( $zone[1] ) && $zone[1] ) ? true : false,
|
1 => ( isset( $zone[1] ) && $zone[1] ),
|
||||||
2 => ( isset( $zone[2] ) && $zone[2] ) ? true : false
|
2 => ( isset( $zone[2] ) && $zone[2] ),
|
||||||
);
|
);
|
||||||
$exists[3] = ( $exists[0] && 'Etc' !== $zone[0] ) ? true : false;
|
$exists[3] = ( $exists[0] && 'Etc' !== $zone[0] );
|
||||||
$exists[4] = ( $exists[1] && $exists[3] ) ? true : false;
|
$exists[4] = ( $exists[1] && $exists[3] );
|
||||||
$exists[5] = ( $exists[2] && $exists[3] ) ? true : false;
|
$exists[5] = ( $exists[2] && $exists[3] );
|
||||||
|
|
||||||
$zonen[] = array(
|
$zonen[] = array(
|
||||||
'continent' => ( $exists[0] ? $zone[0] : '' ),
|
'continent' => ( $exists[0] ? $zone[0] : '' ),
|
||||||
|
@ -1116,7 +1116,7 @@ class WP_Embed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use oEmbed to get the HTML
|
// Use oEmbed to get the HTML
|
||||||
$attr['discover'] = ( apply_filters('embed_oembed_discover', false) && author_can( $post_ID, 'unfiltered_html' ) ) ? true : false;
|
$attr['discover'] = ( apply_filters('embed_oembed_discover', false) && author_can( $post_ID, 'unfiltered_html' ) );
|
||||||
$html = wp_oembed_get( $url, $attr );
|
$html = wp_oembed_get( $url, $attr );
|
||||||
|
|
||||||
// Cache the result
|
// Cache the result
|
||||||
|
@ -684,7 +684,7 @@ function wp_set_auth_cookie($user_id, $remember = false, $secure = '') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( '' === $secure )
|
if ( '' === $secure )
|
||||||
$secure = is_ssl() ? true : false;
|
$secure = is_ssl();
|
||||||
|
|
||||||
if ( $secure ) {
|
if ( $secure ) {
|
||||||
$auth_cookie_name = SECURE_AUTH_COOKIE;
|
$auth_cookie_name = SECURE_AUTH_COOKIE;
|
||||||
@ -777,10 +777,7 @@ if ( !function_exists('auth_redirect') ) :
|
|||||||
function auth_redirect() {
|
function auth_redirect() {
|
||||||
// Checks if a user is logged in, if not redirects them to the login page
|
// Checks if a user is logged in, if not redirects them to the login page
|
||||||
|
|
||||||
if ( is_ssl() || force_ssl_admin() )
|
$secure = ( is_ssl() || force_ssl_admin() );
|
||||||
$secure = true;
|
|
||||||
else
|
|
||||||
$secure = false;
|
|
||||||
|
|
||||||
// If https is required and request is http, redirect
|
// If https is required and request is http, redirect
|
||||||
if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
|
if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
|
||||||
|
@ -1958,7 +1958,7 @@ class WP_Rewrite {
|
|||||||
unset($this->search_structure);
|
unset($this->search_structure);
|
||||||
unset($this->feed_structure);
|
unset($this->feed_structure);
|
||||||
unset($this->comment_feed_structure);
|
unset($this->comment_feed_structure);
|
||||||
$this->use_trailing_slashes = ( substr($this->permalink_structure, -1, 1) == '/' ) ? true : false;
|
$this->use_trailing_slashes = ( '/' == substr($this->permalink_structure, -1, 1) );
|
||||||
|
|
||||||
// Enable generic rules for pages if permalink structure doesn't begin with a wildcard.
|
// Enable generic rules for pages if permalink structure doesn't begin with a wildcard.
|
||||||
if ( preg_match("/^[^%]*%(?:postname|category|tag|author)%/", $this->permalink_structure) )
|
if ( preg_match("/^[^%]*%(?:postname|category|tag|author)%/", $this->permalink_structure) )
|
||||||
|
@ -41,7 +41,7 @@ function wp_signon( $credentials = '', $secure_cookie = '' ) {
|
|||||||
do_action_ref_array('wp_authenticate', array(&$credentials['user_login'], &$credentials['user_password']));
|
do_action_ref_array('wp_authenticate', array(&$credentials['user_login'], &$credentials['user_password']));
|
||||||
|
|
||||||
if ( '' === $secure_cookie )
|
if ( '' === $secure_cookie )
|
||||||
$secure_cookie = is_ssl() ? true : false;
|
$secure_cookie = is_ssl();
|
||||||
|
|
||||||
global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
|
global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
|
||||||
$auth_secure_cookie = $secure_cookie;
|
$auth_secure_cookie = $secure_cookie;
|
||||||
|
Loading…
Reference in New Issue
Block a user