Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/09/2015 05:07:56 AM (11 years ago)
Author:
tw2113
Message:

More updates to BP-Core docs.

See #6398.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-template.php

    r10012 r10039  
    11<?php
    22/**
    3  * Core component template tag functions
     3 * Core component template tag functions.
    44 *
    55 * @package BuddyPress
     
    152152 * Not currently used in BuddyPress.
    153153 *
    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.
    155155 */
    156156function bp_has_options_avatar() {
     
    326326
    327327/**
    328  * Format a date based on a UNIX timestamp
     328 * Format a date based on a UNIX timestamp.
    329329 *
    330330 * This function can be used to turn a UNIX timestamp into a properly formatted
     
    342342 *
    343343 * @param int|string  $time         The UNIX timestamp to be formatted.
    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.
     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.
    353353 */
    354354function bp_format_time( $time = '', $exclude_time = false, $gmt = true ) {
     
    415415 * do the necessary argument swapping for dynamic phrases.
    416416 *
    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").
    418418 * @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 displayed
    420  *        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").
    421421 * @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.
    425426 */
    426427function bp_word_or_name( $youtext, $nametext, $capitalize = true, $echo = true ) {
     
    568569     *
    569570     * @param string $component Component name. Default: current component.
     571     *
    570572     * @return string Placeholder text for search field.
    571573     */
     
    691693         * @since BuddyPress (2.2.0)
    692694         *
    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.
    695697         */
    696698        $attributes = (array) apply_filters( 'bp_get_form_field_attributes', $attributes, $name );
     
    747749 * ### Options:
    748750 *
    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.
    757759 * @param array $options {
    758760 *     An array of HTML attributes and options. Each item is optional.
    759  *     @type string $ending The string used after truncation.
    760  *           Default: ' [&hellip;]'.
    761  *     @type bool $exact If true, $text will be trimmed to exactly $length.
    762  *           If false, $text will not be cut mid-word. Default: false.
    763  *     @type bool $html If true, don't include HTML tags when calculating
    764  *           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: ' [&hellip;]'.
     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.
    767769 * }
    768770 * @return string Trimmed string.
     
    10271029 *
    10281030 * @return bool True if the activation_complete global flag has been set,
    1029  *         otherwise false.
     1031 *              otherwise false.
    10301032 */
    10311033function bp_account_was_activated() {
     
    10711073 * @param array $args {
    10721074 *     Array of optional parameters.
    1073  *     @type string $before String to appear before the site name in the
    1074  *           email subject. Default: '['.
    1075  *     @type string $after String to appear after the site name in the
    1076  *           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: ']'.
    10771079 *     @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 of
    1080  *           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).
    10811083 * }
    10821084 * @return string Sanitized email subject.
     
    11151117 *
    11161118 * @param string|bool $object
     1119 *
    11171120 * @return string The AJAX querystring.
    11181121 */
     
    12061209 *
    12071210 * @return array|bool $action_variables The action variables array, or false
    1208  *         if the array is empty.
     1211 *                                      if the array is empty.
    12091212 */
    12101213function bp_action_variables() {
     
    12301233 *
    12311234 * @param int $position The key of the action_variables array that you want.
     1235 *
    12321236 * @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.
    12341238 */
    12351239function bp_action_variable( $position = 0 ) {
     
    13041308     * is used:
    13051309     * 1) Use the short slug to get the canonical component name from the
    1306      *    active component array
     1310     *    active component array.
    13071311     * 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.
    13091313     * 3) If nothing turns up, it probably means that $component is itself
    1310      *    a root slug
     1314     *    a root slug.
    13111315     *
    13121316     * Example: If your groups directory is at /community/companies, this
     
    13191323     *
    13201324     * @param string $component Optional. Defaults to the current component.
     1325     *
    13211326     * @return string $root_slug The root slug.
    13221327     */
     
    13671372 *
    13681373 * @param string $root_slug Needle to our active component haystack.
     1374 *
    13691375 * @return mixed False if none found, component name if found.
    13701376 */
     
    14391445 * @uses apply_filters() Filter 'bp_displayed_user_id' to change this value.
    14401446 *
    1441  * @return int ID of the currently displayed user.
     1447 * @return int $id ID of the currently displayed user.
    14421448 */
    14431449function bp_displayed_user_id() {
     
    14871493 * This function is designed to be generous, accepting several different kinds
    14881494 * 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.
    14921498 *
    14931499 * @since BuddyPress (1.5.0)
    14941500 *
    14951501 * @param string $component Name of the component being checked.
     1502 *
    14961503 * @return bool Returns true if the component matches, or else false.
    14971504 */
     
    15821589 *
    15831590 * @param string $action The action being tested against.
     1591 *
    15841592 * @return bool True if the current action matches $action.
    15851593 */
     
    16021610 * @since BuddyPress (1.5.0)
    16031611 *
    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 *
    16081617 * @return bool True if $action_variable matches at the $position provided.
    16091618 */
     
    16411650 *
    16421651 * @param string $item The item being checked.
     1652 *
    16431653 * @return bool True if $item is the current item.
    16441654 */
     
    16841694 *
    16851695 * @return bool True if the current user is an admin for the current item,
    1686  *         otherwise false.
     1696 *              otherwise false.
    16871697 */
    16881698function bp_is_item_admin() {
     
    17081718 *
    17091719 * @return bool True if the current user is a mod for the current item,
    1710  *         otherwise false.
     1720 *              otherwise false.
    17111721 */
    17121722function bp_is_item_mod() {
     
    17311741 * Is this a component directory page?
    17321742 *
    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.
    17351744 */
    17361745function bp_is_directory() {
     
    18051814 * @param string $component Optional. Name of the component to check for.
    18061815 *                          Default: current component.
     1816 *
    18071817 * @return bool True if the specified component is set to be the site's front
    18081818 *              page, otherwise false.
     
    19081918 * @param string $component The component name.
    19091919 * @param string $feature   The feature name.
     1920 *
    19101921 * @return bool
    19111922 */
     
    19301941            /**
    19311942             * 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.
    19321946             *
    19331947             * @since BuddyPress (2.3.0)
     
    20522066 *
    20532067 * @return bool True if the current component is active and is one of BP's
    2054  *         packaged components.
     2068 *              packaged components.
    20552069 */
    20562070function bp_is_current_component_core() {
     
    20702084
    20712085/**
    2072  * Is the current page the activity directory ?
     2086 * Is the current page the activity directory?
    20732087 *
    20742088 * @since BuddyPress (2.0.0)
     
    20962110
    20972111/**
    2098  * Is the current page the members directory ?
     2112 * Is the current page the members directory?
    20992113 *
    21002114 * @since BuddyPress (2.0.0)
     
    27442758     * Uses the above is_() functions to output a body class for each scenario.
    27452759     *
    2746      * @param array $wp_classes The body classes coming from WP.
     2760     * @param array      $wp_classes    The body classes coming from WP.
    27472761     * @param array|bool $custom_classes Classes that were passed to get_body_class().
     2762     *
    27482763     * @return array $classes The BP-adjusted body classes.
    27492764     */
     
    29812996 *
    29822997 * @param array $wp_classes The post classes coming from WordPress.
     2998 *
    29832999 * @return array
    29843000 */
     
    30453061 * @param array $a First item.
    30463062 * @param array $b Second item.
     3063 *
    30473064 * @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.
    30493067 */
    30503068function _bp_nav_menu_sort( $a, $b ) {
     
    31543172 * @param string|array $args {
    31553173 *     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'.
    31603179 *     @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. 0
    3165  *           means all. Default: 0.
    3166  *     @type bool $echo True to echo the menu, false to return it.
    3167  *           Default: true.
    3168  *     @type bool $fallback_cb If the menu doesn't exist, should a callback
    3169  *           function be fired? Default: false (no fallback).
    3170  *     @type string $items_wrap How the list items should be wrapped. Should be
    3171  *           in the form of a printf()-friendly string, using numbered
    3172  *           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 which
    3176  *           forms the menu. Default: 'menu'.
    3177  *     @type string $menu_id The ID that is applied to the <ul> element which
    3178  *           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'.
    31813200 * }
     3201 *
    31823202 * @return string|null If $echo is false, returns a string containing the nav
    3183  *         menu markup.
     3203 *                     menu markup.
    31843204 */
    31853205function bp_nav_menu( $args = array() ) {
Note: See TracChangeset for help on using the changeset viewer.