| | 248 | $themes = get_site_transient( 'update_themes' ); |
| | 249 | if ( isset($themes->response) && is_array($themes->response) ) { |
| | 250 | $themes = array_keys( $themes->response ); |
| | 251 | |
| | 252 | foreach( $themes as $theme ) { |
| | 253 | add_action( "after_theme_row_$theme", 'wp_theme_update_row', 10, 2 ); |
| | 254 | } |
| | 255 | } |
| | 256 | } |
| | 257 | add_action( 'admin_init', 'wp_theme_update_rows' ); |
| | 258 | |
| | 259 | function wp_theme_update_row( $theme_key, $theme ) { |
| | 260 | $current = get_site_transient( 'update_themes' ); |
| | 261 | if ( !isset( $current->response[ $theme_key ] ) ) |
| | 262 | return false; |
| | 263 | $r = $current->response[ $theme_key ]; |
| | 264 | $themes_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()); |
| | 265 | $theme_name = wp_kses( $theme['Name'], $themes_allowedtags ); |
| | 266 | |
| | 267 | $details_url = self_admin_url("theme-install.php?tab=theme-information&theme=$theme_key&TB_iframe=true&width=600&height=400"); |
| | 268 | |
| | 269 | echo '<tr class="plugin-update-tr"><td colspan="3" class="plugin-update"><div class="update-message">'; |
| | 270 | if ( ! current_user_can('update_themes') ) |
| | 271 | printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r->new_version ); |
| | 272 | else if ( empty( $r['package'] ) ) |
| | 273 | printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic upgrade is unavailable for this plugin.</em>'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'] ); |
| | 274 | else |
| | 275 | printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">upgrade automatically</a>.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'], wp_nonce_url( self_admin_url('update.php?action=upgrade-theme&theme=') . $theme_key, 'upgrade-theme_' . $theme_key) ); |
| | 276 | |
| | 277 | do_action( "in_theme_update_message-$theme_key", $theme, $r ); |
| | 278 | |
| | 279 | echo '</div></td></tr>'; |
| | 280 | } |
| | 281 | |