Skip to:
Content

BuddyPress.org

Changeset 7434


Ignore:
Timestamp:
10/16/2013 05:41:34 PM (11 years ago)
Author:
boonebgorges
Message:

Improve inline docs in bp-core. See #5022

Location:
trunk/bp-core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-buddybar.php

    r7228 r7434  
    22
    33/**
    4  * Core BuddyPress Navigational Functions
     4 * Core BuddyPress Navigational Functions.
    55 *
    66 * @package BuddyPress
    77 * @subpackage Core
    8  * @todo Deprecate BuddyBar functions
     8 * @todo Deprecate BuddyBar functions.
    99 */
    1010
     
    1313
    1414/**
    15  * Adds a navigation item to the main navigation array used in BuddyPress themes.
    16  *
    17  * @package BuddyPress Core
    18  * @global BuddyPress $bp The one true BuddyPress instance
     15 * Add an item to the main BuddyPress navigation array.
     16 *
     17 * @global BuddyPress $bp The one true BuddyPress instance.
     18 *
     19 * @param array $args {
     20 *     Array describing the new nav item.
     21 *     @type string $name Display name for the nav item.
     22 *     @type string $slug Unique URL slug for the nav item.
     23 *     @type bool|string $item_css_id Optional. 'id' attribute for the nav
     24 *           item. Default: the value of $slug.
     25 *     @type bool $show_for_displayed_user Optional. Whether the nav item
     26 *           should be visible when viewing a member profile other than your
     27 *           own. Default: true.
     28 *     @type bool $site_admin_only Optional. Whether the nav item should be
     29 *           visible only to site admins (those with the 'bp_moderate' cap).
     30 *           Default: false.
     31 *     @type int $position Optional. Numerical index specifying where the item
     32 *           should appear in the nav array. Default: 99.
     33 *     @type callable $screen_function The callback function that will run
     34 *           when the nav item is clicked.
     35 *     @type bool|string $default_subnav_slug Optional. The slug of the default
     36 *           subnav item to select when the nav item is clicked.
     37 * }
     38 * @return bool|null Returns false on failure.
    1939 */
    2040function bp_core_new_nav_item( $args = '' ) {
     
    98118
    99119/**
    100  * Modify the default subnav item to load when a top level nav item is clicked.
    101  *
    102  * @package BuddyPress Core
    103  * @global BuddyPress $bp The one true BuddyPress instance
     120 * Modify the default subnav item that loads when a top level nav item is clicked.
     121 *
     122 * @global BuddyPress $bp The one true BuddyPress instance.
     123 *
     124 * @param array $args {
     125 *     @type string $parent_slug The slug of the nav item whose default is
     126 *           being changed.
     127 *     @type callable $screen_function The new default callback function that
     128 *           will run when the nav item is clicked.
     129 *     @type string $subnav_slug The slug of the new default subnav item.
     130 * }
    104131 */
    105132function bp_core_new_nav_default( $args = '' ) {
     
    164191
    165192/**
    166  * We can only sort nav items by their position integer at a later point in time, once all
    167  * plugins have registered their navigation items.
    168  *
    169  * @package BuddyPress Core
     193 * Sort the navigation menu items.
     194 *
     195 * The sorting is split into a separate function because it can only happen
     196 * after all plugins have had a chance to register their navigation items.
     197 *
    170198 * @global BuddyPress $bp The one true BuddyPress instance
     199 *
     200 * @return bool|null Returns false on failure.
    171201 */
    172202function bp_core_sort_nav_items() {
     
    198228
    199229/**
    200  * Adds a navigation item to the sub navigation array used in BuddyPress themes.
    201  *
    202  * @package BuddyPress Core
    203  * @global BuddyPress $bp The one true BuddyPress instance
     230 * Add a subnav item to the BuddyPress navigation.
     231 *
     232 * @global BuddyPress $bp The one true BuddyPress instance.
     233 *
     234 * @param array $args {
     235 *     Array describing the new subnav item.
     236 *     @type string $name Display name for the subnav item.
     237 *     @type string $slug Unique URL slug for the subnav item.
     238 *     @type string $parent_slug Slug of the top-level nav item under which the
     239 *           new subnav item should be added.
     240 *     @type string $parent_url URL of the parent nav item.
     241 *     @type bool|string $item_css_id Optional. 'id' attribute for the nav
     242 *           item. Default: the value of $slug.
     243 *     @type bool $user_has_access Optional. True if the logged-in user has
     244 *           access to the subnav item, otherwise false. Can be set dynamically
     245 *           when registering the subnav; eg, use bp_is_my_profile() to restrict
     246 *           access to profile owners only. Default: true.
     247 *     @type bool $site_admin_only Optional. Whether the nav item should be
     248 *           visible only to site admins (those with the 'bp_moderate' cap).
     249 *           Default: false.
     250 *     @type int $position Optional. Numerical index specifying where the item
     251 *           should appear in the subnav array. Default: 90.
     252 *     @type callable $screen_function The callback function that will run
     253 *           when the nav item is clicked.
     254 *     @type string $link Optional. The URL that the subnav item should point
     255 *           to. Defaults to a value generated from the $parent_url + $slug.
     256 * }
     257 * @return bool|null Returns false on failure.
    204258 */
    205259function bp_core_new_subnav_item( $args = '' ) {
     
    319373}
    320374
     375/**
     376 * Sort all subnavigation arrays.
     377 *
     378 * @global BuddyPress $bp The one true BuddyPress instance
     379 *
     380 * @return bool|null Returns false on failure.
     381 */
    321382function bp_core_sort_subnav_items() {
    322383    global $bp;
     
    350411
    351412/**
    352  * Determines whether a given nav item has subnav items
    353  *
    354  * @package BuddyPress
    355  * @since BuddyPress (1.5)
    356  *
    357  * @param string $nav_item The id of the top-level nav item whose nav items you're checking
    358  * @return bool $has_subnav True if the nav item is found and has subnav items; false otherwise
     413 * Check whether a given nav item has subnav items.
     414 *
     415 * @since BuddyPress (1.5.0)
     416 *
     417 * @param string $nav_item The slug of the top-level nav item whose subnav
     418 *        items you're checking. Default: the current component slug.
     419 * @return bool $has_subnav True if the nav item is found and has subnav
     420 *        items; false otherwise.
    359421 */
    360422function bp_nav_item_has_subnav( $nav_item = '' ) {
     
    370432
    371433/**
    372  * Removes a navigation item from the sub navigation array used in BuddyPress themes.
    373  *
    374  * @package BuddyPress Core
    375  * @param int $parent_id The id of the parent navigation item.
    376  * @param bool|string false if the parent item doesn't exist or $slug the slug of the sub navigation item.
     434 * Remove a nav item from the navigation array.
     435 *
     436 * @param int $parent_id The slug of the parent navigation item.
     437 * @param bool Returns false on failure, ie if the nav item can't be found.
    377438 */
    378439function bp_core_remove_nav_item( $parent_id ) {
     
    400461
    401462/**
    402  * Removes a navigation item from the sub navigation array used in BuddyPress themes.
    403  *
    404  * @package BuddyPress Core
    405  * @param string $parent_id The id of the parent navigation item.
    406  * @param string $slug The slug of the sub navigation item.
     463 * Remove a subnav item from the navigation array.
     464 *
     465 * @param string $parent_id The slug of the parent navigation item.
     466 * @param string $slug The slug of the subnav item to be removed.
    407467 */
    408468function bp_core_remove_subnav_item( $parent_id, $slug ) {
     
    425485
    426486/**
    427  * Clear the subnav items for a specific nav item.
    428  *
    429  * @package BuddyPress Core
    430  * @param string $parent_id The id of the parent navigation item.
    431  * @global BuddyPress $bp The one true BuddyPress instance
     487 * Clear all subnav items from a specific nav item.
     488 *
     489 * @global BuddyPress $bp The one true BuddyPress instance.
     490 *
     491 * @param string $parent_slug The slug of the parent navigation item.
    432492 */
    433493function bp_core_reset_subnav_items( $parent_slug ) {
     
    437497}
    438498
    439 /** Template functions ********************************************************/
    440 
     499/** BuddyBar Template functions ***********************************************/
     500
     501/**
     502 * Wrapper function for rendering the BuddyBar.
     503 *
     504 * @return bool|null Returns false if the BuddyBar is disabled.
     505 */
    441506function bp_core_admin_bar() {
    442507    global $bp;
     
    466531}
    467532
    468 // **** Default BuddyPress Toolbar logo ********
     533/**
     534 * Output the BuddyBar logo.
     535 */
    469536function bp_adminbar_logo() {
    470537    echo '<a href="' . bp_get_root_domain() . '" id="admin-bar-logo">' . get_blog_option( bp_get_root_blog_id(), 'blogname' ) . '</a>';
    471538}
    472539
    473 // **** "Log In" and "Sign Up" links (Visible when not logged in) ********
     540/**
     541 * Output the "Log In" and "Sign Up" names to the BuddyBar.
     542 *
     543 * Visible only to visitors who are not logged in.
     544 *
     545 * @return bool|null Returns false if the current user is logged in.
     546 */
    474547function bp_adminbar_login_menu() {
    475548
     
    484557}
    485558
    486 
    487 // **** "My Account" Menu ******
     559/**
     560 * Output the My Account BuddyBar menu.
     561 *
     562 * @return bool|null Returns false on failure.
     563 */
    488564function bp_adminbar_account_menu() {
    489565    global $bp;
     
    558634}
    559635
    560 
    561 // **** "Random" Menu (visible when not logged in) ********
     636/**
     637 * Output the Random BuddyBar menu.
     638 *
     639 * Not visible for logged-in users.
     640 */
    562641function bp_adminbar_random_menu() {
    563642?>
     
    593672 * This is a direct copy of WP's private _get_admin_bar_pref()
    594673 *
    595  * @since BuddyPress (1.5)
    596  *
    597  * @param string $context Context of this preference check, either 'admin' or 'front'.
    598  * @param int $user Optional. ID of the user to check, defaults to 0 for current user.
     674 * @since BuddyPress (1.5.0)
    599675 *
    600676 * @uses get_user_option()
    601677 *
    602  * @return bool Whether the Toolbar should be showing for this user.
     678 * @param string $context Context of this preference check. 'admin' or 'front'.
     679 * @param int $user Optional. ID of the user to check. Default: 0 (which falls
     680 *        back to the logged-in user's ID).
     681 * @return bool True if the toolbar should be showing for this user.
    603682 */
    604683function bp_get_admin_bar_pref( $context, $user = 0 ) {
     
    611690
    612691/**
    613  * Handle the BuddyBar CSS
     692 * Enqueue the BuddyBar CSS.
    614693 */
    615694function bp_core_load_buddybar_css() {
  • trunk/bp-core/bp-core-cache.php

    r7024 r7434  
    11<?php
    22/**
     3 * BuddyPress Core Caching Functions.
     4 *
    35 * Caching functions handle the clearing of cached objects and pages on specific
    46 * actions throughout BuddyPress.
     
    911
    1012/**
    11  * REQUIRES WP-SUPER-CACHE
     13 * Prune the WP Super Cache.
     14 *
     15 * @see prune_super_cache()
    1216 *
    1317 * When wp-super-cache is installed this function will clear cached pages
    1418 * so that success/error messages are not cached, or time sensitive content.
    15  *
    16  * @package BuddyPress Core
    1719 */
    1820function bp_core_clear_cache() {
     
    2628
    2729/**
    28  * Add's 'bp' to global group of network wide cachable objects
    29  *
    30  * @package BuddyPress Core
     30 * Add 'bp' to global group of network wide cachable objects.
    3131 */
    3232function bp_core_add_global_group() {
     
    3838
    3939/**
    40  * Clears all cached objects for a user, or a user is part of.
    41  *
    42  * @package BuddyPress Core
     40 * Clear all cached objects for a user, or those that a user is part of.
    4341 */
    4442function bp_core_clear_user_object_cache( $user_id ) {
     
    4745
    4846/**
    49  * Clears member count caches and transients
     47 * Clear member count caches and transients.
    5048 */
    5149function bp_core_clear_member_count_caches() {
     
    6260 * Update the metadata cache for the specified objects.
    6361 *
    64  * @since BuddyPress (1.6)
    65  * @global $wpdb WordPress database object for queries.
    66  * @param array $args See $defaults definition for more details
    67  * @return mixed Metadata cache for the specified objects, or false on failure.
     62 * Based on WordPress's {@link update_meta_cache()}, this function primes the
     63 * cache with metadata related to a set of objects. This is typically done when
     64 * querying for a loop of objects; pre-fetching metadata for each queried
     65 * object can lead to dramatic performance improvements when using metadata
     66 * in the context of template loops.
     67 *
     68 * @since BuddyPress (1.6.0)
     69 *
     70 * @global $wpdb WordPress database object for queries..
     71 *
     72 * @param array $args {
     73 *     Array of arguments.
     74 *     @type array|string $object_ids List of object IDs to fetch metadata for.
     75 *           Accepts an array or a comma-separated list of numeric IDs.
     76 *     @type string $object_type The type of object, eg 'groups' or 'activity'.
     77 *     @type string $meta_table The name of the metadata table being queried.
     78 *     @type string $object_column Optional. The name of the database column
     79 *           where IDs (those provided by $object_ids) are found. Eg, 'group_id'
     80 *           for the groups metadata tables. Default: $object_type . '_id'.
     81 *     @type string $cache_key_prefix Optional. The prefix to use when creating
     82 *           cache key names. Default: the value of $meta_table.
     83 * }
     84 * @return array|bool Metadata cache for the specified objects, or false on failure.
    6885 */
    6986function bp_update_meta_cache( $args = array() ) {
Note: See TracChangeset for help on using the changeset viewer.