Changeset 6755 for trunk/src/includes/common/ajax.php
- Timestamp:
- 12/20/2017 04:43:09 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/common/ajax.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/common/ajax.php
r6745 r6755 57 57 * theme-side AJAX handler. 58 58 * 59 * This is largely taken from admin-ajax.php, but adapted specifically for 60 * theme-side bbPress-only AJAX requests. 61 * 59 62 * @since 2.3.0 bbPress (r4543) 63 * 64 * @param string $action Sanitized action from bbp_post_request/bbp_get_request 60 65 * 61 66 * @return If not a bbPress AJAX request 62 67 */ 63 function bbp_do_ajax( ) {68 function bbp_do_ajax( $action = '' ) { 64 69 65 // Bail if not a nAJAX request70 // Bail if not a bbPress specific AJAX request 66 71 if ( ! bbp_is_ajax() ) { 67 72 return; … … 73 78 // Set the header content type 74 79 @header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); 80 @header( 'X-Robots-Tag: noindex' ); 75 81 76 82 // Disable content sniffing in browsers that support it 77 83 send_nosniff_header(); 78 84 85 // Disable browser caching for 86 nocache_headers(); 87 88 // Compat for targeted action hooks (without $action param) 89 $action = empty( $action ) 90 ? sanitize_key( $_REQUEST['action'] ) 91 : $action; 92 93 // Setup action key 94 $key = "bbp_ajax_{$action}"; 95 96 // Bail if no action is registered 97 if ( empty( $action ) || ! has_action( $key ) ) { 98 wp_die( '0', 400 ); 99 } 100 79 101 // Everything is 200 OK. 80 102 bbp_set_200(); 81 103 82 // Perform custom bbPress ajax83 do_action( 'bbp_ajax_' . sanitize_key( $_REQUEST['action'] ));104 // Execute custom bbPress AJAX action 105 do_action( $key ); 84 106 85 107 // All done
Note: See TracChangeset
for help on using the changeset viewer.