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:
parent
8c8bf5039f
commit
30d6eb32c6
|
@ -95,7 +95,7 @@ if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_R
|
||||||
|
|
||||||
wp_redirect( $redirect_to );
|
wp_redirect( $redirect_to );
|
||||||
exit;
|
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']) ) );
|
wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ else
|
||||||
|
|
||||||
require_once('admin-header.php');
|
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';
|
$comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all';
|
||||||
if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam', 'trash')) )
|
if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam', 'trash')) )
|
||||||
|
|
|
@ -40,7 +40,7 @@ if ( isset($_GET['action']) && isset($_GET['delete']) ) {
|
||||||
wp_redirect($location);
|
wp_redirect($location);
|
||||||
exit();
|
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']) ) );
|
wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ break;
|
||||||
|
|
||||||
default:
|
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']) ) );
|
wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delet
|
||||||
|
|
||||||
wp_redirect($sendback);
|
wp_redirect($sendback);
|
||||||
exit();
|
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']) ) );
|
wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||||
else
|
else
|
||||||
$this->options['hostname'] = $opt['hostname'];
|
$this->options['hostname'] = $opt['hostname'];
|
||||||
|
|
||||||
if ( isset($opt['base']) && ! empty($opt['base']) )
|
if ( ! empty($opt['base']) )
|
||||||
$this->wp_base = $opt['base'];
|
$this->wp_base = $opt['base'];
|
||||||
|
|
||||||
// Check if the options provided are OK.
|
// Check if the options provided are OK.
|
||||||
|
|
|
@ -39,7 +39,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||||
else
|
else
|
||||||
$this->options['hostname'] = $opt['hostname'];
|
$this->options['hostname'] = $opt['hostname'];
|
||||||
|
|
||||||
if ( isset($opt['base']) && ! empty($opt['base']) )
|
if ( ! empty($opt['base']) )
|
||||||
$this->wp_base = $opt['base'];
|
$this->wp_base = $opt['base'];
|
||||||
|
|
||||||
// Check if the options provided are OK.
|
// Check if the options provided are OK.
|
||||||
|
|
|
@ -73,7 +73,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
|
||||||
else
|
else
|
||||||
$this->options['hostname'] = $opt['hostname'];
|
$this->options['hostname'] = $opt['hostname'];
|
||||||
|
|
||||||
if ( isset($opt['base']) && ! empty($opt['base']) )
|
if ( ! empty($opt['base']) )
|
||||||
$this->wp_base = $opt['base'];
|
$this->wp_base = $opt['base'];
|
||||||
|
|
||||||
// Check if the options provided are OK.
|
// Check if the options provided are OK.
|
||||||
|
|
|
@ -1243,9 +1243,8 @@ function get_admin_page_title() {
|
||||||
global $pagenow;
|
global $pagenow;
|
||||||
global $plugin_page;
|
global $plugin_page;
|
||||||
|
|
||||||
if ( isset( $title ) && !empty ( $title ) ) {
|
if ( ! empty ( $title ) )
|
||||||
return $title;
|
return $title;
|
||||||
}
|
|
||||||
|
|
||||||
$hook = get_plugin_page_hook( $plugin_page, $pagenow );
|
$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 ) {
|
foreach ( $menu as $menu_array ) {
|
||||||
if ( isset( $plugin_page ) &&
|
if ( isset( $plugin_page ) &&
|
||||||
($plugin_page == $menu_array[2] ) &&
|
($plugin_page == $menu_array[2] ) &&
|
||||||
|
|
|
@ -79,7 +79,7 @@ function display_setup_form( $error = 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;
|
||||||
if ( isset( $_POST ) && ! empty( $_POST ) )
|
if ( ! empty( $_POST ) )
|
||||||
$blog_public = isset( $_POST['blog_public'] );
|
$blog_public = isset( $_POST['blog_public'] );
|
||||||
|
|
||||||
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( stripslashes( $_POST['weblog_title'] ) ) : '';
|
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( stripslashes( $_POST['weblog_title'] ) ) : '';
|
||||||
|
|
|
@ -28,7 +28,7 @@ if ( isset($_GET['action']) && isset($_GET['linkcheck']) ) {
|
||||||
wp_safe_redirect( wp_get_referer() );
|
wp_safe_redirect( wp_get_referer() );
|
||||||
exit;
|
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']) ) );
|
wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,14 +54,14 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
||||||
$class[] = 'current';
|
$class[] = 'current';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset($item[4]) && ! empty($item[4]) )
|
if ( ! empty($item[4]) )
|
||||||
$class[] = $item[4];
|
$class[] = $item[4];
|
||||||
|
|
||||||
$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
|
$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
|
||||||
$tabindex = ' tabindex="1"';
|
$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 = '';
|
$img = '';
|
||||||
if ( isset($item[6]) && ! empty($item[6]) ) {
|
if ( ! empty($item[6]) ) {
|
||||||
if ( 'div' === $item[6] )
|
if ( 'div' === $item[6] )
|
||||||
$img = '<br />';
|
$img = '<br />';
|
||||||
else
|
else
|
||||||
|
|
|
@ -117,7 +117,7 @@ if ( isset($_GET['find_detached']) ) {
|
||||||
|
|
||||||
wp_redirect($location);
|
wp_redirect($location);
|
||||||
exit;
|
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']) ) );
|
wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ get_header();
|
||||||
<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
|
<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
|
||||||
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
|
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
|
||||||
<h2 class="pagetitle">Author Archive</h2>
|
<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>
|
<h2 class="pagetitle">Blog Archives</h2>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<p>You have searched the <a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a> blog archives
|
<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>
|
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>
|
<p>You are currently browsing the <a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a> blog archives.</p>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
|
@ -951,7 +951,7 @@ function wp_kses_bad_protocol_once2($matches) {
|
||||||
global $_kses_allowed_protocols;
|
global $_kses_allowed_protocols;
|
||||||
|
|
||||||
if ( is_array($matches) ) {
|
if ( is_array($matches) ) {
|
||||||
if ( ! isset($matches[1]) || empty($matches[1]) )
|
if ( empty($matches[1]) )
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
$string = $matches[1];
|
$string = $matches[1];
|
||||||
|
|
|
@ -62,7 +62,7 @@ function wp_fix_server_vars() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append the query string if it exists and isn't null
|
// 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'];
|
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -828,7 +828,7 @@ function wp_page_menu( $args = array() ) {
|
||||||
$list_args = $args;
|
$list_args = $args;
|
||||||
|
|
||||||
// Show Home in the menu
|
// 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'] )
|
if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
|
||||||
$text = __('Home');
|
$text = __('Home');
|
||||||
else
|
else
|
||||||
|
|
|
@ -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
|
// Create a valid post name. Drafts and pending posts are allowed to have an empty
|
||||||
// post name.
|
// post name.
|
||||||
if ( !isset($post_name) || empty($post_name) ) {
|
if ( empty($post_name) ) {
|
||||||
if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
|
if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
|
||||||
$post_name = sanitize_title($post_title);
|
$post_name = sanitize_title($post_title);
|
||||||
else
|
else
|
||||||
|
|
|
@ -2234,7 +2234,7 @@ class WP_Query {
|
||||||
if ( ! empty($q['meta_key']) )
|
if ( ! empty($q['meta_key']) )
|
||||||
$where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s ", $q['meta_key']);
|
$where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s ", $q['meta_key']);
|
||||||
if ( ! empty($q['meta_value']) ) {
|
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'] = '=';
|
$q['meta_compare'] = '=';
|
||||||
|
|
||||||
$where .= $wpdb->prepare("AND $wpdb->postmeta.meta_value {$q['meta_compare']} %s ", $q['meta_value']);
|
$where .= $wpdb->prepare("AND $wpdb->postmeta.meta_value {$q['meta_compare']} %s ", $q['meta_value']);
|
||||||
|
|
|
@ -966,7 +966,7 @@ function is_dynamic_sidebar() {
|
||||||
function is_active_sidebar( $index ) {
|
function is_active_sidebar( $index ) {
|
||||||
$index = ( is_int($index) ) ? "sidebar-$index" : sanitize_title($index);
|
$index = ( is_int($index) ) ? "sidebar-$index" : sanitize_title($index);
|
||||||
$sidebars_widgets = wp_get_sidebars_widgets();
|
$sidebars_widgets = wp_get_sidebars_widgets();
|
||||||
if ( isset($sidebars_widgets[$index]) && !empty($sidebars_widgets[$index]) )
|
if ( !empty($sidebars_widgets[$index]) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue