Changeset 10039
- Timestamp:
- 08/09/2015 05:07:56 AM (9 years ago)
- Location:
- trunk/src/bp-core
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-actions.php
r10012 r10039 1 1 <?php 2 3 2 /** 4 3 * BuddyPress Filters & Actions. … … 10 9 * They are consolidated here to make searching for them easier, and to help 11 10 * developers understand at a glance the order in which things occur. 12 *13 11 */ 14 12 15 // Exit if accessed directly 13 // Exit if accessed directly. 16 14 defined( 'ABSPATH' ) || exit; 17 15 … … 34 32 add_action( 'plugins_loaded', 'bp_loaded', 10 ); 35 33 add_action( 'init', 'bp_init', 10 ); 36 add_action( 'parse_query', 'bp_parse_query', 2 ); // Early for overrides 34 add_action( 'parse_query', 'bp_parse_query', 2 ); // Early for overrides. 37 35 add_action( 'wp', 'bp_ready', 10 ); 38 36 add_action( 'set_current_user', 'bp_setup_current_user', 10 ); 39 37 add_action( 'setup_theme', 'bp_setup_theme', 10 ); 40 add_action( 'after_setup_theme', 'bp_after_setup_theme', 100 ); // After WP themes 38 add_action( 'after_setup_theme', 'bp_after_setup_theme', 100 ); // After WP themes. 41 39 add_action( 'wp_enqueue_scripts', 'bp_enqueue_scripts', 10 ); 42 add_action( 'admin_bar_menu', 'bp_setup_admin_bar', 20 ); // After WP core 40 add_action( 'admin_bar_menu', 'bp_setup_admin_bar', 20 ); // After WP core. 43 41 add_action( 'template_redirect', 'bp_template_redirect', 10 ); 44 42 add_action( 'widgets_init', 'bp_widgets_init', 10 ); … … 100 98 add_action( 'bp_after_setup_theme', 'bp_load_theme_functions', 1 ); 101 99 102 // Load the admin 100 // Load the admin. 103 101 if ( is_admin() ) { 104 102 add_action( 'bp_loaded', 'bp_admin' ); 105 103 } 106 104 107 // Activation redirect 105 // Activation redirect. 108 106 add_action( 'bp_activation', 'bp_add_activation_redirect' ); -
trunk/src/bp-core/bp-core-attachments.php
r10012 r10039 7 7 */ 8 8 9 // Exit if accessed directly 9 // Exit if accessed directly. 10 10 defined( 'ABSPATH' ) || exit; 11 11 -
trunk/src/bp-core/bp-core-avatars.php
r10012 r10039 1 1 <?php 2 3 2 /** 4 3 * BuddyPress Avatars. 5 */ 6 7 // Exit if accessed directly 4 * 5 * @package BuddyPress 6 */ 7 8 // Exit if accessed directly. 8 9 defined( 'ABSPATH' ) || exit; 9 10 10 /** *11 /** 11 12 * Set up the constants we need for avatar support. 12 13 */ … … 326 327 /** Sanity Checks *********************************************************/ 327 328 328 // Get a fallback for the 'alt' parameter, create html output 329 // Get a fallback for the 'alt' parameter, create html output. 329 330 if ( empty( $params['alt'] ) ) { 330 331 $params['alt'] = __( 'Profile Photo', 'buddypress' ); … … 332 333 $html_alt = ' alt="' . esc_attr( $params['alt'] ) . '"'; 333 334 334 // Filter image title and create html string 335 // Filter image title and create html string. 335 336 $html_title = ''; 336 337 … … 351 352 } 352 353 353 // Set CSS ID and create html string 354 // Set CSS ID and create html string. 354 355 $html_css_id = ''; 355 356 … … 531 532 return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $avatar_url . '"' . $html_class . $html_css_id . $html_width . $html_height . $html_alt . $html_title . ' />', $params, $params['item_id'], $params['avatar_dir'], $html_css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir ); 532 533 533 534 // ...or only the URL 534 535 } else { 535 536 … … 612 613 } 613 614 614 615 // No avatar was found, and we've been told not to use a gravatar. 615 616 } else { 616 617 … … 644 645 * @param array|string $args { 645 646 * Array of function parameters. 646 * @type bool|int $item_id ID of the item whose avatar you're deleting. 647 * Defaults to the current item of type $object. 648 * @type string $object Object type of the item whose avatar you're 649 * deleting. 'user', 'group', 'blog', or custom. Default: 'user'. 647 * @type bool|int $item_id ID of the item whose avatar you're deleting. 648 * Defaults to the current item of type $object. 649 * @type string $object Object type of the item whose avatar you're 650 * deleting. 'user', 'group', 'blog', or custom. 651 * Default: 'user'. 650 652 * @type bool|string $avatar_dir Subdirectory where avatar is located. 651 * Default: false, which falls back on the default location652 * corresponding to the $object.653 * Default: false, which falls back on the default location 654 * corresponding to the $object. 653 655 * } 654 656 * @return bool True on success, false on failure. … … 730 732 */ 731 733 function bp_avatar_ajax_delete() { 732 // Bail if not a POST action 734 // Bail if not a POST action. 733 735 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) { 734 736 wp_send_json_error(); … … 810 812 } 811 813 812 // Setup some variables 814 // Setup some variables. 813 815 $bp = buddypress(); 814 816 $upload_path = bp_core_avatar_upload_path(); 815 817 816 // Upload the file 818 // Upload the file. 817 819 $avatar_attachment = new BP_Attachment_Avatar(); 818 820 $bp->avatar_admin->original = $avatar_attachment->upload( $file, $upload_dir_filter ); 819 821 820 // In case of an error, stop the process and display a feedback to the user 822 // In case of an error, stop the process and display a feedback to the user. 821 823 if ( ! empty( $bp->avatar_admin->original['error'] ) ) { 822 824 bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $bp->avatar_admin->original['error'] ), 'error' ); … … 824 826 } 825 827 826 // Maybe resize 828 // Maybe resize. 827 829 $bp->avatar_admin->resized = $avatar_attachment->shrink( $bp->avatar_admin->original['file'] ); 828 830 $bp->avatar_admin->image = new stdClass(); … … 838 840 } 839 841 840 // Check for WP_Error on what should be an image 842 // Check for WP_Error on what should be an image. 841 843 if ( is_wp_error( $bp->avatar_admin->image->dir ) ) { 842 844 bp_core_add_message( sprintf( __( 'Upload failed! Error was: %s', 'buddypress' ), $bp->avatar_admin->image->dir->get_error_message() ), 'error' ); … … 844 846 } 845 847 846 // If the uploaded image is smaller than the "full" dimensions, throw a warning 848 // If the uploaded image is smaller than the "full" dimensions, throw a warning. 847 849 if ( $avatar_attachment->is_too_small( $bp->avatar_admin->image->file ) ) { 848 850 bp_core_add_message( sprintf( __( 'You have selected an image that is smaller than recommended. For best results, upload a picture larger than %d x %d pixels.', 'buddypress' ), bp_core_avatar_full_width(), bp_core_avatar_full_height() ), 'error' ); 849 851 } 850 852 851 // Set the url value for the image 853 // Set the url value for the image. 852 854 $bp->avatar_admin->image->url = bp_core_avatar_url() . $bp->avatar_admin->image->dir; 853 855 … … 1005 1007 1006 1008 /** 1007 * Handle avatar webcam capture. 1008 * 1009 * @since BuddyPress (2.3.0) 1010 * 1011 * @param string $data Base64 encoded image. 1012 * @param int $item_id. 1009 * Handle avatar webcam capture. 1013 1010 * 1014 * @return bool True on success, false on failure. 1015 */ 1011 * @since BuddyPress (2.3.0) 1012 * 1013 * @param string $data Base64 encoded image. 1014 * @param int $item_id Item to associate. 1015 * 1016 * @return bool True on success, false on failure. 1017 */ 1016 1018 function bp_avatar_handle_capture( $data = '', $item_id = 0 ) { 1017 1019 if ( empty( $data ) || empty( $item_id ) ) { … … 1021 1023 $avatar_dir = bp_core_avatar_upload_path() . '/avatars'; 1022 1024 1023 // It's not a regular upload, we may need to create this folder 1025 // It's not a regular upload, we may need to create this folder. 1024 1026 if ( ! file_exists( $avatar_dir ) ) { 1025 1027 if ( ! wp_mkdir_p( $avatar_dir ) ) { … … 1040 1042 $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', $avatar_dir . '/' . $item_id, $item_id, 'user', 'avatars' ); 1041 1043 1042 // It's not a regular upload, we may need to create this folder 1044 // It's not a regular upload, we may need to create this folder. 1043 1045 if( ! is_dir( $avatar_folder_dir ) ) { 1044 1046 if ( ! wp_mkdir_p( $avatar_folder_dir ) ) { … … 1449 1451 } 1450 1452 1451 // See if the value has already been calculated and stashed in the $bp global 1453 // See if the value has already been calculated and stashed in the $bp global. 1452 1454 if ( isset( $bp->avatar->$type ) ) { 1453 1455 $retval = $bp->avatar->$type; 1454 1456 } else { 1455 // If this value has been set in a constant, just use that 1457 // If this value has been set in a constant, just use that. 1456 1458 if ( defined( $constant ) ) { 1457 1459 $retval = constant( $constant ); 1458 1460 } else { 1459 1461 1460 // Use cached upload dir data if available 1462 // Use cached upload dir data if available. 1461 1463 if ( ! empty( $bp->avatar->upload_dir ) ) { 1462 1464 $upload_dir = $bp->avatar->upload_dir; 1463 1465 1464 // No cache, so query for it 1466 // No cache, so query for it. 1465 1467 } else { 1466 1468 1467 // Get upload directory information from current site 1469 // Get upload directory information from current site. 1468 1470 $upload_dir = bp_upload_dir(); 1469 1471 1470 // Stash upload directory data for later use 1472 // Stash upload directory data for later use. 1471 1473 $bp->avatar->upload_dir = $upload_dir; 1472 1474 } 1473 1475 1474 // Directory does not exist and cannot be created 1476 // Directory does not exist and cannot be created. 1475 1477 if ( ! empty( $upload_dir['error'] ) ) { 1476 1478 $retval = ''; … … 1488 1490 } 1489 1491 1490 // Stash in $bp for later use 1492 // Stash in $bp for later use. 1491 1493 $bp->avatar->$type = $retval; 1492 1494 } -
trunk/src/bp-core/bp-core-buddybar.php
r10012 r10039 80 80 * @since BuddyPress (2.4.0) 81 81 * 82 * @param array $args {82 * @param array|string $args { 83 83 * Array describing the new nav item. 84 84 * @type string $name Display name for the nav item. … … 164 164 * @since BuddyPress (2.4.0) 165 165 * 166 * @param array $args {166 * @param array|string $args { 167 167 * Array describing the new nav item. 168 168 * @type string $name Display name for the nav item. -
trunk/src/bp-core/bp-core-cache.php
r10012 r10039 2 2 /** 3 3 * BuddyPress Core Caching Functions. 4 * 5 * @package BuddyPress 4 6 * 5 7 * Caching functions handle the clearing of cached objects and pages on specific … … 38 40 * Clear all cached objects for a user, or those that a user is part of. 39 41 * 40 * @param string $user_id 42 * @param string $user_id User ID to delete cache for. 41 43 */ 42 44 function bp_core_clear_user_object_cache( $user_id ) { … … 62 64 * @since BuddyPress (2.0.0) 63 65 * 64 * @param int $post_id 66 * @param int $post_id ID of the page that was saved. 65 67 */ 66 68 function bp_core_clear_directory_pages_cache_page_edit( $post_id ) { … … 69 71 } 70 72 71 // Bail if BP is not defined here 73 // Bail if BP is not defined here. 72 74 if ( ! buddypress() ) { 73 75 return; … … 185 187 'meta_table' => '', // Name of the table containing the metadata 186 188 'object_column' => '', // DB column for the object ids (group_id, etc) 187 'cache_key_prefix' => '' // Prefix to use when creating cache key names. Eg 188 // 'bp_groups_groupmeta' 189 'cache_key_prefix' => '' // Prefix to use when creating cache key names. Eg 'bp_groups_groupmeta' 189 190 ); 190 191 $r = wp_parse_args( $args, $defaults ); -
trunk/src/bp-core/bp-core-functions.php
r10016 r10039 65 65 } 66 66 /** 67 * Return the BuddyPress database version 67 * Return the BuddyPress database version. 68 68 * 69 69 * @since BuddyPress (1.6) … … 170 170 * Format numbers the BuddyPress way. 171 171 * 172 * @param int $numberThe number to be formatted.172 * @param int $number The number to be formatted. 173 173 * @param bool $decimals Whether to use decimals. See {@link number_format_i18n()}. 174 * 174 175 * @return string The formatted number. 175 176 */ … … 224 225 * 225 226 * @since BuddyPress (1.6) 227 * 226 228 * @param array $old_args_keys Old argument indexs, keyed to their positions. 227 * @param array $func_args The parameters passed to the originating function. 229 * @param array $func_args The parameters passed to the originating function. 230 * 228 231 * @return array $new_args The parsed arguments. 229 232 */ … … 251 254 * @since BuddyPress (r7704) 252 255 * 253 * @param string|array $args Value to merge with $defaults 254 * @param array $defaults Array that serves as the defaults. 255 * @param string $filter_key String to key the filters from 256 * @param string|array $args Value to merge with $defaults. 257 * @param array $defaults Array that serves as the defaults. 258 * @param string $filter_key String to key the filters from. 259 * 256 260 * @return array Merged user defined values with defaults. 257 261 */ … … 313 317 * @since BuddyPress (2.2.0) 314 318 * 315 * @param string $page_arg The $_REQUEST argument to look for 316 * @param int $page The original page value to fall back to 317 * @return int A sanitized integer value, good for pagination 319 * @param string $page_arg The $_REQUEST argument to look for. 320 * @param int $page The original page value to fall back to. 321 * 322 * @return int A sanitized integer value, good for pagination. 318 323 */ 319 324 function bp_sanitize_pagination_arg( $page_arg = '', $page = 1 ) { … … 344 349 * 345 350 * @param string $order The 'order' string, as passed to the SQL constructor. 351 * 346 352 * @return string The sanitized value 'DESC' or 'ASC'. 347 353 */ … … 364 370 * 365 371 * @param string $text The raw text to be escaped. 372 * 366 373 * @return string Text in the form of a LIKE phrase. Not SQL safe. Run through 367 * wpdb::prepare() before use.374 * wpdb::prepare() before use. 368 375 */ 369 376 function bp_esc_like( $text ) { … … 386 393 * 387 394 * @return bool False when compatibility mode is disabled, true when enabled. 388 * Default: false.395 * Default: false. 389 396 */ 390 397 function bp_is_username_compatibility_mode() { … … 475 482 * pages. When running save routines, use 'all' to avoid removing data related to inactive 476 483 * components. Default: 'active'. 484 * 477 485 * @return array|string An array of page IDs, keyed by component names, or an 478 486 * empty string if the list is not found. … … 526 534 * 527 535 * @param array $blog_page_ids The IDs of the WP pages corresponding to BP 528 * component directories.536 * component directories. 529 537 */ 530 538 function bp_core_update_directory_page_ids( $blog_page_ids ) { … … 608 616 * @since BuddyPress (1.7.0) 609 617 * 610 * @param array $components Components to create pages for.611 * @param string $existing 'delete' if you want to delete existing page612 * mappingsand replace with new ones. Otherwise existing page mappings613 * are kept, and the gaps filled in with new pages. Default: 'keep'.618 * @param array $components Components to create pages for. 619 * @param string $existing 'delete' if you want to delete existing page mappings 620 * and replace with new ones. Otherwise existing page mappings 621 * are kept, and the gaps filled in with new pages. Default: 'keep'. 614 622 */ 615 623 function bp_core_add_page_mappings( $components, $existing = 'keep' ) { … … 749 757 * 750 758 * @param string $root_slug The root slug, which comes from $bp->pages->[component]->slug. 759 * 751 760 * @return string The short slug for use in the middle of URLs. 752 761 */ … … 914 923 * 915 924 * @param string $location The redirect URL. 916 * @param int $statusOptional. The numeric code to give in the redirect917 * headers. Default: 302.925 * @param int $status Optional. The numeric code to give in the redirect 926 * headers. Default: 302. 918 927 */ 919 928 function bp_core_redirect( $location = '', $status = 302 ) { … … 1006 1015 * @since BuddyPress (1.2.6) 1007 1016 * 1008 * @param bool $gmtTrue to use GMT (rather than local) time. Default: true.1017 * @param bool $gmt True to use GMT (rather than local) time. Default: true. 1009 1018 * @param string $type See the 'type' parameter in {@link current_time()}. 1010 Default: 'mysql'. 1019 * Default: 'mysql'. 1020 * 1011 1021 * @return string Current time in 'Y-m-d h:i:s' format. 1012 1022 */ … … 1042 1052 * 1043 1053 * @param int|string $older_date The earlier time from which you're calculating 1044 * the time elapsed. Enter either as an integer Unix timestamp, or as a 1045 * date string of the format 'Y-m-d h:i:s'. 1046 * @param int|bool $newer_date Optional. Unix timestamp of date to compare older 1047 * date to. Default: false (current time). 1054 * the time elapsed. Enter either as an integer Unix timestamp, 1055 * or as a date string of the format 'Y-m-d h:i:s'. 1056 * @param int|bool $newer_date Optional. Unix timestamp of date to compare older 1057 * date to. Default: false (current time). 1058 * 1048 1059 * @return string String representing the time since the older date, eg 1049 1060 * "2 hours and 50 minutes". … … 1238 1249 * 1239 1250 * @param string $message Feedback message to be displayed. 1240 * @param string $type Message type. 'updated', 'success', 'error', 'warning'.1241 * Default: 'success'.1251 * @param string $type Message type. 'updated', 'success', 'error', 'warning'. 1252 * Default: 'success'. 1242 1253 */ 1243 1254 function bp_core_add_message( $message, $type = '' ) { … … 1413 1424 * 1414 1425 * @param int|string $last_activity_date The date of last activity. 1415 * @param string $string A sprintf()-able statement of the form 'active %s' 1426 * @param string $string A sprintf()-able statement of the form 'active %s'. 1427 * 1416 1428 * @return string $last_active A string of the form '3 years ago'. 1417 1429 */ … … 1463 1475 * 1464 1476 * @param string|bool $key The usermeta meta_key. 1477 * 1465 1478 * @return string $key The usermeta meta_key. 1466 1479 */ … … 1489 1502 * @uses bp_get_user_meta_key() For a filterable version of the meta key. 1490 1503 * 1491 * @param int $user_id The ID of the user whose meta you're fetching. 1492 * @param string $key The meta key to retrieve. 1493 * @param bool $single Whether to return a single value. 1504 * @param int $user_id The ID of the user whose meta you're fetching. 1505 * @param string $key The meta key to retrieve. 1506 * @param bool $single Whether to return a single value. 1507 * 1494 1508 * @return mixed Will be an array if $single is false. Will be value of meta data field if $single 1495 1509 * is true. … … 1511 1525 * @uses bp_get_user_meta_key() For a filterable version of the meta key. 1512 1526 * 1513 * @param int $user_id The ID of the user whose meta you're setting. 1514 * @param string $key The meta key to set. 1515 * @param mixed $value Metadata value. 1516 * @param mixed $prev_value Optional. Previous value to check before removing. 1527 * @param int $user_id The ID of the user whose meta you're setting. 1528 * @param string $key The meta key to set. 1529 * @param mixed $value Metadata value. 1530 * @param mixed $prev_value Optional. Previous value to check before removing. 1531 * 1517 1532 * @return bool False on failure, true on success. 1518 1533 */ … … 1533 1548 * @uses bp_get_user_meta_key() For a filterable version of the meta key. 1534 1549 * 1535 * @param int $user_id The ID of the user whose meta you're deleting. 1536 * @param string $key The meta key to delete. 1537 * @param mixed $value Optional. Metadata value. 1550 * @param int $user_id The ID of the user whose meta you're deleting. 1551 * @param string $key The meta key to delete. 1552 * @param mixed $value Optional. Metadata value. 1553 * 1538 1554 * @return bool False for failure. True for success. 1539 1555 */ … … 1566 1582 * 1567 1583 * @return bool False when activity embed support is disabled; true when 1568 * enabled. Default: true.1584 * enabled. Default: true. 1569 1585 */ 1570 1586 function bp_use_embed_in_activity() { … … 1586 1602 * 1587 1603 * @return bool False when activity replies embed support is disabled; true 1588 * when enabled. Default: true.1604 * when enabled. Default: true. 1589 1605 */ 1590 1606 function bp_use_embed_in_activity_replies() { … … 1606 1622 * 1607 1623 * @return bool False when forum post embed support is disabled; true when 1608 * enabled. Default: true.1624 * enabled. Default: true. 1609 1625 */ 1610 1626 function bp_use_embed_in_forum_posts() { … … 1626 1642 * 1627 1643 * @return bool False when private message embed support is disabled; true when 1628 * enabled. Default: true.1644 * enabled. Default: true. 1629 1645 */ 1630 1646 function bp_use_embed_in_private_messages() { … … 1649 1665 * @see bp_get_admin_url() For description of parameters. 1650 1666 * 1651 * @param string $path See {@link bp_get_admin_url()}.1667 * @param string $path See {@link bp_get_admin_url()}. 1652 1668 * @param string $scheme See {@link bp_get_admin_url()}. 1653 1669 */ … … 1664 1680 * @uses admin_url() 1665 1681 * 1666 * @param string $path Optional. The sub-path under /wp-admin to be1667 * appended to the admin URL.1682 * @param string $path Optional. The sub-path under /wp-admin to be 1683 * appended to the admin URL. 1668 1684 * @param string $scheme The scheme to use. Default is 'admin', which 1669 * obeys {@link force_ssl_admin()} and {@link is_ssl()}. 'http' 1670 * or 'https' can be passed to force those schemes. 1685 * obeys {@link force_ssl_admin()} and {@link is_ssl()}. 'http' 1686 * or 'https' can be passed to force those schemes. 1687 * 1671 1688 * @return string Admin url link with optional path appended. 1672 1689 */ … … 1698 1715 * 1699 1716 * @return bool True if the BP admin screen should appear in the Network Admin, 1700 * otherwise false.1717 * otherwise false. 1701 1718 */ 1702 1719 function bp_core_do_network_admin() { … … 1752 1769 * 1753 1770 * @param int $blog_id Optional. Default: the ID of the current blog. 1771 * 1754 1772 * @return bool $is_root_blog Returns true if this is bp_get_root_blog_id(). 1755 1773 */ … … 1830 1848 * 1831 1849 * @return bool False when multiblog mode is disabled; true when enabled. 1832 * Default: false.1850 * Default: false. 1833 1851 */ 1834 1852 function bp_is_multiblog_mode() { … … 1900 1918 * Set the "is_directory" global. 1901 1919 * 1902 * @param bool $is_directory Optional. Default: false.1903 * @param string $component Optional. Component name. Default: the current1904 * component.1920 * @param bool $is_directory Optional. Default: false. 1921 * @param string $component Optional. Component name. Default: the current 1922 * component. 1905 1923 */ 1906 1924 function bp_update_is_directory( $is_directory = false, $component = '' ) { … … 1924 1942 * Set the "is_item_admin" global. 1925 1943 * 1926 * @param bool $is_item_admin Optional. Default: false.1927 * @param string $component Optional. Component name. Default: the current1928 * component.1944 * @param bool $is_item_admin Optional. Default: false. 1945 * @param string $component Optional. Component name. Default: the current 1946 * component. 1929 1947 */ 1930 1948 function bp_update_is_item_admin( $is_item_admin = false, $component = '' ) { … … 1948 1966 * Set the "is_item_mod" global. 1949 1967 * 1950 * @param bool $is_item_mod Optional. Default: false.1951 * @param string $component Optional. Component name. Default: the current1952 * component.1968 * @param bool $is_item_mod Optional. Default: false. 1969 * @param string $component Optional. Component name. Default: the current 1970 * component. 1953 1971 */ 1954 1972 function bp_update_is_item_mod( $is_item_mod = false, $component = '' ) { … … 1976 1994 * @global WP_Query $wp_query WordPress query object. 1977 1995 * 1978 * @param string $redirect If 'remove_canonical_direct', remove WordPress' 1979 * "helpful"redirect_canonical action. Default: 'remove_canonical_redirect'.1996 * @param string $redirect If 'remove_canonical_direct', remove WordPress' "helpful" 1997 * redirect_canonical action. Default: 'remove_canonical_redirect'. 1980 1998 */ 1981 1999 function bp_do_404( $redirect = 'remove_canonical_direct' ) { … … 2012 2030 * @uses do_action() Calls 'bp_verify_nonce_request' on $action. 2013 2031 * 2014 * @param string $action Action nonce. 2015 * @param string $query_arg where to look for nonce in $_REQUEST. 2032 * @param string $action Action nonce. 2033 * @param string $query_arg Where to look for nonce in $_REQUEST. 2034 * 2016 2035 * @return bool True if the nonce is verified, otherwise false. 2017 2036 */ … … 2084 2103 2085 2104 /** 2086 * Return true|false if this is a POST request 2105 * Return true|false if this is a POST request. 2087 2106 * 2088 2107 * @since BuddyPress (1.9.0) … … 2094 2113 2095 2114 /** 2096 * Return true|false if this is a GET request 2115 * Return true|false if this is a GET request. 2097 2116 * 2098 2117 * @since BuddyPress (1.9.0) … … 2414 2433 * 2415 2434 * @param string $slug The slug of the nav item: login, register, or one of the 2416 * slugs from buddypress()->bp_nav. 2435 * slugs from buddypress()->bp_nav. 2436 * 2417 2437 * @return string $nav_item_url The URL generated for the current user. 2418 2438 */ … … 2436 2456 * for similar kinds of future requirements, or those implemented by third-party developers. 2437 2457 * 2458 * @since BuddyPress (2.1.0) 2459 * 2438 2460 * @param array $args 2461 * 2439 2462 * @return array|WP_Error Array of results. If there were any problems, returns a WP_Error object. 2440 * @since BuddyPress (2.1.0)2441 2463 */ 2442 2464 function bp_core_get_suggestions( $args ) { -
trunk/src/bp-core/bp-core-template.php
r10012 r10039 1 1 <?php 2 2 /** 3 * Core component template tag functions 3 * Core component template tag functions. 4 4 * 5 5 * @package BuddyPress … … 152 152 * Not currently used in BuddyPress. 153 153 * 154 * @return bool Returns true if an options avatar has been set, otherwise false.154 * @return bool $value Returns true if an options avatar has been set, otherwise false. 155 155 */ 156 156 function bp_has_options_avatar() { … … 326 326 327 327 /** 328 * Format a date based on a UNIX timestamp 328 * Format a date based on a UNIX timestamp. 329 329 * 330 330 * This function can be used to turn a UNIX timestamp into a properly formatted … … 342 342 * 343 343 * @param int|string $time The UNIX timestamp to be formatted. 344 * @param bool $exclude_time Optional. True to return only the month + day, false345 * to return month, day, and time. Default: false.346 * @param bool $gmt Optional. True to display in local time, false to347 * leave in GMT. Default: true.348 * 349 * @return mixed 350 * 351 * 352 * 344 * @param bool $exclude_time Optional. True to return only the month + day, false 345 * to return month, day, and time. Default: false. 346 * @param bool $gmt Optional. True to display in local time, false to 347 * leave in GMT. Default: true. 348 * 349 * @return mixed A string representation of $time, in the format 350 * "March 18, 2014 at 2:00 pm" (or whatever your 351 * 'date_format' and 'time_format' settings are 352 * on your root blog). False on failure. 353 353 */ 354 354 function bp_format_time( $time = '', $exclude_time = false, $gmt = true ) { … … 415 415 * do the necessary argument swapping for dynamic phrases. 416 416 * 417 * @param string $youtext The "you" version of the phrase (eg "Your Friends").417 * @param string $youtext The "you" version of the phrase (eg "Your Friends"). 418 418 * @param string $nametext The other-user version of the phrase. Should be in 419 * a format appropriate for sprintf() - use %s in place of the displayed420 * user's name (eg "%'s Friends").419 * a format appropriate for sprintf() - use %s in place of the displayed 420 * user's name (eg "%'s Friends"). 421 421 * @param bool $capitalize Optional. Force into title case. Default: true. 422 * @param bool $echo Optional. True to echo the results, false to return them. 423 * Default: true. 424 * @return string|null If ! $echo, returns the appropriate string. 422 * @param bool $echo Optional. True to echo the results, false to return them. 423 * Default: true. 424 * 425 * @return string|null $nametext If ! $echo, returns the appropriate string. 425 426 */ 426 427 function bp_word_or_name( $youtext, $nametext, $capitalize = true, $echo = true ) { … … 568 569 * 569 570 * @param string $component Component name. Default: current component. 571 * 570 572 * @return string Placeholder text for search field. 571 573 */ … … 691 693 * @since BuddyPress (2.2.0) 692 694 * 693 * @param array $attributes The field attributes 694 * @param string $name The field name 695 * @param array $attributes The field attributes. 696 * @param string $name The field name. 695 697 */ 696 698 $attributes = (array) apply_filters( 'bp_get_form_field_attributes', $attributes, $name ); … … 747 749 * ### Options: 748 750 * 749 * - `ending` Will be used as Ending and appended to the trimmed string 750 * - `exact` If false, $text will not be cut mid-word 751 * - `html` If true, HTML tags would be handled correctly 752 * - `filter_shortcodes` If true, shortcodes will be stripped before truncating 753 * 754 * @param string $text String to truncate.755 * @param int $length Optional. Length of returned string, including ellipsis.756 * Default: 225.751 * - `ending` Will be used as Ending and appended to the trimmed string. 752 * - `exact` If false, $text will not be cut mid-word. 753 * - `html` If true, HTML tags would be handled correctly. 754 * - `filter_shortcodes` If true, shortcodes will be stripped before truncating. 755 * 756 * @param string $text String to truncate. 757 * @param int $length Optional. Length of returned string, including ellipsis. 758 * Default: 225. 757 759 * @param array $options { 758 760 * An array of HTML attributes and options. Each item is optional. 759 * @type string $ending The string used after truncation.760 * Default: ' […]'.761 * @type bool $exactIf true, $text will be trimmed to exactly $length.762 * If false, $text will not be cut mid-word. Default: false.763 * @type bool $htmlIf true, don't include HTML tags when calculating764 * excerpt length. Default: true.765 * @type bool $filter_shortcodes If true, shortcodes will be stripped.766 * Default: true.761 * @type string $ending The string used after truncation. 762 * Default: ' […]'. 763 * @type bool $exact If true, $text will be trimmed to exactly $length. 764 * If false, $text will not be cut mid-word. Default: false. 765 * @type bool $html If true, don't include HTML tags when calculating 766 * excerpt length. Default: true. 767 * @type bool $filter_shortcodes If true, shortcodes will be stripped. 768 * Default: true. 767 769 * } 768 770 * @return string Trimmed string. … … 1027 1029 * 1028 1030 * @return bool True if the activation_complete global flag has been set, 1029 * otherwise false.1031 * otherwise false. 1030 1032 */ 1031 1033 function bp_account_was_activated() { … … 1071 1073 * @param array $args { 1072 1074 * Array of optional parameters. 1073 * @type string $before String to appear before the site name in the1074 * email subject. Default: '['.1075 * @type string $after String to appear after the site name in the1076 * email subject. Default: ']'.1075 * @type string $before String to appear before the site name in the 1076 * email subject. Default: '['. 1077 * @type string $after String to appear after the site name in the 1078 * email subject. Default: ']'. 1077 1079 * @type string $default The default site name, to be used when none is 1078 * found in the database. Default: 'Community'.1079 * @type string $text Text to append to the site name (ie, the main text of1080 * the email subject).1080 * found in the database. Default: 'Community'. 1081 * @type string $text Text to append to the site name (ie, the main text of 1082 * the email subject). 1081 1083 * } 1082 1084 * @return string Sanitized email subject. … … 1115 1117 * 1116 1118 * @param string|bool $object 1119 * 1117 1120 * @return string The AJAX querystring. 1118 1121 */ … … 1206 1209 * 1207 1210 * @return array|bool $action_variables The action variables array, or false 1208 * if the array is empty.1211 * if the array is empty. 1209 1212 */ 1210 1213 function bp_action_variables() { … … 1230 1233 * 1231 1234 * @param int $position The key of the action_variables array that you want. 1235 * 1232 1236 * @return string|bool $action_variable The value of that position in the 1233 * array, or false if not found.1237 * array, or false if not found. 1234 1238 */ 1235 1239 function bp_action_variable( $position = 0 ) { … … 1304 1308 * is used: 1305 1309 * 1) Use the short slug to get the canonical component name from the 1306 * active component array 1310 * active component array. 1307 1311 * 2) Use the component name to get the root slug out of the 1308 * appropriate part of the $bp global 1312 * appropriate part of the $bp global. 1309 1313 * 3) If nothing turns up, it probably means that $component is itself 1310 * a root slug 1314 * a root slug. 1311 1315 * 1312 1316 * Example: If your groups directory is at /community/companies, this … … 1319 1323 * 1320 1324 * @param string $component Optional. Defaults to the current component. 1325 * 1321 1326 * @return string $root_slug The root slug. 1322 1327 */ … … 1367 1372 * 1368 1373 * @param string $root_slug Needle to our active component haystack. 1374 * 1369 1375 * @return mixed False if none found, component name if found. 1370 1376 */ … … 1439 1445 * @uses apply_filters() Filter 'bp_displayed_user_id' to change this value. 1440 1446 * 1441 * @return int ID of the currently displayed user.1447 * @return int $id ID of the currently displayed user. 1442 1448 */ 1443 1449 function bp_displayed_user_id() { … … 1487 1493 * This function is designed to be generous, accepting several different kinds 1488 1494 * of value for the $component parameter. It checks $component_name against: 1489 * - the component's root_slug, which matches the page slug in $bp->pages 1490 * - the component's regular slug 1491 * - the component's id, or 'canonical' name 1495 * - the component's root_slug, which matches the page slug in $bp->pages. 1496 * - the component's regular slug. 1497 * - the component's id, or 'canonical' name. 1492 1498 * 1493 1499 * @since BuddyPress (1.5.0) 1494 1500 * 1495 1501 * @param string $component Name of the component being checked. 1502 * 1496 1503 * @return bool Returns true if the component matches, or else false. 1497 1504 */ … … 1582 1589 * 1583 1590 * @param string $action The action being tested against. 1591 * 1584 1592 * @return bool True if the current action matches $action. 1585 1593 */ … … 1602 1610 * @since BuddyPress (1.5.0) 1603 1611 * 1604 * @param string $action_variable The action_variable being tested against. 1605 * @param int|bool $position Optional. The array key you're testing against. If you 1606 * don't provide a $position, the function will return true if the 1607 * $action_variable is found *anywhere* in the action variables array. 1612 * @param string $action_variable The action_variable being tested against. 1613 * @param int|bool $position Optional. The array key you're testing against. If you 1614 * don't provide a $position, the function will return true if the 1615 * $action_variable is found *anywhere* in the action variables array. 1616 * 1608 1617 * @return bool True if $action_variable matches at the $position provided. 1609 1618 */ … … 1641 1650 * 1642 1651 * @param string $item The item being checked. 1652 * 1643 1653 * @return bool True if $item is the current item. 1644 1654 */ … … 1684 1694 * 1685 1695 * @return bool True if the current user is an admin for the current item, 1686 * otherwise false.1696 * otherwise false. 1687 1697 */ 1688 1698 function bp_is_item_admin() { … … 1708 1718 * 1709 1719 * @return bool True if the current user is a mod for the current item, 1710 * otherwise false.1720 * otherwise false. 1711 1721 */ 1712 1722 function bp_is_item_mod() { … … 1731 1741 * Is this a component directory page? 1732 1742 * 1733 * @return bool True if the current page is a component directory, otherwise 1734 * false. 1743 * @return bool True if the current page is a component directory, otherwise false. 1735 1744 */ 1736 1745 function bp_is_directory() { … … 1805 1814 * @param string $component Optional. Name of the component to check for. 1806 1815 * Default: current component. 1816 * 1807 1817 * @return bool True if the specified component is set to be the site's front 1808 1818 * page, otherwise false. … … 1908 1918 * @param string $component The component name. 1909 1919 * @param string $feature The feature name. 1920 * 1910 1921 * @return bool 1911 1922 */ … … 1930 1941 /** 1931 1942 * Filters whether or not a given feature for a component is active. 1943 * 1944 * This is a variable filter that is based on the component and feature 1945 * that you are checking of active status of. 1932 1946 * 1933 1947 * @since BuddyPress (2.3.0) … … 2052 2066 * 2053 2067 * @return bool True if the current component is active and is one of BP's 2054 * packaged components.2068 * packaged components. 2055 2069 */ 2056 2070 function bp_is_current_component_core() { … … 2070 2084 2071 2085 /** 2072 * Is the current page the activity directory 2086 * Is the current page the activity directory? 2073 2087 * 2074 2088 * @since BuddyPress (2.0.0) … … 2096 2110 2097 2111 /** 2098 * Is the current page the members directory 2112 * Is the current page the members directory? 2099 2113 * 2100 2114 * @since BuddyPress (2.0.0) … … 2744 2758 * Uses the above is_() functions to output a body class for each scenario. 2745 2759 * 2746 * @param array $wp_classesThe body classes coming from WP.2760 * @param array $wp_classes The body classes coming from WP. 2747 2761 * @param array|bool $custom_classes Classes that were passed to get_body_class(). 2762 * 2748 2763 * @return array $classes The BP-adjusted body classes. 2749 2764 */ … … 2981 2996 * 2982 2997 * @param array $wp_classes The post classes coming from WordPress. 2998 * 2983 2999 * @return array 2984 3000 */ … … 3045 3061 * @param array $a First item. 3046 3062 * @param array $b Second item. 3063 * 3047 3064 * @return int Returns an integer less than, equal to, or greater than zero if 3048 * the first argument is considered to be respectively less than, equal to, or greater than the second. 3065 * the first argument is considered to be respectively less than, 3066 * equal to, or greater than the second. 3049 3067 */ 3050 3068 function _bp_nav_menu_sort( $a, $b ) { … … 3154 3172 * @param string|array $args { 3155 3173 * An array of optional arguments. 3156 * @type string $after Text after the link text. Default: ''. 3157 * @type string $before Text before the link text. Default: ''. 3158 * @type string $container The name of the element to wrap the navigation 3159 * with. 'div' or 'nav'. Default: 'div'. 3174 * 3175 * @type string $after Text after the link text. Default: ''. 3176 * @type string $before Text before the link text. Default: ''. 3177 * @type string $container The name of the element to wrap the navigation 3178 * with. 'div' or 'nav'. Default: 'div'. 3160 3179 * @type string $container_class The class that is applied to the container. 3161 * Default: 'menu-bp-container'.3162 * @type string $container_id The ID that is applied to the container.3163 * Default: ''.3164 * @type int depth How many levels of the hierarchy are to be included. 03165 * means all. Default: 0.3166 * @type bool $echoTrue to echo the menu, false to return it.3167 * Default: true.3168 * @type bool $fallback_cbIf the menu doesn't exist, should a callback3169 * function be fired? Default: false (no fallback).3170 * @type string $items_wrap How the list items should be wrapped. Should be3171 * in the form of a printf()-friendly string, using numbered3172 * placeholders. Default: '<ul id="%1$s" class="%2$s">%3$s</ul>'.3173 * @type string $link_after Text after the link. Default: ''.3174 * @type string $link_before Text before the link. Default: ''.3175 * @type string $menu_class CSS class to use for the <ul> element which3176 * forms the menu. Default: 'menu'.3177 * @type string $menu_id The ID that is applied to the <ul> element which3178 * forms the menu. Default: 'menu-bp', incremented.3179 * @type string $walker Allows a custom walker class to be specified.3180 * Default: 'BP_Walker_Nav_Menu'.3180 * Default: 'menu-bp-container'. 3181 * @type string $container_id The ID that is applied to the container. 3182 * Default: ''. 3183 * @type int $depth How many levels of the hierarchy are to be included. 3184 * 0 means all. Default: 0. 3185 * @type bool $echo True to echo the menu, false to return it. 3186 * Default: true. 3187 * @type bool $fallback_cb If the menu doesn't exist, should a callback 3188 * function be fired? Default: false (no fallback). 3189 * @type string $items_wrap How the list items should be wrapped. Should be 3190 * in the form of a printf()-friendly string, using numbered 3191 * placeholders. Default: '<ul id="%1$s" class="%2$s">%3$s</ul>'. 3192 * @type string $link_after Text after the link. Default: ''. 3193 * @type string $link_before Text before the link. Default: ''. 3194 * @type string $menu_class CSS class to use for the <ul> element which 3195 * forms the menu. Default: 'menu'. 3196 * @type string $menu_id The ID that is applied to the <ul> element which 3197 * forms the menu. Default: 'menu-bp', incremented. 3198 * @type string $walker Allows a custom walker class to be specified. 3199 * Default: 'BP_Walker_Nav_Menu'. 3181 3200 * } 3201 * 3182 3202 * @return string|null If $echo is false, returns a string containing the nav 3183 * menu markup.3203 * menu markup. 3184 3204 */ 3185 3205 function bp_nav_menu( $args = array() ) { -
trunk/src/bp-core/bp-core-wpabstraction.php
r10012 r10039 2 2 /** 3 3 * WordPress Abstraction. 4 * 5 * @package BuddyPress 4 6 * 5 7 * The functions within this file will detect the version of WordPress you are … … 10 12 */ 11 13 12 // Exit if accessed directly 14 // Exit if accessed directly. 13 15 defined( 'ABSPATH' ) || exit; 14 16 … … 29 31 30 32 /** 31 * Only add MS-specific abstraction functions if WordPress is not in multisite mode 33 * Only add MS-specific abstraction functions if WordPress is not in multisite mode. 32 34 */ 33 35 if ( !is_multisite() ) { … … 129 131 * 130 132 * @param string|bool $prefix Global table prefix. 133 * 131 134 * @return string SQL chunk. 132 135 */ … … 139 142 140 143 /** 141 * Multibyte encoding fallback functions 144 * Multibyte encoding fallback functions. 142 145 * 143 146 * The PHP multibyte encoding extension is not enabled by default. In cases where it is not enabled, … … 152 155 * @param string $str String to be measured. 153 156 * @param string $enc Optional. Encoding type. Ignored. 157 * 154 158 * @return int String length. 155 159 */ … … 177 181 * @param string $haystack String to search in. 178 182 * @param string $needle String to search for. 179 * @param int $offset Optional. Start position for the search. Default: 0.183 * @param int $offset Optional. Start position for the search. Default: 0. 180 184 * @param string $encoding Optional. Encoding type. Ignored. 185 * 181 186 * @return int|bool Position of needle in haystack if found, else false. 182 187 */ … … 201 206 * @param string $haystack String to search in. 202 207 * @param string $needle String to search for. 203 * @param int $offset Optional. Start position for the search. Default: 0.208 * @param int $offset Optional. Start position for the search. Default: 0. 204 209 * @param string $encoding Optional. Encoding type. Ignored. 210 * 205 211 * @return int Position of last needle in haystack if found, else false. 206 212 */
Note: See TracChangeset
for help on using the changeset viewer.