Make WordPress Core

Ticket #35617: 35617.0.diff

File 35617.0.diff, 3.1 KB (added by westonruter, 8 years ago)
  • src/wp-admin/js/customize-controls.js

    diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
    index 4901b56..caf296a 100644
     
    33753375                api.bind( 'nonce-refresh', function( nonce ) {
    33763376                        $.extend( api.settings.nonce, nonce );
    33773377                        $.extend( api.previewer.nonce, nonce );
     3378                        api.previewer.send( 'nonce-refresh', nonce );
    33783379                });
    33793380
    33803381                // Create Settings
  • src/wp-includes/class-wp-customize-manager.php

    diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
    index aa73ed7..da3b222 100644
    final class WP_Customize_Manager { 
    801801         */
    802802        public function customize_preview_settings() {
    803803                $settings = array(
     804                        'theme'    => array(
     805                                'stylesheet' => $this->get_stylesheet(),
     806                                'active'     => $this->is_theme_active(),
     807                        ),
    804808                        'channel' => wp_unslash( $_POST['customize_messenger_channel'] ),
    805809                        'activePanels' => array(),
    806810                        'activeSections' => array(),
    final class WP_Customize_Manager { 
    808812                        '_dirty' => array_keys( $this->unsanitized_post_values() ),
    809813                );
    810814
    811                 if ( 2 == $this->nonce_tick ) {
    812                         $settings['nonce'] = array(
    813                                 'save' => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ),
    814                                 'preview' => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() )
    815                         );
    816                 }
     815                $settings['nonce'] = array(
     816                        'save' => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ),
     817                        'preview' => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() ),
     818                );
     819
     820                /** This filter is documented in wp-includes/class-wp-customize-manager.php */
     821                $settings['nonce'] = apply_filters( 'customize_refresh_nonces', $settings['nonce'], $this );
    817822
    818823                foreach ( $this->panels as $panel_id => $panel ) {
    819824                        if ( $panel->check_capabilities() ) {
    final class WP_Customize_Manager { 
    17031708                        'documentTitleTmpl' => $this->get_document_title_template(),
    17041709                );
    17051710
     1711                /** This filter is documented in wp-includes/class-wp-customize-manager.php */
     1712                $settings['nonce'] = apply_filters( 'customize_refresh_nonces', $settings['nonce'], $this );
     1713
    17061714                // Prepare Customize Section objects to pass to JavaScript.
    17071715                foreach ( $this->sections() as $id => $section ) {
    17081716                        if ( $section->check_capabilities() ) {
  • src/wp-includes/js/customize-preview.js

    diff --git src/wp-includes/js/customize-preview.js src/wp-includes/js/customize-preview.js
    index 1d18027..b6da775 100644
     
    146146                });
    147147
    148148                api.preview.bind( 'active', function() {
    149                         if ( api.settings.nonce ) {
    150                                 api.preview.send( 'nonce', api.settings.nonce );
    151                         }
     149                        api.preview.send( 'nonce', api.settings.nonce );
    152150
    153151                        api.preview.send( 'documentTitle', document.title );
    154152                });
     
    163161                        } );
    164162                } );
    165163
     164                api.preview.bind( 'nonce-refresh', function( nonce ) {
     165                        $.extend( api.settings.nonce, nonce );
     166                } );
     167
    166168                /*
    167169                 * Send a message to the parent customize frame with a list of which
    168170                 * containers and controls are active.