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:
parent
1868c1fc4b
commit
af860fbe84
|
@ -244,10 +244,6 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
|
||||||
$status = $this->_get_theme_status( $theme );
|
$status = $this->_get_theme_status( $theme );
|
||||||
|
|
||||||
switch ( $status ) {
|
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':
|
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>';
|
$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;
|
break;
|
||||||
|
@ -255,6 +251,10 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
|
||||||
case 'latest_installed':
|
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>';
|
$actions[] = '<span class="install-now" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . '">' . _x( 'Installed', 'theme' ) . '</span>';
|
||||||
break;
|
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>';
|
$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
|
<div class="install-theme-info"><?php
|
||||||
switch ( $status ) {
|
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':
|
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>';
|
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;
|
break;
|
||||||
|
@ -378,6 +374,10 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
|
||||||
case 'latest_installed':
|
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>';
|
echo '<span class="theme-install" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . '">' . _x( 'Installed', 'theme' ) . '</span>';
|
||||||
break;
|
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>
|
<h3 class="theme-name"><?php echo $name; ?></h3>
|
||||||
<span class="theme-by"><?php printf( __( 'By %s' ), $author ); ?></span>
|
<span class="theme-by"><?php printf( __( 'By %s' ), $author ); ?></span>
|
||||||
|
|
|
@ -601,7 +601,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
else :
|
else :
|
||||||
switch ( $comment->comment_type ) :
|
switch ( $comment->comment_type ) {
|
||||||
case 'pingback' :
|
case 'pingback' :
|
||||||
$type = __( 'Pingback' );
|
$type = __( 'Pingback' );
|
||||||
break;
|
break;
|
||||||
|
@ -610,7 +610,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
$type = ucwords( $comment->comment_type );
|
$type = ucwords( $comment->comment_type );
|
||||||
endswitch;
|
}
|
||||||
$type = esc_html( $type );
|
$type = esc_html( $type );
|
||||||
?>
|
?>
|
||||||
<div class="dashboard-comment-wrap">
|
<div class="dashboard-comment-wrap">
|
||||||
|
|
|
@ -302,8 +302,8 @@ CREATE TABLE $wpdb->signups (
|
||||||
case 'ms_global' :
|
case 'ms_global' :
|
||||||
$queries = $ms_global_tables;
|
$queries = $ms_global_tables;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
case 'all' :
|
case 'all' :
|
||||||
|
default:
|
||||||
$queries = $global_tables . $blog_tables;
|
$queries = $global_tables . $blog_tables;
|
||||||
if ( $is_multisite )
|
if ( $is_multisite )
|
||||||
$queries .= $ms_global_tables;
|
$queries .= $ms_global_tables;
|
||||||
|
|
|
@ -90,12 +90,12 @@ case 'edit' :
|
||||||
$message = '';
|
$message = '';
|
||||||
$class = '';
|
$class = '';
|
||||||
if ( isset($_GET['message']) ) {
|
if ( isset($_GET['message']) ) {
|
||||||
switch ( $_GET['message'] ) :
|
switch ( $_GET['message'] ) {
|
||||||
case 'updated' :
|
case 'updated' :
|
||||||
$message = __('Media attachment updated.');
|
$message = __('Media attachment updated.');
|
||||||
$class = 'updated';
|
$class = 'updated';
|
||||||
break;
|
break;
|
||||||
endswitch;
|
}
|
||||||
}
|
}
|
||||||
if ( $message )
|
if ( $message )
|
||||||
echo "<div id='message' class='$class'><p>$message</p></div>\n";
|
echo "<div id='message' class='$class'><p>$message</p></div>\n";
|
||||||
|
|
|
@ -785,7 +785,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
|
||||||
. $args['unit'] . ";'>$tag_name</a>";
|
. $args['unit'] . ";'>$tag_name</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( $args['format'] ) :
|
switch ( $args['format'] ) {
|
||||||
case 'array' :
|
case 'array' :
|
||||||
$return =& $a;
|
$return =& $a;
|
||||||
break;
|
break;
|
||||||
|
@ -797,7 +797,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
|
||||||
default :
|
default :
|
||||||
$return = join( $args['separator'], $a );
|
$return = join( $args['separator'], $a );
|
||||||
break;
|
break;
|
||||||
endswitch;
|
}
|
||||||
|
|
||||||
if ( $args['filter'] ) {
|
if ( $args['filter'] ) {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2301,7 +2301,7 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) {
|
||||||
$title = $error_data['title'];
|
$title = $error_data['title'];
|
||||||
}
|
}
|
||||||
$errors = $message->get_error_messages();
|
$errors = $message->get_error_messages();
|
||||||
switch ( count( $errors ) ) :
|
switch ( count( $errors ) ) {
|
||||||
case 0 :
|
case 0 :
|
||||||
$message = '';
|
$message = '';
|
||||||
break;
|
break;
|
||||||
|
@ -2311,7 +2311,7 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) {
|
||||||
default :
|
default :
|
||||||
$message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>";
|
$message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>";
|
||||||
break;
|
break;
|
||||||
endswitch;
|
}
|
||||||
} elseif ( is_string( $message ) ) {
|
} elseif ( is_string( $message ) ) {
|
||||||
$message = "<p>$message</p>";
|
$message = "<p>$message</p>";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue