Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/13/2012 05:46:52 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Clean up $bp->current_component, $bp->current_action, and $bp->current_item usage. Fixes #3738.

File:
1 edited

Legend:

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

    r5729 r5758  
    2323    // If we are looking at a member profile, then the we can use the current component as an
    2424    // index. Otherwise we need to use the component's root_slug
    25     $component_index = !empty( $bp->displayed_user ) ? $bp->current_component : bp_get_root_slug( $bp->current_component );
     25    $component_index = !empty( $bp->displayed_user ) ? bp_current_component() : bp_get_root_slug( bp_current_component() );
    2626
    2727    if ( !bp_is_single_item() ) {
     
    3232        }
    3333    } else {
    34         if ( !isset( $bp->bp_options_nav[$bp->current_item] ) || count( $bp->bp_options_nav[$bp->current_item] ) < 1 ) {
     34        if ( !isset( $bp->bp_options_nav[bp_current_item()] ) || count( $bp->bp_options_nav[bp_current_item()] ) < 1 ) {
    3535            return false;
    3636        } else {
    37             $the_index = $bp->current_item;
     37            $the_index = bp_current_item();
    3838        }
    3939    }
     
    4545
    4646        // If the current action or an action variable matches the nav item id, then add a highlight CSS class.
    47         if ( $subnav_item['slug'] == $bp->current_action ) {
     47        if ( $subnav_item['slug'] == bp_current_action() ) {
    4848            $selected = ' class="current selected"';
    4949        } else {
     
    661661        // Use current global component if none passed
    662662        if ( empty( $component ) )
    663             $component = $bp->current_component;
     663            $component = bp_current_component();
    664664
    665665        // Component is active
     
    695695    // If no slug is passed, look at current_component
    696696    if ( empty( $root_slug ) )
    697         $root_slug = $bp->current_component;
     697        $root_slug = bp_current_component();
    698698
    699699    // No current component or root slug, so flee
     
    763763
    764764    if ( !empty( $bp->current_component ) ) {
     765
    765766        // First, check to see whether $component_name and the current
    766767        // component are a simple match
     
    781782        // corresponding slug from $bp->active_components.
    782783        } else if ( $key = array_search( $component, $bp->active_components ) ) {
    783             if ( strstr( $bp->current_component, $key ) )
     784            if ( strstr( $bp->current_component, $key ) ) {
    784785                $is_current_component = true;
     786            }
    785787
    786788        // If we haven't found a match yet, check against the root_slugs
     
    790792                // If the $component parameter does not match the current_component,
    791793                // then move along, these are not the droids you are looking for
    792                 if ( empty( $bp->{$id}->root_slug ) || $bp->{$id}->root_slug != $bp->current_component )
     794                if ( empty( $bp->{$id}->root_slug ) || $bp->{$id}->root_slug != $bp->current_component ) {
    793795                    continue;
     796                }
    794797
    795798                if ( $id == $component ) {
     
    808811
    809812        // Component name is in the page template name
    810         if ( !empty( $page_template ) && strstr( strtolower( $page_template ), strtolower( $component ) ) )
     813        if ( !empty( $page_template ) && strstr( strtolower( $page_template ), strtolower( $component ) ) ) {
    811814            $is_current_component = true;
     815        }
    812816    }
    813817
     
    833837 */
    834838function bp_is_current_action( $action = '' ) {
    835     global $bp;
    836 
    837     if ( $action == $bp->current_action )
     839    if ( $action == bp_current_action() )
    838840        return true;
    839841
     
    10811083
    10821084function bp_is_single_activity() {
    1083     global $bp;
    1084 
    1085     if ( bp_is_activity_component() && is_numeric( $bp->current_action ) )
     1085    if ( bp_is_activity_component() && is_numeric( bp_current_action() ) )
    10861086        return true;
    10871087
Note: See TracChangeset for help on using the changeset viewer.