Skip to:
Content

bbPress.org

Changeset 7361


Ignore:
Timestamp:
11/16/2025 11:04:14 PM (2 months ago)
Author:
johnjamesjacoby
Message:

Tools - Code Improvement: Document some filters.

This commit improves the code documentation of several filters across the codebase.

Props johnjamesjacoby, narenin, sirlouen.

In trunk, for 2.7.

See #3110.

Location:
trunk/src/includes
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/classes/class-bbp-admin.php

    r7360 r7361  
    692692        }
    693693
    694         // Filter & return
     694        /**
     695         * Filters the mapped Settings capabilities.
     696         *
     697         * @since 2.2.0
     698         *
     699         * @param array  $caps    The capabilities for meta capability.
     700         * @param string $cap     Capability name.
     701         * @param int    $user_id User ID.
     702         * @param array  $args    Arguments.
     703         */
    695704        return (array) apply_filters( 'bbp_map_settings_meta_caps', $caps, $cap, $user_id, $args );
    696705    }
  • trunk/src/includes/admin/common.php

    r6780 r7361  
    140140    $value = rtrim( $value, '/' );
    141141
    142     // Filter & return
     142    /**
     143     * Filters the sanitized slug value.
     144     *
     145     * @since 2.6.0 bbPress (r5364)
     146     *
     147     * @param string $value The sanitized slug.
     148     * @param string $slug  The original slug value.
     149     */
    143150    return apply_filters( 'bbp_sanitize_slug', $value, $slug );
    144151}
  • trunk/src/includes/admin/forums.php

    r7360 r7361  
    483483    private function get_row_action_sort_order() {
    484484
    485         // Filter & return
     485        /**
     486         * Filters the row action sort order.
     487         *
     488         * @since 2.6.0 bbPress (r6771)
     489         *
     490         * @param array $order The default sort order.
     491         */
    486492        return (array) apply_filters( 'bbp_admin_forum_row_action_sort_order', array(
    487493            'edit',
     
    503509    private function get_allowed_notice_toggles() {
    504510
    505         // Filter & return
    506         return apply_filters( 'bbp_admin_forums_allowed_notice_toggles', array(
     511        /**
     512         * Filters the allowed notice toggles.
     513         *
     514         * @since 2.6.0 bbPress (r6396)
     515         *
     516         * @param array $toggles The default notice toggles.
     517         */
     518        return (array) apply_filters( 'bbp_admin_forums_allowed_notice_toggles', array(
    507519            'opened',
    508520            'closed'
     
    519531    private function get_allowed_action_toggles() {
    520532
    521         // Filter & return
     533        /**
     534         * Filters the allowed action toggles.
     535         *
     536         * @since 2.6.0 bbPress (r6396)
     537         *
     538         * @param array $toggles The default action toggles.
     539         */
    522540        return apply_filters( 'bbp_admin_forums_allowed_action_toggles', array(
    523541            'bbp_toggle_forum_close'
     
    553571        }
    554572
    555         // Filter & return
    556         return apply_filters( 'bbp_admin_forums_column_headers', $columns );
     573        /**
     574         * Filters the column headers for the forums page.
     575         *
     576         * @since 2.0.0 bbPress (r2485)
     577         *
     578         * @param array $columns The column headers.
     579         */
     580        return (array) apply_filters( 'bbp_admin_forums_column_headers', $columns );
    557581    }
    558582
  • trunk/src/includes/admin/metaboxes.php

    r7360 r7361  
    8888    }
    8989
    90     // Filter & return
    91     return apply_filters( 'bbp_dashboard_at_a_glance', $elements, $r );
     90    /**
     91     * Filters the "at a glance" dashboard items.
     92     *
     93     * @since 2.6.0
     94     *
     95     * @param array $elements The existing "at a glance" dashboard items.
     96     * @param array $r        The statistics array.
     97     */
     98    return (array) apply_filters( 'bbp_dashboard_at_a_glance', $elements, $r );
    9299}
    93100
  • trunk/src/includes/admin/replies.php

    r7360 r7361  
    612612    private function get_row_action_sort_order() {
    613613
    614         // Filter & return
     614        /**
     615         * Filters the row action sort order for replies.
     616         *
     617         * @since 2.6.0 bbPress (r6771)
     618         *
     619         * @param array $order The default sort order.
     620         */
    615621        return (array) apply_filters( 'bbp_admin_reply_row_action_sort_order', array(
    616622            'edit',
     
    635641    private function get_allowed_notice_toggles() {
    636642
    637         // Filter & return
    638         return apply_filters( 'bbp_admin_replies_allowed_notice_toggles', array(
     643        /**
     644         * Filters the allowed notice toggles for replies.
     645         *
     646         * @since 2.6.0 bbPress (r6396)
     647         *
     648         * @param array $toggles The default notice toggles.
     649         */
     650        return (array) apply_filters( 'bbp_admin_replies_allowed_notice_toggles', array(
    639651            'spammed',
    640652            'unspammed',
     
    653665    private function get_allowed_action_toggles() {
    654666
    655         // Filter & return
    656         return apply_filters( 'bbp_admin_replies_allowed_action_toggles', array(
     667        /**
     668         * Filters the allowed action toggles for replies.
     669         *
     670         * @since 2.6.0 bbPress (r6396)
     671         *
     672         * @param array $toggles The default action toggles.
     673         */
     674        return (array) apply_filters( 'bbp_admin_replies_allowed_action_toggles', array(
    657675            'bbp_toggle_reply_spam',
    658676            'bbp_toggle_reply_approve'
     
    679697        );
    680698
    681         // Filter & return
    682         return apply_filters( 'bbp_admin_replies_column_headers', $columns );
     699        /**
     700         * Filters the column headers for the replies page.
     701         *
     702         * @since 2.0.0 bbPress (r2577)
     703         *
     704         * @param array $columns The column headers.
     705         */
     706        return (array) apply_filters( 'bbp_admin_replies_column_headers', $columns );
    683707    }
    684708
  • trunk/src/includes/admin/tools.php

    r7006 r7361  
    515515    $tools_url = admin_url( 'tools.php' );
    516516
    517     // Filter & return
     517    /**
     518     * Filters the tools admin pages.
     519     *
     520     * @since 2.6.0 bbPress (r6273)
     521     *
     522     * @param array $pages The default array of tools pages.
     523     */
    518524    return (array) apply_filters( 'bbp_tools_admin_tabs', array(
    519525        array(
  • trunk/src/includes/admin/tools/converter.php

    r7046 r7361  
    5151    }
    5252
    53     // Filter & return
     53    /**
     54     * Filters the array of available converters.
     55     *
     56     * @since 2.6.0 bbPress (r6447)
     57     *
     58     * @param array $files Array of available converters with names as keys and file paths as values.
     59     */
    5460    return (array) apply_filters( 'bbp_get_converters', $files );
    5561}
     
    96102    }
    97103
    98     // Filter & return
     104    /**
     105     * Filters the newly created converter object.
     106     *
     107     * @since 2.0.0
     108     *
     109     * @param mixed  $converter The converter object if it exists, null otherwise.
     110     * @param string $platform  Name of the platform class used for conversion.
     111     */
    99112    return apply_filters( 'bbp_new_converter', $converter, $platform );
    100113}
  • trunk/src/includes/common/ajax.php

    r6871 r7361  
    3838        $ajaxurl  = add_query_arg( array( 'bbp-ajax' => 'true' ), $base_url );
    3939
    40         // Filter & return
     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         */
    4148        return apply_filters( 'bbp_get_ajax_url', $ajaxurl );
    4249    }
  • trunk/src/includes/common/shortcodes.php

    r7357 r7361  
    173173        $output = ob_get_clean();
    174174
    175         // Filter & return
     175        /**
     176         * Filters the contents of the output buffer before returning.
     177         *
     178         * @since 2.0.0 bbPress (r3079)
     179         *
     180         * @param string $output     The contents of the output buffer.
     181         * @param string $query_name The query name used for this output.
     182         */
    176183        return apply_filters( 'bbp_display_shortcode', $output, $query_name );
    177184    }
  • trunk/src/includes/core/template-loader.php

    r7357 r7361  
    9393    }
    9494
    95     // Filter & return
     95     /**
     96     * Filters the path to the template file that is being used.
     97     *
     98     * @since 2.0.0 bbPress (r3032)
     99     *
     100     * @param string $template The path to the template file.
     101     */
    96102    return apply_filters( 'bbp_template_include_theme_supports', $template );
    97103}
  • trunk/src/includes/extend/buddypress/groups.php

    r7360 r7361  
    304304        }
    305305
    306         // Filter & return
     306        /**
     307         * Filters the Group Forum Topic meta capabilities.
     308         *
     309         * @since 2.2.0 bbPress (r4434)
     310         *
     311         * @param array  $caps    Capabilities for the meta capability.
     312         * @param string $cap     Capability name.
     313         * @param int    $user_id User ID.
     314         * @param array  $args    Arguments.
     315         */
    307316        return (array) apply_filters( 'bbp_map_group_forum_topic_meta_caps', $caps, $cap, $user_id, $args );
    308317    }
  • trunk/src/includes/replies/capabilities.php

    r7350 r7361  
    1919function bbp_get_reply_caps() {
    2020
    21     // Filter & return
     21    /**
     22     * Filters the reply capabilities.
     23     *
     24     * @since 2.0.0
     25     *
     26     * @param array $caps An array of reply capabilities with keys mapping to WordPress capabilities.
     27     */
    2228    return (array) apply_filters( 'bbp_get_reply_caps', array(
    2329        'edit_posts'          => 'edit_replies',
     
    237243    }
    238244
    239     // Filter & return
     245    /**
     246     * Filters the Reply meta capabilities.
     247     *
     248     * @since 2.2.0 bbPress (r4242)
     249     *
     250     * @param array  $caps    The current capabilities being checked.
     251     * @param string $cap     The capability being checked.
     252     * @param int    $user_id The ID of the user whose capabilities are being checked.
     253     * @param array  $args    Additional arguments provided for the capability check.
     254     */
    240255    return (array) apply_filters( 'bbp_map_reply_meta_caps', $caps, $cap, $user_id, $args );
    241256}
  • trunk/src/includes/users/signups.php

    r7098 r7361  
    234234    }
    235235
    236     // Filter & return
     236    /**
     237     * Filters the validated signup role.
     238     *
     239     * @since 2.6.5
     240     *
     241     * @param string $retval The valid role ID if validation passes; otherwise, an empty string.
     242     * @param string $to_validate The role ID that was validated.
     243     */
    237244    return (string) apply_filters( 'bbp_validate_signup_role', $retval, $to_validate );
    238245}
Note: See TracChangeset for help on using the changeset viewer.