Make WordPress Core


Ignore:
Timestamp:
09/26/2008 06:43:53 AM (17 years ago)
Author:
westi
Message:

Theme update UI first pass. See #7519 props DD32.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/themes.php

    r8656 r8989  
    5959
    6060$themes = array_slice( $themes, $start, $per_page );
     61
     62function theme_update_available( $theme ) {
     63    static $themes_update;
     64    if ( !isset($themes_update) )
     65        $themes_update = get_option('update_themes');
     66
     67    if ( isset($theme->stylesheet) )
     68        $stylesheet = $theme->stylesheet;
     69    elseif ( isset($theme['Stylesheet']) )
     70        $stylesheet = $theme['Stylesheet'];
     71    else
     72        return false; //No valid info passed.
     73
     74    if ( isset($themes_update->response[ $stylesheet ]) ) {
     75        $update = $themes_update->response[ $stylesheet ];
     76        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
     77        $update_url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet);
     78
     79        if ( ! current_user_can('update_themes') )
     80            printf( __('<p>There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a>.</p>'), $ct->name, $details_url, $update['new_version']);
     81        else if ( empty($update->package) )
     82            printf( __('<p>There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> <em>automatic upgrade unavailable for this theme</em>.</p>'), $ct->name, $details_url, $update['new_version']);
     83        else
     84            printf( __('<p>There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> or <a href="%4$s">upgrade automatically</a>.</p>'), $ct->name, $details_url, $update['new_version'], $update_url );
     85    }
     86}
    6187
    6288?>
     
    78104<p><?php _e('Tags:'); ?> <?php echo join(', ', $ct->tags); ?></p>
    79105<?php endif; ?>
     106<?php theme_update_available($ct); ?>
     107
    80108</div>
    81109
     
    142170<?php if ( $tags ) : ?>
    143171        <p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
     172<?php endif; ?>
     173        <?php theme_update_available( $themes[$theme_name] ); ?>
    144174        <noscript><p class="themeactions"><a href="<?php echo $preview_link; ?>" title="<?php echo $preview_text; ?>"><?php _e('Preview'); ?></a> <a href="<?php echo $activate_link; ?>" title="<?php echo $activate_text; ?>"><?php _e('Activate'); ?></a></p></noscript>
    145 <?php endif; ?>
    146175        <div style="display:none;"><a class="previewlink" href="<?php echo $preview_link; ?>"><?php echo $preview_text; ?></a> <a class="activatelink" href="<?php echo $activate_link; ?>"><?php echo $activate_text; ?></a></div>
    147176<?php endif; // end if not empty theme_name ?>
Note: See TracChangeset for help on using the changeset viewer.