From 30d6eb32c6e4e3310c3ba95ebbc08dd1f948aee1 Mon Sep 17 00:00:00 2001 From: nacin Date: Fri, 19 Mar 2010 21:29:21 +0000 Subject: [PATCH] Remove redundant isset() and empty() checks. git-svn-id: http://svn.automattic.com/wordpress/trunk@13770 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-comments.php | 4 ++-- wp-admin/edit-link-categories.php | 2 +- wp-admin/edit-tags.php | 2 +- wp-admin/edit.php | 2 +- wp-admin/includes/class-wp-filesystem-ftpext.php | 2 +- wp-admin/includes/class-wp-filesystem-ftpsockets.php | 2 +- wp-admin/includes/class-wp-filesystem-ssh2.php | 2 +- wp-admin/includes/plugin.php | 5 ++--- wp-admin/install.php | 2 +- wp-admin/link-manager.php | 2 +- wp-admin/menu-header.php | 6 +++--- wp-admin/upload.php | 2 +- wp-content/themes/default/archive.php | 2 +- wp-content/themes/default/sidebar.php | 2 +- wp-includes/kses.php | 2 +- wp-includes/load.php | 2 +- wp-includes/post-template.php | 2 +- wp-includes/post.php | 2 +- wp-includes/query.php | 2 +- wp-includes/widgets.php | 2 +- 20 files changed, 24 insertions(+), 25 deletions(-) diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index a3c6e2bc3e..c89af54eb0 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -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')) ) diff --git a/wp-admin/edit-link-categories.php b/wp-admin/edit-link-categories.php index 5759880f91..cf6caa3b36 100644 --- a/wp-admin/edit-link-categories.php +++ b/wp-admin/edit-link-categories.php @@ -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; } diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index 4c29a707dd..65642881d6 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -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; } diff --git a/wp-admin/edit.php b/wp-admin/edit.php index dee7727692..2db1998474 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -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; } diff --git a/wp-admin/includes/class-wp-filesystem-ftpext.php b/wp-admin/includes/class-wp-filesystem-ftpext.php index a5866b7204..4dff80b3e4 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpext.php +++ b/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -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. diff --git a/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/wp-admin/includes/class-wp-filesystem-ftpsockets.php index c38bb295dd..efd19d1f6f 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpsockets.php +++ b/wp-admin/includes/class-wp-filesystem-ftpsockets.php @@ -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. diff --git a/wp-admin/includes/class-wp-filesystem-ssh2.php b/wp-admin/includes/class-wp-filesystem-ssh2.php index a3f5660a1e..f5a64021cd 100644 --- a/wp-admin/includes/class-wp-filesystem-ssh2.php +++ b/wp-admin/includes/class-wp-filesystem-ssh2.php @@ -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. diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 901aa8e371..87b727fa3e 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -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] ) && diff --git a/wp-admin/install.php b/wp-admin/install.php index 94509fe8ba..8b68abc019 100644 --- a/wp-admin/install.php +++ b/wp-admin/install.php @@ -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'] ) ) : ''; diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php index 90279dcb31..94b916e91c 100644 --- a/wp-admin/link-manager.php +++ b/wp-admin/link-manager.php @@ -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; } diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php index 3583514944..4ded52b32c 100644 --- a/wp-admin/menu-header.php +++ b/wp-admin/menu-header.php @@ -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 = '
'; else diff --git a/wp-admin/upload.php b/wp-admin/upload.php index ce2d1f4d99..493994f8bb 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -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; } diff --git a/wp-content/themes/default/archive.php b/wp-content/themes/default/archive.php index 70c2a8cec8..f84708488c 100644 --- a/wp-content/themes/default/archive.php +++ b/wp-content/themes/default/archive.php @@ -24,7 +24,7 @@ get_header();

Archive for

Author Archive

- +

Blog Archives

diff --git a/wp-content/themes/default/sidebar.php b/wp-content/themes/default/sidebar.php index 892d57409a..9f8990af11 100644 --- a/wp-content/themes/default/sidebar.php +++ b/wp-content/themes/default/sidebar.php @@ -42,7 +42,7 @@

You have searched the blog archives for ''. If you are unable to find anything in these search results, you can try one of these links.

- +

You are currently browsing the blog archives.

diff --git a/wp-includes/kses.php b/wp-includes/kses.php index d0f6d6c523..6a5abe2f5d 100644 --- a/wp-includes/kses.php +++ b/wp-includes/kses.php @@ -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]; diff --git a/wp-includes/load.php b/wp-includes/load.php index 1a2e91d936..06a6ad9b74 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -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']; } } diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index cd5fa5cb8a..b4189c9b9a 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -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 diff --git a/wp-includes/post.php b/wp-includes/post.php index 5313d14dc4..9a9acb03a4 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -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 diff --git a/wp-includes/query.php b/wp-includes/query.php index 9e684dfbf9..7bd75e49d3 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -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']); diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index b213519d87..259eda4d90 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -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;