Changeset 26282 for trunk/src/wp-admin/includes/theme.php
- Timestamp:
- 11/20/2013 02:56:52 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/theme.php
r26278 r26282 105 105 * 106 106 * @since 2.7.0 107 * @see get_theme_update_available() 107 108 * 108 109 * @param object $theme Theme data object. 109 * @return bool False if no valid info was passed.110 110 */ 111 111 function theme_update_available( $theme ) { 112 echo get_theme_update_available( $theme ); 113 } 114 115 /** 116 * Retrieve the update link if there is an update for a theme available. 117 * 118 * Will return a link, if there is an update available. 119 * 120 * @since 3.8.0 121 * 122 * @param object $theme Theme data object. 123 * @return string|bool HTML for the update link, or False if no valid info was passed. 124 */ 125 function get_theme_update_available( $theme ) { 112 126 static $themes_update; 113 127 114 128 if ( !current_user_can('update_themes' ) ) 115 return ;129 return false; 116 130 117 131 if ( !isset($themes_update) ) … … 119 133 120 134 if ( ! is_a( $theme, 'WP_Theme' ) ) 121 return ;135 return false; 122 136 123 137 $stylesheet = $theme->get_stylesheet(); 138 139 $html = ''; 124 140 125 141 if ( isset($themes_update->response[ $stylesheet ]) ) { … … 131 147 132 148 if ( !is_multisite() ) { 133 if ( ! current_user_can('update_themes') ) 134 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']); 135 else if ( empty($update['package']) ) 136 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 update is unavailable for this theme.</em>') . '</strong></p>', $theme_name, $details_url, $update['new_version']); 137 else 138 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>update now</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version'], $update_url, $update_onclick ); 139 } 140 } 149 if ( ! current_user_can('update_themes') ) { 150 $html = sprintf( '<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']); 151 } else if ( empty( $update['package'] ) ) { 152 $html = sprintf( '<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 update is unavailable for this theme.</em>') . '</strong></p>', $theme_name, $details_url, $update['new_version']); 153 } else { 154 $html = sprintf( '<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>update now</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version'], $update_url, $update_onclick ); 155 } 156 } 157 } 158 159 return $html; 141 160 } 142 161 … … 394 413 'active' => $slug === $current_theme, 395 414 'hasUpdate' => isset( $updates[ $slug ] ), 396 'update' => 'New version available', // @todo complete this415 'update' => get_theme_update_available( $theme ), 397 416 'actions' => array( 398 417 'activate' => wp_nonce_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug, 'switch-theme_' . $slug ),
Note: See TracChangeset
for help on using the changeset viewer.