Changeset 21131
- Timestamp:
- 06/26/2012 05:21:04 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-upgrader.php
r21080 r21131 954 954 return $return; 955 955 956 // Ensure stylesheet name hasnt changed after the upgrade: 957 // @TODO: Note, This doesn't handle the Template changing, or the Template name changing. 956 // Ensure stylesheet name hasn't changed after the upgrade: 958 957 if ( $theme == get_stylesheet() && $theme != $this->result['destination_name'] ) { 959 $theme_info = $this->theme_info();958 wp_clean_themes_cache(); 960 959 $stylesheet = $this->result['destination_name']; 961 $template = $theme_info->get_template(); 962 switch_theme($template, $stylesheet, true); 960 switch_theme( $stylesheet ); 963 961 } 964 962 -
trunk/wp-admin/themes.php
r21106 r21131 21 21 if ( ! $theme->exists() || ! $theme->is_allowed() ) 22 22 wp_die( __( 'Cheatin’ uh?' ) ); 23 switch_theme( $_GET['template'], $_GET['stylesheet']);23 switch_theme( $theme->get_stylesheet() ); 24 24 wp_redirect( admin_url('themes.php?activated=true') ); 25 25 exit; -
trunk/wp-includes/class-wp-customize-manager.php
r21070 r21131 476 476 // to operate properly. 477 477 $this->stop_previewing_theme(); 478 switch_theme( $this->get_ template(), $this->get_stylesheet() );478 switch_theme( $this->get_stylesheet() ); 479 479 $this->start_previewing_theme(); 480 480 } -
trunk/wp-includes/theme.php
r21126 r21131 651 651 652 652 /** 653 * Switches current theme to new template and stylesheet names. 653 * Switches the theme. 654 * 655 * Accepts one argument: $stylesheet of the theme. It also accepts an additional function signature 656 * of two arguments: $template then $stylesheet. This is for backwards compatibility. 654 657 * 655 658 * @since 2.5.0 656 659 * @uses do_action() Calls 'switch_theme' action, passing the new theme. 657 660 * 658 * @param string $template Template name 659 * @param string $stylesheet Stylesheet name. 660 */ 661 function switch_theme( $template, $stylesheet ) { 661 * @param string $stylesheet Stylesheet name 662 */ 663 function switch_theme( $stylesheet ) { 662 664 global $wp_theme_directories, $sidebars_widgets; 663 665 … … 667 669 $old_theme = wp_get_theme(); 668 670 $new_theme = wp_get_theme( $stylesheet ); 669 $new_name = $new_theme->get('Name'); 671 672 if ( func_num_args() > 1 ) { 673 $template = $stylesheet; 674 $stylesheet = func_get_arg( 1 ); 675 } else { 676 $template = $new_theme->get_template(); 677 } 670 678 671 679 update_option( 'template', $template ); … … 676 684 update_option( 'stylesheet_root', get_raw_theme_root( $stylesheet, true ) ); 677 685 } 686 687 $new_name = $new_theme->get('Name'); 678 688 679 689 update_option( 'current_theme', $new_name ); … … 707 717 708 718 if ( get_template() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/index.php') ) { 709 switch_theme( WP_DEFAULT_THEME , WP_DEFAULT_THEME);719 switch_theme( WP_DEFAULT_THEME ); 710 720 return false; 711 721 } 712 722 713 723 if ( get_stylesheet() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/style.css') ) { 714 switch_theme( WP_DEFAULT_THEME , WP_DEFAULT_THEME);724 switch_theme( WP_DEFAULT_THEME ); 715 725 return false; 716 726 } 717 727 718 728 if ( is_child_theme() && ! file_exists( get_stylesheet_directory() . '/style.css' ) ) { 719 switch_theme( WP_DEFAULT_THEME , WP_DEFAULT_THEME);729 switch_theme( WP_DEFAULT_THEME ); 720 730 return false; 721 731 }
Note: See TracChangeset
for help on using the changeset viewer.