Ticket #9508: 9508.2.diff
File 9508.2.diff, 5.4 KB (added by , 16 years ago) |
---|
-
wp-admin/includes/theme-install.php
97 97 * @param string $page 98 98 */ 99 99 function install_theme_search($page) { 100 global $theme_field_defaults; 101 100 102 $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : ''; 101 103 $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : ''; 102 104 … … 398 400 ?> 399 401 <table id="availablethemes" cellspacing="0" cellpadding="0"> 400 402 <?php 401 $in_column = 0; 403 402 404 $rows = ceil(count($themes) / 3); 403 405 $table = array(); 404 $i = 0; 405 for ( $row = 1; $row <= $rows; $row++ ) { 406 for ( $col = 1; $col <= 3; $col++ ) { 407 $table[$row][$col] = $i; 408 $i++; 409 } 410 } 406 $theme_keys = array_keys($themes); 407 for ( $row = 1; $row <= $rows; $row++ ) 408 for ( $col = 1; $col <= 3; $col++ ) 409 $table[$row][$col] = array_shift($theme_keys); 411 410 412 411 foreach ( $table as $row => $cols ) { 413 412 ?> 414 413 <tr> 415 414 <?php 416 415 417 416 foreach ( $cols as $col => $theme_index ) { 418 417 $class = array('available-theme'); 419 418 if ( $row == 1 ) $class[] = 'top'; 420 419 if ( $col == 1 ) $class[] = 'left'; 421 420 if ( $row == $rows ) $class[] = 'bottom'; 422 421 if ( $col == 3 ) $class[] = 'right'; 423 $theme = $themes[$theme_index];424 422 ?> 425 423 <td class="<?php echo join(' ', $class); ?>"><?php 426 display_theme($theme); 424 if ( isset($themes[$theme_index]) ) 425 display_theme($themes[$theme_index]); 427 426 ?></td> 428 427 <?php } // end foreach $cols ?> 429 428 </tr> … … 467 467 exit; 468 468 } 469 469 470 if ( version_compare($GLOBALS['wp_version'], $api->tested, '>') )470 if ( !empty($api->tested) && version_compare($GLOBALS['wp_version'], $api->tested, '>') ) 471 471 echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This theme has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>'; 472 else if ( version_compare($GLOBALS['wp_version'], $api->requires, '<') )472 else if ( !empty($api->requires) && version_compare($GLOBALS['wp_version'], $api->requires, '<') ) 473 473 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>'; 474 474 475 475 // Default to a "new" theme … … 477 477 // Check to see if this theme is known to be installed, and has an update awaiting it. 478 478 $update_themes = get_transient('update_themes'); 479 479 if ( is_object($update_themes) ) { 480 foreach ( (array)$update_themes->response as $ file => $theme) {481 if ( $theme ->slug === $api->slug ) {480 foreach ( (array)$update_themes->response as $theme_slug => $theme_info ) { 481 if ( $theme_slug === $api->slug ) { 482 482 $type = 'update_available'; 483 $update_file = $ file;483 $update_file = $theme_slug; 484 484 break; 485 485 } 486 486 } -
wp-admin/themes.php
84 84 if ( !isset($themes_update) ) 85 85 $themes_update = get_transient('update_themes'); 86 86 87 //Note: Current theme is object, with lower case keys, Others are arrays, with Camal Case keys 87 88 if ( is_object($theme) && isset($theme->stylesheet) ) 88 89 $stylesheet = $theme->stylesheet; 89 90 elseif ( is_array($theme) && isset($theme['Stylesheet']) ) … … 93 94 94 95 if ( isset($themes_update->response[ $stylesheet ]) ) { 95 96 $update = $themes_update->response[ $stylesheet ]; 97 $theme_name = is_object($theme) ? $theme->name : (is_array($theme) ? $theme['Name'] : ''); 98 96 99 $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. 97 100 $update_url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet); 98 101 99 102 if ( ! current_user_can('update_themes') ) 100 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']);103 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']); 101 104 else if ( empty($update->package) ) 102 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']);105 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']); 103 106 else 104 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 );107 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 ); 105 108 } 106 109 } 107 110