WordPress.org

Make WordPress Core

Ticket #27055: 27055.34.diff

File 27055.34.diff, 1.9 KB (added by nacin, 5 years ago)

Hacked in already-installed. Not done properly, just getting the ball rolling.

  • src/wp-admin/theme-install.php

     
    3333        'new'      => __( 'Newest Themes' ),
    3434);
    3535
     36$installed_themes = search_theme_directories();
     37foreach ( $installed_themes as $k => $v ) {
     38        if ( false !== strpos( $k, '/' ) ) {
     39                unset( $installed_themes[ $k ] );
     40        }
     41}
     42
    3643wp_localize_script( 'theme', '_wpThemeSettings', array(
    3744        'themes'   => false,
    3845        'settings' => array(
     
    5158                'back'   => __( 'Back' ),
    5259                'error'  => ( 'There was a problem trying to load the themes. Please, try again.' ), // @todo improve
    5360        ),
     61        'installedThemes' => array_keys( $installed_themes ),
    5462        'browse' => array(
    5563                'sections' => $sections,
    5664        ),
     
    187195        <h3 class="theme-name">{{ data.name }}</h3>
    188196
    189197        <div class="theme-actions">
     198        <# if ( -1 === _.indexOf( _wpThemeSettings.installedThemes, data.slug ) ) { #>
    190199                <a class="button button-primary" href="{{ data.installURI }}"><?php esc_html_e( 'Install' ); ?></a>
     200        <# } else { #>
     201                <a class="button button-primary disabled" href="#"><?php esc_html_e( 'Installed' ); ?></a>
     202        <# } #>
    191203                <a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e( 'Preview' ); ?></a>
    192204        </div>
    193205</script>
     
    196208        <div class="wp-full-overlay-sidebar">
    197209                <div class="wp-full-overlay-header">
    198210                        <a href="#" class="close-full-overlay button-secondary"><?php _e( 'Close' ); ?></a>
     211                <# if ( -1 === _.indexOf( _wpThemeSettings.installedThemes, data.slug ) ) { #>
    199212                        <a href="{{ data.installURI }}" class="button button-primary theme-install"><?php _e( 'Install' ); ?></a>
     213                <# } else { #>
     214                        <a class="button button-primary theme-install disabled" href="#"><?php esc_html_e( 'Installed' ); ?></a>
     215                <# } #>
    200216                </div>
    201217                <div class="wp-full-overlay-sidebar-content">
    202218                        <div class="install-theme-info">