Make WordPress Core


Ignore:
Timestamp:
03/20/2009 12:14:57 AM (17 years ago)
Author:
azaozz
Message:

More theme install styling, see #8652

File:
1 edited

Legend:

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

    r10810 r10823  
    141141function install_themes_dashboard() {
    142142    ?>
    143 <p><?php _e('Search for themes by keyword, author, or tag.') ?></p>
     143<p class="install-help"><?php _e('Search for themes by keyword, author, or tag.') ?></p>
    144144
    145145    <?php install_theme_search_form(); ?>
    146146
    147 <h4><?php _e('Advanced Search') ?></h4>
    148 <p><?php _e('Tag filter goes here') ?></p>
    149 
    150147<h4><?php _e('Popular tags') ?></h4>
    151 <p><?php _e('You may also browse based on the most popular tags in the Theme Directory:') ?></p>
     148<p class="install-help"><?php _e('You may also browse based on the most popular tags in the Theme Directory:') ?></p>
    152149    <?php
    153150
     
    184181    <option value="author" <?php selected('author', $type) ?>><?php _e('Author') ?></option>
    185182    <option value="tag" <?php selected('tag', $type) ?>><?php _e('Tag') ?></option>
    186 </select> <input type="text" name="s" id="search-field"
     183</select> <input type="text" name="s" class="search-input"
    187184    value="<?php echo attribute_escape($term) ?>" /> <input type="submit"
    188185    name="search" value="<?php echo attribute_escape(__('Search')) ?>"
     
    259256    ?>
    260257<h4><?php _e('Install a theme in .zip format') ?></h4>
    261 <p><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.') ?></p>
     258<p class="install-help"><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.') ?></p>
    262259<form method="post" enctype="multipart/form-data"
    263260    action="<?php echo admin_url('theme-install.php?tab=do_upload') ?>"><?php wp_nonce_field( 'theme-upload') ?>
     
    280277
    281278    $preview_link = $theme->preview_url . '?TB_iframe=true&amp;width=600&amp;height=400';
    282     if ( empty($actions) ) {
     279    if ( !is_array($actions) ) {
    283280        $actions = array();
    284281        $actions[] = '<a href="' . admin_url('theme-install.php?tab=theme-information&amp;theme=' . $theme->slug .
    285                                         '&amp;TB_iframe=true&amp;width=600&amp;height=800') . '" class="thickbox onclick" title="' . attribute_escape(sprintf(__('Install "%s"'), $name)) . '">' . __('Install') . '</a>';
     282                                        '&amp;TB_iframe=true&amp;tbWidth=500&amp;tbHeight=350') . '" class="thickbox thickbox-preview onclick" title="' . attribute_escape(sprintf(__('Install "%s"'), $name)) . '">' . __('Install') . '</a>';
    286283        $actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview onclick previewlink" title="' . attribute_escape(sprintf(__('Preview "%s"'), $name)) . '">' . __('Preview') . '</a>';
    287284        $actions = apply_filters('theme_install_action_links', $actions, $theme);
     
    291288    ?>
    292289<a class='thickbox thickbox-preview screenshot'
    293     href='<? echo clean_url($preview_link) ?>'
    294     title='<?php attribute_escape(sprintf(__('Preview "%s"'), $name)) ?>'>
    295 <img src='<?php echo clean_url($theme->screenshot_url) ?>' width='150' />
     290    href='<? echo clean_url($preview_link); ?>'
     291    title='<?php echo attribute_escape(sprintf(__('Preview "%s"'), $name)); ?>'>
     292<img src='<?php echo clean_url($theme->screenshot_url); ?>' width='150' />
    296293</a>
    297294<h3><?php echo $name ?></h3>
     
    432429function install_theme_information() {
    433430    //TODO: This function needs a LOT of UI work :)
    434     global $tab, $themes_allowedtags;;
     431    global $tab, $themes_allowedtags;
    435432
    436433    $api = themes_api('theme_information', array('slug' => stripslashes( $_REQUEST['theme'] ) ));
     
    445442        $api->$key = wp_kses($api->$key, $themes_allowedtags);
    446443
    447     $section = isset($_REQUEST['section']) ? stripslashes( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English.
    448     if ( empty($section) || ! isset($api->sections[ $section ]) )
    449         $section = array_shift( $section_titles = array_keys((array)$api->sections) );
    450 
    451444    iframe_header( __('Theme Install') );
     445
     446    if ( empty($api->download_link) ) {
     447        echo '<div id="message" class="error"><p>' . __('<strong>Error:</strong> This theme is currently not available. Please try again later.') . '</p></div>';
     448        iframe_footer();
     449        exit;
     450    }
    452451
    453452    if ( version_compare($GLOBALS['wp_version'], $api->tested, '>') )
     
    456455        echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This theme has not been marked as <strong>compatible</strong> with your version of WordPress.') . '</p></div>';
    457456
    458     if ( empty($api->download_link) ) {
    459         // No go
    460     }
    461     ?>
    462 
    463 <p class="action-button"><?php
    464457    // Default to a "new" theme
    465458    $type = 'install';
    466459    // Check to see if this theme is known to be installed, and has an update awaiting it.
    467     $update_themes = get_option('update_themes');
    468     foreach ( (array)$update_themes->response as $file => $theme ) {
    469         if ( $theme->slug === $api->slug ) {
    470             $type = 'update_available';
    471         $update_file = $file;
    472         break;
    473     }
    474 }
    475 
    476 $action = '';
     460    $update_themes = get_transient('update_themes');
     461    if ( is_object($update_themes) ) {
     462        foreach ( (array)$update_themes->response as $file => $theme ) {
     463            if ( $theme->slug === $api->slug ) {
     464                $type = 'update_available';
     465                $update_file = $file;
     466                break;
     467            }
     468        }
     469    }
     470
     471    $themes = get_themes();
     472    foreach ( $themes as $this_theme ) {
     473        if ( is_array($this_theme) && $this_theme['Stylesheet'] == $api->slug ) {
     474            if ( $this_theme['Version'] == $api->version ) {
     475                $type = 'latest_installed';
     476            } elseif ( $this_theme['Version'] > $api->version ) {
     477                $type = 'newer_installed';
     478                $newer_version = $this_theme['Version'];
     479            }
     480            break;
     481        }
     482    }
     483?>
     484
     485<div class='available-theme'>
     486<img src='<?php echo clean_url($api->screenshot_url) ?>' width='300' class="theme-preview-img" />
     487<h3><?php echo $api->name; ?></h3>
     488<p><?php printf(__('by %s'), $api->author); ?></p>
     489<p><?php printf(__('Version: %s'), $api->version); ?></p>
     490
     491<?php
     492$buttons = '<a class="button" id="cancel" href="#" onclick="tb_close();return false;">' . __('Cancel') . '</a> ';
     493
    477494switch ( $type ) {
    478     default:
    479     case 'install':
    480         if ( current_user_can('install_themes') ) :
    481             $action = '<a class="button" href="' . wp_nonce_url(admin_url('theme-install.php?tab=install&theme=' . $api->slug), 'install-theme_' . $api->slug) . '" target="_parent">' . __('Install Now') . '</a>';
     495default:
     496case 'install':
     497    if ( current_user_can('install_themes') ) :
     498    $buttons .= '<a class="button-primary" id="install" href="' . wp_nonce_url(admin_url('theme-install.php?tab=install&theme=' . $api->slug), 'install-theme_' . $api->slug) . '" target="_parent">' . __('Install Now') . '</a>';
    482499    endif;
    483500    break;
    484501case 'update_available':
    485502    if ( current_user_can('update_themes') ) :
    486     ?><a class="button"
    487     href="<?php echo wp_nonce_url(admin_url('update.php?action=upgrade-theme&theme=' . $update_file), 'upgrade-theme_' . $update_file) ?>"
    488     target="_parent"><?php _e('Install Update Now') ?></a><?php
     503    $buttons .= '<a class="button-primary" id="install" href="' . wp_nonce_url(admin_url('update.php?action=upgrade-theme&theme=' . $update_file), 'upgrade-theme_' . $update_file) . '" target="_parent">' . __('Install Update Now') . '</a>';
    489504    endif;
    490505    break;
    491506case 'newer_installed':
    492507    if ( current_user_can('install_themes') || current_user_can('update_themes') ) :
    493     ?><a><?php printf(__('Newer Version (%s) Installed'), $newer_version) ?></a><?php
     508    ?><p><?php printf(__('Newer version (%s) is installed.'), $newer_version); ?></p><?php
    494509    endif;
    495510    break;
    496511case 'latest_installed':
    497512    if ( current_user_can('install_themes') || current_user_can('update_themes') ) :
    498     ?><a><?php _e('Latest Version Installed') ?></a><?php
     513    ?><p><?php _e('This version is already installed.'); ?></p><?php
    499514    endif;
    500515    break;
    501 } ?></p>
    502 <div class='available-theme'>
     516} ?>
     517<br class="clear" />
     518</div>
     519
     520<p class="action-button">
     521<?php echo $buttons; ?>
     522<br class="clear" />
     523</p>
     524
    503525<?php
    504 display_theme($api, array($action), false);
    505 ?>
    506 </div>
    507     <?php
    508526    iframe_footer();
    509527    exit;
Note: See TracChangeset for help on using the changeset viewer.