Skip to content

Commit

Permalink
The keyword elseif should be used instead of else if so that all …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
staylor committed Jan 8, 2015
1 parent a4ed093 commit 60b0cd7
Show file tree
Hide file tree
Showing 49 changed files with 182 additions and 171 deletions.
9 changes: 5 additions & 4 deletions wp-admin/admin.php
Expand Up @@ -167,12 +167,13 @@
}

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

Expand Down Expand Up @@ -243,7 +244,7 @@
include(ABSPATH . 'wp-admin/admin-footer.php');

exit();
} else if (isset($_GET['import'])) {
} elseif ( isset( $_GET['import'] ) ) {

$importer = $_GET['import'];

Expand Down
2 changes: 1 addition & 1 deletion wp-admin/edit-tags.php
Expand Up @@ -28,7 +28,7 @@
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 {
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/export.php
Expand Up @@ -60,7 +60,7 @@ function export_add_js() {

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'] )
Expand All @@ -76,7 +76,7 @@ function export_add_js() {

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'] )
Expand Down
12 changes: 7 additions & 5 deletions wp-admin/includes/ajax-actions.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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.' ) );
}

Expand Down
5 changes: 3 additions & 2 deletions wp-admin/includes/class-wp-comments-list-table.php
Expand Up @@ -447,10 +447,11 @@ public function column_comment( $comment ) {

// 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>';
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/includes/class-wp-importer.php
Expand Up @@ -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];
}
}
Expand Down
15 changes: 8 additions & 7 deletions wp-admin/includes/class-wp-upgrader-skins.php
Expand Up @@ -447,12 +447,13 @@ public function after() {
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'] );
Expand Down Expand Up @@ -731,13 +732,13 @@ public function get_upgrade_messages() {
* @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 ];

Expand Down
4 changes: 2 additions & 2 deletions wp-admin/includes/class-wp-upgrader.php
Expand Up @@ -431,7 +431,7 @@ public function install_package( $args = array() ) {

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) ) {
Expand Down Expand Up @@ -637,7 +637,7 @@ public function maintenance_mode( $enable = false ) {
$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
$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);
}
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/export.php
Expand Up @@ -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' ) );

Expand Down
12 changes: 6 additions & 6 deletions wp-admin/includes/file.php
Expand Up @@ -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';
Expand Down Expand Up @@ -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']) ) ||
Expand Down
8 changes: 4 additions & 4 deletions wp-admin/includes/media.php
Expand Up @@ -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 */
Expand All @@ -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'] . '.';

Expand Down
6 changes: 3 additions & 3 deletions wp-admin/includes/meta-boxes.php
Expand Up @@ -166,11 +166,11 @@ function post_submit_meta_box($post, $args = array() ) {
if ( 0 != $post->ID ) {
if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
$stamp = __('Scheduled for: <b>%1$s</b>');
} 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: <b>%1$s</b>');
} 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 <b>immediately</b>');
} 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: <b>%1$s</b>');
} else { // draft, 1 or more saves, date specified
$stamp = __('Publish on: <b>%1$s</b>');
Expand Down
5 changes: 3 additions & 2 deletions wp-admin/includes/ms.php
Expand Up @@ -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 );
}
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/plugin-install.php
Expand Up @@ -517,7 +517,7 @@ function install_plugin_information() {
<?php
if ( ! empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) {
echo '<div class="notice notice-warning"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';
} 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 '<div class="notice notice-warning"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.') . '</p></div>';
}

Expand Down
4 changes: 2 additions & 2 deletions wp-admin/includes/plugin.php
Expand Up @@ -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];
}

Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions wp-admin/includes/taxonomy.php
Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/template.php
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/theme.php
Expand Up @@ -167,7 +167,7 @@ function get_theme_update_available( $theme ) {
if ( ! current_user_can('update_themes') ) {
$html = sprintf( '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.' ) . '</strong></p>',
$theme_name, esc_url( $details_url ), esc_attr( $theme['Name'] ), $update['new_version'] );
} else if ( empty( $update['package'] ) ) {
} elseif ( empty( $update['package'] ) ) {
$html = sprintf( '<p><strong>' . __( '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>' ) . '</strong></p>',
$theme_name, esc_url( $details_url ), esc_attr( $theme['Name'] ), $update['new_version'] );
} else {
Expand Down
16 changes: 8 additions & 8 deletions wp-admin/includes/update.php
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 60b0cd7

Please sign in to comment.