From 60b0cd7943b9150b5f69e3ebc9fd06828b9f1e75 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 8 Jan 2015 07:05:25 +0000 Subject: [PATCH] The keyword `elseif` should be used instead of `else if` so that all control keywords look like single words. This was a mess, is now standardized across the codebase, except for a few 3rd-party libs. See #30799. Built from https://develop.svn.wordpress.org/trunk@31090 git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin.php | 9 +++---- wp-admin/edit-tags.php | 2 +- wp-admin/export.php | 4 ++-- wp-admin/includes/ajax-actions.php | 12 ++++++---- .../includes/class-wp-comments-list-table.php | 5 ++-- wp-admin/includes/class-wp-importer.php | 4 ++-- wp-admin/includes/class-wp-upgrader-skins.php | 15 ++++++------ wp-admin/includes/class-wp-upgrader.php | 4 ++-- wp-admin/includes/export.php | 2 +- wp-admin/includes/file.php | 12 +++++----- wp-admin/includes/media.php | 8 +++---- wp-admin/includes/meta-boxes.php | 6 ++--- wp-admin/includes/ms.php | 5 ++-- wp-admin/includes/plugin-install.php | 2 +- wp-admin/includes/plugin.php | 4 ++-- wp-admin/includes/taxonomy.php | 10 ++++---- wp-admin/includes/template.php | 2 +- wp-admin/includes/theme.php | 2 +- wp-admin/includes/update.php | 16 ++++++------- wp-admin/includes/upgrade.php | 16 ++++++------- wp-admin/install.php | 2 +- wp-admin/menu-header.php | 2 +- wp-admin/options-permalink.php | 7 +++--- wp-comments-post.php | 2 +- wp-includes/bookmark.php | 11 +++++---- wp-includes/class-http.php | 18 +++++++------- wp-includes/class-wp-xmlrpc-server.php | 14 ++++++----- wp-includes/class-wp.php | 10 ++++---- wp-includes/comment-template.php | 2 +- wp-includes/comment.php | 6 ++--- wp-includes/date.php | 24 +++++++++---------- wp-includes/deprecated.php | 2 +- wp-includes/formatting.php | 4 ++-- wp-includes/functions.php | 8 +++---- wp-includes/l10n.php | 2 +- wp-includes/load.php | 4 ++-- wp-includes/media.php | 8 +++---- wp-includes/meta.php | 16 ++++++------- wp-includes/nav-menu.php | 2 +- wp-includes/plugin.php | 4 ++-- wp-includes/post-template.php | 4 ++-- wp-includes/post.php | 6 ++--- wp-includes/query.php | 12 +++++----- wp-includes/rewrite.php | 6 ++--- wp-includes/template.php | 2 +- wp-includes/user.php | 14 +++++------ wp-includes/version.php | 2 +- wp-includes/wp-db.php | 10 ++++---- wp-login.php | 9 +++---- 49 files changed, 182 insertions(+), 171 deletions(-) diff --git a/wp-admin/admin.php b/wp-admin/admin.php index 793dc511f6..77d6d44913 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -167,12 +167,13 @@ if ( isset($plugin_page) ) { } $hook_suffix = ''; -if ( isset($page_hook) ) +if ( isset( $page_hook ) ) { $hook_suffix = $page_hook; -else if ( isset($plugin_page) ) +} elseif ( isset( $plugin_page ) ) { $hook_suffix = $plugin_page; -else if ( isset($pagenow) ) +} elseif ( isset( $pagenow ) ) { $hook_suffix = $pagenow; +} set_current_screen(); @@ -243,7 +244,7 @@ if ( isset($plugin_page) ) { include(ABSPATH . 'wp-admin/admin-footer.php'); exit(); -} else if (isset($_GET['import'])) { +} elseif ( isset( $_GET['import'] ) ) { $importer = $_GET['import']; diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index 64371c512d..aebb08ec96 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -28,7 +28,7 @@ $title = $tax->labels->name; if ( 'post' != $post_type ) { $parent_file = ( 'attachment' == $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type"; $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type"; -} else if ( 'link_category' == $tax->name ) { +} elseif ( 'link_category' == $tax->name ) { $parent_file = 'link-manager.php'; $submenu_file = 'edit-tags.php?taxonomy=link_category'; } else { diff --git a/wp-admin/export.php b/wp-admin/export.php index b92c0eccea..0df62a80e4 100644 --- a/wp-admin/export.php +++ b/wp-admin/export.php @@ -60,7 +60,7 @@ if ( isset( $_GET['download'] ) ) { if ( ! isset( $_GET['content'] ) || 'all' == $_GET['content'] ) { $args['content'] = 'all'; - } else if ( 'posts' == $_GET['content'] ) { + } elseif ( 'posts' == $_GET['content'] ) { $args['content'] = 'post'; if ( $_GET['cat'] ) @@ -76,7 +76,7 @@ if ( isset( $_GET['download'] ) ) { if ( $_GET['post_status'] ) $args['status'] = $_GET['post_status']; - } else if ( 'pages' == $_GET['content'] ) { + } elseif ( 'pages' == $_GET['content'] ) { $args['content'] = 'page'; if ( $_GET['page_author'] ) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index b9f13807c6..7af476ea4f 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -422,10 +422,11 @@ function _wp_ajax_add_hierarchical_term() { continue; if ( !$cat_id = term_exists( $cat_name, $taxonomy->name, $parent ) ) $cat_id = wp_insert_term( $cat_name, $taxonomy->name, array( 'parent' => $parent ) ); - if ( is_wp_error( $cat_id ) ) + if ( is_wp_error( $cat_id ) ) { continue; - else if ( is_array( $cat_id ) ) + } elseif ( is_array( $cat_id ) ) { $cat_id = $cat_id['term_id']; + } $checked_categories[] = $cat_id; if ( $parent ) // Do these all at once in a second continue; @@ -741,10 +742,11 @@ function wp_ajax_add_link_category( $action ) { continue; if ( !$cat_id = term_exists( $cat_name, 'link_category' ) ) $cat_id = wp_insert_term( $cat_name, 'link_category' ); - if ( is_wp_error( $cat_id ) ) + if ( is_wp_error( $cat_id ) ) { continue; - else if ( is_array( $cat_id ) ) + } elseif ( is_array( $cat_id ) ) { $cat_id = $cat_id['term_id']; + } $cat_name = esc_html( $cat_name ); $x->add( array( 'what' => 'link-category', @@ -1174,7 +1176,7 @@ function wp_ajax_add_meta() { } else { wp_die( 0 ); } - } else if ( !$mid = add_meta( $pid ) ) { + } elseif ( ! $mid = add_meta( $pid ) ) { wp_die( __( 'Please provide a custom field value.' ) ); } diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index 73e5c82418..cd5d289e9f 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/wp-admin/includes/class-wp-comments-list-table.php @@ -447,10 +447,11 @@ class WP_Comments_List_Table extends WP_List_Table { // Not looking at all comments. if ( $comment_status && 'all' != $comment_status ) { - if ( 'approved' == $the_comment_status ) + if ( 'approved' == $the_comment_status ) { $actions['unapprove'] = "" . __( 'Unapprove' ) . ''; - else if ( 'unapproved' == $the_comment_status ) + } elseif ( 'unapproved' == $the_comment_status ) { $actions['approve'] = "" . __( 'Approve' ) . ''; + } } else { $actions['approve'] = "" . __( 'Approve' ) . ''; $actions['unapprove'] = "" . __( 'Unapprove' ) . ''; diff --git a/wp-admin/includes/class-wp-importer.php b/wp-admin/includes/class-wp-importer.php index b54573f675..0831993da3 100644 --- a/wp-admin/includes/class-wp-importer.php +++ b/wp-admin/includes/class-wp-importer.php @@ -273,14 +273,14 @@ function get_cli_args( $param, $required = false ) { } $last_arg = $key; - } else if ( (bool) preg_match( "/^-([a-zA-Z0-9]+)/", $args[$i], $match ) ) { + } elseif ( (bool) preg_match( "/^-([a-zA-Z0-9]+)/", $args[$i], $match ) ) { for ( $j = 0, $jl = strlen( $match[1] ); $j < $jl; $j++ ) { $key = $match[1]{$j}; $out[$key] = true; } $last_arg = $key; - } else if ( $last_arg !== null ) { + } elseif ( $last_arg !== null ) { $out[$last_arg] = $args[$i]; } } diff --git a/wp-admin/includes/class-wp-upgrader-skins.php b/wp-admin/includes/class-wp-upgrader-skins.php index 7d40373952..f8f5f5acde 100644 --- a/wp-admin/includes/class-wp-upgrader-skins.php +++ b/wp-admin/includes/class-wp-upgrader-skins.php @@ -447,12 +447,13 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin { unset( $install_actions['activate_plugin'] ); } - if ( 'import' == $from ) + if ( 'import' == $from ) { $install_actions['importers_page'] = '' . __('Return to Importers') . ''; - else if ( $this->type == 'web' ) + } elseif ( $this->type == 'web' ) { $install_actions['plugins_page'] = '' . __('Return to Plugin Installer') . ''; - else + } else { $install_actions['plugins_page'] = '' . __('Return to Plugins page') . ''; + } if ( ! $this->result || is_wp_error($this->result) ) { unset( $install_actions['activate_plugin'], $install_actions['network_activate'] ); @@ -731,13 +732,13 @@ class Automatic_Upgrader_Skin extends WP_Upgrader_Skin { * @param string|array|WP_Error $data */ public function feedback( $data ) { - if ( is_wp_error( $data ) ) + if ( is_wp_error( $data ) ) { $string = $data->get_error_message(); - else if ( is_array( $data ) ) + } elseif ( is_array( $data ) ) { return; - else + } else { $string = $data; - + } if ( ! empty( $this->upgrader->strings[ $string ] ) ) $string = $this->upgrader->strings[ $string ]; diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 0f1ca8b96c..8ee665a9df 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -431,7 +431,7 @@ class WP_Upgrader { if ( is_wp_error($removed) ) { return $removed; - } else if ( ! $removed ) { + } elseif ( ! $removed ) { return new WP_Error('remove_old_failed', $this->strings['remove_old_failed']); } } elseif ( $args['abort_if_destination_exists'] && $wp_filesystem->exists($remote_destination) ) { @@ -637,7 +637,7 @@ class WP_Upgrader { $maintenance_string = ''; $wp_filesystem->delete($file); $wp_filesystem->put_contents($file, $maintenance_string, FS_CHMOD_FILE); - } else if ( !$enable && $wp_filesystem->exists($file) ) { + } elseif ( ! $enable && $wp_filesystem->exists( $file ) ) { $this->skin->feedback('maintenance_end'); $wp_filesystem->delete($file); } diff --git a/wp-admin/includes/export.php b/wp-admin/includes/export.php index 1ffc1d349d..cd50e61bb1 100644 --- a/wp-admin/includes/export.php +++ b/wp-admin/includes/export.php @@ -95,7 +95,7 @@ function export_wp( $args = array() ) { $cat = get_term( $term['term_id'], 'category' ); $cats = array( $cat->term_id => $cat ); unset( $term, $cat ); - } else if ( 'all' == $args['content'] ) { + } elseif ( 'all' == $args['content'] ) { $categories = (array) get_categories( array( 'get' => 'all' ) ); $tags = (array) get_tags( array( 'get' => 'all' ) ); diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 6b3facac5f..14fa194ede 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -929,7 +929,7 @@ function get_filesystem_method( $args = array(), $context = false, $allow_relaxe // this means it's safe to modify & create new files via PHP. $method = 'direct'; $GLOBALS['_wp_filesystem_direct_method'] = 'file_owner'; - } else if ( $allow_relaxed_file_ownership ) { + } elseif ( $allow_relaxed_file_ownership ) { // The $context directory is writable, and $allow_relaxed_file_ownership is set, this means we can modify files // safely in this directory. This mode doesn't create new files, only alter existing ones. $method = 'direct'; @@ -1038,15 +1038,15 @@ function request_filesystem_credentials($form_post, $type = '', $error = false, unset($credentials['port']); } - if ( ( defined('FTP_SSH') && FTP_SSH ) || ( defined('FS_METHOD') && 'ssh2' == FS_METHOD ) ) + if ( ( defined( 'FTP_SSH' ) && FTP_SSH ) || ( defined( 'FS_METHOD' ) && 'ssh2' == FS_METHOD ) ) { $credentials['connection_type'] = 'ssh'; - else if ( (defined('FTP_SSL') && FTP_SSL) && 'ftpext' == $type ) //Only the FTP Extension understands SSL + } elseif ( ( defined( 'FTP_SSL' ) && FTP_SSL ) && 'ftpext' == $type ) { //Only the FTP Extension understands SSL $credentials['connection_type'] = 'ftps'; - else if ( !empty($_POST['connection_type']) ) + } elseif ( ! empty( $_POST['connection_type'] ) ) { $credentials['connection_type'] = wp_unslash( $_POST['connection_type'] ); - else if ( !isset($credentials['connection_type']) ) //All else fails (And it's not defaulted to something else saved), Default to FTP + } elseif ( ! isset( $credentials['connection_type'] ) ) { //All else fails (And it's not defaulted to something else saved), Default to FTP $credentials['connection_type'] = 'ftp'; - + } if ( ! $error && ( ( !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) || diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index a539466ae2..599bff8862 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -293,17 +293,17 @@ function media_handle_upload($file_id, $post_id, $post_data = array(), $override if ( ! empty( $meta['album'] ) && ! empty( $meta['artist'] ) ) { /* translators: 1: audio track title, 2: album title, 3: artist name */ $content .= sprintf( __( '"%1$s" from %2$s by %3$s.' ), $title, $meta['album'], $meta['artist'] ); - } else if ( ! empty( $meta['album'] ) ) { + } elseif ( ! empty( $meta['album'] ) ) { /* translators: 1: audio track title, 2: album title */ $content .= sprintf( __( '"%1$s" from %2$s.' ), $title, $meta['album'] ); - } else if ( ! empty( $meta['artist'] ) ) { + } elseif ( ! empty( $meta['artist'] ) ) { /* translators: 1: audio track title, 2: artist name */ $content .= sprintf( __( '"%1$s" by %2$s.' ), $title, $meta['artist'] ); } else { $content .= sprintf( __( '"%s".' ), $title ); } - } else if ( ! empty( $meta['album'] ) ) { + } elseif ( ! empty( $meta['album'] ) ) { if ( ! empty( $meta['artist'] ) ) { /* translators: 1: audio album title, 2: artist name */ @@ -312,7 +312,7 @@ function media_handle_upload($file_id, $post_id, $post_data = array(), $override $content .= $meta['album'] . '.'; } - } else if ( ! empty( $meta['artist'] ) ) { + } elseif ( ! empty( $meta['artist'] ) ) { $content .= $meta['artist'] . '.'; diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 6b1f3b18ab..dac1c5a179 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -166,11 +166,11 @@ $datef = __( 'M j, Y @ G:i' ); if ( 0 != $post->ID ) { if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date $stamp = __('Scheduled for: %1$s'); - } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published + } elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published $stamp = __('Published on: %1$s'); - } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified + } elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified $stamp = __('Publish immediately'); - } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified + } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified $stamp = __('Schedule for: %1$s'); } else { // draft, 1 or more saves, date specified $stamp = __('Publish on: %1$s'); diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index c7401506e9..6e93dbf649 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -145,10 +145,11 @@ function wpmu_delete_blog( $blog_id, $drop = false ) { if ( $file == '.' || $file == '..' ) continue; - if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) ) + if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) ) { $stack[] = $dir . DIRECTORY_SEPARATOR . $file; - else if ( @is_file( $dir . DIRECTORY_SEPARATOR . $file ) ) + } elseif ( @is_file( $dir . DIRECTORY_SEPARATOR . $file ) ) { @unlink( $dir . DIRECTORY_SEPARATOR . $file ); + } } @closedir( $dh ); } diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php index 3031341961..327c1387af 100644 --- a/wp-admin/includes/plugin-install.php +++ b/wp-admin/includes/plugin-install.php @@ -517,7 +517,7 @@ function install_plugin_information() { tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) { echo '

