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.


git-svn-id: https://develop.svn.wordpress.org/trunk@31090 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-01-08 07:04:40 +00:00
parent d0767caf54
commit 6fd11624d1
48 changed files with 181 additions and 170 deletions

View File

@ -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();

View File

@ -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',

View File

@ -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'] = "<a href='$unapprove_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved' class='vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
else if ( 'unapproved' == $the_comment_status )
} elseif ( 'unapproved' == $the_comment_status ) {
$actions['approve'] = "<a href='$approve_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved' class='vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
}
} else {
$actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
$actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';

View File

@ -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'] = '<a href="' . admin_url('import.php') . '" title="' . esc_attr__('Return to Importers') . '" target="_parent">' . __('Return to Importers') . '</a>';
else if ( $this->type == 'web' )
} elseif ( $this->type == 'web' ) {
$install_actions['plugins_page'] = '<a href="' . self_admin_url('plugin-install.php') . '" title="' . esc_attr__('Return to Plugin Installer') . '" target="_parent">' . __('Return to Plugin Installer') . '</a>';
else
} else {
$install_actions['plugins_page'] = '<a href="' . self_admin_url('plugins.php') . '" title="' . esc_attr__('Return to Plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>';
}
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 ];

View File

@ -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']) ) ||

View File

@ -145,11 +145,12 @@ 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 );
}
$index++;

View File

@ -67,12 +67,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))
if ( $id = category_exists( $category ) ) {
$cat_ids[] = $id;
else
if ($id = wp_create_category($category))
} elseif ( $id = wp_create_category( $category ) ) {
$cat_ids[] = $id;
}
}
if ( $post_id )
wp_set_post_categories($post_id, $cat_ids);

View File

@ -278,13 +278,13 @@ function wp_plugin_update_row( $file, $plugin_data ) {
if ( is_network_admin() || !is_multisite() ) {
echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
if ( ! current_user_can('update_plugins') )
if ( ! current_user_can( 'update_plugins' ) ) {
printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.'), $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. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin.</em>'), $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. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.'), $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 '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
if ( ! current_user_can('update_themes') )
if ( ! current_user_can('update_themes') ) {
printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.'), $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. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>'), $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. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.'), $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.

View File

@ -151,12 +151,13 @@ if ( ! empty( $_GET['settings-updated'] ) ) : ?>
<div id="message" class="updated"><p><?php
if ( ! is_multisite() ) {
if ( $iis7_permalinks ) {
if ( $permalink_structure && ! $usingpi && ! $writable )
if ( $permalink_structure && ! $usingpi && ! $writable ) {
_e('You should update your web.config now.');
else if ( $permalink_structure && ! $usingpi && $writable )
} elseif ( $permalink_structure && ! $usingpi && $writable ) {
_e('Permalink structure updated. Remove write access on web.config file now!');
else
} else {
_e('Permalink structure updated.');
}
} elseif ( $is_nginx ) {
_e('Permalink structure updated.');
} else {

View File

@ -393,11 +393,12 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
/** This filter is documented in wp-includes/post.php */
$value = apply_filters( $field, $value, $bookmark_id, $context );
if ( 'attribute' == $context )
if ( 'attribute' == $context ) {
$value = esc_attr( $value );
else if ( 'js' == $context )
} elseif ( 'js' == $context ) {
$value = esc_js( $value );
}
}
return $value;
}

View File

@ -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,11 +4874,12 @@ 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') )
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') )
} 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 )
$post_content = $post_content . "<!--more-->" . $post_more;

View File

@ -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))
} 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.

View File

@ -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";

View File

@ -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' );

View File

@ -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 ) )
if ( is_int( $attachment ) ) {
$attachment = get_post( $attachment );
else if ( is_array($attachment) )
} elseif ( is_array( $attachment ) ) {
$attachment = (object) $attachment;
}
if ( ! is_object($attachment) )
return array();

View File

@ -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) {

View File

@ -1559,11 +1559,11 @@ function sanitize_user_field($field, $value, $user_id, $context) {
if ( 'user_url' == $field )
$value = esc_url($value);
if ( 'attribute' == $context )
if ( 'attribute' == $context ) {
$value = esc_attr( $value );
else if ( 'js' == $context )
} elseif ( 'js' == $context ) {
$value = esc_js( $value );
}
return $value;
}

View File

@ -333,10 +333,11 @@ function retrieve_password() {
*/
$allow = apply_filters( 'allow_password_reset', true, $user_data->ID );
if ( ! $allow )
if ( ! $allow ) {
return new WP_Error( 'no_password_reset', __('Password reset is not allowed for this user') );
else if ( is_wp_error($allow) )
} elseif ( is_wp_error( $allow ) ) {
return $allow;
}
// Generate something random for a password reset key.
$key = wp_generate_password( 20, false );