Customizer: Restore showing a login form inside the previewer if an user is logged out.
Broken since [31370]. props westonruter. see #31294. Built from https://develop.svn.wordpress.org/trunk@31421 git-svn-id: http://core.svn.wordpress.org/trunk@31402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
46f98473d1
commit
1884ec383c
|
@ -140,11 +140,13 @@ final class WP_Customize_Manager {
|
||||||
* @param mixed $message UI message
|
* @param mixed $message UI message
|
||||||
*/
|
*/
|
||||||
protected function wp_die( $ajax_message, $message = null ) {
|
protected function wp_die( $ajax_message, $message = null ) {
|
||||||
if ( $this->doing_ajax() )
|
if ( $this->doing_ajax() || isset( $_POST['customized'] ) ) {
|
||||||
wp_die( $ajax_message );
|
wp_die( $ajax_message );
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! $message )
|
if ( ! $message ) {
|
||||||
$message = __( 'Cheatin’ uh?' );
|
$message = __( 'Cheatin’ uh?' );
|
||||||
|
}
|
||||||
|
|
||||||
wp_die( $message );
|
wp_die( $message );
|
||||||
}
|
}
|
||||||
|
@ -157,8 +159,9 @@ final class WP_Customize_Manager {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function wp_die_handler() {
|
public function wp_die_handler() {
|
||||||
if ( $this->doing_ajax() )
|
if ( $this->doing_ajax() || isset( $_POST['customized'] ) ) {
|
||||||
return '_ajax_wp_die_handler';
|
return '_ajax_wp_die_handler';
|
||||||
|
}
|
||||||
|
|
||||||
return '_default_wp_die_handler';
|
return '_default_wp_die_handler';
|
||||||
}
|
}
|
||||||
|
@ -173,10 +176,12 @@ final class WP_Customize_Manager {
|
||||||
public function setup_theme() {
|
public function setup_theme() {
|
||||||
send_origin_headers();
|
send_origin_headers();
|
||||||
|
|
||||||
if ( is_admin() && ! $this->doing_ajax() )
|
$doing_ajax_or_is_customized = ( $this->doing_ajax() || isset( $_POST['customized'] ) );
|
||||||
auth_redirect();
|
if ( is_admin() && ! $doing_ajax_or_is_customized ) {
|
||||||
elseif ( $this->doing_ajax() && ! is_user_logged_in() )
|
auth_redirect();
|
||||||
$this->wp_die( 0 );
|
} elseif ( $doing_ajax_or_is_customized && ! is_user_logged_in() ) {
|
||||||
|
$this->wp_die( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
show_admin_bar( false );
|
show_admin_bar( false );
|
||||||
|
|
||||||
|
@ -194,16 +199,19 @@ final class WP_Customize_Manager {
|
||||||
} else {
|
} else {
|
||||||
// If the requested theme is not the active theme and the user doesn't have the
|
// If the requested theme is not the active theme and the user doesn't have the
|
||||||
// switch_themes cap, bail.
|
// switch_themes cap, bail.
|
||||||
if ( ! current_user_can( 'switch_themes' ) )
|
if ( ! current_user_can( 'switch_themes' ) ) {
|
||||||
$this->wp_die( -1 );
|
$this->wp_die( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
// If the theme has errors while loading, bail.
|
// If the theme has errors while loading, bail.
|
||||||
if ( $this->theme()->errors() )
|
if ( $this->theme()->errors() ) {
|
||||||
$this->wp_die( -1 );
|
$this->wp_die( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
// If the theme isn't allowed per multisite settings, bail.
|
// If the theme isn't allowed per multisite settings, bail.
|
||||||
if ( ! $this->theme()->is_allowed() )
|
if ( ! $this->theme()->is_allowed() ) {
|
||||||
$this->wp_die( -1 );
|
$this->wp_die( -1 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->start_previewing_theme();
|
$this->start_previewing_theme();
|
||||||
|
@ -215,7 +223,8 @@ final class WP_Customize_Manager {
|
||||||
* @since 3.4.0
|
* @since 3.4.0
|
||||||
*/
|
*/
|
||||||
public function after_setup_theme() {
|
public function after_setup_theme() {
|
||||||
if ( ! $this->doing_ajax() && ! validate_current_theme() ) {
|
$doing_ajax_or_is_customized = ( $this->doing_ajax() || isset( $_SERVER['customized'] ) );
|
||||||
|
if ( ! $doing_ajax_or_is_customized && ! validate_current_theme() ) {
|
||||||
wp_redirect( 'themes.php?broken=true' );
|
wp_redirect( 'themes.php?broken=true' );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -229,8 +238,9 @@ final class WP_Customize_Manager {
|
||||||
*/
|
*/
|
||||||
public function start_previewing_theme() {
|
public function start_previewing_theme() {
|
||||||
// Bail if we're already previewing.
|
// Bail if we're already previewing.
|
||||||
if ( $this->is_preview() )
|
if ( $this->is_preview() ) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->previewing = true;
|
$this->previewing = true;
|
||||||
|
|
||||||
|
@ -266,8 +276,9 @@ final class WP_Customize_Manager {
|
||||||
* @since 3.4.0
|
* @since 3.4.0
|
||||||
*/
|
*/
|
||||||
public function stop_previewing_theme() {
|
public function stop_previewing_theme() {
|
||||||
if ( ! $this->is_preview() )
|
if ( ! $this->is_preview() ) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->previewing = false;
|
$this->previewing = false;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.2-alpha-31420';
|
$wp_version = '4.2-alpha-31421';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue