Changeset 20268
- Timestamp:
- 03/23/2012 10:20:26 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-upgrader.php
r20267 r20268 679 679 $theme_info = $this->theme_info(); 680 680 681 // Do we have any business here? 682 if ( empty($theme_info['Template']) ) 681 if ( ! $theme_info->parent() ) 683 682 return $install_result; 684 683 685 $this->skin->feedback('parent_theme_search', $theme_info['Template'] ); 686 687 $parent_theme = wp_get_theme( $theme_info['Template'] ); 688 if ( ! $parent_theme->errors() ) { 689 $this->skin->feedback( 'parent_theme_currently_installed', $parent_theme['Name'], $parent_theme['Version'] ); 684 $this->skin->feedback( 'parent_theme_search' ); 685 686 if ( ! $theme_info->parent()->errors() ) { 687 $this->skin->feedback( 'parent_theme_currently_installed', $theme_info->parent()->display('Name'), $theme_info->parent()->display('Version') ); 690 688 // We already have the theme, fall through. 691 689 return $install_result; … … 693 691 694 692 // We don't have the parent theme, lets install it 695 $api = themes_api('theme_information', array('slug' => $theme_info ['Template'], 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth.693 $api = themes_api('theme_information', array('slug' => $theme_info->get('Template'), 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth. 696 694 697 695 if ( ! $api || is_wp_error($api) ) { 698 $this->skin->feedback( 'parent_theme_not_found', $theme_info['Template']);696 $this->skin->feedback( 'parent_theme_not_found', $theme_info->get('Template') ); 699 697 // Don't show activate or preview actions after install 700 698 add_filter('install_theme_complete_actions', array(&$this, 'hide_activate_preview_actions') ); … … 712 710 $this->skin->feedback('parent_theme_prepare_install', $api->name, $api->version); 713 711 714 //@TODO: This is a DEBUG line! Only needed with the-common-blog line above.715 remove_filter('upgrader_post_install', array(&$this, 'check_parent_theme_filter'), 10, 3); // This is only needed when we're forcing a template on line 676 above.716 717 712 add_filter('install_theme_complete_actions', '__return_false', 999); // Don't show any actions after installing the theme. 718 713 … … 917 912 return $source; 918 913 919 if ( ! file_exists( $working_directory . 'style.css' ) ) // A proper archive should have a style.css file in the single subdirectory 914 // A proper archive should have a style.css file in the single subdirectory 915 if ( ! file_exists( $working_directory . 'style.css' ) ) 920 916 return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __('The theme is missing the <code>style.css</code> stylesheet.') ); 921 917 922 $info = get_theme_data( $working_directory . 'style.css' ); 923 if ( empty($info['Name']) ) 918 $info = get_file_data( $working_directory . 'style.css', array( 'Name' => 'Theme Name', 'Template' => 'Template' ) ); 919 920 if ( empty( $info['Name'] ) ) 924 921 return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __("The <code>style.css</code> stylesheet doesn't contain a valid theme header.") ); 925 922 926 if ( empty($info['Template']) && ! file_exists( $working_directory . 'index.php' ) ) // If no template is set, it must have at least an index.php to be legit. 923 // If it's not a child theme, it must have at least an index.php to be legit. 924 if ( empty( $info['Template'] ) && ! file_exists( $working_directory . 'index.php' ) ) 927 925 return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __('The theme is missing the <code>index.php</code> file.') ); 928 926 … … 952 950 $theme = isset($theme['theme']) ? $theme['theme'] : ''; 953 951 954 if ( $theme != get_stylesheet() ) // If not current952 if ( $theme != get_stylesheet() ) // If not current 955 953 return $return; 956 954 957 // Ensure stylesheet name hasnt changed after the upgrade:955 // Ensure stylesheet name hasnt changed after the upgrade: 958 956 // @TODO: Note, This doesn't handle the Template changing, or the Template name changing. 959 957 if ( $theme == get_stylesheet() && $theme != $this->result['destination_name'] ) { 960 958 $theme_info = $this->theme_info(); 961 959 $stylesheet = $this->result['destination_name']; 962 $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;960 $template = $theme_info->get_template(); 963 961 switch_theme($template, $stylesheet, true); 964 962 } … … 993 991 return false; 994 992 } 995 return get_theme_data(WP_CONTENT_DIR . '/themes/' . $theme . '/style.css');993 return wp_get_theme( $theme, WP_CONTENT_DIR . '/themes/' ); 996 994 } 997 995 … … 1372 1370 1373 1371 function before() { 1374 parent::before( $this->theme_info['Name']);1372 parent::before( $this->theme_info->display('Name') ); 1375 1373 } 1376 1374 1377 1375 function after() { 1378 parent::after($this->theme_info['Name']); 1379 } 1376 parent::after( $this->theme_info->display('Name') ); 1377 } 1378 1380 1379 function bulk_footer() { 1381 1380 parent::bulk_footer(); … … 1385 1384 ); 1386 1385 1387 $update_actions = apply_filters('update_bulk_theme_complete_actions', $update_actions, $this->theme_info );1386 $update_actions = apply_filters('update_bulk_theme_complete_actions', $update_actions, $this->theme_info ); 1388 1387 if ( ! empty($update_actions) ) 1389 1388 $this->feedback(implode(' | ', (array)$update_actions)); … … 1489 1488 if ( empty($theme_info) ) 1490 1489 return; 1491 $name = $theme_info ['Name'];1490 $name = $theme_info->display('Name'); 1492 1491 $stylesheet = $this->upgrader->result['destination_name']; 1493 $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;1492 $template = $theme_info->get_template(); 1494 1493 1495 1494 $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => 1, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) ); … … 1542 1541 1543 1542 $update_actions = array(); 1544 if ( !empty($this->upgrader->result['destination_name']) && 1545 ($theme_info = $this->upgrader->theme_info()) && 1546 !empty($theme_info) ) { 1547 1548 $name = $theme_info['Name']; 1543 if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) { 1544 $name = $theme_info->display('Name'); 1549 1545 $stylesheet = $this->upgrader->result['destination_name']; 1550 $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;1546 $template = $theme_info->get_template(); 1551 1547 1552 1548 $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) );
Note: See TracChangeset
for help on using the changeset viewer.