Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/15/2015 07:57:03 PM (9 years ago)
Author:
tw2113
Message:

[Samus Aran]
I first battled the documentation inconsistencies on planet Zebes. It was there that I foiled the plans of the
Space Pirate leader Mother Brain to use the issues to attack galactic civilization...

I next fought the inconsistencies on their homeworld SR388. I completely eradicated them except for an @since tag,
which after hatching followed me like a confused child...

I personally delivered it to the Galactic Research Station at Ceres so scientists could study its energy production qualities...

The scientists' findings were astounding! They discovered that the powers of the docs inconsistencies
might be harnessed for the good of galactic civilization!

Satisfied that all was well, I left the station to seek a new bounty to hunt. But, I had hardly gone beyond the asteroid
belt when I picked up a distress signal!

Ceres station was under attack!

More documentation cleanup for part of BP-Core component.

See #6398.

File:
1 edited

Legend:

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

    r10209 r10356  
    2727 *       viewed user.
    2828 *
    29  * @param string $parent_slug
    30  *
     29 * @param string $parent_slug Options nav slug.
    3130 * @return string
    3231 */
     
    3534
    3635    // If we are looking at a member profile, then the we can use the current
    37     // component as an index. Otherwise we need to use the component's root_slug
     36    // component as an index. Otherwise we need to use the component's root_slug.
    3837    $component_index = !empty( $bp->displayed_user ) ? bp_current_component() : bp_get_root_slug( bp_current_component() );
    3938    $selected_item   = bp_current_action();
     
    6059    }
    6160
    62     // Loop through each navigation item
     61    // Loop through each navigation item.
    6362    foreach ( (array) $bp->bp_options_nav[$the_index] as $subnav_item ) {
    6463        if ( empty( $subnav_item['user_has_access'] ) ) {
     
    7372        }
    7473
    75         // List type depends on our current component
     74        // List type depends on our current component.
    7675        $list_type = bp_is_group() ? 'groups' : 'personal';
    7776
     
    9594 *
    9695 * Not currently used in BuddyPress.
     96 *
    9797 * @todo Deprecate.
    9898 */
     
    115115 * @since 2.0.0
    116116 *
    117  * @param string $component
    118  *
     117 * @param string $component Component to get directory title for.
    119118 * @return string
    120119 */
     
    122121    $title = '';
    123122
    124     // Use the string provided by the component
     123    // Use the string provided by the component.
    125124    if ( ! empty( buddypress()->{$component}->directory_title ) ) {
    126125        $title = buddypress()->{$component}->directory_title;
    127126
    128     // If none is found, concatenate
     127    // If none is found, concatenate.
    129128    } elseif ( isset( buddypress()->{$component}->name ) ) {
    130129        $title = sprintf( __( '%s Directory', 'buddypress' ), buddypress()->{$component}->name );
     
    341340 * @since 1.1.0
    342341 *
    343  * @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
     342 * @param int|string $time         The UNIX timestamp to be formatted.
     343 * @param bool       $exclude_time Optional. True to return only the month + day, false
     344 *                                 to return month, day, and time. Default: false.
     345 * @param bool       $gmt          Optional. True to display in local time, false to
    347346 *                                  leave in GMT. Default: true.
    348  *
    349347 * @return mixed A string representation of $time, in the format
    350348 *               "March 18, 2014 at 2:00 pm" (or whatever your
     
    355353
    356354    // Bail if time is empty or not numeric
    357     // @todo We should output something smarter here
     355    // @todo We should output something smarter here.
    358356    if ( empty( $time ) || ! is_numeric( $time ) ) {
    359357        return false;
    360358    }
    361359
    362     // Get GMT offset from root blog
     360    // Get GMT offset from root blog.
    363361    if ( true === $gmt ) {
    364362
    365         // Use Timezone string if set
     363        // Use Timezone string if set.
    366364        $timezone_string = bp_get_option( 'timezone_string' );
    367365        if ( ! empty( $timezone_string ) ) {
     
    370368            $timezone_offset = timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS;
    371369
    372         // Fall back on less reliable gmt_offset
     370        // Fall back on less reliable gmt_offset.
    373371        } else {
    374372            $timezone_offset = bp_get_option( 'gmt_offset' );
    375373        }
    376374
    377         // Calculate time based on the offset
     375        // Calculate time based on the offset.
    378376        $calculated_time = $time + ( $timezone_offset * HOUR_IN_SECONDS );
    379377
    380     // No localizing, so just use the time that was submitted
     378    // No localizing, so just use the time that was submitted.
    381379    } else {
    382380        $calculated_time = $time;
    383381    }
    384382
    385     // Formatted date: "March 18, 2014"
     383    // Formatted date: "March 18, 2014".
    386384    $formatted_date = date_i18n( bp_get_option( 'date_format' ), $calculated_time, $gmt );
    387385
     
    389387    if ( true !== $exclude_time ) {
    390388
    391         // Formatted time: "2:00 pm"
     389        // Formatted time: "2:00 pm".
    392390        $formatted_time = date_i18n( bp_get_option( 'time_format' ), $calculated_time, $gmt );
    393391
    394         // Return string formatted with date and time
     392        // Return string formatted with date and time.
    395393        $formatted_date = sprintf( esc_html__( '%1$s at %2$s', 'buddypress' ), $formatted_date, $formatted_time );
    396394    }
     
    415413 * do the necessary argument swapping for dynamic phrases.
    416414 *
    417  * @param string $youtext  The "you" version of the phrase (eg "Your Friends").
    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 displayed
    420  *                         user's name (eg "%'s Friends").
    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  *
     415 * @param string $youtext    The "you" version of the phrase (eg "Your Friends").
     416 * @param string $nametext   The other-user version of the phrase. Should be in
     417 *                           a format appropriate for sprintf() - use %s in place of the displayed
     418 *                           user's name (eg "%'s Friends").
     419 * @param bool   $capitalize Optional. Force into title case. Default: true.
     420 * @param bool   $echo       Optional. True to echo the results, false to return them.
     421 *                           Default: true.
    425422 * @return string|null $nametext If ! $echo, returns the appropriate string.
    426423 */
     
    569566     *
    570567     * @param string $component Component name. Default: current component.
    571      *
    572568     * @return string Placeholder text for search field.
    573569     */
     
    582578        $default_text = __( 'Search anything...', 'buddypress' );
    583579
    584         // Most of the time, $component will be the actual component ID
     580        // Most of the time, $component will be the actual component ID.
    585581        if ( !empty( $component ) ) {
    586582            if ( !empty( $bp->{$component}->search_string ) ) {
     
    588584            } else {
    589585                // When the request comes through AJAX, we need to get the component
    590                 // name out of $bp->pages
     586                // name out of $bp->pages.
    591587                if ( !empty( $bp->pages->{$component}->slug ) ) {
    592588                    $key = $bp->pages->{$component}->slug;
     
    757753 * @param int    $length Optional. Length of returned string, including ellipsis.
    758754 *                       Default: 225.
    759  * @param array $options {
     755 * @param array  $options {
    760756 *     An array of HTML attributes and options. Each item is optional.
    761757 *     @type string $ending            The string used after truncation.
     
    772768function bp_create_excerpt( $text, $length = 225, $options = array() ) {
    773769
    774     // Backward compatibility. The third argument used to be a boolean $filter_shortcodes
     770    // Backward compatibility. The third argument used to be a boolean $filter_shortcodes.
    775771    $filter_shortcodes_default = is_bool( $options ) ? $options : true;
    776772
     
    782778    ), 'create_excerpt' );
    783779
    784     // Save the original text, to be passed along to the filter
     780    // Save the original text, to be passed along to the filter.
    785781    $original_text = $text;
    786782
     
    803799    $ending = apply_filters( 'bp_excerpt_append_text', $r['ending'] );
    804800
    805     // Remove shortcodes if necessary
     801    // Remove shortcodes if necessary.
    806802    if ( ! empty( $r['filter_shortcodes'] ) ) {
    807803        $text = strip_shortcodes( $text );
     
    809805
    810806    // When $html is true, the excerpt should be created without including HTML tags in the
    811     // excerpt length
     807    // excerpt length.
    812808    if ( ! empty( $r['html'] ) ) {
    813809
    814         // The text is short enough. No need to truncate
     810        // The text is short enough. No need to truncate.
    815811        if ( mb_strlen( preg_replace( '/<.*?>/', '', $text ) ) <= $length ) {
    816812            return $text;
     
    821817        $truncate    = '';
    822818
    823         // Find all the tags and HTML comments and put them in a stack for later use
     819        // Find all the tags and HTML comments and put them in a stack for later use.
    824820        preg_match_all( '/(<\/?([\w+!]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER );
    825821
    826822        foreach ( $tags as $tag ) {
    827             // Process tags that need to be closed
     823            // Process tags that need to be closed.
    828824            if ( !preg_match( '/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/s',  $tag[2] ) ) {
    829825                if ( preg_match( '/<[\w]+[^>]*>/s', $tag[0] ) ) {
     
    872868    }
    873869
    874     // If $exact is false, we can't break on words
     870    // If $exact is false, we can't break on words.
    875871    if ( empty( $r['exact'] ) ) {
    876872        // Find the position of the last space character not part of a tag.
     
    11161112 * WordPress theme without coping the functions from functions.php.
    11171113 *
    1118  * @param string|bool $object
    1119  *
     1114 * @param string|bool $object Current template component.
    11201115 * @return string The AJAX querystring.
    11211116 */
     
    12331228 *
    12341229 * @param int $position The key of the action_variables array that you want.
    1235  *
    12361230 * @return string|bool $action_variable The value of that position in the
    12371231 *                                      array, or false if not found.
     
    13231317     *
    13241318     * @param string $component Optional. Defaults to the current component.
    1325      *
    13261319     * @return string $root_slug The root slug.
    13271320     */
     
    13301323        $root_slug = '';
    13311324
    1332         // Use current global component if none passed
     1325        // Use current global component if none passed.
    13331326        if ( empty( $component ) ) {
    13341327            $component = bp_current_component();
    13351328        }
    13361329
    1337         // Component is active
     1330        // Component is active.
    13381331        if ( ! empty( $bp->active_components[ $component ] ) ) {
    13391332
    13401333            // Backward compatibility: in legacy plugins, the canonical component id
    1341             // was stored as an array value in $bp->active_components
     1334            // was stored as an array value in $bp->active_components.
    13421335            $component_name = ( '1' == $bp->active_components[ $component ] )
    13431336                ? $component
    13441337                : $bp->active_components[$component];
    13451338
    1346             // Component has specific root slug
     1339            // Component has specific root slug.
    13471340            if ( ! empty( $bp->{$component_name}->root_slug ) ) {
    13481341                $root_slug = $bp->{$component_name}->root_slug;
     
    13501343        }
    13511344
    1352         // No specific root slug, so fall back to component slug
     1345        // No specific root slug, so fall back to component slug.
    13531346        if ( empty( $root_slug ) ) {
    13541347            $root_slug = $component;
     
    13721365 *
    13731366 * @param string $root_slug Needle to our active component haystack.
    1374  *
    13751367 * @return mixed False if none found, component name if found.
    13761368 */
     
    13781370    $bp = buddypress();
    13791371
    1380     // If no slug is passed, look at current_component
     1372    // If no slug is passed, look at current_component.
    13811373    if ( empty( $root_slug ) ) {
    13821374        $root_slug = bp_current_component();
    13831375    }
    13841376
    1385     // No current component or root slug, so flee
     1377    // No current component or root slug, so flee.
    13861378    if ( empty( $root_slug ) ) {
    13871379        return false;
    13881380    }
    13891381
    1390     // Loop through active components and look for a match
     1382    // Loop through active components and look for a match.
    13911383    foreach ( array_keys( $bp->active_components ) as $component ) {
    13921384        if ( ( ! empty( $bp->{$component}->slug ) && ( $bp->{$component}->slug == $root_slug ) ) || ( ! empty( $bp->{$component}->root_slug ) && ( $bp->{$component}->root_slug === $root_slug ) ) ) {
     
    14861478}
    14871479
    1488 /** is_() functions to determine the current page *****************************/
     1480/** The is_() functions to determine the current page *****************************/
    14891481
    14901482/**
     
    15001492 *
    15011493 * @param string $component Name of the component being checked.
    1502  *
    15031494 * @return bool Returns true if the component matches, or else false.
    15041495 */
    15051496function bp_is_current_component( $component = '' ) {
    15061497
    1507     // Default is no match. We'll check a few places for matches
     1498    // Default is no match. We'll check a few places for matches.
    15081499    $is_current_component = false;
    15091500
    1510     // Always return false if a null value is passed to the function
     1501    // Always return false if a null value is passed to the function.
    15111502    if ( empty( $component ) ) {
    15121503        return false;
    15131504    }
    15141505
    1515     // Backward compatibility: 'xprofile' should be read as 'profile'
     1506    // Backward compatibility: 'xprofile' should be read as 'profile'.
    15161507    if ( 'xprofile' === $component ) {
    15171508        $component = 'profile';
     
    15201511    $bp = buddypress();
    15211512
    1522     // Only check if BuddyPress found a current_component
     1513    // Only check if BuddyPress found a current_component.
    15231514    if ( ! empty( $bp->current_component ) ) {
    15241515
    15251516        // First, check to see whether $component_name and the current
    1526         // component are a simple match
     1517        // component are a simple match.
    15271518        if ( $bp->current_component == $component ) {
    15281519            $is_current_component = true;
    15291520
    15301521        // Since the current component is based on the visible URL slug let's
    1531         // check the component being passed and see if its root_slug matches
     1522        // check the component being passed and see if its root_slug matches.
    15321523        } elseif ( isset( $bp->{$component}->root_slug ) && $bp->{$component}->root_slug == $bp->current_component ) {
    15331524            $is_current_component = true;
    15341525
    1535         // Because slugs can differ from root_slugs, we should check them too
     1526        // Because slugs can differ from root_slugs, we should check them too.
    15361527        } elseif ( isset( $bp->{$component}->slug ) && $bp->{$component}->slug == $bp->current_component ) {
    15371528            $is_current_component = true;
     
    15461537
    15471538        // If we haven't found a match yet, check against the root_slugs
    1548         // created by $bp->pages, as well as the regular slugs
     1539        // created by $bp->pages, as well as the regular slugs.
    15491540        } else {
    15501541            foreach ( $bp->active_components as $id ) {
    15511542                // If the $component parameter does not match the current_component,
    1552                 // then move along, these are not the droids you are looking for
     1543                // then move along, these are not the droids you are looking for.
    15531544                if ( empty( $bp->{$id}->root_slug ) || $bp->{$id}->root_slug != $bp->current_component ) {
    15541545                    continue;
     
    15891580 *
    15901581 * @param string $action The action being tested against.
    1591  *
    15921582 * @return bool True if the current action matches $action.
    15931583 */
     
    16141604 *                                  don't provide a $position, the function will return true if the
    16151605 *                                  $action_variable is found *anywhere* in the action variables array.
    1616  *
    16171606 * @return bool True if $action_variable matches at the $position provided.
    16181607 */
     
    16211610
    16221611    if ( false !== $position ) {
    1623         // When a $position is specified, check that slot in the action_variables array
     1612        // When a $position is specified, check that slot in the action_variables array.
    16241613        if ( $action_variable ) {
    16251614            $is_action_variable = $action_variable == bp_action_variable( $position );
    16261615        } else {
    16271616            // If no $action_variable is provided, we are essentially checking to see
    1628             // whether the slot is empty
     1617            // whether the slot is empty.
    16291618            $is_action_variable = !bp_action_variable( $position );
    16301619        }
    16311620    } else {
    1632         // When no $position is specified, check the entire array
     1621        // When no $position is specified, check the entire array.
    16331622        $is_action_variable = in_array( $action_variable, (array)bp_action_variables() );
    16341623    }
     
    16501639 *
    16511640 * @param string $item The item being checked.
    1652  *
    16531641 * @return bool True if $item is the current item.
    16541642 */
     
    16681656
    16691657/**
    1670  * Are we looking at a single item? (group, user, etc)
     1658 * Are we looking at a single item? (group, user, etc).
    16711659 *
    16721660 * @return bool True if looking at a single item, otherwise false.
     
    17701758 * already deprecated functions.
    17711759 *
    1772  * @param string $component_name
     1760 * @param string $component_name Component name to check.
    17731761 *
    17741762 * @return bool True if root component, else false.
     
    17781766    $retval = false;
    17791767
    1780     // Default to the current component if none is passed
     1768    // Default to the current component if none is passed.
    17811769    if ( empty( $component_name ) ) {
    17821770        $component_name = bp_current_component();
    17831771    }
    17841772
    1785     // Loop through active components and check for key/slug matches
     1773    // Loop through active components and check for key/slug matches.
    17861774    if ( ! empty( $bp->active_components ) ) {
    17871775        foreach ( (array) $bp->active_components as $key => $slug ) {
     
    18141802 * @param string $component Optional. Name of the component to check for.
    18151803 *                          Default: current component.
    1816  *
    18171804 * @return bool True if the specified component is set to be the site's front
    18181805 *              page, otherwise false.
     
    18231810    $bp = buddypress();
    18241811
    1825     // Default to the current component if none is passed
     1812    // Default to the current component if none is passed.
    18261813    if ( empty( $component ) ) {
    18271814        $component = bp_current_component();
    18281815    }
    18291816
    1830     // Get the path for the current blog/site
     1817    // Get the path for the current blog/site.
    18311818    $path = is_main_site()
    18321819        ? bp_core_get_site_path()
    18331820        : $current_blog->path;
    18341821
    1835     // Get the front page variables
     1822    // Get the front page variables.
    18361823    $show_on_front = get_option( 'show_on_front' );
    18371824    $page_on_front = get_option( 'page_on_front' );
     
    19181905 * @param string $component The component name.
    19191906 * @param string $feature   The feature name.
    1920  *
    19211907 * @return bool
    19221908 */
     
    19241910    $retval = false;
    19251911
    1926     // Default to the current component if none is passed
     1912    // Default to the current component if none is passed.
    19271913    if ( empty( $component ) ) {
    19281914        $component = bp_current_component();
    19291915    }
    19301916
    1931     // Is component in either the active or required components arrays
     1917    // Is component in either the active or required components arrays.
    19321918    if ( isset( buddypress()->active_components[ $component ] ) || isset( buddypress()->required_components[ $component ] ) ) {
    19331919        $retval = true;
     
    19351921        // Is feature active?
    19361922        if ( ! empty( $feature ) ) {
    1937             // The xProfile component is specific
     1923            // The xProfile component is specific.
    19381924            if ( 'xprofile' === $component ) {
    19391925                $component = 'profile';
     
    20932079 * @since 2.0.0
    20942080 *
    2095  * @return True if the current page is the activity directory.
     2081 * @return bool True if the current page is the activity directory.
    20962082 */
    20972083function bp_is_activity_directory() {
     
    21062092 * Is the current page a single activity item permalink?
    21072093 *
    2108  * @return True if the current page is a single activity item permalink.
     2094 * @return bool True if the current page is a single activity item permalink.
    21092095 */
    21102096function bp_is_single_activity() {
     
    21192105 * @since 2.0.0
    21202106 *
    2121  * @return True if the current page is the members directory.
     2107 * @return bool True if the current page is the members directory.
    21222108 */
    21232109function bp_is_members_directory() {
     
    21352121 * http://example.com/members/joe/friends/.
    21362122 *
    2137  * @return True if the current page is part of the profile of the logged-in user.
     2123 * @return bool True if the current page is part of the profile of the logged-in user.
    21382124 */
    21392125function bp_is_my_profile() {
     
    21592145 * Will return true anytime there is a displayed user.
    21602146 *
    2161  * @return True if the current page is a user page.
     2147 * @return bool True if the current page is a user page.
    21622148 */
    21632149function bp_is_user() {
     
    21702156 * Eg http://example.com/members/joe/activity/ (or any subpages thereof).
    21712157 *
    2172  * @return True if the current page is a user's activity stream page.
     2158 * @return bool True if the current page is a user's activity stream page.
    21732159 */
    21742160function bp_is_user_activity() {
     
    21812167 * Eg http://example.com/members/joe/friends/
    21822168 *
    2183  * @return True if the current page is a user's Friends activity stream.
     2169 * @return bool True if the current page is a user's Friends activity stream.
    21842170 */
    21852171function bp_is_user_friends_activity() {
     
    22072193 * Eg http://example.com/members/joe/groups/
    22082194 *
    2209  * @return True if the current page is a user's Groups activity stream.
     2195 * @return bool True if the current page is a user's Groups activity stream.
    22102196 */
    22112197function bp_is_user_groups_activity() {
     
    22312217 * Eg http://example.com/members/joe/profile/ (or a subpage thereof).
    22322218 *
    2233  * @return True if the current page is part of a user's extended profile.
     2219 * @return bool True if the current page is part of a user's extended profile.
    22342220 */
    22352221function bp_is_user_profile() {
     
    22422228 * Eg http://example.com/members/joe/profile/edit/ (or a subpage thereof).
    22432229 *
    2244  * @return True if the current page is a user's profile edit page.
     2230 * @return bool True if the current page is a user's profile edit page.
    22452231 */
    22462232function bp_is_user_profile_edit() {
     
    22592245 * @since  2.4.0
    22602246 *
    2261  * @return True if the current page is a user's profile edit cover image page.
     2247 * @return bool True if the current page is a user's profile edit cover image page.
    22622248 */
    22632249function bp_is_user_change_cover_image() {
     
    24562442
    24572443/**
    2458  * Is the current page the groups directory ?
     2444 * Is the current page the groups directory?
    24592445 *
    24602446 * @since 2.0.0
     
    25332519    $retval = false;
    25342520
    2535     // At a forum URL
     2521    // At a forum URL.
    25362522    if ( bp_is_single_item() && bp_is_groups_component() && bp_is_current_action( 'forum' ) ) {
    25372523        $retval = true;
     
    27662752 * @param string $component Current component to check for.
    27672753 * @param string $callback  Callback to invoke.
    2768  *
    27692754 * @return bool
    27702755 */
     
    28102795     * @param array      $wp_classes     The body classes coming from WP.
    28112796     * @param array|bool $custom_classes Classes that were passed to get_body_class().
    2812      *
    28132797     * @return array $classes The BP-adjusted body classes.
    28142798     */
     
    28172801        $bp_classes = array();
    28182802
    2819         /** Pages *************************************************************/
     2803        /* Pages *************************************************************/
    28202804
    28212805        if ( is_front_page() ) {
     
    28312815        }
    28322816
    2833         /** Components ********************************************************/
     2817        /* Components ********************************************************/
    28342818
    28352819        if ( ! bp_is_blog_page() ) {
     
    28632847        }
    28642848
    2865         /** User **************************************************************/
     2849        /* User **************************************************************/
    28662850
    28672851        if ( bp_is_user() ) {
     
    29232907        }
    29242908
    2925         /** Messages **********************************************************/
     2909        /* Messages **********************************************************/
    29262910
    29272911        if ( bp_is_messages_inbox() ) {
     
    29492933        }
    29502934
    2951         /** Groups ************************************************************/
     2935        /* Groups ************************************************************/
    29522936
    29532937        if ( bp_is_group() ) {
     
    29972981        }
    29982982
    2999         /** Registration ******************************************************/
     2983        /* Registration ******************************************************/
    30002984
    30012985        if ( bp_is_register_page() ) {
     
    30072991        }
    30082992
    3009         /** Current Component & Action ****************************************/
     2993        /* Current Component & Action ****************************************/
    30102994
    30112995        if ( ! bp_is_blog_page() ) {
     
    30142998        }
    30152999
    3016         /** Clean up ***********************************************************/
    3017 
    3018         // Add BuddyPress class if we are within a BuddyPress page
     3000        /* Clean up ***********************************************************/
     3001
     3002        // Add BuddyPress class if we are within a BuddyPress page.
    30193003        if ( ! bp_is_blog_page() ) {
    30203004            $bp_classes[] = 'buddypress';
    30213005        }
    30223006
    3023         // Merge WP classes with BuddyPress classes and remove any duplicates
     3007        // Merge WP classes with BuddyPress classes and remove any duplicates.
    30243008        $classes = array_unique( array_merge( (array) $bp_classes, (array) $wp_classes ) );
    30253009
     
    30463030 *
    30473031 * @param array $wp_classes The post classes coming from WordPress.
    3048  *
    30493032 * @return array
    30503033 */
    30513034function bp_get_the_post_class( $wp_classes = array() ) {
    3052     // don't do anything if we're not on a BP page
     3035    // Don't do anything if we're not on a BP page.
    30533036    if ( ! is_buddypress() ) {
    30543037        return $wp_classes;
     
    30833066    }
    30843067
    3085     // emulate post type css class
     3068    // Emulate post type css class.
    30863069    foreach ( $bp_classes as $bp_class ) {
    30873070        $bp_classes[] = "type-{$bp_class}";
    30883071    }
    30893072
    3090     // okay let's merge!
     3073    // Okay let's merge!
    30913074    return array_unique( array_merge( $bp_classes, $wp_classes ) );
    30923075}
     
    31043087 * @param array $a First item.
    31053088 * @param array $b Second item.
    3106  *
    31073089 * @return int Returns an integer less than, equal to, or greater than zero if
    31083090 *             the first argument is considered to be respectively less than,
     
    31293111    $menus = $selected_menus = array();
    31303112
    3131     // Get the second level menus
     3113    // Get the second level menus.
    31323114    foreach ( (array) buddypress()->bp_options_nav as $parent_menu => $sub_menus ) {
    31333115
     
    31373119        }
    31383120
    3139         // Sort the items in this menu's navigation by their position property
     3121        // Sort the items in this menu's navigation by their position property.
    31403122        $second_level_menus = (array) $sub_menus;
    31413123        usort( $second_level_menus, '_bp_nav_menu_sort' );
    31423124
    3143         // Iterate through the second level menus
     3125        // Iterate through the second level menus.
    31443126        foreach( $second_level_menus as $sub_nav ) {
    31453127
    3146             // Skip items we don't have access to
     3128            // Skip items we don't have access to.
    31473129            if ( empty( $sub_nav['user_has_access'] ) ) {
    31483130                continue;
    31493131            }
    31503132
    3151             // Add this menu
     3133            // Add this menu.
    31523134            $menu         = new stdClass;
    31533135            $menu->class  = array( 'menu-child' );
     
    31553137            $menu->link   = $sub_nav['link'];
    31563138            $menu->name   = $sub_nav['name'];
    3157             $menu->parent = $parent_menu;  // Associate this sub nav with a top-level menu
    3158 
    3159             // If we're viewing this item's screen, record that we need to mark its parent menu to be selected
     3139            $menu->parent = $parent_menu;  // Associate this sub nav with a top-level menu.
     3140
     3141            // If we're viewing this item's screen, record that we need to mark its parent menu to be selected.
    31603142            if ( $sub_nav['slug'] == bp_current_action() ) {
    31613143                $menu->class[]    = 'current-menu-item';
     
    31673149    }
    31683150
    3169     // Get the top-level menu parts (Friends, Groups, etc) and sort by their position property
     3151    // Get the top-level menu parts (Friends, Groups, etc) and sort by their position property.
    31703152    $top_level_menus = (array) buddypress()->bp_nav;
    31713153    usort( $top_level_menus, '_bp_nav_menu_sort' );
    31723154
    3173     // Iterate through the top-level menus
     3155    // Iterate through the top-level menus.
    31743156    foreach ( $top_level_menus as $nav ) {
    31753157
    3176         // Skip items marked as user-specific if you're not on your own profile
     3158        // Skip items marked as user-specific if you're not on your own profile.
    31773159        if ( empty( $nav['show_for_displayed_user'] ) && ! bp_core_can_edit_settings()  ) {
    31783160            continue;
    31793161        }
    31803162
    3181         // Get the correct menu link. See https://buddypress.trac.wordpress.org/ticket/4624
     3163        // Get the correct menu link. See https://buddypress.trac.wordpress.org/ticket/4624.
    31823164        $link = bp_loggedin_user_domain() ? str_replace( bp_loggedin_user_domain(), bp_displayed_user_domain(), $nav['link'] ) : trailingslashit( bp_displayed_user_domain() . $nav['link'] );
    31833165
    3184         // Add this menu
     3166        // Add this menu.
    31853167        $menu         = new stdClass;
    31863168        $menu->class  = array( 'menu-parent' );
     
    31903172        $menu->parent = 0;
    31913173
    3192         // Check if we need to mark this menu as selected
     3174        // Check if we need to mark this menu as selected.
    31933175        if ( in_array( $nav['css_id'], $selected_menus ) ) {
    31943176            $menu->class[] = 'current-menu-parent';
     
    32423224 *                                   Default: 'BP_Walker_Nav_Menu'.
    32433225 * }
    3244  *
    32453226 * @return string|null If $echo is false, returns a string containing the nav
    32463227 *                     menu markup.
     
    32803261    $show_container = false;
    32813262
    3282     // Create custom walker if one wasn't set
     3263    // Create custom walker if one wasn't set.
    32833264    if ( empty( $args->walker ) ) {
    32843265        $args->walker = new BP_Walker_Nav_Menu;
    32853266    }
    32863267
    3287     // Sanitise values for class and ID
     3268    // Sanitise values for class and ID.
    32883269    $args->container_class = sanitize_html_class( $args->container_class );
    32893270    $args->container_id    = sanitize_html_class( $args->container_id );
    32903271
    3291     // Whether to wrap the ul, and what to wrap it with
     3272    // Whether to wrap the ul, and what to wrap it with.
    32923273    if ( $args->container ) {
    32933274
     
    33293310        $wrap_id = 'menu-bp';
    33303311
    3331         // If a specific ID wasn't requested, and there are multiple menus on the same screen, make sure the autogenerated ID is unique
     3312        // If a specific ID wasn't requested, and there are multiple menus on the same screen, make sure the autogenerated ID is unique.
    33323313        while ( in_array( $wrap_id, $menu_id_slugs ) ) {
    33333314            if ( preg_match( '#-(\d+)$#', $wrap_id, $matches ) ) {
     
    33523333    $items = apply_filters( 'bp_nav_menu_items', $items, $args );
    33533334
    3354     // Build the output
     3335    // Build the output.
    33553336    $wrap_class  = $args->menu_class ? $args->menu_class : '';
    33563337    $nav_menu   .= sprintf( $args->items_wrap, esc_attr( $wrap_id ), esc_attr( $wrap_class ), $items );
    33573338    unset( $items );
    33583339
    3359     // If we've wrapped the ul, close it
     3340    // If we've wrapped the ul, close it.
    33603341    if ( ! empty( $show_container ) ) {
    33613342        $nav_menu .= '</' . $args->container . '>';
Note: See TracChangeset for help on using the changeset viewer.