Make WordPress Core

Ticket #20618: 20618.patch

File 20618.patch, 2.8 KB (added by SergeyBiryukov, 13 years ago)
  • wp-admin/includes/class-wp-plugin-install-list-table.php

     
    203203                                                break;
    204204                                        case 'latest_installed':
    205205                                        case 'newer_installed':
    206                                                 $action_links[] = '<span title="' . esc_attr__( 'This plugin is already installed and is up to date' ) . ' ">' . __( 'Installed' ) . '</span>';
     206                                                $action_links[] = '<span title="' . esc_attr__( 'This plugin is already installed and is up to date' ) . ' ">' . _x( 'Installed', 'plugin' ) . '</span>';
    207207                                                break;
    208208                                }
    209209                        }
  • wp-admin/includes/class-wp-theme-install-list-table.php

     
    269269                        'theme'  => $theme->slug,
    270270                ), self_admin_url( 'update.php' ) );
    271271
     272                $update_url = add_query_arg( array(
     273                        'action' => 'upgrade-theme',
     274                        'theme'  => $theme->slug,
     275                ), self_admin_url( 'update.php' ) );
     276
     277                $status = 'install';
     278
     279                // Check to see if the theme is already installed
     280                $installed_theme = wp_get_theme( $theme->slug );
     281                if ( $installed_theme->exists() ) {
     282                        if ( version_compare( $installed_theme->get('Version'), $theme->version, '=' ) )
     283                                $status = 'latest_installed';
     284                        elseif ( version_compare( $installed_theme->get('Version'), $theme->version, '>' ) )
     285                                $status = 'newer_installed';
     286                        else
     287                                $status = 'update_available';
     288                }
     289
    272290                ?>
    273                 <div class="install-theme-info">
    274                         <a class="theme-install button-primary" href="<?php echo wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ); ?>"><?php _e( 'Install' ); ?></a>
     291                <div class="install-theme-info"><?php
     292                        switch ( $status ) {
     293                                default:
     294                                case 'install':
     295                                        echo '<a class="theme-install button-primary" href="' . wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) . '">' . __( 'Install' ) . '</a>';
     296                                        break;
     297                                case 'update_available':
     298                                        echo '<a class="theme-install button-primary" href="' . wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ) . '">' . __( 'Update' ) . '</a>';
     299                                        break;
     300                                case 'newer_installed':
     301                                case 'latest_installed':
     302                                        echo '<span class="theme-install" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . ' ">' . _x( 'Installed', 'theme' ) . '</span>';
     303                                        break;
     304                        } ?>
    275305                        <h3 class="theme-name"><?php echo $name; ?></h3>
    276306                        <span class="theme-by"><?php printf( __( 'By %s' ), $author ); ?></span>
    277307                        <?php if ( isset( $theme->screenshot_url ) ): ?>