Changeset 7347
- Timestamp:
- 08/12/2013 10:30:52 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-loader.php
r7277 r7347 53 53 // Load Akismet support if Akismet is configured 54 54 $akismet_key = bp_get_option( 'wordpress_api_key' ); 55 if ( defined( 'AKISMET_VERSION' ) && ( !empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) && apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) 55 if ( defined( 'AKISMET_VERSION' ) && ( !empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) && apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) { 56 56 $includes[] = 'akismet'; 57 58 if ( is_admin() ) 57 } 58 59 if ( is_admin() ) { 59 60 $includes[] = 'admin'; 61 } 60 62 61 63 parent::includes( $includes ); … … 69 71 * 70 72 * @since BuddyPress (1.5) 71 *72 * @global object $bp BuddyPress global settings73 73 */ 74 74 public function setup_globals( $args = array() ) { 75 global $bp;75 $bp = buddypress(); 76 76 77 77 // Define a slug, if necessary … … 87 87 // All globals for activity component. 88 88 // Note that global_tables is included in this array. 89 $ globals = array(89 $args = array( 90 90 'slug' => BP_ACTIVITY_SLUG, 91 91 'root_slug' => isset( $bp->pages->activity->slug ) ? $bp->pages->activity->slug : BP_ACTIVITY_SLUG, … … 96 96 ); 97 97 98 parent::setup_globals( $ globals );98 parent::setup_globals( $args ); 99 99 } 100 100 … … 111 111 */ 112 112 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 113 114 $sub_nav = array();115 113 116 114 // Add 'Activity' to the main navigation … … 218 216 */ 219 217 public function setup_admin_bar( $wp_admin_nav = array() ) { 220 global $bp; 221 222 // Prevent debug notices 223 $wp_admin_nav = array(); 218 $bp = buddypress(); 224 219 225 220 // Menus for logged in user … … 309 304 */ 310 305 function setup_title() { 311 global $bp;306 $bp = buddypress(); 312 307 313 308 // Adjust title based on view … … 342 337 343 338 function bp_setup_activity() { 344 global $bp; 345 346 $bp->activity = new BP_Activity_Component(); 339 buddypress()->activity = new BP_Activity_Component(); 347 340 } 348 341 add_action( 'bp_setup_components', 'bp_setup_activity', 6 ); -
trunk/bp-blogs/bp-blogs-loader.php
r7277 r7347 35 35 * 36 36 * @since BuddyPress (1.5) 37 * @global BuddyPress $bp The one true BuddyPress instance38 37 */ 39 38 public function setup_globals( $args = array() ) { 40 global $bp;39 $bp = buddypress(); 41 40 42 41 if ( !defined( 'BP_BLOGS_SLUG' ) ) … … 51 50 // All globals for messaging component. 52 51 // Note that global_tables is included in this array. 53 $ globals = array(52 $args = array( 54 53 'slug' => BP_BLOGS_SLUG, 55 54 'root_slug' => isset( $bp->pages->blogs->slug ) ? $bp->pages->blogs->slug : BP_BLOGS_SLUG, … … 62 61 63 62 // Setup the globals 64 parent::setup_globals( $ globals );63 parent::setup_globals( $args ); 65 64 } 66 65 … … 91 90 /** 92 91 * Setup BuddyBar navigation 93 *94 * @global BuddyPress $bp The one true BuddyPress instance95 92 */ 96 93 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 97 global $bp;94 $bp = buddypress(); 98 95 99 96 /** … … 104 101 if ( !is_multisite() ) 105 102 return false; 106 107 $sub_nav = array();108 103 109 104 // Add 'Sites' to the main navigation … … 147 142 */ 148 143 public function setup_admin_bar( $wp_admin_nav = array() ) { 149 global $bp;144 $bp = buddypress(); 150 145 151 146 /** … … 156 151 if ( !is_multisite() ) 157 152 return false; 158 159 // Prevent debug notices160 $wp_admin_nav = array();161 153 162 154 // Menus for logged in user … … 197 189 /** 198 190 * Sets up the title for pages and <title> 199 *200 * @global BuddyPress $bp The one true BuddyPress instance201 191 */ 202 192 function setup_title() { 203 global $bp;193 $bp = buddypress(); 204 194 205 195 // Set up the component options navigation for Blog … … 227 217 228 218 function bp_setup_blogs() { 229 global $bp; 230 $bp->blogs = new BP_Blogs_Component(); 219 buddypress()->blogs = new BP_Blogs_Component(); 231 220 } 232 221 add_action( 'bp_setup_components', 'bp_setup_blogs', 6 ); -
trunk/bp-core/bp-core-loader.php
r7277 r7347 39 39 * 40 40 * @since BuddyPress (1.5) 41 *42 * @global BuddyPress $bp43 41 */ 44 42 private function bootstrap() { 45 global $bp;43 $bp = buddypress(); 46 44 47 45 /** … … 128 126 * 129 127 * @since BuddyPress (1.5) 130 *131 * @global BuddyPress $bp132 128 */ 133 129 public function setup_globals( $args = array() ) { 134 global $bp;130 $bp = buddypress(); 135 131 136 132 /** Database **********************************************************/ … … 192 188 * 193 189 * @since BuddyPress (1.5) 194 *195 * @global BuddyPress $bp196 190 */ 197 191 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 198 global $bp;192 $bp = buddypress(); 199 193 200 194 // If xprofile component is disabled, revert to WordPress profile 201 195 if ( !bp_is_active( 'xprofile' ) ) { 202 203 // Define local variable204 $sub_nav = array();205 196 206 197 // Fallback values if xprofile is disabled … … 244 235 */ 245 236 function bp_setup_core() { 246 global $bp; 247 $bp->core = new BP_Core(); 237 buddypress()->core = new BP_Core(); 248 238 } 249 239 add_action( 'bp_setup_components', 'bp_setup_core', 2 ); -
trunk/bp-forums/bp-forums-loader.php
r7277 r7347 156 156 */ 157 157 public function setup_admin_bar( $wp_admin_nav = array() ) { 158 159 // Prevent debug notices160 $wp_admin_nav = array();161 158 162 159 // Menus for logged in user -
trunk/bp-friends/bp-friends-loader.php
r7277 r7347 31 31 */ 32 32 public function includes( $includes = array() ) { 33 // Files to include34 33 $includes = array( 35 34 'actions', … … 53 52 * 54 53 * @since BuddyPress (1.5) 55 * @global BuddyPress $bp The one true BuddyPress instance56 54 */ 57 55 public function setup_globals( $args = array() ) { 58 global $bp;56 $bp = buddypress(); 59 57 60 58 define ( 'BP_FRIENDS_DB_VERSION', '1800' ); … … 72 70 // All globals for the friends component. 73 71 // Note that global_tables is included in this array. 74 $ globals = array(72 $args = array( 75 73 'slug' => BP_FRIENDS_SLUG, 76 74 'has_directory' => false, … … 80 78 ); 81 79 82 parent::setup_globals( $ globals );80 parent::setup_globals( $args ); 83 81 } 84 82 85 83 /** 86 84 * Setup BuddyBar navigation 87 *88 * @global BuddyPress $bp The one true BuddyPress instance89 85 */ 90 86 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 91 global $bp; 92 93 $sub_nav = array(); 87 $bp = buddypress(); 94 88 95 89 // Add 'Friends' to the main navigation … … 140 134 /** 141 135 * Set up the Toolbar 142 *143 * @global BuddyPress $bp The one true BuddyPress instance144 136 */ 145 137 public function setup_admin_bar( $wp_admin_nav = array() ) { 146 global $bp; 147 148 // Prevent debug notices 149 $wp_admin_nav = array(); 138 $bp = buddypress(); 150 139 151 140 // Menus for logged in user … … 196 185 /** 197 186 * Sets up the title for pages and <title> 198 *199 * @global BuddyPress $bp The one true BuddyPress instance200 187 */ 201 188 function setup_title() { 202 global $bp;189 $bp = buddypress(); 203 190 204 191 // Adjust title … … 221 208 222 209 function bp_setup_friends() { 223 global $bp; 224 $bp->friends = new BP_Friends_Component(); 210 buddypress()->friends = new BP_Friends_Component(); 225 211 } 226 212 add_action( 'bp_setup_components', 'bp_setup_friends', 6 ); -
trunk/bp-groups/bp-groups-loader.php
r7277 r7347 119 119 * 120 120 * @since BuddyPress (1.5) 121 * @global BuddyPress $bp The one true BuddyPress instance122 121 */ 123 122 public function setup_globals( $args = array() ) { 124 global $bp;123 $bp = buddypress(); 125 124 126 125 // Define a slug, if necessary … … 137 136 // All globals for groups component. 138 137 // Note that global_tables is included in this array. 139 $ globals = array(138 $args = array( 140 139 'slug' => BP_GROUPS_SLUG, 141 140 'root_slug' => isset( $bp->pages->groups->slug ) ? $bp->pages->groups->slug : BP_GROUPS_SLUG, … … 146 145 ); 147 146 148 parent::setup_globals( $ globals );147 parent::setup_globals( $args ); 149 148 150 149 /** Single Group Globals **********************************************/ … … 339 338 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 340 339 341 // Define local variables342 $sub_nav = array();343 344 340 // Add 'Groups' to the main navigation 345 341 $main_nav = array( … … 489 485 } 490 486 491 if ( isset( $this->current_group->user_has_access ) ) 487 if ( isset( $this->current_group->user_has_access ) ) { 492 488 do_action( 'groups_setup_nav', $this->current_group->user_has_access ); 493 else489 } else { 494 490 do_action( 'groups_setup_nav'); 491 } 495 492 } 496 493 497 494 /** 498 495 * Set up the Toolbar 499 *500 * @global BuddyPress $bp The one true BuddyPress instance501 496 */ 502 497 public function setup_admin_bar( $wp_admin_nav = array() ) { 503 global $bp; 504 505 // Prevent debug notices 506 $wp_admin_nav = array(); 498 $bp = buddypress(); 507 499 508 500 // Menus for logged in user … … 563 555 /** 564 556 * Sets up the title for pages and <title> 565 *566 * @global BuddyPress $bp The one true BuddyPress instance567 557 */ 568 558 function setup_title() { 569 global $bp;559 $bp = buddypress(); 570 560 571 561 if ( bp_is_groups_component() ) { 572 562 573 563 if ( bp_is_my_profile() && !bp_is_single_item() ) { 574 575 564 $bp->bp_options_title = __( 'Memberships', 'buddypress' ); 576 565 577 566 } else if ( !bp_is_my_profile() && !bp_is_single_item() ) { 578 579 567 $bp->bp_options_avatar = bp_core_fetch_avatar( array( 580 568 'item_id' => bp_displayed_user_id(), … … 595 583 'alt' => __( 'Group Avatar', 'buddypress' ) 596 584 ) ); 585 597 586 if ( empty( $bp->bp_options_avatar ) ) { 598 $bp->bp_options_avatar = '<img src="' . esc_attr( $group->avatar_full ) . '" class="avatar" alt="' . esc_attr( $group->name ) . '" />';587 $bp->bp_options_avatar = bp_group_current_avatar(); 599 588 } 600 589 } … … 607 596 608 597 function bp_setup_groups() { 609 global $bp; 610 611 $bp->groups = new BP_Groups_Component(); 598 buddypress()->groups = new BP_Groups_Component(); 612 599 } 613 600 add_action( 'bp_setup_components', 'bp_setup_groups', 6 ); -
trunk/bp-members/bp-members-loader.php
r7277 r7347 53 53 * 54 54 * @since BuddyPress (1.5) 55 * @global BuddyPress $bp The one true BuddyPress instance56 55 */ 57 56 public function setup_globals( $args = array() ) { 58 global $bp;57 $bp = buddypress(); 59 58 60 59 // Define a slug, if necessary … … 62 61 define( 'BP_MEMBERS_SLUG', $this->id ); 63 62 64 $globals =array(63 parent::setup_globals( array( 65 64 'slug' => BP_MEMBERS_SLUG, 66 65 'root_slug' => isset( $bp->pages->members->slug ) ? $bp->pages->members->slug : BP_MEMBERS_SLUG, 67 66 'has_directory' => true, 68 67 'search_string' => __( 'Search Members...', 'buddypress' ), 69 ); 70 71 parent::setup_globals( $globals ); 68 ) ); 72 69 73 70 /** Logged in user ****************************************************/ … … 105 102 106 103 /** Default Profile Component *****************************************/ 104 107 105 if ( !defined( 'BP_DEFAULT_COMPONENT' ) ) { 108 if ( bp_is_active( 'activity' ) && isset( $bp->pages->activity ) ) 106 if ( bp_is_active( 'activity' ) && isset( $bp->pages->activity ) ) { 109 107 $bp->default_component = bp_get_activity_slug(); 110 else 111 $bp->default_component = ( 'xprofile' == $bp->profile->id ) ? 'profile' : $bp->profile->id; 108 } else { 109 $bp->default_component = ( 'xprofile' === $bp->profile->id ) ? 'profile' : $bp->profile->id; 110 } 112 111 113 112 } else { … … 141 140 /** 142 141 * Setup BuddyBar navigation 143 *144 * @global BuddyPress $bp The one true BuddyPress instance145 142 */ 146 143 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 147 global $bp;144 $bp = buddypress(); 148 145 149 146 // Add 'Profile' to the main navigation … … 151 148 152 149 // Don't set up navigation if there's no user 153 if ( !is_user_logged_in() && !bp_is_user() ) 150 if ( !is_user_logged_in() && !bp_is_user() ) { 154 151 return; 155 156 $sub_nav = array(); 152 } 153 157 154 $main_nav = array( 158 155 'name' => __( 'Profile', 'buddypress' ), … … 165 162 166 163 // User links 167 $user_domain 168 $profile_link 164 $user_domain = bp_displayed_user_domain() ? bp_displayed_user_domain() : bp_loggedin_user_domain(); 165 $profile_link = trailingslashit( $user_domain . $bp->profile->slug ); 169 166 170 167 // Add the subnav items to the profile … … 188 185 */ 189 186 function setup_title() { 190 global $bp;187 $bp = buddypress(); 191 188 192 189 if ( bp_is_my_profile() ) { … … 206 203 207 204 function bp_setup_members() { 208 global $bp; 209 $bp->members = new BP_Members_Component(); 205 buddypress()->members = new BP_Members_Component(); 210 206 } 211 207 add_action( 'bp_setup_components', 'bp_setup_members', 1 ); -
trunk/bp-messages/bp-messages-loader.php
r7277 r7347 40 40 */ 41 41 public function includes( $includes = array() ) { 42 42 43 // Files to include 43 44 $includes = array( … … 63 64 * 64 65 * @since BuddyPress (1.5) 65 * @global BuddyPress $bp The one true BuddyPress instance66 66 */ 67 67 public function setup_globals( $args = array() ) { 68 global $bp;68 $bp = buddypress(); 69 69 70 70 // Define a slug, if necessary … … 96 96 /** 97 97 * Setup BuddyBar navigation 98 *99 * @global BuddyPress $bp The one true BuddyPress instance100 98 */ 101 99 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 102 100 103 $sub_nav = array(); 104 $name = sprintf( __( 'Messages <span>%s</span>', 'buddypress' ), bp_get_total_unread_messages_count() ); 101 $name = sprintf( __( 'Messages <span>%s</span>', 'buddypress' ), bp_get_total_unread_messages_count() ); 105 102 106 103 // Add 'Messages' to the main navigation … … 175 172 /** 176 173 * Set up the Toolbar 177 *178 * @global BuddyPress $bp The one true BuddyPress instance179 174 */ 180 175 public function setup_admin_bar( $wp_admin_nav = array() ) { 181 global $bp; 182 183 // Prevent debug notices 184 $wp_admin_nav = array(); 176 $bp = buddypress(); 185 177 186 178 // Menus for logged in user … … 249 241 /** 250 242 * Sets up the title for pages and <title> 251 *252 * @global BuddyPress $bp The one true BuddyPress instance253 243 */ 254 244 function setup_title() { 255 global $bp;245 $bp = buddypress(); 256 246 257 247 if ( bp_is_messages_component() ) { … … 273 263 274 264 function bp_setup_messages() { 275 global $bp; 276 $bp->messages = new BP_Messages_Component(); 265 buddypress()->messages = new BP_Messages_Component(); 277 266 } 278 267 add_action( 'bp_setup_components', 'bp_setup_messages', 6 ); -
trunk/bp-settings/bp-settings-loader.php
r7289 r7347 65 65 */ 66 66 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 67 68 // Define local variable69 $sub_nav = array();70 67 71 68 // Add the settings navigation item … … 149 146 $bp = buddypress(); 150 147 151 // Prevent debug notices152 $wp_admin_nav = array();153 154 148 // Menus for logged in user 155 149 if ( is_user_logged_in() ) { -
trunk/bp-templates/bp-legacy/buddypress-functions.php
r7228 r7347 773 773 * AJAX spam an activity item or comment 774 774 * 775 * @global BuddyPress $bp The one true BuddyPress instance776 775 * @return mixed String on error, void on success 777 776 * @since BuddyPress (1.6) 778 777 */ 779 778 function bp_legacy_theme_spam_activity() { 780 global $bp;779 $bp = buddypress(); 781 780 782 781 // Bail if not a POST action … … 1240 1239 * AJAX handler for autocomplete. Displays friends only, unless BP_MESSAGES_AUTOCOMPLETE_ALL is defined. 1241 1240 * 1242 * @global BuddyPress $bp The one true BuddyPress instance1243 1241 * @return string HTML 1244 1242 * @since BuddyPress (1.2) -
trunk/bp-xprofile/bp-xprofile-loader.php
r7277 r7347 75 75 * 76 76 * @since BuddyPress (1.5) 77 * @global BuddyPress $bp The one true BuddyPress instance78 77 */ 79 78 public function setup_globals( $args = array() ) { 80 global $bp;79 $bp = buddypress(); 81 80 82 81 // Define a slug, if necessary … … 208 207 /** 209 208 * Set up the Toolbar 210 *211 * @global BuddyPress $bp The one true BuddyPress instance212 209 */ 213 210 public function setup_admin_bar( $wp_admin_nav = array() ) { 214 global $bp;211 $bp = buddypress(); 215 212 216 213 // Prevent debug notices … … 262 259 /** 263 260 * Sets up the title for pages and <title> 264 *265 * @global BuddyPress $bp The one true BuddyPress instance266 261 */ 267 262 function setup_title() { 268 global $bp;263 $bp = buddypress(); 269 264 270 265 if ( bp_is_profile_component() ) { … … 286 281 287 282 function bp_setup_xprofile() { 288 global $bp;283 $bp = buddypress(); 289 284 290 285 if ( !isset( $bp->profile->id ) )
Note: See TracChangeset
for help on using the changeset viewer.