Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/24/2015 06:19:49 AM (7 years ago)
Author:
tw2113
Message:

Adds hooks documentation to bp-core-component.php and bp-core-dependency.php.

See #5940.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-dependency.php

    r9604 r9641  
    2222 */
    2323function bp_include() {
     24
     25    /**
     26     * Fires inside the 'bp_include' function, where plugins should include files.
     27     *
     28     * @since BuddyPress (1.2.5)
     29     */
    2430    do_action( 'bp_include' );
    2531}
     
    2935 */
    3036function bp_setup_components() {
     37
     38    /**
     39     * Fires inside the 'bp_setup_components' function, where plugins should initialize components.
     40     *
     41     * @since BuddyPress (1.6.0)
     42     */
    3143    do_action( 'bp_setup_components' );
    3244}
     
    3648 */
    3749function bp_setup_canonical_stack() {
     50
     51    /**
     52     * Fires inside the 'bp_setup_canonical_stack' function, where plugins should set up their canonical URL.
     53     *
     54     * @since BuddyPress (2.1.0)
     55     */
    3856    do_action( 'bp_setup_canonical_stack' );
    3957}
     
    4563 */
    4664function bp_register_taxonomies() {
     65
     66    /**
     67     * Fires inside the 'bp_register_taxonomies' function, where plugins should register taxonomies.
     68     *
     69     * @since BuddyPress (2.2.0)
     70     */
    4771    do_action( 'bp_register_taxonomies' );
    4872}
     
    5276 */
    5377function bp_setup_globals() {
     78
     79    /**
     80     * Fires inside the 'bp_setup_globals' function, where plugins should initialize global settings.
     81     *
     82     * @since BuddyPress (1.2.0)
     83     */
    5484    do_action( 'bp_setup_globals' );
    5585}
     
    5989 */
    6090function bp_setup_nav() {
     91
     92    /**
     93     * Fires inside the 'bp_setup_nav' function, where plugins should register their navigation items.
     94     *
     95     * @since BuddyPress (1.2.0)
     96     */
    6197    do_action( 'bp_setup_nav' );
    6298}
     
    66102 */
    67103function bp_setup_admin_bar() {
    68     if ( bp_use_wp_admin_bar() )
     104    if ( bp_use_wp_admin_bar() ) {
     105
     106        /**
     107         * Fires inside the 'bp_setup_admin_bar' function, where plugins should add items to the WP admin bar.
     108         *
     109         * This hook will only fire if bp_use_wp_admin_bar() returns true.
     110         *
     111         * @since BuddyPress (1.5.0)
     112         */
    69113        do_action( 'bp_setup_admin_bar' );
     114    }
    70115}
    71116
     
    74119 */
    75120function bp_setup_title() {
     121
     122    /**
     123     * Fires inside the 'bp_setup_title' function, where plugins should modify the page title.
     124     *
     125     * @since BuddyPress (1.5.0)
     126     */
    76127    do_action( 'bp_setup_title' );
    77128}
     
    81132 */
    82133function bp_setup_widgets() {
     134
     135    /**
     136     * Fires inside the 'bp_register_widgets' function, where plugins should register widgets.
     137     *
     138     * @since BuddyPress (1.2.0)
     139     */
    83140    do_action( 'bp_register_widgets' );
    84141}
     
    90147 */
    91148function bp_setup_cache_groups() {
     149
     150    /**
     151     * Fires inside the 'bp_setup_cache_groups' function, where cache groups are registered.
     152     *
     153     * @since BuddyPress (2.2.0)
     154     */
    92155    do_action( 'bp_setup_cache_groups' );
    93156}
     
    112175    }
    113176
     177    /**
     178     * Fires to set up the current user setup process.
     179     *
     180     * @since BuddyPress (1.7.0)
     181     */
    114182    do_action( 'bp_setup_current_user' );
    115183}
     
    119187 */
    120188function bp_init() {
     189
     190    /**
     191     * Fires inside the 'bp_init' function, BuddyPress' main initialization hook.
     192     *
     193     * @since BuddyPress (1.2.0)
     194     */
    121195    do_action( 'bp_init' );
    122196}
     
    128202 */
    129203function bp_loaded() {
     204
     205    /**
     206     * Fires inside the 'bp_loaded' function, which fires after BP's core plugin files have been loaded.
     207     *
     208     * @since BuddyPress (1.2.5)
     209     */
    130210    do_action( 'bp_loaded' );
    131211}
     
    137217 */
    138218function bp_ready() {
     219
     220    /**
     221     * Fires inside the 'bp_ready' function, which runs after BP is set up and the page is about to render.
     222     *
     223     * @since BuddyPress (1.6.0)
     224     */
    139225    do_action( 'bp_ready' );
    140226}
     
    147233 */
    148234function bp_actions() {
     235
     236    /**
     237     * Fires inside the 'bp_actions' function, which runs just before rendering.
     238     *
     239     * @since BuddyPress (1.5.0)
     240     */
    149241    do_action( 'bp_actions' );
    150242}
     
    157249 */
    158250function bp_screens() {
     251
     252    /**
     253     * Fires inside the 'bp_screens' function, which runs just before rendering.
     254     *
     255     * Runs just after 'bp_actions'. Use this hook to attach your template loaders.
     256     *
     257     * @since BuddyPress (1.5.0)
     258     */
    159259    do_action( 'bp_screens' );
    160260}
     
    166266 */
    167267function bp_widgets_init() {
     268
     269    /**
     270     * Fires inside the 'bp_widgets_init' function, which runs after widgets have been set up.
     271     *
     272     * Hooked to 'widgets_init'.
     273     *
     274     * @since BuddyPress (1.6.0)
     275     */
    168276    do_action ( 'bp_widgets_init' );
    169277}
     
    192300 */
    193301function bp_template_redirect() {
     302
     303    /**
     304     * Fires inside the 'bp_template_redirect' function.
     305     *
     306     * @since BuddyPress (1.6.0)
     307     */
    194308    do_action( 'bp_template_redirect' );
    195309}
     
    207321 */
    208322function bp_register_theme_directory() {
     323
     324    /**
     325     * Fires inside the 'bp_register_theme_directory' function.
     326     *
     327     * The main action used registering theme directories.
     328     *
     329     * @since BuddyPress (1.7.0)
     330     */
    209331    do_action( 'bp_register_theme_directory' );
    210332}
     
    220342 */
    221343function bp_register_theme_packages() {
     344
     345    /**
     346     * Fires inside the 'bp_register_theme_packages' function.
     347     *
     348     * @since BuddyPress (1.7.0)
     349     */
    222350    do_action( 'bp_register_theme_packages' );
    223351}
     
    231359 */
    232360function bp_enqueue_scripts() {
     361
     362    /**
     363     * Fires inside the 'bp_enqueue_scripts' function, where BP enqueues its CSS and JS.
     364     *
     365     * @since BuddyPress (1.6.0)
     366     */
    233367    do_action ( 'bp_enqueue_scripts' );
    234368}
     
    242376 */
    243377function bp_add_rewrite_tags() {
     378
     379    /**
     380     * Fires inside the 'bp_add_rewrite_tags' function, where BP adds its custom rewrite tags.
     381     *
     382     * @since BuddyPress (1.8.0)
     383     */
    244384    do_action( 'bp_add_rewrite_tags' );
    245385}
     
    253393 */
    254394function bp_add_rewrite_rules() {
     395
     396    /**
     397     * Fires inside the 'bp_add_rewrite_rules' function, where BP adds its custom rewrite rules.
     398     *
     399     * @since BuddyPress (1.9.0)
     400     */
    255401    do_action( 'bp_add_rewrite_rules' );
    256402}
     
    264410 */
    265411function bp_add_permastructs() {
     412
     413    /**
     414     * Fires inside the 'bp_add_permastructs' function, where BP adds its BP-specific permalink structure.
     415     *
     416     * @since BuddyPress (1.9.0)
     417     */
    266418    do_action( 'bp_add_permastructs' );
    267419}
     
    278430 */
    279431function bp_setup_theme() {
     432
     433    /**
     434     * Fires inside the 'bp_setup_theme' function.
     435     *
     436     * @since BuddyPress (1.6.0)
     437     */
    280438    do_action ( 'bp_setup_theme' );
    281439}
     
    296454 */
    297455function bp_after_setup_theme() {
     456
     457    /**
     458     * Fires inside the 'bp_after_setup_theme' function.
     459     *
     460     * @since BuddyPress (1.7.0)
     461     */
    298462    do_action ( 'bp_after_setup_theme' );
    299463}
     
    312476 */
    313477function bp_request( $query_vars = array() ) {
     478
     479    /**
     480     * Filters the query_vars for the current request.
     481     *
     482     * @since BuddyPress (1.7.0)
     483     *
     484     * @param array $query_vars Array of query variables.
     485     */
    314486    return apply_filters( 'bp_request', $query_vars );
    315487}
     
    322494 * @param string $redirect_to See 'login_redirect'.
    323495 * @param string $redirect_to_raw See 'login_redirect'.
    324  * @param string $user See 'login_redirect'.
     496 * @param bool   $user See 'login_redirect'.
     497 *
     498 * @return string
    325499 */
    326500function bp_login_redirect( $redirect_to = '', $redirect_to_raw = '', $user = false ) {
     501
     502    /**
     503     * Filters the URL to redirect to after login.
     504     *
     505     * @since BuddyPress (1.7.0)
     506     *
     507     * @param string           $redirect_to     The redirect destination URL.
     508     * @param string           $redirect_to_raw The requested redirect destination URL passed as a parameter.
     509     * @param WP_User|WP_Error $user            WP_User object if login was successful, WP_Error object otherwise.
     510     */
    327511    return apply_filters( 'bp_login_redirect', $redirect_to, $redirect_to_raw, $user );
    328512}
     
    341525 */
    342526function bp_template_include( $template = '' ) {
     527
     528    /**
     529     * Filters the template to use with template_include.
     530     *
     531     * @since BuddyPress (1.6.0)
     532     *
     533     * @param string $template The path of the template to include.
     534     */
    343535    return apply_filters( 'bp_template_include', $template );
    344536}
    345537
    346538/**
    347  * Fire the 'bp_generate_rewrite_rules' filter, where BP generates its rewrite rules.
     539 * Fire the 'bp_generate_rewrite_rules' action, where BP generates its rewrite rules.
    348540 *
    349541 * @since BuddyPress (1.7.0)
     
    354546 */
    355547function bp_generate_rewrite_rules( $wp_rewrite ) {
     548
     549    /**
     550     * Fires inside the 'bp_generate_rewrite_rules' function.
     551     *
     552     * @since BuddyPress (1.7.0)
     553     *
     554     * @param WP_Rewrite $wp_rewrite WP_Rewrite object. Passed by reference.
     555     */
    356556    do_action_ref_array( 'bp_generate_rewrite_rules', array( &$wp_rewrite ) );
    357557}
     
    367567 */
    368568function bp_allowed_themes( $themes ) {
     569
     570    /**
     571     * Filters the allowed themes list for BuddyPress-specific themes.
     572     *
     573     * @since BuddyPress (1.7.0)
     574     *
     575     * @param string $template The path of the template to include.
     576     */
    369577    return apply_filters( 'bp_allowed_themes', $themes );
    370578}
     
    393601    $action = sanitize_key( $_POST['action'] );
    394602
    395     // This dynamic action is probably the one you want to use. It narrows down
    396     // the scope of the 'action' without needing to check it in your function.
     603    /**
     604     * Fires at the end of the bp_post_request function.
     605     *
     606     * This dynamic action is probably the one you want to use. It narrows down
     607     * the scope of the 'action' without needing to check it in your function.
     608     *
     609     * @since BuddyPress (1.9.0)
     610     */
    397611    do_action( 'bp_post_request_' . $action );
    398612
    399     // Use this static action if you don't mind checking the 'action' yourself.
     613    /**
     614     * Fires at the end of the bp_post_request function.
     615     *
     616     * Use this static action if you don't mind checking the 'action' yourself.
     617     *
     618     * @since BuddyPress (1.9.0)
     619     *
     620     * @param string $action The action being run.
     621     */
    400622    do_action( 'bp_post_request',   $action );
    401623}
     
    422644    $action = sanitize_key( $_GET['action'] );
    423645
    424     // This dynamic action is probably the one you want to use. It narrows down
    425     // the scope of the 'action' without needing to check it in your function.
     646    /**
     647     * Fires at the end of the bp_get_request function.
     648     *
     649     * This dynamic action is probably the one you want to use. It narrows down
     650     * the scope of the 'action' without needing to check it in your function.
     651     *
     652     * @since BuddyPress (1.9.0)
     653     */
    426654    do_action( 'bp_get_request_' . $action );
    427655
    428     // Use this static action if you don't mind checking the 'action' yourself.
     656    /**
     657     * Fires at the end of the bp_get_request function.
     658     *
     659     * Use this static action if you don't mind checking the 'action' yourself.
     660     *
     661     * @since BuddyPress (1.9.0)
     662     *
     663     * @param string $action The action being run.
     664     */
    429665    do_action( 'bp_get_request',   $action );
    430666}
Note: See TracChangeset for help on using the changeset viewer.