Changeset 21010 for trunk/wp-includes/class-wp-customize-manager.php
- Timestamp:
- 06/06/2012 08:34:24 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-customize-manager.php
r20995 r21010 79 79 */ 80 80 public function setup_theme() { 81 if ( ! ( isset( $_REQUEST['customize'] ) && 'on' == $_REQUEST['customize'] ) && ! basename( $_SERVER['PHP_SELF'] ) == 'customize.php' )82 return;83 84 81 send_origin_headers(); 82 83 $this->original_stylesheet = get_stylesheet(); 84 85 $this->theme = wp_get_theme( isset( $_REQUEST['theme'] ) ? $_REQUEST['theme'] : null ); 86 87 // You can't preview a theme if it doesn't exist, or if it is not allowed (unless active). 88 if ( ! $this->theme->exists() ) 89 wp_die( __( 'Cheatin’ uh?' ) ); 90 91 if ( $this->theme->get_stylesheet() != get_stylesheet() && ( ! $this->theme()->is_allowed() || ! current_user_can( 'switch_themes' ) ) ) 92 wp_die( __( 'Cheatin’ uh?' ) ); 93 94 if ( ! current_user_can( 'edit_theme_options' ) ) 95 wp_die( __( 'Cheatin’ uh?' ) ); 85 96 86 97 $this->start_previewing_theme(); … … 96 107 */ 97 108 public function start_previewing_theme() { 98 if ( $this->is_preview() || false === $this->theme || ( $this->theme && ! $this->theme->exists() ) ) 109 // Bail if we're already previewing. 110 if ( $this->is_preview() ) 99 111 return; 100 101 // Initialize $theme and $original_stylesheet if they do not yet exist.102 if ( ! isset( $this->theme ) ) {103 $this->theme = wp_get_theme( isset( $_REQUEST['theme'] ) ? $_REQUEST['theme'] : null );104 if ( ! $this->theme->exists() ) {105 $this->theme = false;106 return;107 }108 }109 110 $this->original_stylesheet = get_stylesheet();111 112 112 113 $this->previewing = true; … … 420 421 die; 421 422 422 check_ajax_referer( 'customize_controls ', 'nonce' );423 check_ajax_referer( 'customize_controls-' . $this->get_stylesheet(), 'nonce' ); 423 424 424 425 // Do we have to switch themes? 425 426 if ( $this->get_stylesheet() != $this->original_stylesheet ) { 426 if ( ! current_user_can( 'switch_themes' ) )427 die;428 429 427 // Temporarily stop previewing the theme to allow switch_themes() 430 428 // to operate properly.
Note: See TracChangeset
for help on using the changeset viewer.