Changeset 54122 for trunk/src/wp-admin/includes/post.php
- Timestamp:
- 09/11/2022 08:44:50 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/post.php
r53715 r54122 2335 2335 } 2336 2336 2337 /* 2338 * Refresh nonces used by the meta box loader. 2339 * 2340 * The logic is very similar to that provided by post.js for the classic editor. 2341 */ 2342 $script = "( function( $ ) { 2343 var check, timeout; 2344 2345 function schedule() { 2346 check = false; 2347 window.clearTimeout( timeout ); 2348 timeout = window.setTimeout( function() { check = true; }, 300000 ); 2349 } 2350 2351 $( document ).on( 'heartbeat-send.wp-refresh-nonces', function( e, data ) { 2352 var post_id, \$authCheck = $( '#wp-auth-check-wrap' ); 2353 2354 if ( check || ( \$authCheck.length && ! \$authCheck.hasClass( 'hidden' ) ) ) { 2355 if ( ( post_id = $( '#post_ID' ).val() ) && $( '#_wpnonce' ).val() ) { 2356 data['wp-refresh-metabox-loader-nonces'] = { 2357 post_id: post_id 2358 }; 2359 } 2360 } 2361 }).on( 'heartbeat-tick.wp-refresh-nonces', function( e, data ) { 2362 var nonces = data['wp-refresh-metabox-loader-nonces']; 2363 2364 if ( nonces ) { 2365 if ( nonces.replace ) { 2366 if ( nonces.replace.metabox_loader_nonce && window._wpMetaBoxUrl && wp.url ) { 2367 window._wpMetaBoxUrl= wp.url.addQueryArgs( window._wpMetaBoxUrl, { 'meta-box-loader-nonce': nonces.replace.metabox_loader_nonce } ); 2368 } 2369 2370 if ( nonces.replace._wpnonce ) { 2371 $( '#_wpnonce' ).val( nonces.replace._wpnonce ); 2372 } 2373 } 2374 } 2375 }).ready( function() { 2376 schedule(); 2377 }); 2378 } )( jQuery );"; 2379 wp_add_inline_script( 'heartbeat', $script ); 2380 2337 2381 // Reset meta box data. 2338 2382 $wp_meta_boxes = $_original_meta_boxes;
Note: See TracChangeset
for help on using the changeset viewer.