Skip to:
Content

bbPress.org


Ignore:
Timestamp:
12/05/2025 02:27:53 AM (4 months ago)
Author:
johnjamesjacoby
Message:

Tools - Code Improvement: docs & code formatting improvements.

Props johnjamesjacoby, noruzzaman.

Fixes #3659.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/common/ajax.php

    r7379 r7380  
    22
    33/**
    4  * bbPress Common AJAX Functions
     4 * bbPress Common AJAX Functions.
    55 *
    66 * Common AJAX functions are ones that are used to setup and/or use during
     
    1515
    1616/**
    17  * Output the URL to use for theme-side bbPress AJAX requests
     17 * Output the URL to use for theme-side bbPress AJAX requests.
    1818 *
    1919 * @since 2.3.0 bbPress (r4543)
     
    2222    echo esc_url( bbp_get_ajax_url() );
    2323}
     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 */
     33function 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
    2441    /**
    25      * Return the URL to use for theme-side bbPress AJAX requests
     42     * Filters the URL used for theme-side bbPress AJAX requests.
    2643     *
    2744     * @since 2.3.0 bbPress (r4543)
    2845     *
    29      * @global WP $wp
    30      * @return string
     46     * @param string $ajaxurl The URL for bbPress AJAX requests.
     47     * @return string The filtered URL for bbPress AJAX requests.
    3148     */
    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}
    5051
    5152/**
     
    5455 * @since 2.3.0 bbPress (r4543)
    5556 *
    56  * @return bool Looking for bbp-ajax
     57 * @return bool Looking for bbp-ajax.
    5758 */
    5859function bbp_is_ajax() {
     
    6970 * @since 2.3.0 bbPress (r4543)
    7071 *
    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.
    7273 *
    73  * @return If not a bbPress AJAX request
     74 * @return If not a bbPress AJAX request.
    7475 */
    7576function bbp_do_ajax( $action = '' ) {
     
    112113
    113114/**
    114  * Send headers for AJAX specific requests
     115 * Send headers for AJAX specific requests.
    115116 *
    116117 * This was abstracted from bbp_do_ajax() for use in custom theme-side AJAX
     
    133134
    134135/**
    135  * Helper method to return JSON response for bbPress AJAX calls
     136 * Helper method to return JSON response for bbPress AJAX calls.
    136137 *
    137138 * @since 2.3.0 bbPress (r4542)
Note: See TracChangeset for help on using the changeset viewer.