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

git-svn-id: https://develop.svn.wordpress.org/trunk@8989 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood
2008-09-26 06:43:53 +00:00
parent e506385bd1
commit 2e12a7cc82
6 changed files with 221 additions and 10 deletions
+30 -1
View File
@@ -59,6 +59,32 @@ $page_links = paginate_links( array(
$themes = array_slice( $themes, $start, $per_page );
function theme_update_available( $theme ) {
static $themes_update;
if ( !isset($themes_update) )
$themes_update = get_option('update_themes');
if ( isset($theme->stylesheet) )
$stylesheet = $theme->stylesheet;
elseif ( isset($theme['Stylesheet']) )
$stylesheet = $theme['Stylesheet'];
else
return false; //No valid info passed.
if ( isset($themes_update->response[ $stylesheet ]) ) {
$update = $themes_update->response[ $stylesheet ];
$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.
$update_url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet);
if ( ! current_user_can('update_themes') )
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']);
else if ( empty($update->package) )
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']);
else
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 );
}
}
?>
<div class="wrap">
@@ -77,6 +103,8 @@ $themes = array_slice( $themes, $start, $per_page );
<?php if ( $ct->tags ) : ?>
<p><?php _e('Tags:'); ?> <?php echo join(', ', $ct->tags); ?></p>
<?php endif; ?>
<?php theme_update_available($ct); ?>
</div>
<h2><?php _e('Available Themes'); ?></h2>
@@ -141,8 +169,9 @@ foreach ( $cols as $col => $theme_name ) {
<p><?php echo $description; ?></p>
<?php if ( $tags ) : ?>
<p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
<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>
<?php endif; ?>
<?php theme_update_available( $themes[$theme_name] ); ?>
<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>
<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>
<?php endif; // end if not empty theme_name ?>
</td>