Remove redundant isset() and empty() checks.

git-svn-id: http://svn.automattic.com/wordpress/trunk@13770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-03-19 21:29:21 +00:00
parent 8c8bf5039f
commit 30d6eb32c6
20 changed files with 24 additions and 25 deletions

View File

@ -95,7 +95,7 @@ if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_R
wp_redirect( $redirect_to );
exit;
} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
} elseif ( ! empty($_GET['_wp_http_referer']) ) {
wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
exit;
}
@ -107,7 +107,7 @@ else
require_once('admin-header.php');
$mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : esc_attr($_GET['mode']);
$mode = ( empty($_GET['mode']) ) ? 'detail' : esc_attr($_GET['mode']);
$comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all';
if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam', 'trash')) )

View File

@ -40,7 +40,7 @@ if ( isset($_GET['action']) && isset($_GET['delete']) ) {
wp_redirect($location);
exit();
}
} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
} elseif ( ! empty($_GET['_wp_http_referer']) ) {
wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
exit;
}

View File

@ -155,7 +155,7 @@ break;
default:
if ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
if ( ! empty($_GET['_wp_http_referer']) ) {
wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
exit;
}

View File

@ -132,7 +132,7 @@ if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delet
wp_redirect($sendback);
exit();
} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
} elseif ( ! empty($_GET['_wp_http_referer']) ) {
wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
exit;
}

View File

@ -45,7 +45,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
else
$this->options['hostname'] = $opt['hostname'];
if ( isset($opt['base']) && ! empty($opt['base']) )
if ( ! empty($opt['base']) )
$this->wp_base = $opt['base'];
// Check if the options provided are OK.

View File

@ -39,7 +39,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
else
$this->options['hostname'] = $opt['hostname'];
if ( isset($opt['base']) && ! empty($opt['base']) )
if ( ! empty($opt['base']) )
$this->wp_base = $opt['base'];
// Check if the options provided are OK.

View File

@ -73,7 +73,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
else
$this->options['hostname'] = $opt['hostname'];
if ( isset($opt['base']) && ! empty($opt['base']) )
if ( ! empty($opt['base']) )
$this->wp_base = $opt['base'];
// Check if the options provided are OK.

View File

@ -1243,9 +1243,8 @@ function get_admin_page_title() {
global $pagenow;
global $plugin_page;
if ( isset( $title ) && !empty ( $title ) ) {
if ( ! empty ( $title ) )
return $title;
}
$hook = get_plugin_page_hook( $plugin_page, $pagenow );
@ -1290,7 +1289,7 @@ function get_admin_page_title() {
}
}
}
if ( !isset($title) || empty ( $title ) ) {
if ( empty ( $title ) ) {
foreach ( $menu as $menu_array ) {
if ( isset( $plugin_page ) &&
($plugin_page == $menu_array[2] ) &&

View File

@ -79,7 +79,7 @@ function display_setup_form( $error = null ) {
// Ensure that Blogs appear in search engines by default
$blog_public = 1;
if ( isset( $_POST ) && ! empty( $_POST ) )
if ( ! empty( $_POST ) )
$blog_public = isset( $_POST['blog_public'] );
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( stripslashes( $_POST['weblog_title'] ) ) : '';

View File

@ -28,7 +28,7 @@ if ( isset($_GET['action']) && isset($_GET['linkcheck']) ) {
wp_safe_redirect( wp_get_referer() );
exit;
}
} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
} elseif ( ! empty($_GET['_wp_http_referer']) ) {
wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
exit;
}

View File

@ -54,14 +54,14 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$class[] = 'current';
}
if ( isset($item[4]) && ! empty($item[4]) )
if ( ! empty($item[4]) )
$class[] = $item[4];
$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
$tabindex = ' tabindex="1"';
$id = isset($item[5]) && ! empty($item[5]) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
$id = ! empty($item[5]) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
$img = '';
if ( isset($item[6]) && ! empty($item[6]) ) {
if ( ! empty($item[6]) ) {
if ( 'div' === $item[6] )
$img = '<br />';
else

View File

@ -117,7 +117,7 @@ if ( isset($_GET['find_detached']) ) {
wp_redirect($location);
exit;
} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
} elseif ( ! empty($_GET['_wp_http_referer']) ) {
wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
exit;
}

View File

@ -24,7 +24,7 @@ get_header();
<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h2 class="pagetitle">Author Archive</h2>
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<?php /* If this is a paged archive */ } elseif ( !empty($_GET['paged']) ) { ?>
<h2 class="pagetitle">Blog Archives</h2>
<?php } ?>

View File

@ -42,7 +42,7 @@
<p>You have searched the <a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a> blog archives
for <strong>'<?php the_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
<?php /* If this set is paginated */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<?php /* If this set is paginated */ } elseif ( !empty($_GET['paged']) ) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a> blog archives.</p>
<?php } ?>

View File

@ -951,7 +951,7 @@ function wp_kses_bad_protocol_once2($matches) {
global $_kses_allowed_protocols;
if ( is_array($matches) ) {
if ( ! isset($matches[1]) || empty($matches[1]) )
if ( empty($matches[1]) )
return '';
$string = $matches[1];

View File

@ -62,7 +62,7 @@ function wp_fix_server_vars() {
}
// Append the query string if it exists and isn't null
if ( isset( $_SERVER['QUERY_STRING'] ) && !empty( $_SERVER['QUERY_STRING'] ) ) {
if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
}
}

View File

@ -828,7 +828,7 @@ function wp_page_menu( $args = array() ) {
$list_args = $args;
// Show Home in the menu
if ( isset($args['show_home']) && ! empty($args['show_home']) ) {
if ( ! empty($args['show_home']) ) {
if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
$text = __('Home');
else

View File

@ -2078,7 +2078,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
// Create a valid post name. Drafts and pending posts are allowed to have an empty
// post name.
if ( !isset($post_name) || empty($post_name) ) {
if ( empty($post_name) ) {
if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
$post_name = sanitize_title($post_title);
else

View File

@ -2234,7 +2234,7 @@ class WP_Query {
if ( ! empty($q['meta_key']) )
$where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s ", $q['meta_key']);
if ( ! empty($q['meta_value']) ) {
if ( ! isset($q['meta_compare']) || empty($q['meta_compare']) || ! in_array($q['meta_compare'], array('=', '!=', '>', '>=', '<', '<=')) )
if ( empty($q['meta_compare']) || ! in_array($q['meta_compare'], array('=', '!=', '>', '>=', '<', '<=')) )
$q['meta_compare'] = '=';
$where .= $wpdb->prepare("AND $wpdb->postmeta.meta_value {$q['meta_compare']} %s ", $q['meta_value']);

View File

@ -966,7 +966,7 @@ function is_dynamic_sidebar() {
function is_active_sidebar( $index ) {
$index = ( is_int($index) ) ? "sidebar-$index" : sanitize_title($index);
$sidebars_widgets = wp_get_sidebars_widgets();
if ( isset($sidebars_widgets[$index]) && !empty($sidebars_widgets[$index]) )
if ( !empty($sidebars_widgets[$index]) )
return true;
return false;