Changeset 38334
- Timestamp:
- 08/23/2016 02:32:18 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-comments-list-table.php
r37674 r38334 95 95 $comments_per_page = $this->get_per_page( $comment_status ); 96 96 97 $doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;97 $doing_ajax = wp_doing_ajax(); 98 98 99 99 if ( isset( $_REQUEST['number'] ) ) { … … 601 601 602 602 // Reply and quickedit need a hide-if-no-js span when not added with ajax 603 if ( ( 'reply' === $action || 'quickedit' === $action ) && ! defined('DOING_AJAX') )603 if ( ( 'reply' === $action || 'quickedit' === $action ) && ! wp_doing_ajax() ) 604 604 $action .= ' hide-if-no-js'; 605 605 elseif ( ( $action === 'untrash' && $the_comment_status === 'trash' ) || ( $action === 'unspam' && $the_comment_status === 'spam' ) ) { -
trunk/src/wp-admin/includes/class-wp-list-table.php
r38146 r38334 285 285 286 286 // Redirect if page number is invalid and headers are not already sent. 287 if ( ! headers_sent() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {287 if ( ! headers_sent() && ! wp_doing_ajax() && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) { 288 288 wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) ); 289 289 exit; -
trunk/src/wp-admin/includes/class-wp-terms-list-table.php
r38077 r38334 368 368 $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' ); 369 369 370 $uri = ( defined( 'DOING_AJAX' ) && DOING_AJAX) ? wp_get_referer() : $_SERVER['REQUEST_URI'];370 $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI']; 371 371 372 372 $edit_link = add_query_arg( … … 426 426 $default_term = get_option( 'default_' . $taxonomy ); 427 427 428 $uri = ( defined( 'DOING_AJAX' ) && DOING_AJAX) ? wp_get_referer() : $_SERVER['REQUEST_URI'];428 $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI']; 429 429 430 430 $edit_link = add_query_arg( -
trunk/src/wp-admin/includes/dashboard.php
r38028 r38334 967 967 function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) { 968 968 $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; 969 $doing_ajax = ( defined('DOING_AJAX') && DOING_AJAX);969 $doing_ajax = wp_doing_ajax(); 970 970 971 971 if ( empty($check_urls) ) { -
trunk/src/wp-admin/includes/ms.php
r38024 r38334 41 41 } 42 42 43 if ( $file['error'] != '0' && ! isset( $_POST['html-upload'] ) && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX) ) {43 if ( $file['error'] != '0' && ! isset( $_POST['html-upload'] ) && ! wp_doing_ajax() ) { 44 44 wp_die( $file['error'] . ' <a href="javascript:history.go(-1)">' . __( 'Back' ) . '</a>' ); 45 45 } -
trunk/src/wp-admin/includes/theme.php
r38167 r38334 460 460 461 461 if ( $ssl && is_wp_error( $request ) ) { 462 if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX) {462 if ( ! wp_doing_ajax() ) { 463 463 trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); 464 464 } -
trunk/src/wp-includes/class-wp-ajax-response.php
r38028 r38334 150 150 echo $response; 151 151 echo '</wp_ajax>'; 152 if ( defined( 'DOING_AJAX' ) && DOING_AJAX)152 if ( wp_doing_ajax() ) 153 153 wp_die(); 154 154 else -
trunk/src/wp-includes/class-wp-customize-manager.php
r38299 r38334 316 316 */ 317 317 public function doing_ajax( $action = null ) { 318 $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); 319 if ( ! $doing_ajax ) { 318 if ( ! wp_doing_ajax() ) { 320 319 return false; 321 320 } -
trunk/src/wp-includes/comment.php
r38313 r38334 633 633 */ 634 634 do_action( 'comment_duplicate_trigger', $commentdata ); 635 if ( defined( 'DOING_AJAX') ) {635 if ( wp_doing_ajax() ) { 636 636 die( __('Duplicate comment detected; it looks as though you’ve already said that!') ); 637 637 } … … 769 769 do_action( 'comment_flood_trigger', $time_lastcomment, $time_newcomment ); 770 770 771 if ( defined('DOING_AJAX') )771 if ( wp_doing_ajax() ) 772 772 die( __('You are posting comments too quickly. Slow down.') ); 773 773 -
trunk/src/wp-includes/functions.php
r38308 r38334 2571 2571 } 2572 2572 2573 if ( defined( 'DOING_AJAX' ) && DOING_AJAX) {2573 if ( wp_doing_ajax() ) { 2574 2574 /** 2575 2575 * Filters the callback for killing WordPress execution for Ajax requests. … … 3065 3065 @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); 3066 3066 echo wp_json_encode( $response ); 3067 if ( defined( 'DOING_AJAX' ) && DOING_AJAX)3067 if ( wp_doing_ajax() ) 3068 3068 wp_die(); 3069 3069 else -
trunk/src/wp-includes/load.php
r38239 r38334 335 335 } 336 336 337 if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX) ) {337 if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || wp_doing_ajax() ) { 338 338 @ini_set( 'display_errors', 0 ); 339 339 } … … 1028 1028 return false; 1029 1029 } 1030 1031 /** 1032 * Determines whether the current request is a WordPress Ajax request. 1033 * 1034 * @since 4.7.0 1035 * 1036 * @return bool True if it's a WordPress Ajax request, false otherwise. 1037 */ 1038 function wp_doing_ajax() { 1039 /** 1040 * Filter whether the current request is a WordPress Ajax request. 1041 * 1042 * @since 4.7.0 1043 * 1044 * @param bool $wp_doing_ajax Whether the current request is a WordPress Ajax request. 1045 */ 1046 return apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX ); 1047 } -
trunk/src/wp-includes/option.php
r38307 r38334 787 787 function wp_user_settings() { 788 788 789 if ( ! is_admin() || defined( 'DOING_AJAX') ) {789 if ( ! is_admin() || wp_doing_ajax() ) { 790 790 return; 791 791 } -
trunk/src/wp-includes/pluggable.php
r38286 r38334 604 604 605 605 // Allow a grace period for POST and Ajax requests 606 if ( defined('DOING_AJAX') || 'POST' == $_SERVER['REQUEST_METHOD'] ) {606 if ( wp_doing_ajax() || 'POST' == $_SERVER['REQUEST_METHOD'] ) { 607 607 $expired += HOUR_IN_SECONDS; 608 608 } … … 1105 1105 1106 1106 if ( $die && false === $result ) { 1107 if ( defined( 'DOING_AJAX' ) && DOING_AJAX) {1107 if ( wp_doing_ajax() ) { 1108 1108 wp_die( -1 ); 1109 1109 } else { -
trunk/src/wp-includes/update.php
r37570 r38334 679 679 } 680 680 681 if ( ( ! is_main_site() && ! is_network_admin() ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX) ) {681 if ( ( ! is_main_site() && ! is_network_admin() ) || wp_doing_ajax() ) { 682 682 return; 683 683 }
Note: See TracChangeset
for help on using the changeset viewer.