Ticket #31897: 31897.diff
| File 31897.diff, 3.4 KB (added by , 10 years ago) |
|---|
-
src/wp-admin/customize.php
55 55 wp_enqueue_script( 'customize-controls' ); 56 56 wp_enqueue_style( 'customize-controls' ); 57 57 58 // Setup heartbeat to keep nonces up to date. 59 wp_enqueue_script( 'heartbeat' ); 60 58 61 /** 59 62 * Enqueue Customizer control scripts. 60 63 * -
src/wp-admin/includes/admin-filters.php
80 80 // Theme hooks. 81 81 add_action( 'customize_controls_print_footer_scripts', 'customize_themes_print_templates' ); 82 82 83 // Customizer hooks: refresh the customizer nonces using the hearbeat api. 84 add_filter( 'heartbeat_received', 'wp_refresh_customizer_nonces', 10, 3 ); 85 86 83 87 // Theme Install hooks. 84 88 // add_action('install_themes_dashboard', 'install_themes_dashboard'); 85 89 // add_action('install_themes_upload', 'install_themes_upload', 10, 0); -
src/wp-admin/includes/ajax-actions.php
2707 2707 wp_send_json( $response ); 2708 2708 } 2709 2709 } 2710 2711 2710 if ( ! empty( $data ) ) { 2712 2711 /** 2713 2712 * Filter the Heartbeat response received. -
src/wp-admin/includes/misc.php
843 843 return $response; 844 844 } 845 845 846 /** 847 * Return refreshed customizer nonces when needed. 848 * 849 * @since 4.5.0 850 */ 851 function wp_refresh_customizer_nonces( $response, $data, $screen_id ) { 852 853 if ( array_key_exists( 'wp-refresh-customizer-nonce', $data ) ) { 854 855 // Bootstrap the customizer. 856 require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; 857 $GLOBALS['wp_customize'] = new WP_Customize_Manager(); 858 $wp_customize = $GLOBALS['wp_customize']; 859 860 $received = $data['wp-refresh-customizer-nonce']; 861 862 if ( 2 === wp_verify_nonce( $received['save'], 'save-customize_' . $wp_customize->get_stylesheet() ) ) { 863 $response['wp-refresh-customizer-nonce'] = $wp_customize->get_nonces(); 864 } 865 } 866 867 return $response; 868 } 869 846 870 /** 847 871 * Disable suspension of Heartbeat on the Add/Edit Post screens. 848 872 * -
src/wp-admin/js/customize-controls.js
2946 2946 active: $.Deferred() 2947 2947 }; 2948 2948 2949 // When the heartbeat returns a refreshed nonce array, apply it. 2950 $( document ).on( 'heartbeat-tick.wp-refresh-nonces', function( e, data ) { 2951 if ( 'undefined' !== typeof data['wp-refresh-customizer-nonce'] ) { 2952 api.trigger( 'nonce-refresh', data['wp-refresh-customizer-nonce'] ); 2953 } 2954 } ); 2955 2956 // Attach our existing nonce to the heartbeat request, so it can be checked for expiration. 2957 $( document ).on( 'heartbeat-send.wp-refresh-nonces', function( e, data ) { 2958 data['wp-refresh-customizer-nonce'] = api.settings.nonce; 2959 } ); 2960 2949 2961 /* 2950 2962 * Wrap this.refresh to prevent it from hammering the servers: 2951 2963 *
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)