Ticket #8198: 8198-1.diff
File 8198-1.diff, 28.3 KB (added by , 4 years ago) |
---|
-
src/class-buddypress.php
diff --git src/class-buddypress.php src/class-buddypress.php index 2fad19aa1..e8f2a9797 100644
1 1 <?php 2 /** 3 * Main BuddyPress Class. 4 * 5 * @package BuddyPress 6 * @subpackage Main 7 * @since 1.6.0 8 */ 2 9 3 10 // Exit if accessed directly. 4 11 defined( 'ABSPATH' ) || exit; … … class BuddyPress { 30 37 /** Not Magic *************************************************************/ 31 38 32 39 /** 40 * Primary BuddyPress navigation. 41 * 33 42 * @var array Primary BuddyPress navigation. 34 43 */ 35 44 public $bp_nav = array(); 36 45 37 46 /** 47 * Options for the BuddyPress navigation. 48 * 38 49 * @var array Secondary BuddyPress navigation to $bp_nav. 39 50 */ 40 51 public $bp_options_nav = array(); 41 52 42 53 /** 43 * @var array The unfiltered URI broken down into chunks. 54 * Unfiltered URI. 55 * 44 56 * @see bp_core_set_uri_globals() 57 * @var array The unfiltered URI broken down into chunks. 45 58 */ 46 59 public $unfiltered_uri = array(); 47 60 48 61 /** 49 * @var array The canonical URI stack. 62 * Canonical stack. 63 * 50 64 * @see bp_redirect_canonical() 51 65 * @see bp_core_new_nav_item() 66 * @var array The canonical URI stack. 52 67 */ 53 68 public $canonical_stack = array(); 54 69 55 70 /** 71 * Current action variables. 72 * 56 73 * @var array Additional navigation elements (supplemental). 57 74 */ 58 75 public $action_variables = array(); 59 76 60 77 /** 78 * Current member type. 79 * 61 80 * @var string Current member directory type. 62 81 */ 63 82 public $current_member_type = ''; 64 83 65 84 /** 85 * BuddyPress required components. 86 * 66 87 * @var array Required components (core, members). 67 88 */ 68 89 public $required_components = array(); 69 90 70 91 /** 92 * BuddyPress loaded components. 93 * 71 94 * @var array Additional active components. 72 95 */ 73 96 public $loaded_components = array(); 74 97 75 98 /** 99 * BuddyPress active components. 100 * 76 101 * @var array Active components. 77 102 */ 78 103 public $active_components = array(); … … class BuddyPress { 81 106 * Whether autoload is in use. 82 107 * 83 108 * @since 2.5.0 109 * 84 110 * @var bool 85 111 */ 86 112 public $do_autoload = true; … … class BuddyPress { 88 114 /** Option Overload *******************************************************/ 89 115 90 116 /** 117 * BuddyPress options. 118 * 91 119 * @var array Optional Overloads default options retrieved from get_option(). 92 120 */ 93 121 public $options = array(); … … class BuddyPress { 118 146 119 147 // Only run these methods if they haven't been run previously. 120 148 if ( null === $instance ) { 121 $instance = new BuddyPress ;149 $instance = new BuddyPress(); 122 150 $instance->constants(); 123 151 $instance->setup_globals(); 124 152 $instance->legacy_constants(); … … class BuddyPress { 138 166 * A dummy constructor to prevent BuddyPress from being loaded more than once. 139 167 * 140 168 * @since 1.7.0 169 * 141 170 * @see BuddyPress::instance() 142 171 * @see buddypress() 143 172 */ 144 private function __construct() { /* Do nothing here */ } 173 private function __construct() { 174 /* Do nothing here */ 175 } 145 176 146 177 /** 147 178 * A dummy magic method to prevent BuddyPress from being cloned. 148 179 * 149 180 * @since 1.7.0 150 181 */ 151 public function __clone() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'buddypress' ), '1.7' ); } 182 public function __clone() { 183 _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'buddypress' ), '1.7' ); 184 } 152 185 153 186 /** 154 187 * A dummy magic method to prevent BuddyPress from being unserialized. 155 188 * 156 189 * @since 1.7.0 157 190 */ 158 public function __wakeup() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'buddypress' ), '1.7' ); } 191 public function __wakeup() { 192 _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'buddypress' ), '1.7' ); 193 } 159 194 160 195 /** 161 196 * Magic method for checking the existence of a certain custom field. … … class BuddyPress { 166 201 * 167 202 * @return bool 168 203 */ 169 public function __isset( $key ) { return isset( $this->data[$key] ); } 204 public function __isset( $key ) { 205 return isset( $this->data[ $key ] ); 206 } 170 207 171 208 /** 172 209 * Magic method for getting BuddyPress variables. … … class BuddyPress { 177 214 * 178 215 * @return mixed 179 216 */ 180 public function __get( $key ) { return isset( $this->data[$key] ) ? $this->data[$key] : null; } 217 public function __get( $key ) { 218 return isset( $this->data[ $key ] ) ? $this->data[ $key ] : null; 219 } 181 220 182 221 /** 183 222 * Magic method for setting BuddyPress variables. … … class BuddyPress { 187 226 * @param string $key Key to set a value for. 188 227 * @param mixed $value Value to set. 189 228 */ 190 public function __set( $key, $value ) { $this->data[$key] = $value; } 229 public function __set( $key, $value ) { 230 $this->data[ $key ] = $value; 231 } 191 232 192 233 /** 193 234 * Magic method for unsetting BuddyPress variables. … … class BuddyPress { 196 237 * 197 238 * @param string $key Key to unset a value for. 198 239 */ 199 public function __unset( $key ) { if ( isset( $this->data[$key] ) ) unset( $this->data[$key] ); } 240 public function __unset( $key ) { 241 if ( isset( $this->data[ $key ] ) ) { 242 unset( $this->data[ $key ] ); 243 } 244 } 200 245 201 246 /** 202 247 * Magic method to prevent notices and errors from invalid method calls. … … class BuddyPress { 208 253 * 209 254 * @return null 210 255 */ 211 public function __call( $name = '', $args = array() ) { unset( $name, $args ); return null; } 256 public function __call( $name = '', $args = array() ) { 257 unset( $name, $args ); 258 259 return null; 260 } 212 261 213 262 /** Private Methods *******************************************************/ 214 263 … … class BuddyPress { 216 265 * Bootstrap constants. 217 266 * 218 267 * @since 1.6.0 219 *220 268 */ 221 269 private function constants() { 222 270 223 271 // Place your custom code (actions/filters) in a file called 224 272 // '/plugins/bp-custom.php' and it will be loaded before anything else. 225 273 if ( file_exists( WP_PLUGIN_DIR . '/bp-custom.php' ) ) { 226 require ( WP_PLUGIN_DIR . '/bp-custom.php' );274 require WP_PLUGIN_DIR . '/bp-custom.php'; 227 275 } 228 276 229 277 // Path and URL. … … class BuddyPress { 267 315 // /wp-admin/includes/plugin.php file in order to use that function. 268 316 269 317 // Get network-activated plugins. 270 $plugins = get_site_option( 'active_sitewide_plugins' );318 $plugins = get_site_option( 'active_sitewide_plugins' ); 271 319 272 320 // Basename. 273 321 $basename = basename( constant( 'BP_PLUGIN_DIR' ) ) . '/bp-loader.php'; … … class BuddyPress { 278 326 $root_blog_id = $current_site->blog_id; 279 327 } 280 328 } 281 282 329 } 283 330 284 331 define( 'BP_ROOT_BLOG', $root_blog_id ); … … class BuddyPress { 297 344 * Component global variables. 298 345 * 299 346 * @since 1.6.0 300 *301 347 */ 302 348 private function setup_globals() { 303 349 304 /** Versions * *********************************************************/350 /** Versions */ 305 351 306 352 $this->version = '10.0.0-alpha'; 307 353 $this->db_version = 12850; 308 354 309 /** Loading * **********************************************************/355 /** Loading */ 310 356 311 357 /** 312 358 * Should deprecated code be loaded? … … class BuddyPress { 316 362 */ 317 363 $this->load_deprecated = false; 318 364 319 /** Toolbar * **********************************************************/365 /** Toolbar */ 320 366 321 367 /** 322 368 * @var string The primary toolbar ID. 323 369 */ 324 370 $this->my_account_menu_id = ''; 325 371 326 /** URIs * *************************************************************/372 /** URIs */ 327 373 328 374 /** 329 375 * @var int The current offset of the URI. … … class BuddyPress { 336 382 */ 337 383 $this->no_status_set = false; 338 384 339 /** Components * *******************************************************/385 /** Components */ 340 386 341 387 /** 342 388 * @var string Name of the current BuddyPress component (primary). … … class BuddyPress { 358 404 */ 359 405 $this->is_single_item = false; 360 406 361 /** Root * *************************************************************/407 /** Root */ 362 408 363 409 /** 364 410 * Filters the BuddyPress Root blog ID. … … class BuddyPress { 369 415 */ 370 416 $this->root_blog_id = (int) apply_filters( 'bp_get_root_blog_id', BP_ROOT_BLOG ); 371 417 372 /** Paths **************************************************************/418 /** Paths */ 373 419 374 420 // BuddyPress root directory. 375 $this->file 376 $this->basename 377 $this->plugin_dir 378 $this->plugin_url 421 $this->file = constant( 'BP_PLUGIN_DIR' ) . 'bp-loader.php'; 422 $this->basename = basename( constant( 'BP_PLUGIN_DIR' ) ) . '/bp-loader.php'; 423 $this->plugin_dir = trailingslashit( constant( 'BP_PLUGIN_DIR' ) . constant( 'BP_SOURCE_SUBDIRECTORY' ) ); 424 $this->plugin_url = trailingslashit( constant( 'BP_PLUGIN_URL' ) . constant( 'BP_SOURCE_SUBDIRECTORY' ) ); 379 425 380 426 // Languages. 381 $this->lang_dir 427 $this->lang_dir = $this->plugin_dir . 'bp-languages'; 382 428 383 429 // Templates (theme compatibility). 384 $this->themes_dir 385 $this->themes_url 430 $this->themes_dir = $this->plugin_dir . 'bp-templates'; 431 $this->themes_url = $this->plugin_url . 'bp-templates'; 386 432 387 433 // Themes (for bp-default). 388 434 $this->old_themes_dir = $this->plugin_dir . 'bp-themes'; 389 435 $this->old_themes_url = $this->plugin_url . 'bp-themes'; 390 436 391 /** Theme Compat * *****************************************************/437 /** Theme Compat */ 392 438 393 $this->theme_compat 394 $this->filters 439 $this->theme_compat = new stdClass(); // Base theme compatibility class. 440 $this->filters = new stdClass(); // Used when adding/removing filters. 395 441 396 /** Users * ************************************************************/442 /** Users */ 397 443 398 444 $this->current_user = new stdClass(); 399 445 $this->displayed_user = new stdClass(); 400 446 401 /** Post types and taxonomies * ****************************************/447 /** Post types and taxonomies */ 402 448 403 449 /** 404 450 * Filters the post type slug for the email component. 405 451 * 406 * since 2.5.0452 * @since 2.5.0 407 453 * 408 454 * @param string $value Email post type slug. 409 455 */ 410 $this->email_post_type 456 $this->email_post_type = apply_filters( 'bp_email_post_type', 'bp-email' ); 411 457 412 458 /** 413 459 * Filters the taxonomy slug for the email type component. … … class BuddyPress { 449 495 * Include required files. 450 496 * 451 497 * @since 1.6.0 452 *453 498 */ 454 499 private function includes() { 455 500 spl_autoload_register( array( $this, 'autoload' ) ); 456 501 457 502 // Load the WP abstraction file so BuddyPress can run on all WordPress setups. 458 require ( $this->plugin_dir . 'bp-core/bp-core-wpabstraction.php' );503 require $this->plugin_dir . 'bp-core/bp-core-wpabstraction.php'; 459 504 460 505 // Setup the versions (after we include multisite abstraction above). 461 506 $this->versions(); 462 507 463 /** Update/Install * ***************************************************/508 /** Update/Install */ 464 509 465 510 // Theme compatibility. 466 require ( $this->plugin_dir . 'bp-core/bp-core-template-loader.php' );467 require ( $this->plugin_dir . 'bp-core/bp-core-theme-compatibility.php' );511 require $this->plugin_dir . 'bp-core/bp-core-template-loader.php'; 512 require $this->plugin_dir . 'bp-core/bp-core-theme-compatibility.php'; 468 513 469 514 // Require all of the BuddyPress core libraries. 470 require ( $this->plugin_dir . 'bp-core/bp-core-dependency.php' );471 require ( $this->plugin_dir . 'bp-core/bp-core-actions.php' );472 require ( $this->plugin_dir . 'bp-core/bp-core-caps.php' );473 require ( $this->plugin_dir . 'bp-core/bp-core-cache.php' );474 require ( $this->plugin_dir . 'bp-core/bp-core-cssjs.php' );475 require ( $this->plugin_dir . 'bp-core/bp-core-update.php' );476 require ( $this->plugin_dir . 'bp-core/bp-core-options.php' );477 require ( $this->plugin_dir . 'bp-core/bp-core-taxonomy.php' );478 require ( $this->plugin_dir . 'bp-core/bp-core-filters.php' );479 require ( $this->plugin_dir . 'bp-core/bp-core-attachments.php' );480 require ( $this->plugin_dir . 'bp-core/bp-core-avatars.php' );481 require ( $this->plugin_dir . 'bp-core/bp-core-widgets.php' );482 require ( $this->plugin_dir . 'bp-core/bp-core-template.php' );483 require ( $this->plugin_dir . 'bp-core/bp-core-adminbar.php' );484 require ( $this->plugin_dir . 'bp-core/bp-core-buddybar.php' );485 require ( $this->plugin_dir . 'bp-core/bp-core-catchuri.php' );486 require ( $this->plugin_dir . 'bp-core/bp-core-functions.php' );487 require ( $this->plugin_dir . 'bp-core/bp-core-moderation.php' );488 require ( $this->plugin_dir . 'bp-core/bp-core-loader.php' );489 require ( $this->plugin_dir . 'bp-core/bp-core-customizer-email.php' );490 require ( $this->plugin_dir . 'bp-core/bp-core-rest-api.php' );491 require ( $this->plugin_dir . 'bp-core/bp-core-blocks.php' );515 require $this->plugin_dir . 'bp-core/bp-core-dependency.php'; 516 require $this->plugin_dir . 'bp-core/bp-core-actions.php'; 517 require $this->plugin_dir . 'bp-core/bp-core-caps.php'; 518 require $this->plugin_dir . 'bp-core/bp-core-cache.php'; 519 require $this->plugin_dir . 'bp-core/bp-core-cssjs.php'; 520 require $this->plugin_dir . 'bp-core/bp-core-update.php'; 521 require $this->plugin_dir . 'bp-core/bp-core-options.php'; 522 require $this->plugin_dir . 'bp-core/bp-core-taxonomy.php'; 523 require $this->plugin_dir . 'bp-core/bp-core-filters.php'; 524 require $this->plugin_dir . 'bp-core/bp-core-attachments.php'; 525 require $this->plugin_dir . 'bp-core/bp-core-avatars.php'; 526 require $this->plugin_dir . 'bp-core/bp-core-widgets.php'; 527 require $this->plugin_dir . 'bp-core/bp-core-template.php'; 528 require $this->plugin_dir . 'bp-core/bp-core-adminbar.php'; 529 require $this->plugin_dir . 'bp-core/bp-core-buddybar.php'; 530 require $this->plugin_dir . 'bp-core/bp-core-catchuri.php'; 531 require $this->plugin_dir . 'bp-core/bp-core-functions.php'; 532 require $this->plugin_dir . 'bp-core/bp-core-moderation.php'; 533 require $this->plugin_dir . 'bp-core/bp-core-loader.php'; 534 require $this->plugin_dir . 'bp-core/bp-core-customizer-email.php'; 535 require $this->plugin_dir . 'bp-core/bp-core-rest-api.php'; 536 require $this->plugin_dir . 'bp-core/bp-core-blocks.php'; 492 537 493 538 // Maybe load deprecated functionality (this double negative is proof positive!). 494 539 if ( ! bp_get_option( '_bp_ignore_deprecated_code', ! $this->load_deprecated ) ) { 495 require ( $this->plugin_dir . 'bp-core/deprecated/1.2.php' );496 require ( $this->plugin_dir . 'bp-core/deprecated/1.5.php' );497 require ( $this->plugin_dir . 'bp-core/deprecated/1.6.php' );498 require ( $this->plugin_dir . 'bp-core/deprecated/1.7.php' );499 require ( $this->plugin_dir . 'bp-core/deprecated/1.9.php' );500 require ( $this->plugin_dir . 'bp-core/deprecated/2.0.php' );501 require ( $this->plugin_dir . 'bp-core/deprecated/2.1.php' );502 require ( $this->plugin_dir . 'bp-core/deprecated/2.2.php' );503 require ( $this->plugin_dir . 'bp-core/deprecated/2.3.php' );504 require ( $this->plugin_dir . 'bp-core/deprecated/2.4.php' );505 require ( $this->plugin_dir . 'bp-core/deprecated/2.5.php' );506 require ( $this->plugin_dir . 'bp-core/deprecated/2.6.php' );507 require ( $this->plugin_dir . 'bp-core/deprecated/2.7.php' );508 require ( $this->plugin_dir . 'bp-core/deprecated/2.8.php' );509 require ( $this->plugin_dir . 'bp-core/deprecated/2.9.php' );510 require ( $this->plugin_dir . 'bp-core/deprecated/3.0.php' );511 require ( $this->plugin_dir . 'bp-core/deprecated/4.0.php' );512 require ( $this->plugin_dir . 'bp-core/deprecated/6.0.php' );513 require ( $this->plugin_dir . 'bp-core/deprecated/7.0.php' );514 require ( $this->plugin_dir . 'bp-core/deprecated/8.0.php' );515 require ( $this->plugin_dir . 'bp-core/deprecated/9.0.php' );540 require $this->plugin_dir . 'bp-core/deprecated/1.2.php'; 541 require $this->plugin_dir . 'bp-core/deprecated/1.5.php'; 542 require $this->plugin_dir . 'bp-core/deprecated/1.6.php'; 543 require $this->plugin_dir . 'bp-core/deprecated/1.7.php'; 544 require $this->plugin_dir . 'bp-core/deprecated/1.9.php'; 545 require $this->plugin_dir . 'bp-core/deprecated/2.0.php'; 546 require $this->plugin_dir . 'bp-core/deprecated/2.1.php'; 547 require $this->plugin_dir . 'bp-core/deprecated/2.2.php'; 548 require $this->plugin_dir . 'bp-core/deprecated/2.3.php'; 549 require $this->plugin_dir . 'bp-core/deprecated/2.4.php'; 550 require $this->plugin_dir . 'bp-core/deprecated/2.5.php'; 551 require $this->plugin_dir . 'bp-core/deprecated/2.6.php'; 552 require $this->plugin_dir . 'bp-core/deprecated/2.7.php'; 553 require $this->plugin_dir . 'bp-core/deprecated/2.8.php'; 554 require $this->plugin_dir . 'bp-core/deprecated/2.9.php'; 555 require $this->plugin_dir . 'bp-core/deprecated/3.0.php'; 556 require $this->plugin_dir . 'bp-core/deprecated/4.0.php'; 557 require $this->plugin_dir . 'bp-core/deprecated/6.0.php'; 558 require $this->plugin_dir . 'bp-core/deprecated/7.0.php'; 559 require $this->plugin_dir . 'bp-core/deprecated/8.0.php'; 560 require $this->plugin_dir . 'bp-core/deprecated/9.0.php'; 516 561 } 517 562 518 563 // Load wp-cli module if PHP 5.6+. … … class BuddyPress { 521 566 && ! class_exists( 'Buddypress\CLI\Command\BuddypressCommand' ) 522 567 && file_exists( $this->plugin_dir . 'cli/wp-cli-bp.php' ) 523 568 && version_compare( phpversion(), '5.6.0', '>=' ) ) { 524 require ( $this->plugin_dir . 'cli/wp-cli-bp.php' );569 require $this->plugin_dir . 'cli/wp-cli-bp.php'; 525 570 } 526 571 } 527 572 … … class BuddyPress { 530 575 * 531 576 * @since 2.5.0 532 577 * 533 * @param string $class 578 * @param string $class Classes to be autoloaded. 579 * @return string Path of a class. 534 580 */ 535 581 public function autoload( $class ) { 536 582 $class_parts = explode( '_', strtolower( $class ) ); … … class BuddyPress { 554 600 555 601 // These classes don't have a name that matches their component. 556 602 $irregular_map = array( 557 'BP_Akismet' => 'activity',558 'BP_REST_Activity_Endpoint' => 'activity',559 560 'BP_REST_Blogs_Endpoint' => 'blogs',561 'BP_REST_Attachments_Blog_Avatar_Endpoint' => 'blogs',562 563 'BP_Admin' => 'core',564 'BP_Attachment_Avatar' => 'core',565 'BP_Attachment_Cover_Image' => 'core',566 'BP_Attachment' => 'core',567 'BP_Button' => 'core',568 'BP_Block' => 'core',569 'BP_Component' => 'core',570 'BP_Customizer_Control_Range' => 'core',571 'BP_Date_Query' => 'core',572 'BP_Email_Delivery' => 'core',573 'BP_Email_Address' => 'core',574 'BP_Email_Recipient' => 'core',575 'BP_Email_Sender' => 'core',576 'BP_Email_Participant' => 'core',577 'BP_Email' => 'core',578 'BP_Embed' => 'core',579 'BP_Media_Extractor' => 'core',580 'BP_Members_Suggestions' => 'core',581 'BP_PHPMailer' => 'core',582 'BP_Recursive_Query' => 'core',583 'BP_Suggestions' => 'core',584 'BP_Theme_Compat' => 'core',585 'BP_User_Query' => 'core',586 'BP_Walker_Category_Checklist' => 'core',603 'BP_Akismet' => 'activity', 604 'BP_REST_Activity_Endpoint' => 'activity', 605 606 'BP_REST_Blogs_Endpoint' => 'blogs', 607 'BP_REST_Attachments_Blog_Avatar_Endpoint' => 'blogs', 608 609 'BP_Admin' => 'core', 610 'BP_Attachment_Avatar' => 'core', 611 'BP_Attachment_Cover_Image' => 'core', 612 'BP_Attachment' => 'core', 613 'BP_Button' => 'core', 614 'BP_Block' => 'core', 615 'BP_Component' => 'core', 616 'BP_Customizer_Control_Range' => 'core', 617 'BP_Date_Query' => 'core', 618 'BP_Email_Delivery' => 'core', 619 'BP_Email_Address' => 'core', 620 'BP_Email_Recipient' => 'core', 621 'BP_Email_Sender' => 'core', 622 'BP_Email_Participant' => 'core', 623 'BP_Email' => 'core', 624 'BP_Embed' => 'core', 625 'BP_Media_Extractor' => 'core', 626 'BP_Members_Suggestions' => 'core', 627 'BP_PHPMailer' => 'core', 628 'BP_Recursive_Query' => 'core', 629 'BP_Suggestions' => 'core', 630 'BP_Theme_Compat' => 'core', 631 'BP_User_Query' => 'core', 632 'BP_Walker_Category_Checklist' => 'core', 587 633 /** 588 634 * BP_Walker_Nav_Menu_Checklist class. 589 635 * … … class BuddyPress { 592 638 * 593 639 * @todo Remove the BP_Walker_Nav_Menu_Checklist from our Classes Autoloader. 594 640 */ 595 'BP_Walker_Nav_Menu_Checklist' => 'core',596 'BP_Walker_Nav_Menu' => 'core',597 'BP_Invitation_Manager' => 'core',598 'BP_Invitation' => 'core',599 'BP_REST_Components_Endpoint' => 'core',600 'BP_REST_Attachments' => 'core',601 'BP_Admin_Types' => 'core',602 'BP_Optout' => 'core',603 'BP_Optouts_List_Table' => 'core',604 605 'BP_Core_Friends_Widget' => 'friends',606 'BP_REST_Friends_Endpoint' => 'friends',607 608 'BP_Group_Extension' => 'groups',609 'BP_Group_Member_Query' => 'groups',610 'BP_REST_Groups_Endpoint' => 'groups',611 'BP_REST_Group_Membership_Endpoint' => 'groups',612 'BP_REST_Group_Invites_Endpoint' => 'groups',613 'BP_REST_Group_Membership_Request_Endpoint' => 'groups',614 'BP_REST_Attachments_Group_Avatar_Endpoint' => 'groups',615 'BP_REST_Attachments_Group_Cover_Endpoint' => 'groups',641 'BP_Walker_Nav_Menu_Checklist' => 'core', 642 'BP_Walker_Nav_Menu' => 'core', 643 'BP_Invitation_Manager' => 'core', 644 'BP_Invitation' => 'core', 645 'BP_REST_Components_Endpoint' => 'core', 646 'BP_REST_Attachments' => 'core', 647 'BP_Admin_Types' => 'core', 648 'BP_Optout' => 'core', 649 'BP_Optouts_List_Table' => 'core', 650 651 'BP_Core_Friends_Widget' => 'friends', 652 'BP_REST_Friends_Endpoint' => 'friends', 653 654 'BP_Group_Extension' => 'groups', 655 'BP_Group_Member_Query' => 'groups', 656 'BP_REST_Groups_Endpoint' => 'groups', 657 'BP_REST_Group_Membership_Endpoint' => 'groups', 658 'BP_REST_Group_Invites_Endpoint' => 'groups', 659 'BP_REST_Group_Membership_Request_Endpoint' => 'groups', 660 'BP_REST_Attachments_Group_Avatar_Endpoint' => 'groups', 661 'BP_REST_Attachments_Group_Cover_Endpoint' => 'groups', 616 662 617 663 'BP_Core_Members_Template' => 'members', 618 664 'BP_Core_Members_Widget' => 'members', … … class BuddyPress { 627 673 'BP_Members_Invitation_Manager' => 'members', 628 674 'BP_Members_Invitations_Template' => 'members', 629 675 630 'BP_REST_Messages_Endpoint' => 'messages',676 'BP_REST_Messages_Endpoint' => 'messages', 631 677 632 'BP_REST_Notifications_Endpoint' => 'notifications',678 'BP_REST_Notifications_Endpoint' => 'notifications', 633 679 634 'BP_REST_XProfile_Fields_Endpoint' => 'xprofile',635 'BP_REST_XProfile_Field_Groups_Endpoint' => 'xprofile',636 'BP_REST_XProfile_Data_Endpoint' => 'xprofile',680 'BP_REST_XProfile_Fields_Endpoint' => 'xprofile', 681 'BP_REST_XProfile_Field_Groups_Endpoint' => 'xprofile', 682 'BP_REST_XProfile_Data_Endpoint' => 'xprofile', 637 683 ); 638 684 639 685 $component = null; … … class BuddyPress { 684 730 * Set up the default hooks and actions. 685 731 * 686 732 * @since 1.6.0 687 *688 733 */ 689 734 private function setup_actions() { 690 735 691 736 // Add actions to plugin activation and deactivation hooks. 692 add_action( 'activate_' . $this->basename, 'bp_activation');737 add_action( 'activate_' . $this->basename, 'bp_activation' ); 693 738 add_action( 'deactivate_' . $this->basename, 'bp_deactivation' ); 694 739 695 740 // If BuddyPress is being deactivated, do not add any actions. … … class BuddyPress { 697 742 return; 698 743 } 699 744 700 // Array of BuddyPress core actions 745 // Array of BuddyPress core actions. 701 746 $actions = array( 702 747 'setup_theme', // Setup the default theme compat. 703 748 'setup_current_user', // Setup currently logged in user. … … class BuddyPress { 709 754 'register_theme_packages', // Register bundled theme packages (bp-themes). 710 755 'load_textdomain', // Load textdomain. 711 756 'add_rewrite_tags', // Add rewrite tags. 712 'generate_rewrite_rules' // Generate rewrite rules.757 'generate_rewrite_rules', // Generate rewrite rules. 713 758 ); 714 759 715 760 // Add the actions. 716 foreach ( $actions as $class_action ) {761 foreach ( $actions as $class_action ) { 717 762 if ( method_exists( $this, $class_action ) ) { 718 763 add_action( 'bp_' . $class_action, array( $this, $class_action ), 5 ); 719 764 } … … class BuddyPress { 743 788 $versions['1.6-single'] = get_blog_option( $this->root_blog_id, '_bp_db_version' ); 744 789 745 790 // 1.6-single exists, so trust it. 746 if ( ! empty( $versions['1.6-single'] ) ) {791 if ( ! empty( $versions['1.6-single'] ) ) { 747 792 $this->db_version_raw = (int) $versions['1.6-single']; 748 793 749 794 // If no 1.6-single exists, use the max of the others. 750 795 } else { 751 $versions['1.2'] = get_site_option( 752 $versions['1.5-multi'] = get_site_option( 753 $versions['1.6-multi'] = get_site_option( 754 $versions['1.5-single'] = get_blog_option( $this->root_blog_id, 796 $versions['1.2'] = get_site_option( 'bp-core-db-version' ); 797 $versions['1.5-multi'] = get_site_option( 'bp-db-version' ); 798 $versions['1.6-multi'] = get_site_option( '_bp_db_version' ); 799 $versions['1.5-single'] = get_blog_option( $this->root_blog_id, 'bp-db-version' ); 755 800 756 801 // Remove empty array items. 757 802 $versions = array_filter( $versions ); 758 $this->db_version_raw = (int) ( ! empty( $versions ) ) ? (int) max( $versions ) : 0;803 $this->db_version_raw = (int) ( ! empty( $versions ) ) ? (int) max( $versions ) : 0; 759 804 } 760 805 } 761 806 … … class BuddyPress { 795 840 public function register_theme_packages() { 796 841 797 842 // Register the default theme compatibility package. 798 bp_register_theme_package( array( 799 'id' => 'legacy', 800 'name' => __( 'BuddyPress Legacy', 'buddypress' ), 801 'version' => bp_get_version(), 802 'dir' => trailingslashit( $this->themes_dir . '/bp-legacy' ), 803 'url' => trailingslashit( $this->themes_url . '/bp-legacy' ) 804 ) ); 805 806 bp_register_theme_package( array( 807 'id' => 'nouveau', 808 'name' => __( 'BuddyPress Nouveau', 'buddypress' ), 809 'version' => bp_get_version(), 810 'dir' => trailingslashit( $this->themes_dir . '/bp-nouveau' ), 811 'url' => trailingslashit( $this->themes_url . '/bp-nouveau' ) 812 ) ); 843 bp_register_theme_package( 844 array( 845 'id' => 'legacy', 846 'name' => __( 'BuddyPress Legacy', 'buddypress' ), 847 'version' => bp_get_version(), 848 'dir' => trailingslashit( $this->themes_dir . '/bp-legacy' ), 849 'url' => trailingslashit( $this->themes_url . '/bp-legacy' ), 850 ) 851 ); 852 853 bp_register_theme_package( 854 array( 855 'id' => 'nouveau', 856 'name' => __( 'BuddyPress Nouveau', 'buddypress' ), 857 'version' => bp_get_version(), 858 'dir' => trailingslashit( $this->themes_dir . '/bp-nouveau' ), 859 'url' => trailingslashit( $this->themes_url . '/bp-nouveau' ), 860 ) 861 ); 813 862 814 863 // Register the basic theme stack. This is really dope. 815 864 bp_register_template_stack( 'get_stylesheet_directory', 10 ); 816 bp_register_template_stack( 'get_template_directory', 817 bp_register_template_stack( 'bp_get_theme_compat_dir', 865 bp_register_template_stack( 'get_template_directory', 12 ); 866 bp_register_template_stack( 'bp_get_theme_compat_dir', 14 ); 818 867 } 819 868 820 869 /**