Skip to:
Content

BuddyPress.org

Changeset 4847


Ignore:
Timestamp:
07/25/2011 12:29:19 AM (15 years ago)
Author:
boonebgorges
Message:

Global/slug audit in Core and Activity components. Fixes #3325

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-actions.php

    r4819 r4847  
    2323
    2424        // No activity to display
    25         if ( empty( $bp->action_variables[0] ) || !is_numeric( $bp->action_variables[0] ) )
     25        if ( !bp_action_variable( 0 ) || !is_numeric( bp_action_variable( 0 ) ) )
    2626                return false;
    2727
    2828        // Get the activity details
    29         $activity = bp_activity_get_specific( array( 'activity_ids' => $bp->action_variables[0], 'show_hidden' => true ) );
     29        $activity = bp_activity_get_specific( array( 'activity_ids' => bp_action_variable( 0 ), 'show_hidden' => true ) );
    3030
    3131        // 404 if activity does not exist
    … …  
    8888                return false;
    8989
    90         if ( empty( $activity_id ) && !empty( $bp->action_variables[0] ) && is_numeric( $bp->action_variables[0] ) )
    91                 $activity_id = (int) $bp->action_variables[0];
     90        if ( empty( $activity_id ) && bp_action_variable( 0 ) )
     91                $activity_id = (int) bp_action_variable( 0 );
    9292
    9393        // Not viewing a specific activity item
    … …  
    212212        check_admin_referer( 'mark_favorite' );
    213213
    214         if ( bp_activity_add_user_favorite( $bp->action_variables[0] ) )
     214        if ( bp_activity_add_user_favorite( bp_action_variable( 0 ) ) )
    215215                bp_core_add_message( __( 'Activity marked as favorite.', 'buddypress' ) );
    216216        else
    217217                bp_core_add_message( __( 'There was an error marking that activity as a favorite, please try again.', 'buddypress' ), 'error' );
    218218
    219         bp_core_redirect( wp_get_referer() . '#activity-' . $bp->action_variables[0] );
     219        bp_core_redirect( wp_get_referer() . '#activity-' . bp_action_variable( 0 ) );
    220220}
    221221add_action( 'bp_actions', 'bp_activity_action_mark_favorite' );
    … …  
    230230        check_admin_referer( 'unmark_favorite' );
    231231
    232         if ( bp_activity_remove_user_favorite( $bp->action_variables[0] ) )
     232        if ( bp_activity_remove_user_favorite( bp_action_variable( 0 ) ) )
    233233                bp_core_add_message( __( 'Activity removed as favorite.', 'buddypress' ) );
    234234        else
    235235                bp_core_add_message( __( 'There was an error removing that activity as a favorite, please try again.', 'buddypress' ), 'error' );
    236236
    237         bp_core_redirect( wp_get_referer() . '#activity-' . $bp->action_variables[0] );
     237        bp_core_redirect( wp_get_referer() . '#activity-' . bp_action_variable( 0 ) );
    238238}
    239239add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
    … …  
    270270        global $bp, $wp_query;
    271271
    272         if ( !bp_is_active( 'friends' ) || !bp_is_current_component( 'activity' ) || !bp_is_user() || !bp_is_current_action( bp_get_friends_slug() ) || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
     272        if ( !bp_is_active( 'friends' ) || !bp_is_current_component( 'activity' ) || !bp_is_user() || !bp_is_current_action( bp_get_friends_slug() ) || !bp_is_action_variable( 'feed', 0 ) )
    273273                return false;
    274274
    … …  
    284284        global $bp, $wp_query;
    285285
    286         if ( !bp_is_active( 'groups' ) || !bp_is_current_component( 'activity' ) || !bp_is_user() || !bp_is_current_action( bp_get_groups_slug() ) || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
     286        if ( !bp_is_active( 'groups' ) || !bp_is_current_component( 'activity' ) || !bp_is_user() || !bp_is_current_action( bp_get_groups_slug() ) || !bp_is_action_variable( 'feed', 0 ) )
    287287                return false;
    288288
    … …  
    298298        global $bp, $wp_query;
    299299
    300         if ( !bp_is_current_component( 'activity' ) || !bp_is_user() || !bp_is_current_action( 'mentions' ) || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
     300        if ( !bp_is_current_component( 'activity' ) || !bp_is_user() || !bp_is_current_action( 'mentions' ) || !bp_is_action_variable( 'feed', 0 ) )
    301301                return false;
    302302
    … …  
    312312        global $bp, $wp_query;
    313313
    314         if ( !bp_is_current_component( 'activity' ) || !bp_is_user() || !bp_is_current_action( 'favorites' ) || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
     314        if ( !bp_is_current_component( 'activity' ) || !bp_is_user() || !bp_is_current_action( 'favorites' ) || !bp_is_action_variable( 'feed', 0 ) )
    315315                return false;
    316316
  • trunk/bp-activity/bp-activity-screens.php

    r4817 r4847  
    9999
    100100        // 404 if activity does not exist
    101         if ( empty( $activity['activities'][0] ) || !empty( $bp->action_variables ) ) {
     101        if ( empty( $activity['activities'][0] ) || bp_action_variables() ) {
    102102                bp_do_404();
    103103                return;
  • trunk/bp-activity/bp-activity-template.php

    r4819 r4847  
    275275                $scope = $bp->active_components[$bp->current_action];
    276276        else
    277                 $scope = $bp->current_action;
     277                $scope = bp_current_action();
    278278
    279279        // Support for permalinks on single item pages: /groups/my-group/activity/124/
    280280        if ( bp_is_current_action( bp_get_activity_slug() ) )
    281                 $include = $bp->action_variables[0];
    282 
     281                $include = bp_action_variable( 0 );
     282               
    283283        // Note: any params used for filtering can be a single value, or multiple values comma separated.
    284284        $defaults = array(
  • trunk/bp-core/bp-core-template.php

    r4844 r4847  
    11551155
    11561156function bp_is_group_forum_topic() {
    1157         global $bp;
    1158 
    1159         if ( bp_is_single_item() && bp_is_groups_component() && bp_is_current_action( 'forum' ) && isset( $bp->action_variables[0] ) && 'topic' == $bp->action_variables[0] )
     1157        if ( bp_is_single_item() && bp_is_groups_component() && bp_is_current_action( 'forum' ) && bp_is_action_variable( 'topic', 0 ) )
    11601158                return true;
    11611159
    … …  
    11661164        global $bp;
    11671165
    1168         if ( bp_is_single_item() && bp_is_groups_component() && bp_is_current_action( 'forum' ) && isset( $bp->action_variables[0] ) && 'topic' == $bp->action_variables[0] && isset( $bp->action_variables[2] ) && 'edit' == $bp->action_variables[2] )
     1166        if ( bp_is_single_item() && bp_is_groups_component() && bp_is_current_action( 'forum' ) && bp_is_action_variable( 'topic', 0 ) && bp_is_action_variable( 'edit', 2 ) )
    11691167                return true;
    11701168
Note: See TracChangeset for help on using the changeset viewer.