Changeset 7449
- Timestamp:
- 10/20/2013 12:06:35 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-functions.php
r7427 r7449 2 2 3 3 /** 4 * BuddyPress Common Functions 4 * BuddyPress Common Functions. 5 5 * 6 6 * @package BuddyPress … … 14 14 15 15 /** 16 * Output the BuddyPress version 17 * 18 * @since BuddyPress (1.6) 19 * @uses bp_get_version() To get the BuddyPress version 16 * Output the BuddyPress version. 17 * 18 * @since BuddyPress (1.6.0) 19 * 20 * @uses bp_get_version() To get the BuddyPress version. 20 21 */ 21 22 function bp_version() { … … 23 24 } 24 25 /** 25 * Return the BuddyPress version 26 * Return the BuddyPress version. 26 27 * 27 * @since BuddyPress (1.6) 28 * @return string The BuddyPress version 28 * @since BuddyPress (1.6.0) 29 * 30 * @return string The BuddyPress version. 29 31 */ 30 32 function bp_get_version() { … … 33 35 34 36 /** 35 * Output the BuddyPress database version 36 * 37 * @since BuddyPress (1.6) 38 * @uses bp_get_db_version() To get the BuddyPress version 37 * Output the BuddyPress database version. 38 * 39 * @since BuddyPress (1.6.0) 40 * 41 * @uses bp_get_db_version() To get the BuddyPress database version. 39 42 */ 40 43 function bp_db_version() { 41 44 echo bp_get_db_version(); 45 } 46 /** 47 * Return the BuddyPress database version. 48 * 49 * @since BuddyPress (1.6.0) 50 * @return string The BuddyPress database version. 51 */ 52 function bp_get_db_version() { 53 return buddypress()->db_version; 54 } 55 56 /** 57 * Output the BuddyPress database version. 58 * 59 * @since BuddyPress (1.6.0) 60 * 61 * @uses bp_get_db_version_raw() To get the current database BuddyPress version. 62 */ 63 function bp_db_version_raw() { 64 echo bp_get_db_version_raw(); 42 65 } 43 66 /** … … 45 68 * 46 69 * @since BuddyPress (1.6) 47 * @return string The BuddyPress version48 */49 function bp_get_db_version() {50 return buddypress()->db_version;51 }52 53 /**54 * Output the BuddyPress database version55 *56 * @since BuddyPress (1.6)57 * @uses bp_get_db_version_raw() To get the current BuddyPress version58 */59 function bp_db_version_raw() {60 echo bp_get_db_version_raw();61 }62 /**63 * Return the BuddyPress database version64 70 * 65 * @since BuddyPress (1.6) 66 * @return string The BuddyPress version direct from the database 71 * @return string The BuddyPress version direct from the database. 67 72 */ 68 73 function bp_get_db_version_raw() { … … 74 79 75 80 /** 76 * Allow filtering of database prefix. Intended for use in multinetwork installations. 77 * 78 * @global object $wpdb WordPress database object 79 * @return string Filtered database prefix 81 * Get the $wpdb base prefix, run through the 'bp_core_get_table_prefix' filter. 82 * 83 * The filter is intended primarily for use in multinetwork installations. 84 * 85 * @global object $wpdb WordPress database object. 86 * 87 * @return string Filtered database prefix. 80 88 */ 81 89 function bp_core_get_table_prefix() { … … 132 140 133 141 /** 134 * Format numbers the BuddyPress way 135 * 136 * @param int $number 137 * @param bool $decimals 138 * @return string 142 * Format numbers the BuddyPress way. 143 * 144 * @param int $number The number to be formatted. 145 * @param bool $decimals Whether to use decimals. See {@link number_format_i18n()}. 146 * @return string The formatted number. 139 147 */ 140 148 function bp_core_number_format( $number, $decimals = false ) { … … 178 186 * 179 187 * @since BuddyPress (1.6) 180 * @param array $old_args_keys 181 * @param array $func_args 182 * @return array $new_args 188 * @param array $old_args_keys Old argument indexs, keyed to their positions. 189 * @param array $func_args The parameters passed to the originating function. 190 * @return array $new_args The parsed arguments. 183 191 */ 184 192 function bp_core_parse_args_array( $old_args_keys, $func_args ) { … … 195 203 196 204 /** 197 * Sanitize an 'order' parameter for use in building SQL queries 205 * Sanitize an 'order' parameter for use in building SQL queries. 198 206 * 199 207 * Strings like 'DESC', 'desc', ' desc' will be interpreted into 'DESC'. 200 208 * Everything else becomes 'ASC'. 201 209 * 202 * @since BuddyPress (1.8) 203 * @param string $order The 'order' string, as passed to the SQL constructor 204 * @return string The sanitized value 'DESC' or 'ASC' 210 * @since BuddyPress (1.8.0) 211 * 212 * @param string $order The 'order' string, as passed to the SQL constructor. 213 * @return string The sanitized value 'DESC' or 'ASC'. 205 214 */ 206 215 function bp_esc_sql_order( $order = '' ) { … … 212 221 * Are we running username compatibility mode? 213 222 * 214 * @package BuddyPress 215 * @since BuddyPress (1.5) 216 * 217 * @uses apply_filters() Filter 'bp_is_username_compatibility_mode' to alter 218 * @return bool False when compatibility mode is disabled (default); true when enabled 223 * @since BuddyPress (1.5.0) 224 * 225 * @uses apply_filters() Filter 'bp_is_username_compatibility_mode' to alter. 219 226 * @todo Move to members component? 227 * 228 * @return bool False when compatibility mode is disabled, true when enabled. 229 * Default: false. 220 230 */ 221 231 function bp_is_username_compatibility_mode() { … … 226 236 * Should we use the WP Toolbar? 227 237 * 228 * The WP Toolbar, introduced in WP 3.1, is fully supported in BuddyPress as of BP 1.5. 229 * For BP 1.6, the WP Toolbar is the default. 230 * 231 * @return bool False when WP Toolbar support is disabled; true when enabled (default) 232 * @since BuddyPress (1.5) 233 * @uses apply_filters() Filter 'bp_use_wp_admin_bar' to alter 238 * The WP Toolbar, introduced in WP 3.1, is fully supported in BuddyPress as 239 * of BP 1.5. For BP 1.6, the WP Toolbar is the default. 240 * 241 * @since BuddyPress (1.5.0) 242 * 243 * @uses apply_filters() Filter 'bp_use_wp_admin_bar' to alter. 244 * 245 * @return bool False when WP Toolbar support is disabled, true when enabled. 246 * Default: true. 234 247 */ 235 248 function bp_use_wp_admin_bar() { … … 250 263 251 264 /** 252 * Fetches BP pages from the meta table, depending on setup 253 * 254 * @package BuddyPress Core 255 * @since BuddyPress (1.5) 265 * Fetch a list of BP directory pages from the appropriate meta table. 266 * 267 * @since BuddyPress (1.5.0) 268 * 269 * @return array|string An array of page IDs, keyed by component names, or an 270 * empty string if the list is not found. 256 271 */ 257 272 function bp_core_get_directory_page_ids() { … … 271 286 272 287 /** 273 * Stores BP pages in the meta table, depending on setup 274 * 275 * bp-pages data is stored in site_options (falls back to options on non-MS), in an array keyed by 276 * blog_id. This allows you to change your bp_get_root_blog_id() and go through the setup process again. 277 * 278 * @package BuddyPress Core 279 * @since BuddyPress (1.5) 280 * 281 * @param array $blog_page_ids The IDs of the WP pages corresponding to BP component directories 288 * Store the list of BP directory pages in the appropriate meta table. 289 * 290 * bp-pages data is stored in site_options (falls back to options on non-MS), 291 * in an array keyed by blog_id. This allows you to change your 292 * bp_get_root_blog_id() and go through the setup process again. 293 * 294 * @since BuddyPress (1.5.0) 295 * 296 * @param array $blog_page_ids The IDs of the WP pages corresponding to BP 297 * component directories. 282 298 */ 283 299 function bp_core_update_directory_page_ids( $blog_page_ids ) { … … 286 302 287 303 /** 288 * Get bp-pages names and slugs 289 * 290 * @package BuddyPress Core 291 * @since BuddyPress (1.5) 292 * 293 * @return object Page names, IDs, and slugs 304 * Get names and slugs for BuddyPress component directory pages. 305 * 306 * @since BuddyPress (1.5.0). 307 * 308 * @return object Page names, IDs, and slugs. 294 309 */ 295 310 function bp_core_get_directory_pages() { … … 340 355 341 356 /** 342 * Add the pages for the component mapping. These are most often used by components with directories (e.g. groups, members). 343 * 344 * @param array $default_components Optional components to create pages for 357 * Creates necessary directory pages. 358 * 359 * Directory pages are those WordPress pages used by BP components to display 360 * content (eg, the 'groups' page created by BP). 361 * 362 * @since BuddyPress (1.7.0) 363 * 364 * @param array $default_components Components to create pages for. 345 365 * @param string $existing 'delete' if you want to delete existing page 346 366 * mappings and replace with new ones. Otherwise existing page mappings 347 * are kept, and the gaps filled in with new pages 348 * @since BuddyPress (1.7) 367 * are kept, and the gaps filled in with new pages. Default: 'keepy'. 349 368 */ 350 369 function bp_core_add_page_mappings( $components, $existing = 'keep' ) { … … 421 440 422 441 /** 423 * Create s a default component slug from a WP page root_slug442 * Create a default component slug from a WP page root_slug. 424 443 * 425 444 * Since 1.5, BP components get their root_slug (the slug used immediately … … 427 446 * 428 447 * E.g. if your BP installation at example.com has its members page at 429 * example.com/community/people, $bp->members->root_slug will be 'community/people'. 448 * example.com/community/people, $bp->members->root_slug will be 449 * 'community/people'. 430 450 * 431 451 * By default, this function creates a shorter version of the root_slug for … … 434 454 * 435 455 * Filter on 'bp_core_component_slug_from_root_slug' to override this method 436 * in general, or define a specific component slug constant (e.g. BP_MEMBERS_SLUG) 437 * to override specific component slugs. 438 * 439 * @package BuddyPress Core 440 * @since BuddyPress (1.5) 441 * 442 * @param string $root_slug The root slug, which comes from $bp->pages->[component]->slug 443 * @return string The short slug for use in the middle of URLs 456 * in general, or define a specific component slug constant (e.g. 457 * BP_MEMBERS_SLUG) to override specific component slugs. 458 * 459 * @since BuddyPress (1.5.0) 460 * 461 * @param string $root_slug The root slug, which comes from $bp->pages->[component]->slug. 462 * @return string The short slug for use in the middle of URLs. 444 463 */ 445 464 function bp_core_component_slug_from_root_slug( $root_slug ) { … … 451 470 452 471 /** 453 * This function originally let plugins add support for pages in the root of the install. 454 * These root level pages are now handled by actual WordPress pages and this function is now 455 * a convenience for compatibility with the new method. 456 * 457 * @global $bp BuddyPress global settings 458 * @param string $slug The slug of the component 472 * Add support for a top-level ("root") component. 473 * 474 * This function originally (pre-1.5) let plugins add support for pages in the 475 * root of the install. These root level pages are now handled by actual 476 * WordPress pages and this function is now a convenience for compatibility 477 * with the new method. 478 * 479 * @global $bp BuddyPress global settings. 480 * 481 * @param string $slug The slug of the component being added to the root list. 459 482 */ 460 483 function bp_core_add_root_component( $slug ) { … … 484 507 } 485 508 509 /** 510 * Create WordPress pages to be used as BP component directories. 511 */ 486 512 function bp_core_create_root_component_page() { 487 513 global $bp; … … 497 523 498 524 /** 499 * Adds illegal names to WP so that root components will not conflict with 500 * blog names on a subdirectory installation. 525 * Add illegal blog names to WP so that root components will not conflict with blog names on a subdirectory installation. 501 526 * 502 527 * For example, it would stop someone creating a blog with the slug "groups". … … 511 536 512 537 /** 513 * Return sthe domain for the root blog.514 * eg: http://domain.com/ OR https://domain.com515 * 516 * @package BuddyPress Core538 * Return the domain for the root blog. 539 * 540 * eg: http://domain.com OR https://domain.com 541 * 517 542 * @uses get_blog_option() WordPress function to fetch blog meta. 543 * 518 544 * @return string The domain URL for the blog. 519 545 */ … … 526 552 527 553 /** 528 * Performs a status safe wp_redirect() that is compatible with bp_catch_uri() 529 * 530 * @package BuddyPress Core 554 * Perform a status-safe wp_redirect() that is compatible with BP's URI parser. 555 * 531 556 * @uses wp_safe_redirect() 557 * 558 * @param string $location The redirect URL. 559 * @param int $status Optional. The numeric code to give in the redirect 560 * headers. Default: 302. 532 561 */ 533 562 function bp_core_redirect( $location, $status = 302 ) { … … 548 577 549 578 /** 550 * Returns the referrer URL without the http(s):// 551 * 552 * @package BuddyPress Core 553 * @return string The referrer URL 579 * Return the referrer URL without the http(s):// 580 * 581 * @return string The referrer URL. 554 582 */ 555 583 function bp_core_referrer() { … … 562 590 * Get the path of of the current site. 563 591 * 564 * @package BuddyPress Core565 *566 592 * @global object $current_site 567 * @return string 593 * 594 * @return string URL to the current site. 568 595 */ 569 596 function bp_core_get_site_path() { … … 596 623 597 624 /** 598 * Get the current GMT time to save into the DB 599 * 600 * @package BuddyPress Core 625 * Get the current GMT time to save into the DB. 626 * 601 627 * @since BuddyPress (1.2.6) 628 * 629 * @param bool $gmt True to use GMT (rather than local) time. Default: true. 630 * @return string Current time in 'Y-m-d h:i:s' format. 602 631 */ 603 632 function bp_core_current_time( $gmt = true ) { … … 609 638 610 639 /** 640 * Get an English-language representation of the time elapsed since a given date. 641 * 611 642 * Based on function created by Dunstan Orchard - http://1976design.com 612 643 * … … 621 652 * interval of 3 minutes 59 seconds. 622 653 * 623 * @package BuddyPress Core 624 * @uses apply_filters() Filter 'bp_core_time_since_pre' to bypass BP's calculations 625 * @uses apply_filters() Filter 'bp_core_time_since' to modify BP's calculations 626 * @param int $older_date Unix timestamp of date you want to calculate the time since for 627 * @param int $newer_date Unix timestamp of date to compare older date to. Default false (current time). 628 * @return string The time since. 654 * @uses apply_filters() Filter 'bp_core_time_since_pre' to bypass BP's calculations. 655 * @uses apply_filters() Filter 'bp_core_time_since' to modify BP's calculations. 656 * 657 * @param int|string $older_date The earlier time from which you're calculating 658 * the time elapsed. Enter either as an integer Unix timestamp, or as a 659 * date string of the format 'Y-m-d h:i:s'. 660 * @param int $newer_date Optional. Unix timestamp of date to compare older 661 * date to. Default: false (current time). 662 * @return string String representing the time since the older date, eg 663 * "2 hours and 50 minutes". 629 664 */ 630 665 function bp_core_time_since( $older_date, $newer_date = false ) { … … 774 809 775 810 /** 776 * Adds a feedback (error/success) message to the WP cookie so it can be 777 * displayed after the page reloads. 778 * 779 * @package BuddyPress Core 780 * 781 * @global BuddyPress $bp The one true BuddyPress instance 782 * @param string $message Feedback to give to user 783 * @param string $type updated|success|error|warning 811 * Add a feedback (error/success) message to the WP cookie so it can be displayed after the page reloads. 812 * 813 * @global BuddyPress $bp The one true BuddyPress instance. 814 * 815 * @param string $message Feedback message to be displayed. 816 * @param string $type Message type. 'updated', 'success', 'error', 'warning'. 817 * Default: 'success'. 784 818 */ 785 819 function bp_core_add_message( $message, $type = '' ) { … … 803 837 804 838 /** 805 * Checks if there is a feedback message in the WP cookie, if so, adds a 806 * "template_notices" action so that the message can be parsed into the template 807 * and displayed to the user. 839 * Set up the display of the 'template_notices' feedback message. 840 * 841 * Checks whether there is a feedback message in the WP cookie and, if so, adds 842 * a "template_notices" action so that the message can be parsed into the 843 * template and displayed to the user. 808 844 * 809 845 * After the message is displayed, it removes the message vars from the cookie 810 846 * so that the message is not shown to the user multiple times. 811 847 * 812 * @package BuddyPress Core 813 * @global $bp_message The message text 814 * @global $bp_message_type The type of message (error/success) 848 * @global BuddyPress $bp BuddyPress global settings object. 815 849 * @uses setcookie() Sets a cookie value for the user. 816 850 */ … … 834 868 835 869 /** 836 * Renders a feedback message (either error or success message) to the theme template. 837 * The hook action 'template_notices' is used to call this function, it is not called directly. 838 * 839 * @package BuddyPress Core 840 * @global BuddyPress $bp The one true BuddyPress instance 870 * Render the 'template_notices' feedback message. 871 * 872 * The hook action 'template_notices' is used to call this function, it is not 873 * called directly. 874 * 875 * @global BuddyPress $bp The one true BuddyPress instance. 841 876 */ 842 877 function bp_core_render_message() { … … 863 898 864 899 /** 865 * Record user activity to the database. Many functions use a "last active" feature to 866 * show the length of time since the user was last active. 867 * This function will update that time as a usermeta setting for the user every 5 minutes. 868 * 869 * @package BuddyPress Core 870 * @global $userdata WordPress user data for the current logged in user. 871 * @uses bp_update_user_meta() BP function to update user metadata in the usermeta table. 900 * Listener function for the logged-in user's 'last_activity' metadata. 901 * 902 * Many functions use a "last active" feature to show the length of time since 903 * the user was last active. This function will update that time as a usermeta 904 * setting for the user every 5 minutes while the user is actively browsing the 905 * site. 906 * 907 * @uses bp_update_user_meta() BP function to update user metadata in the 908 * usermeta table. 909 * 910 * @return bool|null Returns false if there is nothing to do. 872 911 */ 873 912 function bp_core_record_activity() { … … 901 940 902 941 /** 903 * Formats last activity based on time since date given. 904 * 905 * @package BuddyPress Core 906 * @param string $last_activity_date The date of last activity. 907 * @param string $string 908 * @uses bp_core_time_since() This function will return an English representation of the time elapsed. 942 * Format last activity string based on time since date given. 943 * 944 * @uses bp_core_time_since() This function will return an English 945 * representation of the time elapsed. 946 * 947 * @param int|string $last_activity_date The date of last activity. 948 * @param string $string A sprintf()-able statement of the form '% ago'. 949 * @return string $last_active A string of the form '3 years ago'. 909 950 */ 910 951 function bp_core_get_last_activity( $last_activity_date, $string ) { … … 923 964 * Get the meta_key for a given piece of user metadata 924 965 * 925 * BuddyPress stores a number of pieces of userdata in the WordPress central usermeta table. In 926 * order to allow plugins to enable multiple instances of BuddyPress on a single WP installation, 927 * BP's usermeta keys are filtered with this function, so that they can be altered on the fly. 928 * 929 * Plugin authors should use BP's _user_meta() functions, which bakes in bp_get_user_meta_key(). 966 * BuddyPress stores a number of pieces of userdata in the WordPress central 967 * usermeta table. In order to allow plugins to enable multiple instances of 968 * BuddyPress on a single WP installation, BP's usermeta keys are filtered 969 * through this function, so that they can be altered on the fly. 970 * 971 * Plugin authors should use BP's _user_meta() functions, which bakes in 972 * bp_get_user_meta_key(): 930 973 * $last_active = bp_get_user_meta( $user_id, 'last_activity', true ); 931 * If you have to use WP's _user_meta() functions for some reason, you should use this function, eg 974 * If you must use WP's _user_meta() functions directly for some reason, you 975 * should use this function to determine the $key parameter, eg 932 976 * $last_active = get_user_meta( $user_id, bp_get_user_meta_key( 'last_activity' ), true ); 933 977 * If using the WP functions, do not not hardcode your meta keys. 934 978 * 935 * @ package BuddyPress936 * @since BuddyPress (1.5)937 * 938 * @uses apply_filters() Filter bp_get_user_meta_key to modify keys individually939 * @param string $key 940 * @return string $key 979 * @since BuddyPress (1.5.0) 980 * 981 * @uses apply_filters() Filter 'bp_get_user_meta_key' to modify keys individually. 982 * 983 * @param string $key The usermeta meta_key. 984 * @return string $key The usermeta meta_key. 941 985 */ 942 986 function bp_get_user_meta_key( $key = false ) { … … 945 989 946 990 /** 947 * Get a piece of usermeta 948 * 949 * This is a wrapper for get_user_meta() that allows for easy use of bp_get_user_meta_key(), thereby 950 * increasing compatibility with non-standard BP setups. 951 * 952 * @package BuddyPress 953 * @since BuddyPress (1.5) 954 * 955 * @uses bp_get_user_meta_key() For a filterable version of the meta key 956 * @uses get_user_meta() See get_user_meta() docs for more details on parameters 957 * @param int $user_id The id of the user whose meta you're fetching 991 * Get a piece of usermeta. 992 * 993 * This is a wrapper for get_user_meta() that allows for easy use of 994 * bp_get_user_meta_key(), thereby increasing compatibility with non-standard 995 * BP setups. 996 * 997 * @since BuddyPress (1.5.0) 998 * 999 * @see get_user_meta() For complete details about parameters and return values. 1000 * @uses bp_get_user_meta_key() For a filterable version of the meta key. 1001 * 1002 * @param int $user_id The ID of the user whose meta you're fetching. 958 1003 * @param string $key The meta key to retrieve. 959 1004 * @param bool $single Whether to return a single value. 960 1005 * @return mixed Will be an array if $single is false. Will be value of meta data field if $single 961 * is true.1006 * is true. 962 1007 */ 963 1008 function bp_get_user_meta( $user_id, $key, $single = false ) { … … 966 1011 967 1012 /** 968 * Update a piece of usermeta 969 * 970 * This is a wrapper for update_user_meta() that allows for easy use of bp_get_user_meta_key(), 971 * thereby increasing compatibility with non-standard BP setups. 972 * 973 * @package BuddyPress 974 * @since BuddyPress (1.5) 975 * 976 * @uses bp_get_user_meta_key() For a filterable version of the meta key 977 * @uses update_user_meta() See update_user_meta() docs for more details on parameters 978 * @param int $user_id The id of the user whose meta you're setting 1013 * Update a piece of usermeta. 1014 * 1015 * This is a wrapper for update_user_meta() that allows for easy use of 1016 * bp_get_user_meta_key(), thereby increasing compatibility with non-standard 1017 * BP setups. 1018 * 1019 * @since BuddyPress (1.5.0) 1020 * 1021 * @see update_user_meta() For complete details about parameters and return values. 1022 * @uses bp_get_user_meta_key() For a filterable version of the meta key. 1023 * 1024 * @param int $user_id The ID of the user whose meta you're setting. 979 1025 * @param string $key The meta key to set. 980 1026 * @param mixed $value Metadata value. 981 1027 * @param mixed $prev_value Optional. Previous value to check before removing. 982 * @return bool False on failure, true ifsuccess.1028 * @return bool False on failure, true on success. 983 1029 */ 984 1030 function bp_update_user_meta( $user_id, $key, $value, $prev_value = '' ) { … … 987 1033 988 1034 /** 989 * Delete a piece of usermeta 990 * 991 * This is a wrapper for delete_user_meta() that allows for easy use of bp_get_user_meta_key(), 992 * thereby increasing compatibility with non-standard BP setups. 993 * 994 * @package BuddyPress 995 * @since BuddyPress (1.5) 996 * 997 * @uses bp_get_user_meta_key() For a filterable version of the meta key 998 * @uses delete_user_meta() See delete_user_meta() docs for more details on parameters 999 * @param int $user_id The id of the user whose meta you're deleting 1035 * Delete a piece of usermeta. 1036 * 1037 * This is a wrapper for delete_user_meta() that allows for easy use of 1038 * bp_get_user_meta_key(), thereby increasing compatibility with non-standard 1039 * BP setups. 1040 * 1041 * @since BuddyPress (1.5.0) 1042 * 1043 * @see delete_user_meta() For complete details about parameters and return values. 1044 * @uses bp_get_user_meta_key() For a filterable version of the meta key. 1045 * 1046 * @param int $user_id The ID of the user whose meta you're deleting. 1000 1047 * @param string $key The meta key to delete. 1001 1048 * @param mixed $value Optional. Metadata value. … … 1011 1058 * Initializes {@link BP_Embed} after everything is loaded. 1012 1059 * 1013 * @ global object $bp BuddyPress global settings1014 * @package BuddyPress Core1015 * @ since BuddyPress (1.5)1060 * @since BuddyPress (1.5.0) 1061 * 1062 * @global BuddyPress $bp BuddyPress global settings. 1016 1063 */ 1017 1064 function bp_embed_init() { … … 1026 1073 * Are oembeds allowed in activity items? 1027 1074 * 1028 * @return bool False when activity embed support is disabled; true when enabled (default) 1029 * @since BuddyPress (1.5) 1075 * @since BuddyPress (1.5.0) 1076 * 1077 * @return bool False when activity embed support is disabled; true when 1078 * enabled. Default: true. 1030 1079 */ 1031 1080 function bp_use_embed_in_activity() { … … 1036 1085 * Are oembeds allwoed in activity replies? 1037 1086 * 1038 * @return bool False when activity replies embed support is disabled; true when enabled (default) 1039 * @since BuddyPress (1.5) 1087 * @since BuddyPress (1.5.0) 1088 * 1089 * @return bool False when activity replies embed support is disabled; true 1090 * when enabled. Default: true. 1040 1091 */ 1041 1092 function bp_use_embed_in_activity_replies() { … … 1046 1097 * Are oembeds allowed in forum posts? 1047 1098 * 1048 * @return bool False when form post embed support is disabled; true when enabled (default) 1049 * @since BuddyPress (1.5) 1099 * @since BuddyPress (1.5.0) 1100 * 1101 * @return bool False when forum post embed support is disabled; true when 1102 * enabled. Default: true. 1050 1103 */ 1051 1104 function bp_use_embed_in_forum_posts() { … … 1056 1109 * Are oembeds allowed in private messages? 1057 1110 * 1058 * @return bool False when form post embed support is disabled; true when enabled (default) 1059 * @since BuddyPress (1.5) 1111 * @since BuddyPress (1.5.0) 1112 * 1113 * @return bool False when private message embed support is disabled; true when 1114 * enabled. Default: true. 1060 1115 */ 1061 1116 function bp_use_embed_in_private_messages() { … … 1066 1121 1067 1122 /** 1068 * Output the correct URL based on BuddyPress and WordPress configuration 1069 * 1070 * @package BuddyPress 1071 * @since BuddyPress (1.5) 1072 * 1073 * @param string $path 1074 * @param string $scheme 1075 * 1076 * @uses bp_get_admin_url() 1123 * Output the correct admin URL based on BuddyPress and WordPress configuration. 1124 * 1125 * @since BuddyPress (1.5.0) 1126 * 1127 * @see bp_get_admin_url() For description of parameters. 1128 * 1129 * @param string $path See {@link bp_get_admin_url()}. 1130 * @param string $scheme See {@link bp_get_admin_url()}. 1077 1131 */ 1078 1132 function bp_admin_url( $path = '', $scheme = 'admin' ) { … … 1080 1134 } 1081 1135 /** 1082 * Return the correct URL based on BuddyPress and WordPress configuration1136 * Return the correct admin URL based on BuddyPress and WordPress configuration. 1083 1137 * 1084 * @package BuddyPress 1085 * @since BuddyPress (1.5) 1086 * 1087 * @param string $path 1088 * @param string $scheme 1138 * @since BuddyPress (1.5.0) 1089 1139 * 1090 1140 * @uses bp_core_do_network_admin() 1091 1141 * @uses network_admin_url() 1092 1142 * @uses admin_url() 1143 * 1144 * @param string $path Optional. The sub-path under /wp-admin to be 1145 * appended to the admin URL. 1146 * @param string $scheme The scheme to use. Default is 'admin', which 1147 * obeys {@link force_ssl_admin()} and {@link is_ssl()}. 'http' 1148 * or 'https' can be passed to force those schemes. 1149 * @return string Admin url link with optional path appended. 1093 1150 */ 1094 1151 function bp_get_admin_url( $path = '', $scheme = 'admin' ) { … … 1107 1164 1108 1165 /** 1109 * Should BuddyPress appear in network admin , or site admin?1166 * Should BuddyPress appear in network admin (vs a single site Dashboard)? 1110 1167 * 1111 1168 * Because BuddyPress can be installed in multiple ways and with multiple … … 1113 1170 * to hook into certain areas of WordPress's admin. 1114 1171 * 1115 * This function defaults to BuddyPress being network activated. 1116 * @since BuddyPress (1.5) 1172 * @since BuddyPress (1.5.0) 1117 1173 * 1118 1174 * @uses bp_is_network_activated() 1119 1175 * @uses bp_is_multiblog_mode() 1120 * @return boolean 1176 * 1177 * @return bool True if the BP admin screen should appear in the Network Admin, 1178 * otherwise false. 1121 1179 */ 1122 1180 function bp_core_do_network_admin() { … … 1131 1189 } 1132 1190 1191 /** 1192 * Return the action name that BuddyPress nav setup callbacks should be hooked to. 1193 * 1194 * Functions used to set up BP Dashboard pages (wrapping such admin-panel 1195 * functions as add_submenu_page()) should use bp_core_admin_hook() for the 1196 * first parameter in add_action(). BuddyPress will then determine 1197 * automatically whether to load the panels in the Network Admin. Ie: 1198 * 1199 * add_action( bp_core_admin_hook(), 'myplugin_dashboard_panel_setup' ); 1200 * 1201 * @return string $hook The proper hook ('network_admin_menu' or 'admin_menu'). 1202 */ 1133 1203 function bp_core_admin_hook() { 1134 1204 $hook = bp_core_do_network_admin() ? 'network_admin_menu' : 'admin_menu'; … … 1140 1210 1141 1211 /** 1142 * Is this the root blog ID? 1143 * 1144 * @package BuddyPress 1145 * @since BuddyPress (1.5) 1146 * 1147 * @param int $blog_id Optional. Defaults to the current blog id. 1212 * Is this the root blog? 1213 * 1214 * @since BuddyPress (1.5.0) 1215 * 1216 * @param int $blog_id Optional. Default: the ID of the current blog. 1148 1217 * @return bool $is_root_blog Returns true if this is bp_get_root_blog_id(). 1149 1218 */ … … 1165 1234 1166 1235 /** 1167 * Is this bp_get_root_blog_id()? 1168 * 1169 * @package BuddyPress 1170 * @since BuddyPress (1.5) 1171 * 1172 * @return int Return the root site ID 1236 * Get the ID of the root blog. 1237 * 1238 * The "root blog" is the blog on a WordPress network where BuddyPress content 1239 * appears (where member profile URLs resolve, where a given theme is loaded, 1240 * etc.). 1241 * 1242 * @since BuddyPress (1.5.0) 1243 * 1244 * @return int The root site ID. 1173 1245 */ 1174 1246 function bp_get_root_blog_id() { … … 1201 1273 * down this road unless you specifically need to. 1202 1274 * 1203 * @package BuddyPress 1204 * @since BuddyPress (1.5) 1205 * 1206 * @uses apply_filters() Filter 'bp_is_multiblog_mode' to alter 1207 * @return bool False when multiblog mode is disabled (default); true when enabled 1275 * @since BuddyPress (1.5.0) 1276 * 1277 * @uses apply_filters() Filter 'bp_is_multiblog_mode' to alter. 1278 * 1279 * @return bool False when multiblog mode is disabled; true when enabled. 1280 * Default: false. 1208 1281 */ 1209 1282 function bp_is_multiblog_mode() { … … 1232 1305 * Used to determine admin menu placement, and where settings and options are 1233 1306 * stored. If you're being *really* clever and manually pulling BuddyPress in 1234 * with an mu-plugin or some other method, you'll want to 1235 * 1236 * @since BuddyPress (1.7) 1237 * @return boolean 1307 * with an mu-plugin or some other method, you'll want to filter 1308 * 'bp_is_network_activated' and override the auto-determined value. 1309 * 1310 * @since BuddyPress (1.7.0) 1311 * 1312 * @return bool True if BuddyPress is network activated. 1238 1313 */ 1239 1314 function bp_is_network_activated() { … … 1256 1331 1257 1332 /** 1258 * Set the $bp->is_directory global 1259 * 1260 * @global BuddyPress $bp The one true BuddyPress instance 1261 * @param bool $is_directory 1262 * @param string $component 1333 * Set the $bp->is_directory global. 1334 * 1335 * @global BuddyPress $bp The one true BuddyPress instance. 1336 * 1337 * @param bool $is_directory Optional. Default: false. 1338 * @param string $component Optional. Component name. Default: the current 1339 * component. 1263 1340 */ 1264 1341 function bp_update_is_directory( $is_directory = false, $component = '' ) { … … 1272 1349 1273 1350 /** 1274 * Set the $bp->is_item_admin global 1275 * 1276 * @global BuddyPress $bp The one true BuddyPress instance 1277 * @param bool $is_item_admin 1278 * @param string $component 1351 * Set the $bp->is_item_admin global. 1352 * 1353 * @global BuddyPress $bp The one true BuddyPress instance. 1354 * 1355 * @param bool $is_item_admin Optional. Default: false. 1356 * @param string $component. Optional. Component name. Default: the current 1357 * component. 1279 1358 */ 1280 1359 function bp_update_is_item_admin( $is_item_admin = false, $component = '' ) { … … 1288 1367 1289 1368 /** 1290 * Set the $bp->is_item_mod global 1291 * 1292 * @global BuddyPress $bp The one true BuddyPress instance 1293 * @param bool $is_item_mod 1294 * @param string $component 1369 * Set the $bp->is_item_mod global. 1370 * 1371 * @global BuddyPress $bp The one true BuddyPress instance. 1372 * 1373 * @param bool $is_item_mod Optional. Default: false. 1374 * @param string $component. Optional. Component name. Default: the current 1375 * component. 1295 1376 */ 1296 1377 function bp_update_is_item_mod( $is_item_mod = false, $component = '' ) { … … 1304 1385 1305 1386 /** 1306 * Trigger a 404 1307 * 1308 * @global BuddyPress $bp The one true BuddyPress instance 1309 * @global WP_Query $wp_query WordPress query object 1310 * @param string $redirect If 'remove_canonical_direct', remove WordPress' "helpful" redirect_canonical action. 1311 * @since BuddyPress (1.5) 1387 * Trigger a 404. 1388 * 1389 * @since BuddyPress (1.5.0) 1390 * 1391 * @global WP_Query $wp_query WordPress query object. 1392 * 1393 * @param string $redirect If 'remove_canonical_direct', remove WordPress' 1394 * "helpful" redirect_canonical action. Default: 'remove_canonical_redirect'. 1312 1395 */ 1313 1396 function bp_do_404( $redirect = 'remove_canonical_direct' ) { … … 1331 1414 * To avoid security exploits within the theme. 1332 1415 * 1333 * @since BuddyPress (1.6 )1416 * @since BuddyPress (1.6.0) 1334 1417 * 1335 1418 * @uses do_action() Calls 'bp_verify_nonce_request' on $action. 1336 * @param string $action Action nonce 1337 * @param string $query_arg where to look for nonce in $_REQUEST 1419 * 1420 * @param string $action Action nonce. 1421 * @param string $query_arg where to look for nonce in $_REQUEST. 1422 * @return bool True if the nonce is verified, otherwise false. 1338 1423 */ 1339 1424 function bp_verify_nonce_request( $action = '', $query_arg = '_wpnonce' ) { … … 1360 1445 1361 1446 /** 1362 * Load the buddypress translation file for current language 1363 * 1364 * @package BuddyPress Core 1447 * Load the buddypress translation file for current language. 1448 * 1449 * @see load_textdomain() for a description of return values. 1450 * 1451 * @return bool True on success, false on failure. 1365 1452 */ 1366 1453 function bp_core_load_buddypress_textdomain() { … … 1380 1467 1381 1468 /** 1382 * A javascript free implementation of the search functions in BuddyPress 1383 * 1384 * @package BuddyPress Core 1469 * A javascript-free implementation of the search functions in BuddyPress. 1470 * 1385 1471 * @param string $slug The slug to redirect to for searching. 1386 1472 */ … … 1446 1532 1447 1533 /** 1448 * Prints the generation time in the footer of the site. 1449 * 1450 * @package BuddyPress Core 1534 * Print the generation time in the footer of the site. 1451 1535 */ 1452 1536 function bp_core_print_generation_time() {
Note: See TracChangeset
for help on using the changeset viewer.