Theme insall cleanups. Props DD32. fixes #9508
git-svn-id: http://svn.automattic.com/wordpress/trunk@10923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4be0d4b866
commit
e3acc800f8
|
@ -97,6 +97,8 @@ add_action('install_themes_search', 'install_theme_search', 10, 1);
|
|||
* @param string $page
|
||||
*/
|
||||
function install_theme_search($page) {
|
||||
global $theme_field_defaults;
|
||||
|
||||
$type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
|
||||
$term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
|
||||
|
||||
|
@ -398,16 +400,12 @@ function display_themes($themes, $page = 1, $totalpages = 1) {
|
|||
?>
|
||||
<table id="availablethemes" cellspacing="0" cellpadding="0">
|
||||
<?php
|
||||
$in_column = 0;
|
||||
$rows = ceil(count($themes) / 3);
|
||||
$table = array();
|
||||
$i = 0;
|
||||
for ( $row = 1; $row <= $rows; $row++ ) {
|
||||
for ( $col = 1; $col <= 3; $col++ ) {
|
||||
$table[$row][$col] = $i;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$theme_keys = array_keys($themes);
|
||||
for ( $row = 1; $row <= $rows; $row++ )
|
||||
for ( $col = 1; $col <= 3; $col++ )
|
||||
$table[$row][$col] = array_shift($theme_keys);
|
||||
|
||||
foreach ( $table as $row => $cols ) {
|
||||
?>
|
||||
|
@ -419,10 +417,10 @@ function display_themes($themes, $page = 1, $totalpages = 1) {
|
|||
if ( $col == 1 ) $class[] = 'left';
|
||||
if ( $row == $rows ) $class[] = 'bottom';
|
||||
if ( $col == 3 ) $class[] = 'right';
|
||||
$theme = $themes[$theme_index];
|
||||
?>
|
||||
<td class="<?php echo join(' ', $class); ?>"><?php
|
||||
display_theme($theme);
|
||||
if ( isset($themes[$theme_index]) )
|
||||
display_theme($themes[$theme_index]);
|
||||
?></td>
|
||||
<?php } // end foreach $cols ?>
|
||||
</tr>
|
||||
|
@ -467,20 +465,20 @@ function install_theme_information() {
|
|||
exit;
|
||||
}
|
||||
|
||||
if ( version_compare($GLOBALS['wp_version'], $api->tested, '>') )
|
||||
if ( !empty($api->tested) && version_compare($GLOBALS['wp_version'], $api->tested, '>') )
|
||||
echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This theme has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';
|
||||
else if ( version_compare($GLOBALS['wp_version'], $api->requires, '<') )
|
||||
else if ( !empty($api->requires) && version_compare($GLOBALS['wp_version'], $api->requires, '<') )
|
||||
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>';
|
||||
|
||||
// Default to a "new" theme
|
||||
$type = 'install';
|
||||
// Check to see if this theme is known to be installed, and has an update awaiting it.
|
||||
$update_themes = get_transient('update_themes');
|
||||
if ( is_object($update_themes) ) {
|
||||
foreach ( (array)$update_themes->response as $file => $theme ) {
|
||||
if ( $theme->slug === $api->slug ) {
|
||||
if ( is_object($update_themes) && isset($update_themes->response) ) {
|
||||
foreach ( (array)$update_themes->response as $theme_slug => $theme_info ) {
|
||||
if ( $theme_slug === $api->slug ) {
|
||||
$type = 'update_available';
|
||||
$update_file = $file;
|
||||
$update_file = $theme_slug;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,15 +93,16 @@ function theme_update_available( $theme ) {
|
|||
|
||||
if ( isset($themes_update->response[ $stylesheet ]) ) {
|
||||
$update = $themes_update->response[ $stylesheet ];
|
||||
$theme_name = is_object($theme) ? $theme->name : (is_array($theme) ? $theme['Name'] : '');
|
||||
$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']);
|
||||
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>'), $theme_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']);
|
||||
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>'), $theme_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 );
|
||||
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>'), $theme_name, $details_url, $update['new_version'], $update_url );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue