Changeset 7380 for trunk/src/includes/common/ajax.php
- Timestamp:
- 12/05/2025 02:27:53 AM (4 months ago)
- File:
-
- 1 edited
-
trunk/src/includes/common/ajax.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/common/ajax.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Common AJAX Functions 4 * bbPress Common AJAX Functions. 5 5 * 6 6 * Common AJAX functions are ones that are used to setup and/or use during … … 15 15 16 16 /** 17 * Output the URL to use for theme-side bbPress AJAX requests 17 * Output the URL to use for theme-side bbPress AJAX requests. 18 18 * 19 19 * @since 2.3.0 bbPress (r4543) … … 22 22 echo esc_url( bbp_get_ajax_url() ); 23 23 } 24 25 /** 26 * Return the URL to use for theme-side bbPress AJAX requests. 27 * 28 * @since 2.3.0 bbPress (r4543) 29 * 30 * @global WP $wp 31 * @return string 32 */ 33 function bbp_get_ajax_url() { 34 global $wp; 35 36 $ssl = bbp_get_url_scheme(); 37 $url = trailingslashit( $wp->request ); 38 $base_url = home_url( $url, $ssl ); 39 $ajaxurl = add_query_arg( array( 'bbp-ajax' => 'true' ), $base_url ); 40 24 41 /** 25 * Return the URL to use for theme-side bbPress AJAX requests42 * Filters the URL used for theme-side bbPress AJAX requests. 26 43 * 27 44 * @since 2.3.0 bbPress (r4543) 28 45 * 29 * @ global WP $wp30 * @return string 46 * @param string $ajaxurl The URL for bbPress AJAX requests. 47 * @return string The filtered URL for bbPress AJAX requests. 31 48 */ 32 function bbp_get_ajax_url() { 33 global $wp; 34 35 $ssl = bbp_get_url_scheme(); 36 $url = trailingslashit( $wp->request ); 37 $base_url = home_url( $url, $ssl ); 38 $ajaxurl = add_query_arg( array( 'bbp-ajax' => 'true' ), $base_url ); 39 40 /** 41 * Filters the URL used for theme-side bbPress AJAX requests. 42 * 43 * @since 2.3.0 bbPress (r4543) 44 * 45 * @param string $ajaxurl The URL for bbPress AJAX requests. 46 * @return string The filtered URL for bbPress AJAX requests. 47 */ 48 return apply_filters( 'bbp_get_ajax_url', $ajaxurl ); 49 } 49 return apply_filters( 'bbp_get_ajax_url', $ajaxurl ); 50 } 50 51 51 52 /** … … 54 55 * @since 2.3.0 bbPress (r4543) 55 56 * 56 * @return bool Looking for bbp-ajax 57 * @return bool Looking for bbp-ajax. 57 58 */ 58 59 function bbp_is_ajax() { … … 69 70 * @since 2.3.0 bbPress (r4543) 70 71 * 71 * @param string $action Sanitized action from bbp_post_request/bbp_get_request 72 * @param string $action Sanitized action from bbp_post_request/bbp_get_request. 72 73 * 73 * @return If not a bbPress AJAX request 74 * @return If not a bbPress AJAX request. 74 75 */ 75 76 function bbp_do_ajax( $action = '' ) { … … 112 113 113 114 /** 114 * Send headers for AJAX specific requests 115 * Send headers for AJAX specific requests. 115 116 * 116 117 * This was abstracted from bbp_do_ajax() for use in custom theme-side AJAX … … 133 134 134 135 /** 135 * Helper method to return JSON response for bbPress AJAX calls 136 * Helper method to return JSON response for bbPress AJAX calls. 136 137 * 137 138 * @since 2.3.0 bbPress (r4542)
Note: See TracChangeset
for help on using the changeset viewer.