WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/07/2014 11:03:05 PM (7 years ago)
Author:
nacin
Message:

Theme Installer: Handle currently installed themes, add search route, let prev/next refresh collections.

props matveb.
see #27055. fixes #27695.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/theme-install.php

    r27962 r28025  
    3333    'new'      => __( 'Newest Themes' ),
    3434);
     35
     36$installed_themes = search_theme_directories();
     37foreach ( $installed_themes as $k => $v ) {
     38    if ( false !== strpos( $k, '/' ) ) {
     39        unset( $installed_themes[ $k ] );
     40    }
     41}
    3542
    3643wp_localize_script( 'theme', '_wpThemeSettings', array(
     
    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,
     
    191199        <a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e( 'Preview' ); ?></a>
    192200    </div>
     201
     202    <# if ( data.installed ) { #>
     203        <div class="theme-installed"><?php _e( 'Already Installed' ); ?></div>
     204    <# } #>
    193205</script>
    194206
     
    197209        <div class="wp-full-overlay-header">
    198210            <a href="#" class="close-full-overlay button-secondary"><?php _e( 'Close' ); ?></a>
     211        <# if ( data.installed ) { #>
     212            <a href="#" class="button button-primary theme-install disabled"><?php _e( 'Installed' ); ?></a>
     213        <# } else { #>
    199214            <a href="{{ data.installURI }}" class="button button-primary theme-install"><?php _e( 'Install' ); ?></a>
     215        <# } #>
    200216        </div>
    201217        <div class="wp-full-overlay-sidebar-content">
Note: See TracChangeset for help on using the changeset viewer.