Ticket #3554: 3554.01.patch
File 3554.01.patch, 3.7 KB (added by , 13 years ago) |
---|
-
bp-core/bp-core-filters.php
function bp_modify_page_title( $title, $sep, $seplocation ) { 292 292 // An index or directory 293 293 } elseif ( bp_is_directory() ) { 294 294 if ( !bp_current_component() ) 295 $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug( bp_ members_slug() ) );295 $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug( bp_get_members_root_slug() ) ); 296 296 else 297 297 $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug() ); 298 298 -
bp-core/bp-core-template.php
function bp_get_name_from_root_slug( $root_slug = '' ) { 680 680 681 681 // If no slug is passed, look at current_component 682 682 if ( empty( $root_slug ) ) 683 $root_slug = $bp-> current_component;683 $root_slug = $bp->{$bp->current_component}->root_slug; 684 684 685 685 // No current component or root slug, so flee 686 686 if ( empty( $root_slug ) ) … … function bp_get_name_from_root_slug( $root_slug = '' ) { 690 690 foreach ( $bp->active_components as $component => $id ) 691 691 if ( isset( $bp->{$component}->root_slug ) && 692 692 !empty( $bp->{$component}->root_slug ) && 693 $bp->{$component}->root_slug == $root_slug ) 693 $bp->{$component}->root_slug == $root_slug ) { 694 694 return $bp->{$component}->name; 695 } 695 696 696 697 return false; 697 698 } … … function bp_is_current_component( $component ) { 748 749 $component = 'profile'; 749 750 750 751 if ( !empty( $bp->current_component ) ) { 751 // First, check to see whether $component_name and the current 752 // component are a simple match 753 if ( $bp->current_component == $component ) { 754 $is_current_component = true; 752 if ( isset( $bp->{$bp->current_component} ) && isset( $bp->{$component} ) ) { 753 $current_slug = isset( $bp->{$bp->current_component}->root_slug ) ? $bp->{$bp->current_component}->root_slug : $bp->{$bp->current_component}->slug; 755 754 756 // Since the current component is based on the visible URL slug let's 757 // check the component being passed and see if its root_slug matches 758 } elseif ( isset( $bp->{$component}->root_slug ) && $bp->{$component}->root_slug == $bp->current_component ) { 759 $is_current_component = true; 760 761 // Because slugs can differ from root_slugs, we should check them too 762 } elseif ( isset( $bp->{$component}->slug ) && $bp->{$component}->slug == $bp->current_component ) { 763 $is_current_component = true; 755 $component_slug = isset( $bp->{$component}->root_slug ) ? $bp->{$component}->root_slug : $bp->{$component}->slug; 764 756 765 // Next, check to see whether $component is a canonical, 766 // non-translatable component name. If so, we can return its 767 // corresponding slug from $bp->active_components. 768 } else if ( $key = array_search( $component, $bp->active_components ) ) { 769 if ( strstr( $bp->current_component, $key ) ) 770 $is_current_component = true; 771 772 // If we haven't found a match yet, check against the root_slugs 773 // created by $bp->pages, as well as the regular slugs 774 } else { 775 foreach ( $bp->active_components as $id ) { 776 // If the $component parameter does not match the current_component, 777 // then move along, these are not the droids you are looking for 778 if ( empty( $bp->{$id}->root_slug ) || $bp->{$id}->root_slug != $bp->current_component ) 779 continue; 780 781 if ( $id == $component ) { 782 $is_current_component = true; 783 break; 784 } 785 } 757 return $current_slug == $component_slug; 786 758 } 787 759 788 760 // Page template fallback check if $bp->current_component is empty