Make WordPress Core

Changeset 28633


Ignore:
Timestamp:
05/30/2014 05:57:51 PM (12 years ago)
Author:
wonderboymusic
Message:

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.

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-theme-install-list-table.php

    r28497 r28633  
    245245
    246246                switch ( $status ) {
    247                         default:
    248                         case 'install':
    249                                 $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>';
    250                                 break;
    251247                        case 'update_available':
    252248                                $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>';
     
    255251                        case 'latest_installed':
    256252                                $actions[] = '<span class="install-now" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . '">' . _x( 'Installed', 'theme' ) . '</span>';
     253                                break;
     254                        case 'install':
     255                        default:
     256                                $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>';
    257257                                break;
    258258                }
     
    368368                <div class="install-theme-info"><?php
    369369                        switch ( $status ) {
    370                                 default:
    371                                 case 'install':
    372                                         echo '<a class="theme-install button-primary" href="' . esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ) . '">' . __( 'Install' ) . '</a>';
    373                                         break;
    374370                                case 'update_available':
    375371                                        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>';
     
    378374                                case 'latest_installed':
    379375                                        echo '<span class="theme-install" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . '">' . _x( 'Installed', 'theme' ) . '</span>';
     376                                        break;
     377                                case 'install':
     378                                default:
     379                                        echo '<a class="theme-install button-primary" href="' . esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ) . '">' . __( 'Install' ) . '</a>';
    380380                                        break;
    381381                        } ?>
  • trunk/src/wp-admin/includes/dashboard.php

    r28592 r28633  
    602602                        <?php
    603603                        else :
    604                                 switch ( $comment->comment_type ) :
    605                                 case 'pingback' :
    606                                         $type = __( 'Pingback' );
    607                                         break;
    608                                 case 'trackback' :
    609                                         $type = __( 'Trackback' );
    610                                         break;
    611                                 default :
    612                                         $type = ucwords( $comment->comment_type );
    613                                 endswitch;
     604                                switch ( $comment->comment_type ) {
     605                                        case 'pingback' :
     606                                                $type = __( 'Pingback' );
     607                                                break;
     608                                        case 'trackback' :
     609                                                $type = __( 'Trackback' );
     610                                                break;
     611                                        default :
     612                                                $type = ucwords( $comment->comment_type );
     613                                }
    614614                                $type = esc_html( $type );
    615615                        ?>
  • trunk/src/wp-admin/includes/schema.php

    r28260 r28633  
    303303                        $queries = $ms_global_tables;
    304304                        break;
     305                case 'all' :
    305306                default:
    306                 case 'all' :
    307307                        $queries = $global_tables . $blog_tables;
    308308                        if ( $is_multisite )
  • trunk/src/wp-admin/media.php

    r28500 r28633  
    9191        $class = '';
    9292        if ( isset($_GET['message']) ) {
    93                 switch ( $_GET['message'] ) :
    94                 case 'updated' :
    95                         $message = __('Media attachment updated.');
    96                         $class = 'updated';
    97                         break;
    98                 endswitch;
     93                switch ( $_GET['message'] ) {
     94                        case 'updated' :
     95                                $message = __('Media attachment updated.');
     96                                $class = 'updated';
     97                                break;
     98                }
    9999        }
    100100        if ( $message )
  • trunk/src/wp-includes/category-template.php

    r28572 r28633  
    786786        }
    787787
    788         switch ( $args['format'] ) :
    789         case 'array' :
    790                 $return =& $a;
    791                 break;
    792         case 'list' :
    793                 $return = "<ul class='wp-tag-cloud'>\n\t<li>";
    794                 $return .= join( "</li>\n\t<li>", $a );
    795                 $return .= "</li>\n</ul>\n";
    796                 break;
    797         default :
    798                 $return = join( $args['separator'], $a );
    799                 break;
    800         endswitch;
     788        switch ( $args['format'] ) {
     789                case 'array' :
     790                        $return =& $a;
     791                        break;
     792                case 'list' :
     793                        $return = "<ul class='wp-tag-cloud'>\n\t<li>";
     794                        $return .= join( "</li>\n\t<li>", $a );
     795                        $return .= "</li>\n</ul>\n";
     796                        break;
     797                default :
     798                        $return = join( $args['separator'], $a );
     799                        break;
     800        }
    801801
    802802        if ( $args['filter'] ) {
  • trunk/src/wp-includes/functions.php

    r28609 r28633  
    23022302                }
    23032303                $errors = $message->get_error_messages();
    2304                 switch ( count( $errors ) ) :
     2304                switch ( count( $errors ) ) {
    23052305                case 0 :
    23062306                        $message = '';
     
    23122312                        $message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>";
    23132313                        break;
    2314                 endswitch;
     2314                }
    23152315        } elseif ( is_string( $message ) ) {
    23162316                $message = "<p>$message</p>";
Note: See TracChangeset for help on using the changeset viewer.