Changeset 14371 for trunk/wp-admin/includes/theme.php
- Timestamp:
- 05/03/2010 01:29:15 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/theme.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/theme.php
r14370 r14371 242 242 } 243 243 244 /** 245 * Check if there is an update for a theme available. 246 * 247 * Will display link, if there is an update available. 248 * 249 * @since 2.7.0 250 * 251 * @param object $theme Theme data object. 252 * @return bool False if no valid info was passed. 253 */ 254 function theme_update_available( $theme ) { 255 static $themes_update; 256 257 if ( !current_user_can('update_themes' ) ) 258 return; 259 260 if ( !isset($themes_update) ) 261 $themes_update = get_site_transient('update_themes'); 262 263 if ( is_object($theme) && isset($theme->stylesheet) ) 264 $stylesheet = $theme->stylesheet; 265 elseif ( is_array($theme) && isset($theme['Stylesheet']) ) 266 $stylesheet = $theme['Stylesheet']; 267 else 268 return false; //No valid info passed. 269 270 if ( isset($themes_update->response[ $stylesheet ]) ) { 271 $update = $themes_update->response[ $stylesheet ]; 272 $theme_name = is_object($theme) ? $theme->name : (is_array($theme) ? $theme['Name'] : ''); 273 $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. 274 $update_url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet); 275 $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;"'; 276 277 if ( ! current_user_can('update_themes') ) 278 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']); 279 else if ( empty($update['package']) ) 280 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']); 281 else 282 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 ); 283 } 284 } 285 244 286 ?>
Note: See TracChangeset
for help on using the changeset viewer.