Changeset 7434
- Timestamp:
- 10/16/2013 05:41:34 PM (11 years ago)
- Location:
- trunk/bp-core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-buddybar.php
r7228 r7434 2 2 3 3 /** 4 * Core BuddyPress Navigational Functions 4 * Core BuddyPress Navigational Functions. 5 5 * 6 6 * @package BuddyPress 7 7 * @subpackage Core 8 * @todo Deprecate BuddyBar functions 8 * @todo Deprecate BuddyBar functions. 9 9 */ 10 10 … … 13 13 14 14 /** 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. 19 39 */ 20 40 function bp_core_new_nav_item( $args = '' ) { … … 98 118 99 119 /** 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 * } 104 131 */ 105 132 function bp_core_new_nav_default( $args = '' ) { … … 164 191 165 192 /** 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 * 170 198 * @global BuddyPress $bp The one true BuddyPress instance 199 * 200 * @return bool|null Returns false on failure. 171 201 */ 172 202 function bp_core_sort_nav_items() { … … 198 228 199 229 /** 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. 204 258 */ 205 259 function bp_core_new_subnav_item( $args = '' ) { … … 319 373 } 320 374 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 */ 321 382 function bp_core_sort_subnav_items() { 322 383 global $bp; … … 350 411 351 412 /** 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. 359 421 */ 360 422 function bp_nav_item_has_subnav( $nav_item = '' ) { … … 370 432 371 433 /** 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. 377 438 */ 378 439 function bp_core_remove_nav_item( $parent_id ) { … … 400 461 401 462 /** 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. 407 467 */ 408 468 function bp_core_remove_subnav_item( $parent_id, $slug ) { … … 425 485 426 486 /** 427 * Clear the subnav items fora specific nav item.428 * 429 * @ package BuddyPress Core430 * @param string $parent_id The id of the parent navigation item.431 * @ global BuddyPress $bp The one true BuddyPress instance487 * 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. 432 492 */ 433 493 function bp_core_reset_subnav_items( $parent_slug ) { … … 437 497 } 438 498 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 */ 441 506 function bp_core_admin_bar() { 442 507 global $bp; … … 466 531 } 467 532 468 // **** Default BuddyPress Toolbar logo ******** 533 /** 534 * Output the BuddyBar logo. 535 */ 469 536 function bp_adminbar_logo() { 470 537 echo '<a href="' . bp_get_root_domain() . '" id="admin-bar-logo">' . get_blog_option( bp_get_root_blog_id(), 'blogname' ) . '</a>'; 471 538 } 472 539 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 */ 474 547 function bp_adminbar_login_menu() { 475 548 … … 484 557 } 485 558 486 487 // **** "My Account" Menu ****** 559 /** 560 * Output the My Account BuddyBar menu. 561 * 562 * @return bool|null Returns false on failure. 563 */ 488 564 function bp_adminbar_account_menu() { 489 565 global $bp; … … 558 634 } 559 635 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 */ 562 641 function bp_adminbar_random_menu() { 563 642 ?> … … 593 672 * This is a direct copy of WP's private _get_admin_bar_pref() 594 673 * 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) 599 675 * 600 676 * @uses get_user_option() 601 677 * 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. 603 682 */ 604 683 function bp_get_admin_bar_pref( $context, $user = 0 ) { … … 611 690 612 691 /** 613 * Handle the BuddyBar CSS692 * Enqueue the BuddyBar CSS. 614 693 */ 615 694 function bp_core_load_buddybar_css() { -
trunk/bp-core/bp-core-cache.php
r7024 r7434 1 1 <?php 2 2 /** 3 * BuddyPress Core Caching Functions. 4 * 3 5 * Caching functions handle the clearing of cached objects and pages on specific 4 6 * actions throughout BuddyPress. … … 9 11 10 12 /** 11 * REQUIRES WP-SUPER-CACHE 13 * Prune the WP Super Cache. 14 * 15 * @see prune_super_cache() 12 16 * 13 17 * When wp-super-cache is installed this function will clear cached pages 14 18 * so that success/error messages are not cached, or time sensitive content. 15 *16 * @package BuddyPress Core17 19 */ 18 20 function bp_core_clear_cache() { … … 26 28 27 29 /** 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. 31 31 */ 32 32 function bp_core_add_global_group() { … … 38 38 39 39 /** 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. 43 41 */ 44 42 function bp_core_clear_user_object_cache( $user_id ) { … … 47 45 48 46 /** 49 * Clear s member count caches and transients47 * Clear member count caches and transients. 50 48 */ 51 49 function bp_core_clear_member_count_caches() { … … 62 60 * Update the metadata cache for the specified objects. 63 61 * 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. 68 85 */ 69 86 function bp_update_meta_cache( $args = array() ) {
Note: See TracChangeset
for help on using the changeset viewer.