Changeset 5758
- Timestamp:
- 02/13/2012 05:46:52 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-screens.php
r5705 r5758 191 191 return false; 192 192 193 if ( empty( $bp->current_action ) || !is_numeric( $bp->current_action) )193 if ( ! bp_current_action() || !is_numeric( bp_current_action() ) ) 194 194 return false; 195 195 … … 248 248 is_user_logged_in() ? 249 249 bp_core_redirect( bp_loggedin_user_domain() ) : 250 bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . esc_url( bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $bp->current_action. '/' ) ) );250 bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . esc_url( bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . bp_current_action() . '/' ) ) ); 251 251 } 252 252 … … 260 260 * @since 1.2.0 261 261 * 262 * @global object $bp BuddyPress global settings263 262 * @uses bp_get_user_meta() 264 263 * @uses bp_core_get_username() … … 266 265 */ 267 266 function bp_activity_screen_notification_settings() { 268 global $bp;269 267 270 268 if ( !$mention = bp_get_user_meta( bp_displayed_user_id(), 'notification_activity_new_mention', true ) ) -
trunk/bp-activity/bp-activity-template.php
r5729 r5758 277 277 278 278 // The default scope should recognize custom slugs 279 if ( array_key_exists( $bp->current_action, (array) $bp->loaded_components ) ) {280 $scope = $bp->loaded_components[ $bp->current_action];279 if ( array_key_exists( bp_current_action(), (array) $bp->loaded_components ) ) { 280 $scope = $bp->loaded_components[bp_current_action()]; 281 281 } 282 282 else … … 1812 1812 * @since 1.2.0 1813 1813 * 1814 * @global object $bp BuddyPress global settings1815 1814 * @uses apply_filters() To call the 'bp_get_activity_permalink_id' hook 1816 1815 * … … 1818 1817 */ 1819 1818 function bp_get_activity_permalink_id() { 1820 global $bp; 1821 1822 return apply_filters( 'bp_get_activity_permalink_id', $bp->current_action ); 1819 return apply_filters( 'bp_get_activity_permalink_id', bp_current_action() ); 1823 1820 } 1824 1821 -
trunk/bp-core/bp-core-buddybar.php
r5751 r5758 125 125 } 126 126 127 if ( $bp->current_component == $parent_slug && !$bp->current_action) {128 if ( !is_object( $screen_function[0] ) ) 127 if ( bp_is_current_component( $parent_slug ) && !bp_current_action() ) { 128 if ( !is_object( $screen_function[0] ) ) { 129 129 add_action( 'bp_screens', $screen_function ); 130 else130 } else { 131 131 add_action( 'bp_screens', array( &$screen_function[0], $screen_function[1] ) ); 132 } 132 133 133 134 if ( $subnav_slug ) { … … 237 238 238 239 // If we *don't* meet condition (1), return 239 if ( $bp->current_component != $parent_slug && $bp->current_item != $parent_slug)240 if ( ! bp_is_current_component( $parent_slug ) && ! bp_is_current_item( $parent_slug ) ) 240 241 return; 241 242 242 243 // If we *do* meet condition (2), then the added subnav item is currently being requested 243 if ( ( !empty( $bp->current_action ) && $slug == $bp->current_action ) || ( bp_is_user() && empty( $bp->current_action ) && $screen_function == $bp->bp_nav[$parent_slug]['screen_function']) ) {244 if ( ( bp_current_action() && bp_is_current_action( $slug ) ) || ( bp_is_user() && ! bp_current_action() && ( $screen_function == $bp->bp_nav[$parent_slug]['screen_function'] ) ) ) { 244 245 245 246 // Before hooking the screen function, check user access 246 if ( $user_has_access) {247 if ( !is_object( $screen_function[0] ) ) 247 if ( !empty( $user_has_access ) ) { 248 if ( !is_object( $screen_function[0] ) ) { 248 249 add_action( 'bp_screens', $screen_function ); 249 else250 } else { 250 251 add_action( 'bp_screens', array( &$screen_function[0], $screen_function[1] ) ); 252 } 251 253 } else { 252 254 // When the content is off-limits, we handle the situation differently -
trunk/bp-core/bp-core-filters.php
r5729 r5758 287 287 // A single group 288 288 } elseif ( bp_is_active( 'groups' ) && !empty( $bp->groups->current_group ) && !empty( $bp->bp_options_nav[$bp->groups->current_group->slug] ) ) { 289 $subnav = isset( $bp->bp_options_nav[$bp->groups->current_group->slug][ $bp->current_action]['name'] ) ? $bp->bp_options_nav[$bp->groups->current_group->slug][$bp->current_action]['name'] : '';289 $subnav = isset( $bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name'] ) ? $bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name'] : ''; 290 290 // translators: "group name | group nav section name" 291 291 $title = sprintf( __( '%1$s | %2$s', 'buddypress' ), $bp->bp_options_title, $subnav ); … … 294 294 } elseif ( bp_is_single_item() ) { 295 295 // translators: "component item name | component nav section name | root component name" 296 $title = sprintf( __( '%1$s | %2$s | %3$s', 'buddypress' ), $bp->bp_options_title, $bp->bp_options_nav[ $bp->current_item][$bp->current_action]['name'], bp_get_name_from_root_slug( bp_get_root_slug() ) );296 $title = sprintf( __( '%1$s | %2$s | %3$s', 'buddypress' ), $bp->bp_options_title, $bp->bp_options_nav[bp_current_item()][bp_current_action()]['name'], bp_get_name_from_root_slug( bp_get_root_slug() ) ); 297 297 298 298 // An index or directory -
trunk/bp-core/bp-core-template.php
r5729 r5758 23 23 // If we are looking at a member profile, then the we can use the current component as an 24 24 // 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() ); 26 26 27 27 if ( !bp_is_single_item() ) { … … 32 32 } 33 33 } 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 ) { 35 35 return false; 36 36 } else { 37 $the_index = $bp->current_item;37 $the_index = bp_current_item(); 38 38 } 39 39 } … … 45 45 46 46 // 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() ) { 48 48 $selected = ' class="current selected"'; 49 49 } else { … … 661 661 // Use current global component if none passed 662 662 if ( empty( $component ) ) 663 $component = $bp->current_component;663 $component = bp_current_component(); 664 664 665 665 // Component is active … … 695 695 // If no slug is passed, look at current_component 696 696 if ( empty( $root_slug ) ) 697 $root_slug = $bp->current_component;697 $root_slug = bp_current_component(); 698 698 699 699 // No current component or root slug, so flee … … 763 763 764 764 if ( !empty( $bp->current_component ) ) { 765 765 766 // First, check to see whether $component_name and the current 766 767 // component are a simple match … … 781 782 // corresponding slug from $bp->active_components. 782 783 } else if ( $key = array_search( $component, $bp->active_components ) ) { 783 if ( strstr( $bp->current_component, $key ) ) 784 if ( strstr( $bp->current_component, $key ) ) { 784 785 $is_current_component = true; 786 } 785 787 786 788 // If we haven't found a match yet, check against the root_slugs … … 790 792 // If the $component parameter does not match the current_component, 791 793 // 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 ) { 793 795 continue; 796 } 794 797 795 798 if ( $id == $component ) { … … 808 811 809 812 // 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 ) ) ) { 811 814 $is_current_component = true; 815 } 812 816 } 813 817 … … 833 837 */ 834 838 function bp_is_current_action( $action = '' ) { 835 global $bp; 836 837 if ( $action == $bp->current_action ) 839 if ( $action == bp_current_action() ) 838 840 return true; 839 841 … … 1081 1083 1082 1084 function 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() ) ) 1086 1086 return true; 1087 1087 -
trunk/bp-groups/bp-groups-loader.php
r5714 r5758 159 159 160 160 // If the user was attempting to access a group, but no group by that name was found, 404 161 if ( bp_is_groups_component() && empty( $this->current_group ) && !empty( $bp->current_action ) && !in_array( $bp->current_action, $this->forbidden_names ) ) {161 if ( bp_is_groups_component() && empty( $this->current_group ) && bp_current_action() && !in_array( bp_current_action(), $this->forbidden_names ) ) { 162 162 bp_do_404(); 163 163 return; … … 169 169 // Prepare for a redirect to the canonical URL 170 170 $bp->redirect_stack['base_url'] = bp_get_group_permalink( $this->current_group ); 171 $bp->redirect_stack['action'] = $bp->current_action;171 $bp->redirect_stack['action'] = bp_current_action(); 172 172 } 173 173 -
trunk/bp-groups/bp-groups-template.php
r5729 r5758 246 246 247 247 // Type 248 if ( 'my-groups' == $bp->current_action) {248 if ( bp_is_current_action( 'my-groups' ) ) { 249 249 if ( 'most-popular' == $order ) { 250 250 $type = 'popular'; … … 252 252 $type = 'alphabetical'; 253 253 } 254 } elseif ( 'invites' == $bp->current_action) {254 } elseif ( bp_is_current_action( 'invites' ) ) { 255 255 $type = 'invites'; 256 256 } elseif ( isset( $bp->groups->current_group->slug ) && $bp->groups->current_group->slug ) { -
trunk/bp-members/bp-members-template.php
r5729 r5758 706 706 707 707 // If the current component matches the nav item id, then add a highlight CSS class. 708 if ( !bp_is_directory() && $bp->active_components[ $bp->current_component] == $nav_item['css_id'] ) {708 if ( !bp_is_directory() && $bp->active_components[bp_current_component()] == $nav_item['css_id'] ) { 709 709 $selected = ' class="current selected"'; 710 710 } … … 751 751 752 752 $selected = ''; 753 if ( $bp->current_component == $user_nav_item['slug']) {753 if ( bp_is_current_component( $user_nav_item['slug'] ) ) { 754 754 $selected = ' class="current selected"'; 755 755 } -
trunk/bp-messages/bp-messages-template.php
r5729 r5758 128 128 $this->thread = $this->next_thread(); 129 129 130 if ( 'notices' != $bp->current_action) {130 if ( ! bp_is_current_action( 'notices' ) ) { 131 131 $last_message_index = count( $this->thread->messages ) - 1; 132 132 $this->thread->messages = array_reverse( (array) $this->thread->messages ); … … 168 168 169 169 $defaults = array( 170 'user_id' => bp_loggedin_user_id(),171 'box' => 'inbox',170 'user_id' => bp_loggedin_user_id(), 171 'box' => 'inbox', 172 172 'per_page' => 10, 173 'max' => false,174 'type' => 'all'173 'max' => false, 174 'type' => 'all' 175 175 ); 176 176 … … 178 178 extract( $r, EXTR_SKIP ); 179 179 180 if ( 'notices' == $bp->current_action&& !bp_current_user_can( 'bp_moderate' ) ) {180 if ( bp_is_current_action( 'notices' ) && !bp_current_user_can( 'bp_moderate' ) ) { 181 181 wp_redirect( bp_displayed_user_id() ); 182 182 } else { 183 if ( 'inbox' == $bp->current_action )183 if ( bp_is_current_action( 'inbox' ) ) { 184 184 bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->messages->id, 'new_message' ); 185 186 if ( 'sentbox' == $bp->current_action ) 185 } 186 187 if ( bp_is_current_action( 'sentbox' ) ) 187 188 $box = 'sentbox'; 188 189 189 if ( 'notices' == $bp->current_action)190 if ( bp_is_current_action( 'notices' ) ) 190 191 $box = 'notices'; 191 192 … … 247 248 function bp_get_message_thread_to() { 248 249 global $messages_template; 249 return apply_filters( 'bp_message_thread_to', BP_Messages_Thread::get_recipient_links($messages_template->thread->recipients ) );250 return apply_filters( 'bp_message_thread_to', BP_Messages_Thread::get_recipient_links($messages_template->thread->recipients ) ); 250 251 } 251 252 … … 263 264 function bp_get_message_thread_delete_link() { 264 265 global $messages_template, $bp; 265 return apply_filters( 'bp_get_message_thread_delete_link', wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . $bp->messages->slug . '/' . $bp->current_action. '/delete/' . $messages_template->thread->thread_id ), 'messages_delete_thread' ) );266 return apply_filters( 'bp_get_message_thread_delete_link', wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . $bp->messages->slug . '/' . bp_current_action() . '/delete/' . $messages_template->thread->thread_id ), 'messages_delete_thread' ) ); 266 267 } 267 268 … … 416 417 </select> 417 418 418 <?php if ( $bp->current_action != 'sentbox' && $bp->current_action != 'notices') : ?>419 <?php if ( ! bp_is_current_action( 'sentbox' ) && bp_is_current_action( 'notices' ) ) : ?> 419 420 420 421 <a href="#" id="mark_as_read"><?php _e('Mark as Read', 'buddypress') ?></a> … … 423 424 <?php endif; ?> 424 425 425 <a href="#" id="delete_<?php echo $bp->current_action ?>_messages"><?php _e('Delete Selected', 'buddypress')?></a> 426 <a href="#" id="delete_<?php echo bp_current_action(); ?>_messages"><?php _e( 'Delete Selected', 'buddypress' ); ?></a> 426 427 427 428 <?php
Note: See TracChangeset
for help on using the changeset viewer.