Skip to:
Content

BuddyPress.org

Changeset 10039


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

More updates to BP-Core docs.

See #6398.

Location:
trunk/src/bp-core
Files:
8 edited

Legend:

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

    r10012 r10039  
    11<?php
    2 
    32/**
    43 * BuddyPress Filters & Actions.
     
    109 * They are consolidated here to make searching for them easier, and to help
    1110 * developers understand at a glance the order in which things occur.
    12  *
    1311 */
    1412
    15 // Exit if accessed directly
     13// Exit if accessed directly.
    1614defined( 'ABSPATH' ) || exit;
    1715
     
    3432add_action( 'plugins_loaded',          'bp_loaded',                 10    );
    3533add_action( 'init',                    'bp_init',                   10    );
    36 add_action( 'parse_query',             'bp_parse_query',            2     ); // Early for overrides
     34add_action( 'parse_query',             'bp_parse_query',            2     ); // Early for overrides.
    3735add_action( 'wp',                      'bp_ready',                  10    );
    3836add_action( 'set_current_user',        'bp_setup_current_user',     10    );
    3937add_action( 'setup_theme',             'bp_setup_theme',            10    );
    40 add_action( 'after_setup_theme',       'bp_after_setup_theme',      100   ); // After WP themes
     38add_action( 'after_setup_theme',       'bp_after_setup_theme',      100   ); // After WP themes.
    4139add_action( 'wp_enqueue_scripts',      'bp_enqueue_scripts',        10    );
    42 add_action( 'admin_bar_menu',          'bp_setup_admin_bar',        20    ); // After WP core
     40add_action( 'admin_bar_menu',          'bp_setup_admin_bar',        20    ); // After WP core.
    4341add_action( 'template_redirect',       'bp_template_redirect',      10    );
    4442add_action( 'widgets_init',            'bp_widgets_init',           10    );
     
    10098add_action( 'bp_after_setup_theme', 'bp_load_theme_functions', 1 );
    10199
    102 // Load the admin
     100// Load the admin.
    103101if ( is_admin() ) {
    104102    add_action( 'bp_loaded', 'bp_admin' );
    105103}
    106104
    107 // Activation redirect
     105// Activation redirect.
    108106add_action( 'bp_activation', 'bp_add_activation_redirect' );
  • trunk/src/bp-core/bp-core-attachments.php

    r10012 r10039  
    77 */
    88
    9 // Exit if accessed directly
     9// Exit if accessed directly.
    1010defined( 'ABSPATH' ) || exit;
    1111
  • trunk/src/bp-core/bp-core-avatars.php

    r10012 r10039  
    11<?php
    2 
    32/**
    43 * BuddyPress Avatars.
    5  */
    6 
    7 // Exit if accessed directly
     4 *
     5 * @package BuddyPress
     6 */
     7
     8// Exit if accessed directly.
    89defined( 'ABSPATH' ) || exit;
    910
    10 /***
     11/**
    1112 * Set up the constants we need for avatar support.
    1213 */
     
    326327    /** Sanity Checks *********************************************************/
    327328
    328     // Get a fallback for the 'alt' parameter, create html output
     329    // Get a fallback for the 'alt' parameter, create html output.
    329330    if ( empty( $params['alt'] ) ) {
    330331        $params['alt'] = __( 'Profile Photo', 'buddypress' );
     
    332333    $html_alt = ' alt="' . esc_attr( $params['alt'] ) . '"';
    333334
    334     // Filter image title and create html string
     335    // Filter image title and create html string.
    335336    $html_title = '';
    336337
     
    351352    }
    352353
    353     // Set CSS ID and create html string
     354    // Set CSS ID and create html string.
    354355    $html_css_id = '';
    355356
     
    531532                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 );
    532533
    533                 // ...or only the URL
     534            // ...or only the URL
    534535            } else {
    535536
     
    612613        }
    613614
    614         // No avatar was found, and we've been told not to use a gravatar.
     615    // No avatar was found, and we've been told not to use a gravatar.
    615616    } else {
    616617
     
    644645 * @param array|string $args {
    645646 *     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'.
    650652 *     @type bool|string $avatar_dir Subdirectory where avatar is located.
    651  *           Default: false, which falls back on the default location
    652  *           corresponding to the $object.
     653 *                                   Default: false, which falls back on the default location
     654 *                                   corresponding to the $object.
    653655 * }
    654656 * @return bool True on success, false on failure.
     
    730732 */
    731733function bp_avatar_ajax_delete() {
    732     // Bail if not a POST action
     734    // Bail if not a POST action.
    733735    if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) {
    734736        wp_send_json_error();
     
    810812    }
    811813
    812     // Setup some variables
     814    // Setup some variables.
    813815    $bp          = buddypress();
    814816    $upload_path = bp_core_avatar_upload_path();
    815817
    816     // Upload the file
     818    // Upload the file.
    817819    $avatar_attachment = new BP_Attachment_Avatar();
    818820    $bp->avatar_admin->original = $avatar_attachment->upload( $file, $upload_dir_filter );
    819821
    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.
    821823    if ( ! empty( $bp->avatar_admin->original['error'] ) ) {
    822824        bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $bp->avatar_admin->original['error'] ), 'error' );
     
    824826    }
    825827
    826     // Maybe resize
     828    // Maybe resize.
    827829    $bp->avatar_admin->resized = $avatar_attachment->shrink( $bp->avatar_admin->original['file'] );
    828830    $bp->avatar_admin->image   = new stdClass();
     
    838840    }
    839841
    840     // Check for WP_Error on what should be an image
     842    // Check for WP_Error on what should be an image.
    841843    if ( is_wp_error( $bp->avatar_admin->image->dir ) ) {
    842844        bp_core_add_message( sprintf( __( 'Upload failed! Error was: %s', 'buddypress' ), $bp->avatar_admin->image->dir->get_error_message() ), 'error' );
     
    844846    }
    845847
    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.
    847849    if ( $avatar_attachment->is_too_small( $bp->avatar_admin->image->file ) ) {
    848850        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' );
    849851    }
    850852
    851     // Set the url value for the image
     853    // Set the url value for the image.
    852854    $bp->avatar_admin->image->url = bp_core_avatar_url() . $bp->avatar_admin->image->dir;
    853855
     
    10051007
    10061008 /**
    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.
    10131010  *
    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  */
    10161018function bp_avatar_handle_capture( $data = '', $item_id = 0 ) {
    10171019    if ( empty( $data ) || empty( $item_id ) ) {
     
    10211023    $avatar_dir = bp_core_avatar_upload_path() . '/avatars';
    10221024
    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.
    10241026    if ( ! file_exists( $avatar_dir ) ) {
    10251027        if ( ! wp_mkdir_p( $avatar_dir ) ) {
     
    10401042    $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', $avatar_dir . '/' . $item_id, $item_id, 'user', 'avatars' );
    10411043
    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.
    10431045    if( ! is_dir( $avatar_folder_dir ) ) {
    10441046        if ( ! wp_mkdir_p( $avatar_folder_dir ) ) {
     
    14491451    }
    14501452
    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.
    14521454    if ( isset( $bp->avatar->$type ) ) {
    14531455        $retval = $bp->avatar->$type;
    14541456    } 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.
    14561458        if ( defined( $constant ) ) {
    14571459            $retval = constant( $constant );
    14581460        } else {
    14591461
    1460             // Use cached upload dir data if available
     1462            // Use cached upload dir data if available.
    14611463            if ( ! empty( $bp->avatar->upload_dir ) ) {
    14621464                $upload_dir = $bp->avatar->upload_dir;
    14631465
    1464             // No cache, so query for it
     1466            // No cache, so query for it.
    14651467            } else {
    14661468
    1467                 // Get upload directory information from current site
     1469                // Get upload directory information from current site.
    14681470                $upload_dir = bp_upload_dir();
    14691471
    1470                 // Stash upload directory data for later use
     1472                // Stash upload directory data for later use.
    14711473                $bp->avatar->upload_dir = $upload_dir;
    14721474            }
    14731475
    1474             // Directory does not exist and cannot be created
     1476            // Directory does not exist and cannot be created.
    14751477            if ( ! empty( $upload_dir['error'] ) ) {
    14761478                $retval = '';
     
    14881490        }
    14891491
    1490         // Stash in $bp for later use
     1492        // Stash in $bp for later use.
    14911493        $bp->avatar->$type = $retval;
    14921494    }
  • trunk/src/bp-core/bp-core-buddybar.php

    r10012 r10039  
    8080 * @since BuddyPress (2.4.0)
    8181 *
    82  * @param array $args {
     82 * @param array|string $args {
    8383 *     Array describing the new nav item.
    8484 *     @type string      $name                    Display name for the nav item.
     
    164164 * @since BuddyPress (2.4.0)
    165165 *
    166  * @param array $args {
     166 * @param array|string $args {
    167167 *     Array describing the new nav item.
    168168 *     @type string      $name                    Display name for the nav item.
  • trunk/src/bp-core/bp-core-cache.php

    r10012 r10039  
    22/**
    33 * BuddyPress Core Caching Functions.
     4 *
     5 * @package BuddyPress
    46 *
    57 * Caching functions handle the clearing of cached objects and pages on specific
     
    3840 * Clear all cached objects for a user, or those that a user is part of.
    3941 *
    40  * @param string $user_id
     42 * @param string $user_id User ID to delete cache for.
    4143 */
    4244function bp_core_clear_user_object_cache( $user_id ) {
     
    6264 * @since BuddyPress (2.0.0)
    6365 *
    64  * @param int $post_id
     66 * @param int $post_id ID of the page that was saved.
    6567 */
    6668function bp_core_clear_directory_pages_cache_page_edit( $post_id ) {
     
    6971    }
    7072
    71     // Bail if BP is not defined here
     73    // Bail if BP is not defined here.
    7274    if ( ! buddypress() ) {
    7375        return;
     
    185187        'meta_table'       => '',      // Name of the table containing the metadata
    186188        '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'
    189190    );
    190191    $r = wp_parse_args( $args, $defaults );
  • trunk/src/bp-core/bp-core-functions.php

    r10016 r10039  
    6565}
    6666    /**
    67      * Return the BuddyPress database version
     67     * Return the BuddyPress database version.
    6868     *
    6969     * @since BuddyPress (1.6)
     
    170170 * Format numbers the BuddyPress way.
    171171 *
    172  * @param int $number The number to be formatted.
     172 * @param int  $number  The number to be formatted.
    173173 * @param bool $decimals Whether to use decimals. See {@link number_format_i18n()}.
     174 *
    174175 * @return string The formatted number.
    175176 */
     
    224225 *
    225226 * @since BuddyPress (1.6)
     227 *
    226228 * @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 *
    228231 * @return array $new_args The parsed arguments.
    229232 */
     
    251254 * @since BuddyPress (r7704)
    252255 *
    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 *
    256260 * @return array Merged user defined values with defaults.
    257261 */
     
    313317 * @since BuddyPress (2.2.0)
    314318 *
    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.
    318323 */
    319324function bp_sanitize_pagination_arg( $page_arg = '', $page = 1 ) {
     
    344349 *
    345350 * @param string $order The 'order' string, as passed to the SQL constructor.
     351 *
    346352 * @return string The sanitized value 'DESC' or 'ASC'.
    347353 */
     
    364370 *
    365371 * @param string $text The raw text to be escaped.
     372 *
    366373 * @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.
    368375 */
    369376function bp_esc_like( $text ) {
     
    386393 *
    387394 * @return bool False when compatibility mode is disabled, true when enabled.
    388  *         Default: false.
     395 *              Default: false.
    389396 */
    390397function bp_is_username_compatibility_mode() {
     
    475482 *                       pages. When running save routines, use 'all' to avoid removing data related to inactive
    476483 *                       components. Default: 'active'.
     484 *
    477485 * @return array|string An array of page IDs, keyed by component names, or an
    478486 *                      empty string if the list is not found.
     
    526534 *
    527535 * @param array $blog_page_ids The IDs of the WP pages corresponding to BP
    528  *        component directories.
     536 *                             component directories.
    529537 */
    530538function bp_core_update_directory_page_ids( $blog_page_ids ) {
     
    608616 * @since BuddyPress (1.7.0)
    609617 *
    610  * @param array $components Components to create pages for.
    611  * @param string $existing 'delete' if you want to delete existing page
    612  *        mappings and replace with new ones. Otherwise existing page mappings
    613  *        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'.
    614622 */
    615623function bp_core_add_page_mappings( $components, $existing = 'keep' ) {
     
    749757 *
    750758 * @param string $root_slug The root slug, which comes from $bp->pages->[component]->slug.
     759 *
    751760 * @return string The short slug for use in the middle of URLs.
    752761 */
     
    914923 *
    915924 * @param string $location The redirect URL.
    916  * @param int $status Optional. The numeric code to give in the redirect
    917  *        headers. Default: 302.
     925 * @param int    $status  Optional. The numeric code to give in the redirect
     926 *                         headers. Default: 302.
    918927 */
    919928function bp_core_redirect( $location = '', $status = 302 ) {
     
    10061015 * @since BuddyPress (1.2.6)
    10071016 *
    1008  * @param bool $gmt True to use GMT (rather than local) time. Default: true.
     1017 * @param bool   $gmt True to use GMT (rather than local) time. Default: true.
    10091018 * @param string $type See the 'type' parameter in {@link current_time()}.
    1010           Default: 'mysql'.
     1019 *                     Default: 'mysql'.
     1020 *
    10111021 * @return string Current time in 'Y-m-d h:i:s' format.
    10121022 */
     
    10421052 *
    10431053 * @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 *
    10481059 * @return string String representing the time since the older date, eg
    10491060 *         "2 hours and 50 minutes".
     
    12381249 *
    12391250 * @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'.
    12421253 */
    12431254function bp_core_add_message( $message, $type = '' ) {
     
    14131424 *
    14141425 * @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 *
    14161428 * @return string $last_active A string of the form '3 years ago'.
    14171429 */
     
    14631475 *
    14641476 * @param string|bool $key The usermeta meta_key.
     1477 *
    14651478 * @return string $key The usermeta meta_key.
    14661479 */
     
    14891502 * @uses bp_get_user_meta_key() For a filterable version of the meta key.
    14901503 *
    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 *
    14941508 * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
    14951509 *         is true.
     
    15111525 * @uses bp_get_user_meta_key() For a filterable version of the meta key.
    15121526 *
    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 *
    15171532 * @return bool False on failure, true on success.
    15181533 */
     
    15331548 * @uses bp_get_user_meta_key() For a filterable version of the meta key.
    15341549 *
    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 *
    15381554 * @return bool False for failure. True for success.
    15391555 */
     
    15661582 *
    15671583 * @return bool False when activity embed support is disabled; true when
    1568  *         enabled. Default: true.
     1584 *              enabled. Default: true.
    15691585 */
    15701586function bp_use_embed_in_activity() {
     
    15861602 *
    15871603 * @return bool False when activity replies embed support is disabled; true
    1588  *         when enabled. Default: true.
     1604 *              when enabled. Default: true.
    15891605 */
    15901606function bp_use_embed_in_activity_replies() {
     
    16061622 *
    16071623 * @return bool False when forum post embed support is disabled; true when
    1608  *         enabled. Default: true.
     1624 *              enabled. Default: true.
    16091625 */
    16101626function bp_use_embed_in_forum_posts() {
     
    16261642 *
    16271643 * @return bool False when private message embed support is disabled; true when
    1628  *         enabled. Default: true.
     1644 *              enabled. Default: true.
    16291645 */
    16301646function bp_use_embed_in_private_messages() {
     
    16491665 * @see bp_get_admin_url() For description of parameters.
    16501666 *
    1651  * @param string $path See {@link bp_get_admin_url()}.
     1667 * @param string $path   See {@link bp_get_admin_url()}.
    16521668 * @param string $scheme See {@link bp_get_admin_url()}.
    16531669 */
     
    16641680     * @uses admin_url()
    16651681     *
    1666      * @param string $path Optional. The sub-path under /wp-admin to be
    1667      *        appended to the admin URL.
     1682     * @param string $path   Optional. The sub-path under /wp-admin to be
     1683     *                       appended to the admin URL.
    16681684     * @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     *
    16711688     * @return string Admin url link with optional path appended.
    16721689     */
     
    16981715 *
    16991716 * @return bool True if the BP admin screen should appear in the Network Admin,
    1700  *         otherwise false.
     1717 *              otherwise false.
    17011718 */
    17021719function bp_core_do_network_admin() {
     
    17521769 *
    17531770 * @param int $blog_id Optional. Default: the ID of the current blog.
     1771 *
    17541772 * @return bool $is_root_blog Returns true if this is bp_get_root_blog_id().
    17551773 */
     
    18301848 *
    18311849 * @return bool False when multiblog mode is disabled; true when enabled.
    1832  *         Default: false.
     1850 *              Default: false.
    18331851 */
    18341852function bp_is_multiblog_mode() {
     
    19001918 * Set the "is_directory" global.
    19011919 *
    1902  * @param bool $is_directory Optional. Default: false.
    1903  * @param string $component Optional. Component name. Default: the current
    1904  *        component.
     1920 * @param bool   $is_directory Optional. Default: false.
     1921 * @param string $component    Optional. Component name. Default: the current
     1922 *                             component.
    19051923 */
    19061924function bp_update_is_directory( $is_directory = false, $component = '' ) {
     
    19241942 * Set the "is_item_admin" global.
    19251943 *
    1926  * @param bool $is_item_admin Optional. Default: false.
    1927  * @param string $component Optional. Component name. Default: the current
    1928  *        component.
     1944 * @param bool   $is_item_admin Optional. Default: false.
     1945 * @param string $component     Optional. Component name. Default: the current
     1946 *                              component.
    19291947 */
    19301948function bp_update_is_item_admin( $is_item_admin = false, $component = '' ) {
     
    19481966 * Set the "is_item_mod" global.
    19491967 *
    1950  * @param bool $is_item_mod Optional. Default: false.
    1951  * @param string $component Optional. Component name. Default: the current
    1952  *        component.
     1968 * @param bool   $is_item_mod Optional. Default: false.
     1969 * @param string $component   Optional. Component name. Default: the current
     1970 *                            component.
    19531971 */
    19541972function bp_update_is_item_mod( $is_item_mod = false, $component = '' ) {
     
    19761994 * @global WP_Query $wp_query WordPress query object.
    19771995 *
    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'.
    19801998 */
    19811999function bp_do_404( $redirect = 'remove_canonical_direct' ) {
     
    20122030 * @uses do_action() Calls 'bp_verify_nonce_request' on $action.
    20132031 *
    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 *
    20162035 * @return bool True if the nonce is verified, otherwise false.
    20172036 */
     
    20842103
    20852104/**
    2086  * Return true|false if this is a POST request
     2105 * Return true|false if this is a POST request.
    20872106 *
    20882107 * @since BuddyPress (1.9.0)
     
    20942113
    20952114/**
    2096  * Return true|false if this is a GET request
     2115 * Return true|false if this is a GET request.
    20972116 *
    20982117 * @since BuddyPress (1.9.0)
     
    24142433 *
    24152434 * @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 *
    24172437 * @return string $nav_item_url The URL generated for the current user.
    24182438 */
     
    24362456 * for similar kinds of future requirements, or those implemented by third-party developers.
    24372457 *
     2458 * @since BuddyPress (2.1.0)
     2459 *
    24382460 * @param array $args
     2461 *
    24392462 * @return array|WP_Error Array of results. If there were any problems, returns a WP_Error object.
    2440  * @since BuddyPress (2.1.0)
    24412463 */
    24422464function bp_core_get_suggestions( $args ) {
  • 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() ) {
  • trunk/src/bp-core/bp-core-wpabstraction.php

    r10012 r10039  
    22/**
    33 * WordPress Abstraction.
     4 *
     5 * @package BuddyPress
    46 *
    57 * The functions within this file will detect the version of WordPress you are
     
    1012 */
    1113
    12 // Exit if accessed directly
     14// Exit if accessed directly.
    1315defined( 'ABSPATH' ) || exit;
    1416
     
    2931
    3032/**
    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.
    3234 */
    3335if ( !is_multisite() ) {
     
    129131 *
    130132 * @param string|bool $prefix Global table prefix.
     133 *
    131134 * @return string SQL chunk.
    132135 */
     
    139142
    140143/**
    141  * Multibyte encoding fallback functions
     144 * Multibyte encoding fallback functions.
    142145 *
    143146 * The PHP multibyte encoding extension is not enabled by default. In cases where it is not enabled,
     
    152155     * @param string $str String to be measured.
    153156     * @param string $enc Optional. Encoding type. Ignored.
     157     *
    154158     * @return int String length.
    155159     */
     
    177181     * @param string $haystack String to search in.
    178182     * @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.
    180184     * @param string $encoding Optional. Encoding type. Ignored.
     185     *
    181186     * @return int|bool Position of needle in haystack if found, else false.
    182187     */
     
    201206     * @param string $haystack String to search in.
    202207     * @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.
    204209     * @param string $encoding Optional. Encoding type. Ignored.
     210     *
    205211     * @return int Position of last needle in haystack if found, else false.
    206212     */
Note: See TracChangeset for help on using the changeset viewer.