Changeset 24406
- Timestamp:
- 06/05/2013 12:13:40 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ajax-actions.php
r24388 r24406 14 14 15 15 // screen_id is the same as $current_screen->id and the JS global 'pagenow' 16 if ( ! empty($_POST['screen id']) )17 $screen_id = sanitize_key($_POST['screen id']);16 if ( ! empty($_POST['screen_id']) ) 17 $screen_id = sanitize_key($_POST['screen_id']); 18 18 else 19 $screen_id = ' site';19 $screen_id = 'front'; 20 20 21 21 if ( ! empty($_POST['data']) ) { … … 30 30 31 31 // send the current time according to the server 32 $response['server time'] = time();32 $response['server_time'] = time(); 33 33 34 34 wp_send_json($response); … … 2059 2059 2060 2060 // screen_id is the same as $current_screen->id and the JS global 'pagenow' 2061 if ( ! empty($_POST['screen id']) )2062 $screen_id = sanitize_key($_POST['screen id']);2061 if ( ! empty($_POST['screen_id']) ) 2062 $screen_id = sanitize_key($_POST['screen_id']); 2063 2063 else 2064 $screen_id = ' site';2064 $screen_id = 'front'; 2065 2065 2066 2066 if ( ! empty($_POST['data']) ) { 2067 2067 $data = (array) $_POST['data']; 2068 // todo: how much to sanitize and preset and what to leave to be accessed from $data or $_POST..?2069 $user = wp_get_current_user();2070 $data['user_id'] = $user->exists() ? $user->ID : 0;2071 2068 2072 2069 // todo: separate filters: 'heartbeat_[action]' so we call different callbacks only when there is data for them, … … 2081 2078 2082 2079 // send the current time acording to the server 2083 $response['server time'] = time();2080 $response['server_time'] = time(); 2084 2081 2085 2082 wp_send_json($response); -
trunk/wp-admin/includes/misc.php
r24303 r24406 570 570 $checked = array(); 571 571 572 if ( 'edit-post' == $screen_id && array_key_exists( 'wp-check-locked ', $data ) && is_array( $data['wp-check-locked'] ) ) {573 foreach ( $data['wp-check-locked '] as $key ) {572 if ( 'edit-post' == $screen_id && array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) { 573 foreach ( $data['wp-check-locked-posts'] as $key ) { 574 574 $post_id = (int) substr( $key, 5 ); 575 575 … … 586 586 587 587 if ( ! empty( $checked ) ) 588 $response['wp-check-locked '] = $checked;588 $response['wp-check-locked-posts'] = $checked; 589 589 590 590 return $response; … … 602 602 $send = array(); 603 603 604 if ( ! $post_id = absint( $received['post_id'] ) )604 if ( ! $post_id = absint( $received['post_id'] ) ) 605 605 return $response; 606 606 607 if ( ! current_user_can('edit_post', $post_id) )607 if ( ! current_user_can('edit_post', $post_id) ) 608 608 return $response; 609 609 -
trunk/wp-admin/js/inline-edit-post.js
r24299 r24406 294 294 295 295 // Show/hide locks on posts 296 $( document ).on( 'heartbeat-tick.wp-check-locked ', function( e, data ) {297 var locked = data['wp-check-locked '] || {};296 $( document ).on( 'heartbeat-tick.wp-check-locked-posts', function( e, data ) { 297 var locked = data['wp-check-locked-posts'] || {}; 298 298 299 299 $('#the-list tr').each( function(i, el) { … … 316 316 } 317 317 }); 318 }).on( 'heartbeat-send.wp-check-locked ', function( e, data ) {318 }).on( 'heartbeat-send.wp-check-locked-posts', function( e, data ) { 319 319 var check = []; 320 320 … … 325 325 326 326 if ( check.length ) 327 data['wp-check-locked '] = check;327 data['wp-check-locked-posts'] = check; 328 328 }); 329 329 -
trunk/wp-includes/js/heartbeat.js
r24384 r24406 12 12 beat, 13 13 nonce, 14 screen id = typeof pagenow != 'undefined' ? pagenow : '',14 screenId = typeof pagenow != 'undefined' ? pagenow : '', 15 15 url = typeof ajaxurl != 'undefined' ? ajaxurl : '', 16 16 settings, … … 43 43 interval = settings.interval || 15; // default interval 44 44 delete settings.interval; 45 // The interval can be from 5 to 60sec.46 if ( interval < 5 )47 interval = 5;45 // The interval can be from 15 to 60 sec. and can be set temporarily to 5 sec. 46 if ( interval < 15 ) 47 interval = 15; 48 48 else if ( interval > 60 ) 49 49 interval = 60; … … 51 51 interval = interval * 1000; 52 52 53 // 'screen id' can be added from settings on the front-end where the JS global 'pagenow' is not set54 screen id = screenid || settings.screenid || 'site';55 delete settings.screen id;53 // 'screenId' can be added from settings on the front-end where the JS global 'pagenow' is not set 54 screenId = screenId || settings.screenId || 'front'; 55 delete settings.screenId; 56 56 57 57 // Add or overwrite public vars … … 84 84 } 85 85 86 // Set error state and fire an event ifXHR errors or timeout86 // Set error state and fire an event on XHR errors or timeout 87 87 function errorstate( error ) { 88 88 var trigger; … … 149 149 send._nonce = nonce; 150 150 send.action = 'heartbeat'; 151 send.screen id = screenid;151 send.screen_id = screenId; 152 152 send.has_focus = hasFocus; 153 153
Note: See TracChangeset
for help on using the changeset viewer.