' . __('Warning: This plugin has not been tested with your current version of WordPress.') . '

'; - } else if ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) { + } elseif ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) { echo '

' . __('Warning: This plugin has not been marked as compatible with your version of WordPress.') . '

'; } diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index a357779e4b..cc15b55b79 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -1652,7 +1652,7 @@ function get_plugin_page_hookname( $plugin_page, $parent_page ) { else if ( isset( $admin_page_hooks[$parent] )) $page_type = $admin_page_hooks[$parent]; - } else if ( isset( $admin_page_hooks[$parent] ) ) { + } elseif ( isset( $admin_page_hooks[$parent] ) ) { $page_type = $admin_page_hooks[$parent]; } @@ -1713,7 +1713,7 @@ function user_can_access_admin_page() { return true; else return false; - } else if ( $submenu_array[2] == $pagenow ) { + } elseif ( $submenu_array[2] == $pagenow ) { if ( current_user_can( $submenu_array[1] )) return true; else diff --git a/wp-admin/includes/taxonomy.php b/wp-admin/includes/taxonomy.php index a4fa571b55..124c0239a3 100644 --- a/wp-admin/includes/taxonomy.php +++ b/wp-admin/includes/taxonomy.php @@ -66,12 +66,12 @@ function wp_create_category( $cat_name, $parent = 0 ) { */ function wp_create_categories( $categories, $post_id = '' ) { $cat_ids = array (); - foreach ($categories as $category) { - if ($id = category_exists($category)) + foreach ( $categories as $category ) { + if ( $id = category_exists( $category ) ) { $cat_ids[] = $id; - else - if ($id = wp_create_category($category)) - $cat_ids[] = $id; + } elseif ( $id = wp_create_category( $category ) ) { + $cat_ids[] = $id; + } } if ( $post_id ) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index f351364d14..554b720e2b 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1848,7 +1848,7 @@ function get_submit_button( $text = null, $type = 'primary large', $name = 'subm foreach ( $other_attributes as $attribute => $value ) { $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important } - } else if ( !empty( $other_attributes ) ) { // Attributes provided as a string + } elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string $attributes = $other_attributes; } diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index 8c2c678eca..b1d113225e 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -167,7 +167,7 @@ function get_theme_update_available( $theme ) { if ( ! current_user_can('update_themes') ) { $html = sprintf( '

' . __( 'There is a new version of %1$s available. View version %4$s details.' ) . '

', $theme_name, esc_url( $details_url ), esc_attr( $theme['Name'] ), $update['new_version'] ); - } else if ( empty( $update['package'] ) ) { + } elseif ( empty( $update['package'] ) ) { $html = sprintf( '

' . __( 'There is a new version of %1$s available. View version %4$s details. Automatic update is unavailable for this theme.' ) . '

', $theme_name, esc_url( $details_url ), esc_attr( $theme['Name'] ), $update['new_version'] ); } else { diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php index 502666a550..5639459547 100644 --- a/wp-admin/includes/update.php +++ b/wp-admin/includes/update.php @@ -278,13 +278,13 @@ function wp_plugin_update_row( $file, $plugin_data ) { if ( is_network_admin() || !is_multisite() ) { echo '
'; - if ( ! current_user_can('update_plugins') ) + if ( ! current_user_can( 'update_plugins' ) ) { printf( __('There is a new version of %1$s available. View version %4$s details.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version ); - else if ( empty($r->package) ) + } elseif ( empty($r->package) ) { printf( __('There is a new version of %1$s available. View version %4$s details. Automatic update is unavailable for this plugin.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version ); - else + } else { printf( __('There is a new version of %1$s available. View version %4$s details or update now.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=') . $file, 'upgrade-plugin_' . $file) ); - + } /** * Fires at the end of the update message container in each * row of the plugins list table. @@ -367,13 +367,13 @@ function wp_theme_update_row( $theme_key, $theme ) { $wp_list_table = _get_list_table('WP_MS_Themes_List_Table'); echo '
'; - if ( ! current_user_can('update_themes') ) + if ( ! current_user_can('update_themes') ) { printf( __('There is a new version of %1$s available. View version %4$s details.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r->new_version ); - else if ( empty( $r['package'] ) ) + } elseif ( empty( $r['package'] ) ) { printf( __('There is a new version of %1$s available. View version %4$s details. Automatic update is unavailable for this theme.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'] ); - else + } else { printf( __('There is a new version of %1$s available. View version %4$s details or update now.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'], wp_nonce_url( self_admin_url('update.php?action=upgrade-theme&theme=') . $theme_key, 'upgrade-theme_' . $theme_key) ); - + } /** * Fires at the end of the update message container in each * row of the themes list table. diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index e48d9de5d3..1c0f9f770f 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -74,7 +74,7 @@ function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated $user_id = wp_create_user($user_name, $user_password, $user_email); update_user_option($user_id, 'default_password_nag', true, true); $email_password = true; - } else if ( !$user_id ) { + } elseif ( ! $user_id ) { // Password has been provided $message = ''.__('Your chosen password.').''; $user_id = wp_create_user($user_name, $user_password, $user_email); @@ -840,7 +840,7 @@ function upgrade_210() { if ( 'static' == $status ) { $status = 'publish'; $type = 'page'; - } else if ( 'attachment' == $status ) { + } elseif ( 'attachment' == $status ) { $status = 'inherit'; $type = 'attachment'; } @@ -1716,14 +1716,14 @@ function dbDelta( $queries = '', $execute = true ) { // Create a tablename index for an array ($cqueries) of queries foreach($queries as $qry) { - if (preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) { + if ( preg_match( "|CREATE TABLE ([^ ]*)|", $qry, $matches ) ) { $cqueries[ trim( $matches[1], '`' ) ] = $qry; $for_update[$matches[1]] = 'Created table '.$matches[1]; - } else if (preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) { - array_unshift($cqueries, $qry); - } else if (preg_match("|INSERT INTO ([^ ]*)|", $qry, $matches)) { + } elseif ( preg_match( "|CREATE DATABASE ([^ ]*)|", $qry, $matches ) ) { + array_unshift( $cqueries, $qry ); + } elseif ( preg_match( "|INSERT INTO ([^ ]*)|", $qry, $matches ) ) { $iqueries[] = $qry; - } else if (preg_match("|UPDATE ([^ ]*)|", $qry, $matches)) { + } elseif ( preg_match( "|UPDATE ([^ ]*)|", $qry, $matches ) ) { $iqueries[] = $qry; } else { // Unrecognized query type @@ -1875,7 +1875,7 @@ function dbDelta( $queries = '', $execute = true ) { $index_string = ''; if ($index_name == 'PRIMARY') { $index_string .= 'PRIMARY '; - } else if($index_data['unique']) { + } elseif ( $index_data['unique'] ) { $index_string .= 'UNIQUE '; } $index_string .= 'KEY '; diff --git a/wp-admin/install.php b/wp-admin/install.php index 93c9d72f87..258162733f 100644 --- a/wp-admin/install.php +++ b/wp-admin/install.php @@ -254,7 +254,7 @@ switch($step) { // TODO: poka-yoke display_setup_form( __( 'Your passwords do not match. Please try again.' ) ); $error = true; - } else if ( empty( $admin_email ) ) { + } elseif ( empty( $admin_email ) ) { // TODO: poka-yoke display_setup_form( __( 'You must provide an email address.' ) ); $error = true; diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php index dea73320f0..c599fd1be8 100644 --- a/wp-admin/menu-header.php +++ b/wp-admin/menu-header.php @@ -174,7 +174,7 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) { $class[] = 'current'; // If plugin_page is set the parent must either match the current page or not physically exist. // This allows plugin pages with the same hook to exist under different parents. - } else if ( + } elseif ( ( ! isset( $plugin_page ) && $self == $sub_item[2] ) || ( isset( $plugin_page ) && $plugin_page == $sub_item[2] && ( $item[2] == $self_type || $item[2] == $self || file_exists($menu_file) === false ) ) ) { diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php index 327c0cc247..c79fa37e3c 100644 --- a/wp-admin/options-permalink.php +++ b/wp-admin/options-permalink.php @@ -151,12 +151,13 @@ if ( ! empty( $_GET['settings-updated'] ) ) : ?>

exists() ) { if ( 6 > strlen( $comment_author_email ) || '' == $comment_author ) { wp_die( __( 'ERROR: please fill the required fields (name, email).' ), 200 ); - } else if ( ! is_email( $comment_author_email ) ) { + } elseif ( ! is_email( $comment_author_email ) ) { wp_die( __( 'ERROR: please enter a valid email address.' ), 200 ); } } diff --git a/wp-includes/bookmark.php b/wp-includes/bookmark.php index 08b2129773..47f5d233ab 100644 --- a/wp-includes/bookmark.php +++ b/wp-includes/bookmark.php @@ -386,17 +386,18 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) { } else { $value = esc_attr($value); } - } else if ( 'db' == $context ) { + } elseif ( 'db' == $context ) { /** This filter is documented in wp-includes/post.php */ $value = apply_filters( "pre_$field", $value ); } else { /** This filter is documented in wp-includes/post.php */ $value = apply_filters( $field, $value, $bookmark_id, $context ); - if ( 'attribute' == $context ) - $value = esc_attr($value); - else if ( 'js' == $context ) - $value = esc_js($value); + if ( 'attribute' == $context ) { + $value = esc_attr( $value ); + } elseif ( 'js' == $context ) { + $value = esc_js( $value ); + } } return $value; diff --git a/wp-includes/class-http.php b/wp-includes/class-http.php index 8f7351de8e..a644b90640 100644 --- a/wp-includes/class-http.php +++ b/wp-includes/class-http.php @@ -893,12 +893,12 @@ class WP_Http_Streams { $r = wp_parse_args( $args, $defaults ); - if ( isset($r['headers']['User-Agent']) ) { + if ( isset( $r['headers']['User-Agent'] ) ) { $r['user-agent'] = $r['headers']['User-Agent']; - unset($r['headers']['User-Agent']); - } else if ( isset($r['headers']['user-agent']) ) { + unset( $r['headers']['User-Agent'] ); + } elseif ( isset( $r['headers']['user-agent'] ) ) { $r['user-agent'] = $r['headers']['user-agent']; - unset($r['headers']['user-agent']); + unset( $r['headers']['user-agent'] ); } // Construct Cookie: header if any cookies are set. @@ -1358,12 +1358,12 @@ class WP_Http_Curl { $r = wp_parse_args( $args, $defaults ); - if ( isset($r['headers']['User-Agent']) ) { + if ( isset( $r['headers']['User-Agent'] ) ) { $r['user-agent'] = $r['headers']['User-Agent']; - unset($r['headers']['User-Agent']); - } else if ( isset($r['headers']['user-agent']) ) { + unset( $r['headers']['User-Agent'] ); + } elseif ( isset( $r['headers']['user-agent'] ) ) { $r['user-agent'] = $r['headers']['user-agent']; - unset($r['headers']['user-agent']); + unset( $r['headers']['user-agent'] ); } // Construct Cookie: header if any cookies are set. @@ -2244,7 +2244,7 @@ class WP_Http_Encoding { if ( is_array( $headers ) ) { if ( array_key_exists('content-encoding', $headers) && ! empty( $headers['content-encoding'] ) ) return true; - } else if ( is_string( $headers ) ) { + } elseif ( is_string( $headers ) ) { return ( stripos($headers, 'content-encoding:') !== false ); } diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index f3b76363b4..779433e246 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -3211,10 +3211,11 @@ class wp_xmlrpc_server extends IXR_Server { if ( !$user ) { $logged_in = false; - if ( $allow_anon && get_option('comment_registration') ) + if ( $allow_anon && get_option('comment_registration') ) { return new IXR_Error( 403, __( 'You must be registered to comment' ) ); - else if ( !$allow_anon ) + } elseif ( ! $allow_anon ) { return $this->error; + } } else { $logged_in = true; } @@ -4873,10 +4874,11 @@ class wp_xmlrpc_server extends IXR_Server { $tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null; if ( ('publish' == $post_status) ) { - if ( ( 'page' == $post_type ) && !current_user_can('publish_pages') ) - return new IXR_Error(401, __('Sorry, you do not have the right to publish this page.')); - else if ( !current_user_can('publish_posts') ) - return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.')); + if ( ( 'page' == $post_type ) && ! current_user_can( 'publish_pages' ) ) { + return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this page.' ) ); + } elseif ( ! current_user_can( 'publish_posts' ) ) { + return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this post.' ) ); + } } if ( $post_more ) diff --git a/wp-includes/class-wp.php b/wp-includes/class-wp.php index f8b3f82753..6ac5fb4777 100644 --- a/wp-includes/class-wp.php +++ b/wp-includes/class-wp.php @@ -135,11 +135,11 @@ class WP { $this->query_vars = array(); $post_type_query_vars = array(); - if ( is_array($extra_query_vars) ) + if ( is_array( $extra_query_vars ) ) { $this->extra_query_vars = & $extra_query_vars; - else if (! empty($extra_query_vars)) - parse_str($extra_query_vars, $this->extra_query_vars); - + } elseif ( ! empty( $extra_query_vars ) ) { + parse_str( $extra_query_vars, $this->extra_query_vars ); + } // Process PATH_INFO, REQUEST_URI, and 404 for permalinks. // Fetch the rewrite rules. @@ -357,7 +357,7 @@ class WP { } elseif ( in_array( $status, array( 403, 500, 502, 503 ) ) ) { $exit_required = true; } - } else if ( empty($this->query_vars['feed']) ) { + } elseif ( empty( $this->query_vars['feed'] ) ) { $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset'); } else { // We're showing a feed, so WP is indeed the only thing that last changed diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index d00c4444cd..0a41244ea7 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -1168,7 +1168,7 @@ function comments_template( $file = '/comments.php', $separate_comments = false if ( $user_ID ) { $comment_args['include_unapproved'] = array( $user_ID ); - } else if ( ! empty( $comment_author_email ) ) { + } elseif ( ! empty( $comment_author_email ) ) { $comment_args['include_unapproved'] = array( $comment_author_email ); } diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 8b303b33d6..23663abbfe 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -506,7 +506,7 @@ class WP_Comment_Query { // Disable ORDER BY with 'none', an empty array, or boolean false. if ( in_array( $this->query_vars['orderby'], array( 'none', array(), false ), true ) ) { $orderby = ''; - } else if ( ! empty( $this->query_vars['orderby'] ) ) { + } elseif ( ! empty( $this->query_vars['orderby'] ) ) { $ordersby = is_array( $this->query_vars['orderby'] ) ? $this->query_vars['orderby'] : preg_split( '/[,\s]/', $this->query_vars['orderby'] ); @@ -2228,9 +2228,9 @@ function wp_update_comment($commentarr) { if ( ! isset( $data['comment_approved'] ) ) { $data['comment_approved'] = 1; - } else if ( 'hold' == $data['comment_approved'] ) { + } elseif ( 'hold' == $data['comment_approved'] ) { $data['comment_approved'] = 0; - } else if ( 'approve' == $data['comment_approved'] ) { + } elseif ( 'approve' == $data['comment_approved'] ) { $data['comment_approved'] = 1; } diff --git a/wp-includes/date.php b/wp-includes/date.php index b1fd0054fa..c023574ed6 100644 --- a/wp-includes/date.php +++ b/wp-includes/date.php @@ -425,7 +425,7 @@ class WP_Date_Query { $valid = false; } - } else if ( $day_exists && $month_exists ) { + } elseif ( $day_exists && $month_exists ) { /* * 2. checking day, month combination * We use 2012 because, as a leap year, it's the most permissive. @@ -607,7 +607,7 @@ class WP_Date_Query { foreach ( $query as $key => $clause ) { if ( 'relation' === $key ) { $relation = $query['relation']; - } else if ( is_array( $clause ) ) { + } elseif ( is_array( $clause ) ) { // This is a first-order clause. if ( $this->is_first_order_clause( $clause ) ) { @@ -616,7 +616,7 @@ class WP_Date_Query { $where_count = count( $clause_sql['where'] ); if ( ! $where_count ) { $sql_chunks['where'][] = ''; - } else if ( 1 === $where_count ) { + } elseif ( 1 === $where_count ) { $sql_chunks['where'][] = $clause_sql['where'][0]; } else { $sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )'; @@ -725,16 +725,16 @@ class WP_Date_Query { if ( isset( $query['year'] ) && $value = $this->build_value( $compare, $query['year'] ) ) $where_parts[] = "YEAR( $column ) $compare $value"; - if ( isset( $query['month'] ) && $value = $this->build_value( $compare, $query['month'] ) ) + if ( isset( $query['month'] ) && $value = $this->build_value( $compare, $query['month'] ) ) { $where_parts[] = "MONTH( $column ) $compare $value"; - else if ( isset( $query['monthnum'] ) && $value = $this->build_value( $compare, $query['monthnum'] ) ) + } elseif ( isset( $query['monthnum'] ) && $value = $this->build_value( $compare, $query['monthnum'] ) ) { $where_parts[] = "MONTH( $column ) $compare $value"; - - if ( isset( $query['week'] ) && false !== ( $value = $this->build_value( $compare, $query['week'] ) ) ) + } + if ( isset( $query['week'] ) && false !== ( $value = $this->build_value( $compare, $query['week'] ) ) ) { $where_parts[] = _wp_mysql_week( $column ) . " $compare $value"; - else if ( isset( $query['w'] ) && false !== ( $value = $this->build_value( $compare, $query['w'] ) ) ) + } elseif ( isset( $query['w'] ) && false !== ( $value = $this->build_value( $compare, $query['w'] ) ) ) { $where_parts[] = _wp_mysql_week( $column ) . " $compare $value"; - + } if ( isset( $query['dayofyear'] ) && $value = $this->build_value( $compare, $query['dayofyear'] ) ) $where_parts[] = "DAYOFYEAR( $column ) $compare $value"; @@ -858,14 +858,14 @@ class WP_Date_Query { 'year' => intval( $matches[1] ), ); - } else if ( preg_match( '/^(\d{4})\-(\d{2})$/', $datetime, $matches ) ) { + } elseif ( preg_match( '/^(\d{4})\-(\d{2})$/', $datetime, $matches ) ) { // Y-m $datetime = array( 'year' => intval( $matches[1] ), 'month' => intval( $matches[2] ), ); - } else if ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2})$/', $datetime, $matches ) ) { + } elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2})$/', $datetime, $matches ) ) { // Y-m-d $datetime = array( 'year' => intval( $matches[1] ), @@ -873,7 +873,7 @@ class WP_Date_Query { 'day' => intval( $matches[3] ), ); - } else if ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})$/', $datetime, $matches ) ) { + } elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})$/', $datetime, $matches ) ) { // Y-m-d H:i $datetime = array( 'year' => intval( $matches[1] ), diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index 64291cae76..c3d2e04e05 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -2396,7 +2396,7 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) { if ( !$cur ) $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') ); - else if ( $cur->meta_value != $meta_value ) + elseif ( $cur->meta_value != $meta_value ) $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') ); else return false; diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 38e8db65b1..ddeff9a1e0 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1502,7 +1502,7 @@ function force_balance_tags( $text ) { // or close to be safe $tag = '/' . $tag; } // if stacktop value = tag close value then pop - else if ( $tagstack[$stacksize - 1] == $tag ) { // found closing tag + elseif ( $tagstack[$stacksize - 1] == $tag ) { // found closing tag $tag = ''; // Close Tag // Pop array_pop( $tagstack ); @@ -2337,7 +2337,7 @@ function iso8601_to_datetime($date_string, $timezone = 'user') { return gmdate('Y-m-d H:i:s', $timestamp); - } else if ($timezone == 'user') { + } elseif ($timezone == 'user') { return preg_replace('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', '$1-$2-$3 $4:$5:$6', $date_string); } } diff --git a/wp-includes/functions.php b/wp-includes/functions.php index ea868d7284..bbc11c5f7a 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1437,7 +1437,7 @@ function wp_get_referer() { $ref = false; if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) $ref = wp_unslash( $_REQUEST['_wp_http_referer'] ); - else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) + elseif ( ! empty( $_SERVER['HTTP_REFERER'] ) ) $ref = wp_unslash( $_SERVER['HTTP_REFERER'] ); if ( $ref && $ref !== wp_unslash( $_SERVER['REQUEST_URI'] ) ) @@ -1670,11 +1670,11 @@ function wp_is_writable( $path ) { */ function win_is_writable( $path ) { - if ( $path[strlen( $path ) - 1] == '/' ) // if it looks like a directory, check a random file within the directory + if ( $path[strlen( $path ) - 1] == '/' ) { // if it looks like a directory, check a random file within the directory return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp'); - else if ( is_dir( $path ) ) // If it's a directory (and not a file) check a random file within the directory + } elseif ( is_dir( $path ) ) { // If it's a directory (and not a file) check a random file within the directory return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' ); - + } // check tmp file for read/write capabilities $should_delete_tmp_file = !file_exists( $path ); $f = @fopen( $path, 'a' ); diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index 67215452b7..fc2be882dc 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -594,7 +594,7 @@ function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path if ( false !== $plugin_rel_path ) { $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' ); - } else if ( false !== $deprecated ) { + } elseif ( false !== $deprecated ) { _deprecated_argument( __FUNCTION__, '2.7' ); $path = ABSPATH . trim( $deprecated, '/' ); } else { diff --git a/wp-includes/load.php b/wp-includes/load.php index 3c4995ed81..14f74fc863 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -59,7 +59,7 @@ function wp_fix_server_vars() { $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; } // IIS Isapi_Rewrite - else if ( isset( $_SERVER['HTTP_X_REWRITE_URL'] ) ) { + elseif ( isset( $_SERVER['HTTP_X_REWRITE_URL'] ) ) { $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; } else { // Use ORIG_PATH_INFO if there is no PATH_INFO @@ -427,7 +427,7 @@ function wp_start_object_cache() { } $first_init = true; - } else if ( ! wp_using_ext_object_cache() && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { + } elseif ( ! wp_using_ext_object_cache() && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { /* * Sometimes advanced-cache.php can load object-cache.php before * it is loaded here. This breaks the function_exists check above diff --git a/wp-includes/media.php b/wp-includes/media.php index 14428bacb3..fddeb4a758 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1984,11 +1984,11 @@ function adjacent_image_link($prev = true, $size = 'thumbnail', $text = false) { * @return array Empty array on failure. List of taxonomies on success. */ function get_attachment_taxonomies($attachment) { - if ( is_int( $attachment ) ) - $attachment = get_post($attachment); - else if ( is_array($attachment) ) + if ( is_int( $attachment ) ) { + $attachment = get_post( $attachment ); + } elseif ( is_array( $attachment ) ) { $attachment = (object) $attachment; - + } if ( ! is_object($attachment) ) return array(); diff --git a/wp-includes/meta.php b/wp-includes/meta.php index da465d064c..5e88467daa 100644 --- a/wp-includes/meta.php +++ b/wp-includes/meta.php @@ -995,11 +995,11 @@ class WP_Meta_Query { if ( 'relation' === $key ) { $relation = $query; - } else if ( ! is_array( $query ) ) { + } elseif ( ! is_array( $query ) ) { continue; // First-order clause. - } else if ( $this->is_first_order_clause( $query ) ) { + } elseif ( $this->is_first_order_clause( $query ) ) { if ( isset( $query['value'] ) && array() === $query['value'] ) { unset( $query['value'] ); } @@ -1029,7 +1029,7 @@ class WP_Meta_Query { * This value will not actually be used to join clauses, but it * simplifies the logic around combining key-only queries. */ - } else if ( 1 === count( $clean_queries ) ) { + } elseif ( 1 === count( $clean_queries ) ) { $clean_queries['relation'] = 'OR'; // Default to AND. @@ -1093,11 +1093,11 @@ class WP_Meta_Query { $primary_meta_query, $existing_meta_query, ); - } else if ( ! empty( $primary_meta_query ) ) { + } elseif ( ! empty( $primary_meta_query ) ) { $meta_query = array( $primary_meta_query, ); - } else if ( ! empty( $existing_meta_query ) ) { + } elseif ( ! empty( $existing_meta_query ) ) { $meta_query = $existing_meta_query; } @@ -1254,7 +1254,7 @@ class WP_Meta_Query { foreach ( $query as $key => &$clause ) { if ( 'relation' === $key ) { $relation = $query['relation']; - } else if ( is_array( $clause ) ) { + } elseif ( is_array( $clause ) ) { // This is a first-order clause. if ( $this->is_first_order_clause( $clause ) ) { @@ -1263,7 +1263,7 @@ class WP_Meta_Query { $where_count = count( $clause_sql['where'] ); if ( ! $where_count ) { $sql_chunks['where'][] = ''; - } else if ( 1 === $where_count ) { + } elseif ( 1 === $where_count ) { $sql_chunks['where'][] = $clause_sql['where'][0]; } else { $sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )'; @@ -1492,7 +1492,7 @@ class WP_Meta_Query { $compatible_compares = array( '=', 'IN', 'BETWEEN', 'LIKE', 'REGEXP', 'RLIKE', '>', '>=', '<', '<=' ); // Clauses joined by AND with "negative" operators share a join only if they also share a key. - } else if ( isset( $sibling['key'] ) && isset( $clause['key'] ) && $sibling['key'] === $clause['key'] ) { + } elseif ( isset( $sibling['key'] ) && isset( $clause['key'] ) && $sibling['key'] === $clause['key'] ) { $compatible_compares = array( '!=', 'NOT IN', 'NOT LIKE' ); } diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php index 602ad41eac..e0c9072040 100644 --- a/wp-includes/nav-menu.php +++ b/wp-includes/nav-menu.php @@ -806,7 +806,7 @@ function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_ 'post_type' == $menu_item_type ) { $menu_item_ids[] = (int) $menu_item->ID; - } else if ( + } elseif ( 'taxonomy' == $object_type && 'taxonomy' == $menu_item_type && get_post_meta( $menu_item->ID, '_menu_item_object', true ) == $taxonomy diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php index 06d727f313..3ec3a088d6 100644 --- a/wp-includes/plugin.php +++ b/wp-includes/plugin.php @@ -327,7 +327,7 @@ function remove_all_filters( $tag, $priority = false ) { if ( isset( $wp_filter[ $tag ]) ) { if ( false === $priority ) { $wp_filter[ $tag ] = array(); - } else if ( isset( $wp_filter[ $tag ][ $priority ] ) ) { + } elseif ( isset( $wp_filter[ $tag ][ $priority ] ) ) { $wp_filter[ $tag ][ $priority ] = array(); } } @@ -900,7 +900,7 @@ function _wp_filter_build_unique_id($tag, $function, $priority) { return $obj_idx; } - } else if ( is_string($function[0]) ) { + } elseif ( is_string( $function[0] ) ) { // Static Calling return $function[0] . '::' . $function[1]; } diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index b15b9daa46..d6dfa322a3 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -129,7 +129,7 @@ function get_the_title( $post = 0 ) { */ $protected_title_format = apply_filters( 'protected_title_format', __( 'Protected: %s' ), $post ); $title = sprintf( $protected_title_format, $title ); - } else if ( isset( $post->post_status ) && 'private' == $post->post_status ) { + } elseif ( isset( $post->post_status ) && 'private' == $post->post_status ) { /** * Filter the text prepended to the post title of private posts. @@ -566,7 +566,7 @@ function get_body_class( $class = '' ) { if ( is_array( $post_type ) ) $post_type = reset( $post_type ); $classes[] = 'post-type-archive-' . sanitize_html_class( $post_type ); - } else if ( is_author() ) { + } elseif ( is_author() ) { $author = $wp_query->get_queried_object(); $classes[] = 'author'; if ( isset( $author->user_nicename ) ) { diff --git a/wp-includes/post.php b/wp-includes/post.php index c4257e4a2e..20da79a7cd 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2184,7 +2184,7 @@ function sanitize_post_field($field, $value, $post_id, $context) { } else { $value = esc_attr($value); } - } else if ( 'db' == $context ) { + } elseif ( 'db' == $context ) { if ( $prefixed ) { /** @@ -2252,7 +2252,7 @@ function sanitize_post_field($field, $value, $post_id, $context) { if ( 'attribute' == $context ) $value = esc_attr($value); - else if ( 'js' == $context ) + elseif ( 'js' == $context ) $value = esc_js($value); return $value; @@ -3907,7 +3907,7 @@ function wp_set_post_categories( $post_ID = 0, $post_categories = array(), $appe } else { $post_categories = array(); } - } else if ( 1 == count($post_categories) && '' == reset($post_categories) ) { + } elseif ( 1 == count( $post_categories ) && '' == reset( $post_categories ) ) { return true; } diff --git a/wp-includes/query.php b/wp-includes/query.php index b60e37fd79..86c62f6375 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -1654,9 +1654,9 @@ class WP_Query { $this->is_date = true; if ( strlen($qv['m']) > 9 ) { $this->is_time = true; - } else if ( strlen($qv['m']) > 7 ) { + } elseif ( strlen( $qv['m'] ) > 7 ) { $this->is_day = true; - } else if ( strlen($qv['m']) > 5 ) { + } elseif ( strlen( $qv['m'] ) > 5 ) { $this->is_month = true; } else { $this->is_year = true; @@ -1956,7 +1956,7 @@ class WP_Query { $tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db'); $q['tag_slug__in'][] = $tag; } - } else if ( preg_match('/[+\r\n\t ]+/', $q['tag']) || !empty($q['cat']) ) { + } elseif ( preg_match('/[+\r\n\t ]+/', $q['tag'] ) || ! empty( $q['cat'] ) ) { $tags = preg_split('/[+\r\n\t ]+/', $q['tag']); foreach ( (array) $tags as $tag ) { $tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db'); @@ -2467,7 +2467,7 @@ class WP_Query { $q['posts_per_page'] = (int) $q['posts_per_page']; if ( $q['posts_per_page'] < -1 ) $q['posts_per_page'] = abs($q['posts_per_page']); - else if ( $q['posts_per_page'] == 0 ) + elseif ( $q['posts_per_page'] == 0 ) $q['posts_per_page'] = 1; if ( !isset($q['comments_per_page']) || $q['comments_per_page'] == 0 ) @@ -4350,7 +4350,7 @@ class WP_Query { return true; } elseif ( in_array( $page_obj->post_title, $page ) ) { return true; - } else if ( in_array( $page_obj->post_name, $page ) ) { + } elseif ( in_array( $page_obj->post_name, $page ) ) { return true; } else { foreach ( $page as $pagepath ) { @@ -4568,7 +4568,7 @@ class WP_Query { */ if ( $post->ID === get_queried_object_id() && ( $this->is_page() || $this->is_single() ) ) { $more = 1; - } else if ( $this->is_feed() ) { + } elseif ( $this->is_feed() ) { $more = 1; } else { $more = 0; diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index 2399fd8b90..98791f6dde 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -1376,11 +1376,11 @@ class WP_Rewrite { $rewrite = array_merge($rewrite, array($pagematch => $pagequery)); //only on pages with comments add ../comment-page-xx/ - if ( EP_PAGES & $ep_mask || EP_PERMALINK & $ep_mask ) + if ( EP_PAGES & $ep_mask || EP_PERMALINK & $ep_mask ) { $rewrite = array_merge($rewrite, array($commentmatch => $commentquery)); - else if ( EP_ROOT & $ep_mask && get_option('page_on_front') ) + } elseif ( EP_ROOT & $ep_mask && get_option('page_on_front') ) { $rewrite = array_merge($rewrite, array($rootcommentmatch => $rootcommentquery)); - + } //do endpoints if ( $endpoints ) { foreach ( (array) $ep_query_append as $regex => $ep) { diff --git a/wp-includes/template.php b/wp-includes/template.php index b02486a39d..ae2e43bb42 100644 --- a/wp-includes/template.php +++ b/wp-includes/template.php @@ -467,7 +467,7 @@ function locate_template($template_names, $load = false, $require_once = true ) if ( file_exists(STYLESHEETPATH . '/' . $template_name)) { $located = STYLESHEETPATH . '/' . $template_name; break; - } else if ( file_exists(TEMPLATEPATH . '/' . $template_name) ) { + } elseif ( file_exists(TEMPLATEPATH . '/' . $template_name) ) { $located = TEMPLATEPATH . '/' . $template_name; break; } diff --git a/wp-includes/user.php b/wp-includes/user.php index 3640980f56..1ac07727bc 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -630,7 +630,7 @@ class WP_User_Query { $orderby = 'ID'; } elseif ( 'meta_value' == $qv['orderby'] ) { $orderby = "$wpdb->usermeta.meta_value"; - } else if ( 'include' === $qv['orderby'] && ! empty( $include ) ) { + } elseif ( 'include' === $qv['orderby'] && ! empty( $include ) ) { // Sanitized earlier. $include_sql = implode( ',', $include ); $orderby = "FIELD( $wpdb->users.ID, $include_sql )"; @@ -1514,7 +1514,7 @@ function sanitize_user_field($field, $value, $user_id, $context) { $value = esc_html( $value ); // textarea_escaped? else $value = esc_attr($value); - } else if ( 'db' == $context ) { + } elseif ( 'db' == $context ) { if ( $prefixed ) { /** This filter is documented in wp-includes/post.php */ $value = apply_filters( "pre_{$field}", $value ); @@ -1559,11 +1559,11 @@ function sanitize_user_field($field, $value, $user_id, $context) { if ( 'user_url' == $field ) $value = esc_url($value); - if ( 'attribute' == $context ) - $value = esc_attr($value); - else if ( 'js' == $context ) - $value = esc_js($value); - + if ( 'attribute' == $context ) { + $value = esc_attr( $value ); + } elseif ( 'js' == $context ) { + $value = esc_js( $value ); + } return $value; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 19aec42021..97c24e3312 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31089'; +$wp_version = '4.2-alpha-31090'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 5178317bfa..0f886f88f1 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -1366,7 +1366,7 @@ class wpdb { while ( mysqli_more_results( $this->dbh ) ) { mysqli_next_result( $this->dbh ); } - } else if ( is_resource( $this->result ) ) { + } elseif ( is_resource( $this->result ) ) { mysql_free_result( $this->result ); } } @@ -1435,9 +1435,9 @@ class wpdb { if ( $this->has_connected ) { $attempt_fallback = false; - } else if ( defined( 'WP_USE_EXT_MYSQL' ) && ! WP_USE_EXT_MYSQL ) { + } elseif ( defined( 'WP_USE_EXT_MYSQL' ) && ! WP_USE_EXT_MYSQL ) { $attempt_fallback = false; - } else if ( ! function_exists( 'mysql_connect' ) ) { + } elseif ( ! function_exists( 'mysql_connect' ) ) { $attempt_fallback = false; } @@ -1475,7 +1475,7 @@ class wpdb { " ), htmlspecialchars( $this->dbhost, ENT_QUOTES ) ), 'db_connect_fail' ); return false; - } else if ( $this->dbh ) { + } elseif ( $this->dbh ) { $this->has_connected = true; $this->set_charset( $this->dbh ); $this->ready = true; @@ -1673,7 +1673,7 @@ class wpdb { $this->last_result[$num_rows] = $row; $num_rows++; } - } else if ( is_resource( $this->result ) ) { + } elseif ( is_resource( $this->result ) ) { while ( $row = @mysql_fetch_object( $this->result ) ) { $this->last_result[$num_rows] = $row; $num_rows++; diff --git a/wp-login.php b/wp-login.php index 3dabec4a4c..8290f1afef 100644 --- a/wp-login.php +++ b/wp-login.php @@ -276,7 +276,7 @@ function retrieve_password() { if ( empty( $_POST['user_login'] ) ) { $errors->add('empty_username', __('ERROR: Enter a username or e-mail address.')); - } else if ( strpos( $_POST['user_login'], '@' ) ) { + } elseif ( strpos( $_POST['user_login'], '@' ) ) { $user_data = get_user_by( 'email', trim( $_POST['user_login'] ) ); if ( empty( $user_data ) ) $errors->add('invalid_email', __('ERROR: There is no user registered with that email address.')); @@ -333,10 +333,11 @@ function retrieve_password() { */ $allow = apply_filters( 'allow_password_reset', true, $user_data->ID ); - if ( ! $allow ) - return new WP_Error('no_password_reset', __('Password reset is not allowed for this user')); - else if ( is_wp_error($allow) ) + if ( ! $allow ) { + return new WP_Error( 'no_password_reset', __('Password reset is not allowed for this user') ); + } elseif ( is_wp_error( $allow ) ) { return $allow; + } // Generate something random for a password reset key. $key = wp_generate_password( 20, false );