Skip to:
Content

BuddyPress.org

Changeset 9683


Ignore:
Timestamp:
04/03/2015 03:05:18 AM (5 years ago)
Author:
tw2113
Message:

Adds hooks documentation for bp-core-functions.php.

:)

See #5940.

Location:
trunk/src
Files:
2 edited

Legend:

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

    r9665 r9683  
    9090    global $wpdb;
    9191
     92    /**
     93     * Filters the $wpdb base prefix.
     94     *
     95     * Intended primarily for use in multinetwork installations.
     96     *
     97     * @since BuddyPress (1.2.6)
     98     *
     99     * @param string $base_prefix Base prefix to use.
     100     */
    92101    return apply_filters( 'bp_core_get_table_prefix', $wpdb->base_prefix );
    93102}
     
    172181    }
    173182
     183    /**
     184     * Filters the BuddyPress formatted number.
     185     *
     186     * @since BuddyPress (1.2.4)
     187     *
     188     * @param string $value    BuddyPress formatted value.
     189     * @param int    $number   The number to be formatted.
     190     * @param bool   $decimals Whether or not to use decimals.
     191     */
    174192    return apply_filters( 'bp_core_number_format', number_format_i18n( $number, $decimals ), $number, $decimals );
    175193}
     
    251269    // Passively filter the args before the parse
    252270    if ( !empty( $filter_key ) ) {
     271
     272        /**
     273         * Filters the arguments key before parsing if filter key provided.
     274         *
     275         * This is a dynamic filter dependent on the specified key.
     276         *
     277         * @since BuddyPress (2.0.0)
     278         *
     279         * @param array $r Array of arguments to use.
     280         */
    253281        $r = apply_filters( 'bp_before_' . $filter_key . '_parse_args', $r );
    254282    }
     
    261289    // Aggressively filter the args after the parse
    262290    if ( !empty( $filter_key ) ) {
     291
     292        /**
     293         * Filters the arguments key after parsing if filter key provided.
     294         *
     295         * This is a dynamic filter dependent on the specified key.
     296         *
     297         * @since BuddyPress (2.0.0)
     298         *
     299         * @param array $r Array of parsed arguments.
     300         */
    263301        $r = apply_filters( 'bp_after_' . $filter_key . '_parse_args', $r );
    264302    }
     
    351389 */
    352390function bp_is_username_compatibility_mode() {
     391
     392    /**
     393     * Filters whether or not to use username compatibility mode.
     394     *
     395     * @since BuddyPress (1.5.0)
     396     *
     397     * @param bool $value Whether or not username compatibility mode should be used.
     398     */
    353399    return apply_filters( 'bp_is_username_compatibility_mode', defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) && BP_ENABLE_USERNAME_COMPATIBILITY_MODE );
    354400}
     
    380426    }
    381427
     428    /**
     429     * Filters whether or not to use the admin bar.
     430     *
     431     * @since BuddyPress (1.5.0)
     432     *
     433     * @param bool $use_admin_bar Whether or not to use the admin bar.
     434     */
    382435    return (bool) apply_filters( 'bp_use_wp_admin_bar', $use_admin_bar );
    383436}
     
    453506    }
    454507
     508    /**
     509     * Filters the list of BP directory pages from the appropriate meta table.
     510     *
     511     * @since BuddyPress (1.5.0)
     512     *
     513     * @param array $page_ids Array of directory pages.
     514     */
    455515    return apply_filters( 'bp_core_get_directory_page_ids', $page_ids );
    456516}
     
    530590    }
    531591
     592    /**
     593     * Filters the names and slugs for BuddyPress component directory pages.
     594     *
     595     * @since BuddyPress (1.5.0)
     596     *
     597     * @param object $pages Object holding page names and slugs.
     598     */
    532599    return apply_filters( 'bp_core_get_directory_pages', $pages );
    533600}
     
    688755    $slug        = array_pop( $slug_chunks );
    689756
     757    /**
     758     * Filters the default component slug from a WP page root_slug.
     759     *
     760     * @since BuddyPress (1.5.0)
     761     *
     762     * @param string $slug      Short slug for use in the middle of URLs.
     763     * @param string $root_slug The root slug which comes from $bp->pages-[component]->slug.
     764     */
    690765    return apply_filters( 'bp_core_component_slug_from_root_slug', $slug, $root_slug );
    691766}
     
    798873    }
    799874
     875    /**
     876     * Filters whether BuddyPress should register the bp-themes directory.
     877     *
     878     * @since BuddyPress (1.9.0)
     879     *
     880     * @param bool $register If bp-themes should be registered.
     881     */
    800882    return apply_filters( 'bp_do_register_theme_directory', $register );
    801883}
     
    816898    $domain = get_home_url( bp_get_root_blog_id() );
    817899
     900    /**
     901     * Filters the domain for the root blog.
     902     *
     903     * @since BuddyPress (1.0.1)
     904     *
     905     * @param string $domain The domain URL for the blog.
     906     */
    818907    return apply_filters( 'bp_core_get_root_domain', $domain );
    819908}
     
    870959
    871960/**
    872  * Get the path of of the current site.
     961 * Get the path of the current site.
    873962 *
    874963 * @global object $current_site
     
    900989    }
    901990
     991    /**
     992     * Filters the path of the current site.
     993     *
     994     * @since BuddyPress (1.2.0)
     995     *
     996     * @param string $site_path URL to the current site.
     997     */
    902998    return apply_filters( 'bp_core_get_site_path', $site_path );
    903999}
     
    9161012 */
    9171013function bp_core_current_time( $gmt = true, $type = 'mysql' ) {
     1014
     1015    /**
     1016     * Filters the current GMT time to save into the DB.
     1017     *
     1018     * @since BuddyPress (1.2.6)
     1019     *
     1020     * @param string $value Current GMT time.
     1021     */
    9181022    return apply_filters( 'bp_core_current_time', current_time( $type, $gmt ) );
    9191023}
     
    9471051function bp_core_time_since( $older_date, $newer_date = false ) {
    9481052
    949     // Use this filter to bypass BuddyPress's time_since calculations
     1053    /**
     1054     * Filters whether or not to bypass BuddyPress' time_since calculations.
     1055     *
     1056     * @since BuddyPress (1.7.0)
     1057     *
     1058     * @param bool   $value      Whether or not to bypass.
     1059     * @param string $older_date Earlier time from which we're calculating time elapsed.
     1060     * @param string $newer_date Unix timestamp of date to compare older time to.
     1061     */
    9501062    $pre_value = apply_filters( 'bp_core_time_since_pre', false, $older_date, $newer_date );
    9511063    if ( false !== $pre_value ) {
     
    9531065    }
    9541066
    955     // Setup the strings
     1067    /**
     1068     * Filters the value to use if the time since is unknown.
     1069     *
     1070     * @since BuddyPress (1.5.0)
     1071     *
     1072     * @param string $value String representing the time since the older date.
     1073     */
    9561074    $unknown_text   = apply_filters( 'bp_core_time_since_unknown_text',   __( 'sometime',  'buddypress' ) );
     1075
     1076    /**
     1077     * Filters the value to use if the time since is right now.
     1078     *
     1079     * @since BuddyPress (1.5.0)
     1080     *
     1081     * @param string $value String representing the time since the older date.
     1082     */
    9571083    $right_now_text = apply_filters( 'bp_core_time_since_right_now_text', __( 'right now', 'buddypress' ) );
     1084
     1085    /**
     1086     * Filters the value to use if the time since is some time ago.
     1087     *
     1088     * @since BuddyPress (1.5.0)
     1089     *
     1090     * @param string $value String representing the time since the older date.
     1091     */
    9581092    $ago_text       = apply_filters( 'bp_core_time_since_ago_text',       __( '%s ago',    'buddypress' ) );
    9591093
     
    10861220    }
    10871221
     1222    /**
     1223     * Filters the English-language representation of the time elapsed since a given date.
     1224     *
     1225     * @since BuddyPress (1.7.0)
     1226     *
     1227     * @param string $output     Final 'time since' string.
     1228     * @param string $older_date Earlier time from which we're calculating time elapsed.
     1229     * @param string $newer_date Unix timestamp of date to compare older time to.
     1230     */
    10881231    return apply_filters( 'bp_core_time_since', $output, $older_date, $newer_date );
    10891232}
     
    11701313    if ( !empty( $bp->template_message ) ) :
    11711314        $type    = ( 'success' === $bp->template_message_type ) ? 'updated' : 'error';
     1315
     1316        /**
     1317         * Filters the 'template_notices' feedback message content.
     1318         *
     1319         * @since BuddyPress (1.5.5)
     1320         *
     1321         * @param string $template_message Feedback message content.
     1322         * @param string $type             The type of message being displayed.
     1323         *                                 Either 'updated' or 'error'.
     1324         */
    11721325        $content = apply_filters( 'bp_core_render_message_content', $bp->template_message, $type ); ?>
    11731326
     
    11801333    <?php
    11811334
     1335        /**
     1336         * Fires after the display of any template_notices feedback messages.
     1337         *
     1338         * @since BuddyPress (1.1.0)
     1339         */
    11821340        do_action( 'bp_core_render_message' );
    11831341
     
    12281386    // Use this action to detect the very first activity for a given member
    12291387    if ( empty( $activity ) ) {
     1388
     1389        /**
     1390         * Fires inside the recording of an activity item.
     1391         *
     1392         * Use this action to detect the very first activity for a given member.
     1393         *
     1394         * @since BuddyPress (1.6.0)
     1395         *
     1396         * @param int $user_id ID of the user whose activity is recorded.
     1397         */
    12301398        do_action( 'bp_first_activity_for_member', $user_id );
    12311399    }
     
    12601428        : sprintf( $string, bp_core_time_since( $last_activity_date ) );
    12611429
    1262     // Filter and return
     1430    /**
     1431     * Filters last activity string based on time since date given.
     1432     *
     1433     * @since BuddyPress (1.2.0)
     1434     *
     1435     * @param string $last_active        Last activity string based on time since date given.
     1436     * @param string $last_activity_date The date of last activity.
     1437     * @param string $string             A sprintf()-able statement of the form 'active %s'.
     1438     */
    12631439    return apply_filters( 'bp_core_get_last_activity', $last_active, $last_activity_date, $string );
    12641440}
     
    12901466 */
    12911467function bp_get_user_meta_key( $key = false ) {
     1468
     1469    /**
     1470     * Filters the meta_key for a given piece of user metadata.
     1471     *
     1472     * @since BuddyPress (1.5.0)
     1473     *
     1474     * @param string $key The usermeta meta key.
     1475     */
    12921476    return apply_filters( 'bp_get_user_meta_key', $key );
    12931477}
     
    13851569 */
    13861570function bp_use_embed_in_activity() {
     1571
     1572    /**
     1573     * Filters whether or not oEmbeds are allowed in activity items.
     1574     *
     1575     * @since BuddyPress (1.5.0)
     1576     *
     1577     * @param bool $value Whether or not oEmbeds are allowed.
     1578     */
    13871579    return apply_filters( 'bp_use_oembed_in_activity', !defined( 'BP_EMBED_DISABLE_ACTIVITY' ) || !BP_EMBED_DISABLE_ACTIVITY );
    13881580}
     
    13971589 */
    13981590function bp_use_embed_in_activity_replies() {
     1591
     1592    /**
     1593     * Filters whether or not oEmbeds are allowed in activity replies.
     1594     *
     1595     * @since BuddyPress (1.5.0)
     1596     *
     1597     * @param bool $value Whether or not oEmbeds are allowed.
     1598     */
    13991599    return apply_filters( 'bp_use_embed_in_activity_replies', !defined( 'BP_EMBED_DISABLE_ACTIVITY_REPLIES' ) || !BP_EMBED_DISABLE_ACTIVITY_REPLIES );
    14001600}
     
    14091609 */
    14101610function bp_use_embed_in_forum_posts() {
     1611
     1612    /**
     1613     * Filters whether or not oEmbeds are allowed in forum posts.
     1614     *
     1615     * @since BuddyPress (1.5.0)
     1616     *
     1617     * @param bool $value Whether or not oEmbeds are allowed.
     1618     */
    14111619    return apply_filters( 'bp_use_embed_in_forum_posts', !defined( 'BP_EMBED_DISABLE_FORUM_POSTS' ) || !BP_EMBED_DISABLE_FORUM_POSTS );
    14121620}
     
    14211629 */
    14221630function bp_use_embed_in_private_messages() {
     1631
     1632    /**
     1633     * Filters whether or not oEmbeds are allowed in private messages.
     1634     *
     1635     * @since BuddyPress (1.5.0)
     1636     *
     1637     * @param bool $value Whether or not oEmbeds are allowed.
     1638     */
    14231639    return apply_filters( 'bp_use_embed_in_private_messages', !defined( 'BP_EMBED_DISABLE_PRIVATE_MESSAGES' ) || !BP_EMBED_DISABLE_PRIVATE_MESSAGES );
    14241640}
     
    14931709    }
    14941710
     1711    /**
     1712     * Filters whether or not BuddyPress should appear in network admin.
     1713     *
     1714     * @since BuddyPress (1.5.0)
     1715     *
     1716     * @param bool $retval Whether or not BuddyPress should be in the network admin.
     1717     */
    14951718    return (bool) apply_filters( 'bp_core_do_network_admin', $retval );
    14961719}
     
    15111734    $hook = bp_core_do_network_admin() ? 'network_admin_menu' : 'admin_menu';
    15121735
     1736    /**
     1737     * Filters the action name that BuddyPress nav setup callbacks should be hooked to.
     1738     *
     1739     * @since BuddyPress (1.5.0)
     1740     *
     1741     * @param string $hook Action name to be attached to.
     1742     */
    15131743    return apply_filters( 'bp_core_admin_hook', $hook );
    15141744}
     
    15391769    }
    15401770
     1771    /**
     1772     * Filters whether or not we're on the root blog.
     1773     *
     1774     * @since BuddyPress (1.5.0)
     1775     *
     1776     * @param bool $is_root_blog Whether or not we're on the root blog.
     1777     */
    15411778    return (bool) apply_filters( 'bp_is_root_blog', (bool) $is_root_blog );
    15421779}
     
    15541791 */
    15551792function bp_get_root_blog_id() {
     1793
     1794    /**
     1795     * Filters the ID for the root blog.
     1796     *
     1797     * @since BuddyPress (1.5.0)
     1798     *
     1799     * @param int $root_blog_id ID for the root blog.
     1800     */
    15561801    return (int) apply_filters( 'bp_get_root_blog_id', (int) buddypress()->root_blog_id );
    15571802}
     
    16041849    }
    16051850
     1851    /**
     1852     * Filters whether or not we're running in multiblog mode.
     1853     *
     1854     * @since BuddyPress (1.5.0)
     1855     *
     1856     * @param bool $retval Whether or not we're running multiblog mode.
     1857     */
    16061858    return apply_filters( 'bp_is_multiblog_mode', $retval );
    16071859}
     
    16331885    }
    16341886
     1887    /**
     1888     * Filters whether or not we're active at the network level.
     1889     *
     1890     * @since BuddyPress (1.7.0)
     1891     *
     1892     * @param bool $retval Whether or not we're network activated.
     1893     */
    16351894    return (bool) apply_filters( 'bp_is_network_activated', $retval );
    16361895}
     
    16511910    }
    16521911
     1912    /**
     1913     * Filters the "is_directory" global value.
     1914     *
     1915     * @since BuddyPress (1.5.0)
     1916     *
     1917     * @param bool   $is_directory Whether or not we're "is_directory".
     1918     * @param string $component    Component name. Default: the current component.
     1919     */
    16531920    buddypress()->is_directory = apply_filters( 'bp_update_is_directory', $is_directory, $component );
    16541921}
     
    16671934    }
    16681935
     1936    /**
     1937     * Filters the "is_item_admin" global value.
     1938     *
     1939     * @since BuddyPress (1.5.0)
     1940     *
     1941     * @param bool   $is_item_admin Whether or not we're "is_item_admin".
     1942     * @param string $component     Component name. Default: the current component.
     1943     */
    16691944    buddypress()->is_item_admin = apply_filters( 'bp_update_is_item_admin', $is_item_admin, $component );
    16701945}
     
    16831958    }
    16841959
     1960    /**
     1961     * Filters the "is_item_mod" global value.
     1962     *
     1963     * @since BuddyPress (1.5.0)
     1964     *
     1965     * @param bool   $is_item_mod Whether or not we're "is_item_mod".
     1966     * @param string $component   Component name. Default: the current component.
     1967     */
    16851968    buddypress()->is_item_mod = apply_filters( 'bp_update_is_item_mod', $is_item_mod, $component );
    16861969}
     
    16991982    global $wp_query;
    17001983
     1984    /**
     1985     * Fires inside the triggering of a 404.
     1986     *
     1987     * @since BuddyPress (1.5.0)
     1988     *
     1989     * @param string $redirect Redirect type used to determine if redirect_canonical
     1990     *                         function should be be removed.
     1991     */
    17011992    do_action( 'bp_do_404', $redirect );
    17021993
     
    17582049    /** Look for match ********************************************************/
    17592050
    1760     // Filter the requested URL, for configurations like reverse proxying
     2051    /**
     2052     * Filters the requested URL being nonce-verified.
     2053     *
     2054     * Useful for configurations like reverse proxying.
     2055     *
     2056     * @since BuddyPress (1.9.0)
     2057     *
     2058     * @param string $requested_url The requested URL.
     2059     */
    17612060    $matched_url = apply_filters( 'bp_verify_nonce_request_url', $requested_url );
    17622061
     
    17692068    }
    17702069
    1771     // Do extra things
     2070    /**
     2071     * Fires at the end of the nonce verification check.
     2072     *
     2073     * @since BuddyPress (1.6.0)
     2074     *
     2075     * @param string $action Action nonce.
     2076     * @param bool   $result Boolean result of nonce verification.
     2077     */
    17722078    do_action( 'bp_verify_nonce_request', $action, $result );
    17732079
     
    18092115function bp_core_load_buddypress_textdomain() {
    18102116    $domain = 'buddypress';
     2117
     2118    /**
     2119     * Filters the locale to be loaded for the language files.
     2120     *
     2121     * @since BuddyPress (1.0.2)
     2122     *
     2123     * @param string $value Current locale for the install.
     2124     */
    18112125    $mofile_custom = sprintf( '%s-%s.mo', $domain, apply_filters( 'buddypress_locale', get_locale() ) );
    18122126
     2127    /**
     2128     * Filters the locations to load language files from.
     2129     *
     2130     * @since BuddyPress (2.2.0)
     2131     *
     2132     * @param array $value Array of directories to check for language files in.
     2133     */
    18132134    $locations = apply_filters( 'buddypress_locale_locations', array(
    18142135        trailingslashit( WP_LANG_DIR . '/' . $domain  ),
     
    18902211    }
    18912212
     2213    /**
     2214     * Filters the constructed url for use with site searching.
     2215     *
     2216     * @since BuddyPress (1.0.0)
     2217     *
     2218     * @param string $value        URL for use with site searching.
     2219     * @param array  $search_terms Array of search terms.
     2220     */
    18922221    bp_core_redirect( apply_filters( 'bp_core_search_site', home_url( $slug . $query_string . urlencode( $search_terms ) ), $search_terms ) );
    18932222}
     
    21282457
    21292458    } else {
    2130         // If you've built a custom suggestions service, use this to tell BP the name of your class.
     2459
     2460        /**
     2461         * Filters the default suggestions service to use.
     2462         *
     2463         * Use this hook to tell BP the name of your class
     2464         * if you've built a custom suggestions service.
     2465         *
     2466         * @since BuddyPress (2.1.0)
     2467         *
     2468         * @param string $value Custom class to use. Default: none.
     2469         * @param array  $args  Array of arguments for sugggestions.
     2470         */
    21312471        $class = apply_filters( 'bp_suggestions_services', '', $args );
    21322472    }
     
    21462486    }
    21472487
     2488    /**
     2489     * Filters the available type of at-mentions.
     2490     *
     2491     * @since BuddyPress (2.1.0)
     2492     *
     2493     * @param array|WP_Error $retval Array of results or WP_Error object.
     2494     * @param array          $args   Array of arguments for suggestions.
     2495     */
    21482496    return apply_filters( 'bp_core_get_suggestions', $retval, $args );
    21492497}
  • trunk/src/bp-loader.php

    r9615 r9683  
    144144        // Always return the instance
    145145        return $instance;
     146
     147        // The last metroid is in captivity. The galaxy is at peace.
    146148    }
    147149
Note: See TracChangeset for help on using the changeset viewer.