Cleanup for `switch` statements:

* Move `default` to the bottom in `WP_Theme_Install_List_Table`
* `switch/endswitch` syntax is not supported in Hack. Switch to `switch (...) {  .... }` syntax. (A few template-type instances linger).

Fixes #28409.
See #27881.


Built from https://develop.svn.wordpress.org/trunk@28633


git-svn-id: http://core.svn.wordpress.org/trunk@28452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-05-30 17:58:15 +00:00
parent 1868c1fc4b
commit af860fbe84
6 changed files with 40 additions and 40 deletions

View File

@ -244,10 +244,6 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
$status = $this->_get_theme_status( $theme );
switch ( $status ) {
default:
case 'install':
$actions[] = '<a class="install-now" href="' . esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>';
break;
case 'update_available':
$actions[] = '<a class="install-now" href="' . esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ) . '">' . __( 'Update' ) . '</a>';
break;
@ -255,6 +251,10 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
case 'latest_installed':
$actions[] = '<span class="install-now" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . '">' . _x( 'Installed', 'theme' ) . '</span>';
break;
case 'install':
default:
$actions[] = '<a class="install-now" href="' . esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>';
break;
}
$actions[] = '<a class="install-theme-preview" href="' . esc_url( $preview_url ) . '" title="' . esc_attr( sprintf( __( 'Preview %s' ), $name ) ) . '">' . __( 'Preview' ) . '</a>';
@ -367,10 +367,6 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
?>
<div class="install-theme-info"><?php
switch ( $status ) {
default:
case 'install':
echo '<a class="theme-install button-primary" href="' . esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ) . '">' . __( 'Install' ) . '</a>';
break;
case 'update_available':
echo '<a class="theme-install button-primary" href="' . esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ) . '">' . __( 'Update' ) . '</a>';
break;
@ -378,6 +374,10 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
case 'latest_installed':
echo '<span class="theme-install" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . '">' . _x( 'Installed', 'theme' ) . '</span>';
break;
case 'install':
default:
echo '<a class="theme-install button-primary" href="' . esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ) . '">' . __( 'Install' ) . '</a>';
break;
} ?>
<h3 class="theme-name"><?php echo $name; ?></h3>
<span class="theme-by"><?php printf( __( 'By %s' ), $author ); ?></span>

View File

@ -601,16 +601,16 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
<?php
else :
switch ( $comment->comment_type ) :
case 'pingback' :
$type = __( 'Pingback' );
break;
case 'trackback' :
$type = __( 'Trackback' );
break;
default :
$type = ucwords( $comment->comment_type );
endswitch;
switch ( $comment->comment_type ) {
case 'pingback' :
$type = __( 'Pingback' );
break;
case 'trackback' :
$type = __( 'Trackback' );
break;
default :
$type = ucwords( $comment->comment_type );
}
$type = esc_html( $type );
?>
<div class="dashboard-comment-wrap">

View File

@ -302,8 +302,8 @@ CREATE TABLE $wpdb->signups (
case 'ms_global' :
$queries = $ms_global_tables;
break;
default:
case 'all' :
default:
$queries = $global_tables . $blog_tables;
if ( $is_multisite )
$queries .= $ms_global_tables;

View File

@ -90,12 +90,12 @@ case 'edit' :
$message = '';
$class = '';
if ( isset($_GET['message']) ) {
switch ( $_GET['message'] ) :
case 'updated' :
$message = __('Media attachment updated.');
$class = 'updated';
break;
endswitch;
switch ( $_GET['message'] ) {
case 'updated' :
$message = __('Media attachment updated.');
$class = 'updated';
break;
}
}
if ( $message )
echo "<div id='message' class='$class'><p>$message</p></div>\n";

View File

@ -785,19 +785,19 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
. $args['unit'] . ";'>$tag_name</a>";
}
switch ( $args['format'] ) :
case 'array' :
$return =& $a;
break;
case 'list' :
$return = "<ul class='wp-tag-cloud'>\n\t<li>";
$return .= join( "</li>\n\t<li>", $a );
$return .= "</li>\n</ul>\n";
break;
default :
$return = join( $args['separator'], $a );
break;
endswitch;
switch ( $args['format'] ) {
case 'array' :
$return =& $a;
break;
case 'list' :
$return = "<ul class='wp-tag-cloud'>\n\t<li>";
$return .= join( "</li>\n\t<li>", $a );
$return .= "</li>\n</ul>\n";
break;
default :
$return = join( $args['separator'], $a );
break;
}
if ( $args['filter'] ) {
/**

View File

@ -2301,7 +2301,7 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) {
$title = $error_data['title'];
}
$errors = $message->get_error_messages();
switch ( count( $errors ) ) :
switch ( count( $errors ) ) {
case 0 :
$message = '';
break;
@ -2311,7 +2311,7 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) {
default :
$message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>";
break;
endswitch;
}
} elseif ( is_string( $message ) ) {
$message = "<p>$message</p>";
}