mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Theme Customizer: Validate themes with more than just an existence check.
* The current theme goes through validate_current_theme(). * If doing a preview of a different theme, we check theme->errors(). Also: * Don't attach previewing hooks when previewing the current theme. Aside from being unnecessary, this prevents issues with a theme with the error of theme_parent_invalid. * Call send_origin_headers() earlier, to allow wp_die( '0' ) to properly be returned in a domain mapping situation. * Fix the 'Save & Activate' message on themes.php. fixes #20921. git-svn-id: https://develop.svn.wordpress.org/trunk@21069 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+14
-12
@@ -92,18 +92,6 @@ wp_enqueue_script( 'customize-loader' );
|
||||
require_once('./admin-header.php');
|
||||
?>
|
||||
|
||||
<?php if ( ! validate_current_theme() ) : ?>
|
||||
<div id="message1" class="updated"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
|
||||
<?php elseif ( isset($_GET['activated']) ) :
|
||||
if ( isset($wp_registered_sidebars) && count( (array) $wp_registered_sidebars ) && current_user_can('edit_theme_options') ) { ?>
|
||||
<div id="message2" class="updated"><p><?php printf( __('New theme activated. This theme supports widgets, please visit the <a href="%s">widgets settings</a> screen to configure them.'), admin_url( 'widgets.php' ) ); ?></p></div><?php
|
||||
} else { ?>
|
||||
<div id="message2" class="updated"><p><?php printf( __( 'New theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div><?php
|
||||
}
|
||||
elseif ( isset($_GET['deleted']) ) : ?>
|
||||
<div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="wrap"><?php
|
||||
screen_icon();
|
||||
if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
|
||||
@@ -114,6 +102,20 @@ if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
|
||||
<?php endif; ?>
|
||||
</h2>
|
||||
<?php
|
||||
if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) : ?>
|
||||
<div id="message1" class="updated"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
|
||||
<?php elseif ( isset($_GET['activated']) ) :
|
||||
if ( isset( $_GET['previewed'] ) ) { ?>
|
||||
<div id="message2" class="updated"><p><?php printf( __( 'Settings saved and theme activated. <a href="%s">Visit site</a>.' ), home_url( '/' ) ); ?></p></div>
|
||||
<?php } elseif ( isset($wp_registered_sidebars) && count( (array) $wp_registered_sidebars ) && current_user_can('edit_theme_options') ) { ?>
|
||||
<div id="message2" class="updated"><p><?php printf( __('New theme activated. This theme supports widgets, please visit the <a href="%s">widgets settings</a> screen to configure them.'), admin_url( 'widgets.php' ) ); ?></p></div><?php
|
||||
} else { ?>
|
||||
<div id="message2" class="updated"><p><?php printf( __( 'New theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div><?php
|
||||
}
|
||||
elseif ( isset($_GET['deleted']) ) : ?>
|
||||
<div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
$ct = wp_get_theme();
|
||||
$screenshot = $ct->get_screenshot();
|
||||
|
||||
Reference in New Issue
Block a user