Add nonce to AJAX action for script compression setting
Merges [37143] to the 4.4 branch git-svn-id: https://develop.svn.wordpress.org/branches/4.4@37144 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b0c1cef37c
commit
71a6ac9a0d
@ -197,8 +197,10 @@ function wp_ajax_wp_compression_test() {
|
||||
echo $out;
|
||||
wp_die();
|
||||
} elseif ( 'no' == $_GET['test'] ) {
|
||||
check_ajax_referer( 'update_can_compress_scripts' );
|
||||
update_site_option('can_compress_scripts', 0);
|
||||
} elseif ( 'yes' == $_GET['test'] ) {
|
||||
check_ajax_referer( 'update_can_compress_scripts' );
|
||||
update_site_option('can_compress_scripts', 1);
|
||||
}
|
||||
}
|
||||
|
@ -1784,6 +1784,7 @@ function _media_states( $post ) {
|
||||
function compression_test() {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
var compressionNonce = <?php echo wp_json_encode( wp_create_nonce( 'update_can_compress_scripts' ) ); ?>;
|
||||
var testCompression = {
|
||||
get : function(test) {
|
||||
var x;
|
||||
@ -1803,7 +1804,7 @@ function compression_test() {
|
||||
}
|
||||
};
|
||||
|
||||
x.open('GET', ajaxurl + '?action=wp-compression-test&test='+test+'&'+(new Date()).getTime(), true);
|
||||
x.open('GET', ajaxurl + '?action=wp-compression-test&test='+test+'&_ajax_nonce='+compressionNonce+'&'+(new Date()).getTime(), true);
|
||||
x.send('');
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user