mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-06 12:51:58 +00:00
Refresh nonces in the customizer. props koopersmith. see #20876.
git-svn-id: https://develop.svn.wordpress.org/trunk@21135 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -17,6 +17,8 @@ final class WP_Customize_Manager {
|
||||
protected $sections = array();
|
||||
protected $controls = array();
|
||||
|
||||
protected $nonce_tick;
|
||||
|
||||
protected $customized;
|
||||
|
||||
private $_post_values;
|
||||
@@ -308,6 +310,8 @@ final class WP_Customize_Manager {
|
||||
* @since 3.4.0
|
||||
*/
|
||||
public function customize_preview_init() {
|
||||
$this->nonce_tick = check_ajax_referer( 'preview-customize_' . $this->get_stylesheet(), 'nonce' );
|
||||
|
||||
$this->prepare_controls();
|
||||
|
||||
wp_enqueue_script( 'customize-preview' );
|
||||
@@ -362,6 +366,13 @@ final class WP_Customize_Manager {
|
||||
'channel' => esc_js( $_POST['customize_messenger_channel'] ),
|
||||
);
|
||||
|
||||
if ( 2 == $this->nonce_tick ) {
|
||||
$settings['nonce'] = array(
|
||||
'save' => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ),
|
||||
'preview' => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() )
|
||||
);
|
||||
}
|
||||
|
||||
foreach ( $this->settings as $id => $setting ) {
|
||||
$settings['values'][ $id ] = $setting->js_value();
|
||||
}
|
||||
@@ -468,7 +479,7 @@ final class WP_Customize_Manager {
|
||||
if ( ! $this->is_preview() )
|
||||
die;
|
||||
|
||||
check_ajax_referer( 'customize_controls-' . $this->get_stylesheet(), 'nonce' );
|
||||
check_ajax_referer( 'save-customize_' . $this->get_stylesheet(), 'nonce' );
|
||||
|
||||
// Do we have to switch themes?
|
||||
if ( ! $this->is_theme_active() ) {
|
||||
|
||||
Reference in New Issue
Block a user