Changeset 10039 for trunk/src/bp-core/bp-core-template.php
- Timestamp:
- 08/09/2015 05:07:56 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/bp-core-template.php (modified) (34 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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 A string representation of $time, in the format350 * "March 18, 2014 at 2:00 pm" (or whatever your351 * 'date_format' and 'time_format' settings are352 * on your root blog). False on failure.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() ) {
Note: See TracChangeset
for help on using the changeset viewer.