Changeset 14371 for trunk/wp-admin/themes.php
- Timestamp:
- 05/03/2010 01:29:15 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/themes.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/themes.php
r14369 r14371 88 88 89 89 $themes = array_slice( $themes, $start, $per_page ); 90 91 /**92 * Check if there is an update for a theme available.93 *94 * Will display link, if there is an update available.95 *96 * @since 2.7.097 *98 * @param object $theme Theme data object.99 * @return bool False if no valid info was passed.100 */101 function theme_update_available( $theme ) {102 static $themes_update;103 104 if ( !current_user_can('update_themes' ) )105 return;106 107 if ( !isset($themes_update) )108 $themes_update = get_site_transient('update_themes');109 110 if ( is_object($theme) && isset($theme->stylesheet) )111 $stylesheet = $theme->stylesheet;112 elseif ( is_array($theme) && isset($theme['Stylesheet']) )113 $stylesheet = $theme['Stylesheet'];114 else115 return false; //No valid info passed.116 117 if ( isset($themes_update->response[ $stylesheet ]) ) {118 $update = $themes_update->response[ $stylesheet ];119 $theme_name = is_object($theme) ? $theme->name : (is_array($theme) ? $theme['Name'] : '');120 $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.121 $update_url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet);122 $update_onclick = 'onclick="if ( confirm(\'' . esc_js( __("Upgrading this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to upgrade.") ) . '\') ) {return true;}return false;"';123 124 if ( ! current_user_can('update_themes') )125 printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version']);126 else if ( empty($update['package']) )127 printf( '<p><strong>' . __('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>.') . '</strong></p>', $theme_name, $details_url, $update['new_version']);128 else129 printf( '<p><strong>' . __('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" %5$s>upgrade automatically</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version'], $update_url, $update_onclick );130 }131 }132 133 90 ?> 134 91
Note: See TracChangeset
for help on using the changeset viewer.