Changeset 7760 for trunk/bp-loader.php
- Timestamp:
- 01/27/2014 08:58:31 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-loader.php
r7756 r7760 34 34 * Tap tap tap... Is this thing on? 35 35 * 36 * @since BuddyPress (1.6 )36 * @since BuddyPress (1.6.0) 37 37 */ 38 38 class BuddyPress { 39 39 40 /** Magic *****************************************************************/ 41 42 /** 43 * BuddyPress uses many variables, most of which can be filtered to customize 44 * the way that it works. To prevent unauthorized access, these variables 45 * are stored in a private array that is magically updated using PHP 5.2+ 46 * methods. This is to prevent third party plugins from tampering with 47 * essential information indirectly, which would cause issues later. 40 /** Magic *************************************************************/ 41 42 /** 43 * BuddyPress uses many variables, most of which can be filtered to 44 * customize the way that it works. To prevent unauthorized access, 45 * these variables are stored in a private array that is magically 46 * updated using PHP 5.2+ methods. This is to prevent third party 47 * plugins from tampering with essential information indirectly, which 48 * would cause issues later. 48 49 * 49 50 * @see BuddyPress::setup_globals() … … 52 53 private $data; 53 54 54 /** Not Magic ********************************************************* ****/55 56 /** 57 * @var array Primary BuddyPress navigation 55 /** Not Magic *********************************************************/ 56 57 /** 58 * @var array Primary BuddyPress navigation. 58 59 */ 59 60 public $bp_nav = array(); 60 61 61 62 /** 62 * @var array Secondary BuddyPress navigation to $bp_nav 63 * @var array Secondary BuddyPress navigation to $bp_nav. 63 64 */ 64 65 public $bp_options_nav = array(); 65 66 66 67 /** 67 * @var array The unfiltered URI broken down into chunks 68 * @var array The unfiltered URI broken down into chunks. 68 69 * @see bp_core_set_uri_globals() 69 70 */ … … 71 72 72 73 /** 73 * @var array The canonical URI stack 74 * @var array The canonical URI stack. 74 75 * @see bp_redirect_canonical() 75 76 * @see bp_core_new_nav_item() … … 78 79 79 80 /** 80 * @var array Additional navigation elements (supplemental) 81 * @var array Additional navigation elements (supplemental). 81 82 */ 82 83 public $action_variables = array(); 83 84 84 85 /** 85 * @var array Required components (core, members) 86 * @var array Required components (core, members). 86 87 */ 87 88 public $required_components = array(); 88 89 89 90 /** 90 * @var array Additional active components 91 * @var array Additional active components. 91 92 */ 92 93 public $loaded_components = array(); 93 94 94 95 /** 95 * @var array Active components 96 * @var array Active components. 96 97 */ 97 98 public $active_components = array(); 98 99 99 /** Option Overload *************************************************** ****/100 101 /** 102 * @var array Optional Overloads default options retrieved from get_option() 100 /** Option Overload ***************************************************/ 101 102 /** 103 * @var array Optional Overloads default options retrieved from get_option(). 103 104 */ 104 105 public $options = array(); 105 106 106 /** Singleton ********************************************************* ****/107 108 /** 109 * Main BuddyPress Instance 107 /** Singleton *********************************************************/ 108 109 /** 110 * Main BuddyPress Instance. 110 111 * 111 112 * BuddyPress is great … … 113 114 * For this, we thank you 114 115 * 115 * Insures that only one instance of BuddyPress exists in memory at any one116 * time. Also prevents needing to define globals all over the place.117 * 118 * @since BuddyPress (1.7 )119 * 120 * @static varobject $instance121 * @uses BuddyPress::constants() Setup the constants (mostly deprecated) 122 * @uses BuddyPress::setup_globals() Setup the globals needed 123 * @uses BuddyPress::legacy_constants() Setup the legacy constants (deprecated) 124 * @uses BuddyPress::includes() Include the required files 125 * @uses BuddyPress::setup_actions() Setup the hooks and actions 116 * Insures that only one instance of BuddyPress exists in memory at any 117 * one time. Also prevents needing to define globals all over the place. 118 * 119 * @since BuddyPress (1.7.0) 120 * 121 * @static object $instance 122 * @uses BuddyPress::constants() Setup the constants (mostly deprecated). 123 * @uses BuddyPress::setup_globals() Setup the globals needed. 124 * @uses BuddyPress::legacy_constants() Setup the legacy constants (deprecated). 125 * @uses BuddyPress::includes() Include the required files. 126 * @uses BuddyPress::setup_actions() Setup the hooks and actions. 126 127 * @see buddypress() 127 128 * 128 * @return BuddyPress The one true BuddyPress 129 * @return BuddyPress The one true BuddyPress. 129 130 */ 130 131 public static function instance() { … … 133 134 static $instance = null; 134 135 135 // Only run these methods if they haven't been r an previously136 // Only run these methods if they haven't been run previously 136 137 if ( null === $instance ) { 137 138 $instance = new BuddyPress; … … 147 148 } 148 149 149 /** Magic Methods ***************************************************** ****/150 /** Magic Methods *****************************************************/ 150 151 151 152 /** 152 153 * A dummy constructor to prevent BuddyPress from being loaded more than once. 153 154 * 154 * @since BuddyPress (1.7 )155 * @since BuddyPress (1.7.0) 155 156 * @see BuddyPress::instance() 156 157 * @see buddypress() … … 159 160 160 161 /** 161 * A dummy magic method to prevent BuddyPress from being cloned 162 * 163 * @since BuddyPress (1.7 )162 * A dummy magic method to prevent BuddyPress from being cloned. 163 * 164 * @since BuddyPress (1.7.0) 164 165 */ 165 166 public function __clone() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'buddypress' ), '1.7' ); } 166 167 167 168 /** 168 * A dummy magic method to prevent BuddyPress from being unserialized 169 * 170 * @since BuddyPress (1.7 )169 * A dummy magic method to prevent BuddyPress from being unserialized. 170 * 171 * @since BuddyPress (1.7.0) 171 172 */ 172 173 public function __wakeup() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'buddypress' ), '1.7' ); } 173 174 174 175 /** 175 * Magic method for checking the existence of a certain custom field 176 * 177 * @since BuddyPress (1.7 )176 * Magic method for checking the existence of a certain custom field. 177 * 178 * @since BuddyPress (1.7.0) 178 179 */ 179 180 public function __isset( $key ) { return isset( $this->data[$key] ); } 180 181 181 182 /** 182 * Magic method for getting BuddyPress varibles 183 * 184 * @since BuddyPress (1.7 )183 * Magic method for getting BuddyPress varibles. 184 * 185 * @since BuddyPress (1.7.0) 185 186 */ 186 187 public function __get( $key ) { return isset( $this->data[$key] ) ? $this->data[$key] : null; } 187 188 188 189 /** 189 * Magic method for setting BuddyPress varibles 190 * 191 * @since BuddyPress (1.7 )190 * Magic method for setting BuddyPress varibles. 191 * 192 * @since BuddyPress (1.7.0) 192 193 */ 193 194 public function __set( $key, $value ) { $this->data[$key] = $value; } 194 195 195 196 /** 196 * Magic method for unsetting BuddyPress variables 197 * 198 * @since BuddyPress (1.7 )197 * Magic method for unsetting BuddyPress variables. 198 * 199 * @since BuddyPress (1.7.0) 199 200 */ 200 201 public function __unset( $key ) { if ( isset( $this->data[$key] ) ) unset( $this->data[$key] ); } 201 202 202 203 /** 203 * Magic method to prevent notices and errors from invalid method calls 204 * 205 * @since BuddyPress (1.7 )204 * Magic method to prevent notices and errors from invalid method calls. 205 * 206 * @since BuddyPress (1.7.0) 206 207 */ 207 208 public function __call( $name = '', $args = array() ) { unset( $name, $args ); return null; } 208 209 209 /** Private Methods *************************************************** ****/210 211 /** 212 * Bootstrap constants 213 * 214 * @since BuddyPress (1.6 )210 /** Private Methods ***************************************************/ 211 212 /** 213 * Bootstrap constants. 214 * 215 * @since BuddyPress (1.6.0) 215 216 * 216 217 * @uses is_multisite() … … 285 286 286 287 /** 287 * Component global variables 288 * 289 * @since BuddyPress (1.6 )288 * Component global variables. 289 * 290 * @since BuddyPress (1.6.0) 290 291 * @access private 291 292 * 292 * @uses plugin_dir_path() To generate BuddyPress plugin path 293 * @uses plugin_dir_url() To generate BuddyPress plugin url 294 * @uses apply_filters() Calls various filters 293 * @uses plugin_dir_path() To generate BuddyPress plugin path. 294 * @uses plugin_dir_url() To generate BuddyPress plugin url. 295 * @uses apply_filters() Calls various filters. 295 296 */ 296 297 private function setup_globals() { 297 298 298 /** Versions ************************************************** ********/299 /** Versions **************************************************/ 299 300 300 301 $this->version = '2.0-alpha-7752'; 301 302 $this->db_version = 7553; 302 303 303 /** Loading *************************************************** ********/304 /** Loading ***************************************************/ 304 305 305 306 $this->load_deprecated = true; 306 307 307 /** Toolbar *************************************************** ********/308 /** Toolbar ***************************************************/ 308 309 309 310 /** … … 312 313 $this->my_account_menu_id = ''; 313 314 314 /** URI 's *************************************************************/315 /** URIs ******************************************************/ 315 316 316 317 /** 317 * @var int The current offset of the URI 318 * @var int The current offset of the URI. 318 319 * @see bp_core_set_uri_globals() 319 320 */ … … 325 326 $this->no_status_set = false; 326 327 327 /** Components ************************************************ ********/328 /** Components ************************************************/ 328 329 329 330 /** … … 347 348 $this->is_single_item = false; 348 349 349 /** Root ****************************************************** ********/350 /** Root ******************************************************/ 350 351 351 352 // BuddyPress Root blog ID 352 353 $this->root_blog_id = (int) apply_filters( 'bp_get_root_blog_id', BP_ROOT_BLOG ); 353 354 354 /** Paths *************************************************************/355 /** Paths******************************************************/ 355 356 356 357 // BuddyPress root directory … … 371 372 $this->old_themes_url = $this->plugin_url . 'bp-themes'; 372 373 373 /** Theme Compat ********************************************** ********/374 /** Theme Compat **********************************************/ 374 375 375 376 $this->theme_compat = new stdClass(); // Base theme compatibility class 376 377 $this->filters = new stdClass(); // Used when adding/removing filters 377 378 378 /** Users ***************************************************** ********/379 /** Users *****************************************************/ 379 380 380 381 $this->current_user = new stdClass(); … … 383 384 384 385 /** 385 * Legacy BuddyPress constants 386 * Legacy BuddyPress constants. 386 387 * 387 388 * Try to avoid using these. Their values have been moved into variables 388 389 * in the instance, and have matching functions to get/set their values. 389 390 * 390 * @since BuddyPress (1.7 )391 * @since BuddyPress (1.7.0) 391 392 */ 392 393 private function legacy_constants() { … … 400 401 401 402 /** 402 * Include required files 403 * 404 * @since BuddyPress (1.6 )403 * Include required files. 404 * 405 * @since BuddyPress (1.6.0) 405 406 * @access private 406 407 * 407 * @uses is_admin() If in WordPress admin, load additional file 408 * @uses is_admin() If in WordPress admin, load additional file. 408 409 */ 409 410 private function includes() { … … 415 416 $this->versions(); 416 417 417 /** Update/Install ******************************************** ********/418 /** Update/Install ********************************************/ 418 419 419 420 // Theme compatability … … 452 453 453 454 /** 454 * Set up the default hooks and actions455 * 456 * @since BuddyPress (1.6 )455 * Set up the default hooks and actions. 456 * 457 * @since BuddyPress (1.6.0) 457 458 * @access private 458 459 * 459 * @uses register_activation_hook() To register the activation hook 460 * @uses register_deactivation_hook() To register the deactivation hook 461 * @uses add_action() To add various actions 460 * @uses register_activation_hook() To register the activation hook. 461 * @uses register_deactivation_hook() To register the deactivation hook. 462 * @uses add_action() To add various actions. 462 463 */ 463 464 private function setup_actions() { … … 495 496 496 497 /** 497 * Private method to align the active and database versions 498 * 499 * @since BuddyPress (1.7 )498 * Private method to align the active and database versions. 499 * 500 * @since BuddyPress (1.7.0) 500 501 */ 501 502 private function versions() { … … 522 523 } 523 524 524 /** Public Methods **************************************************** ****/525 /** Public Methods ****************************************************/ 525 526 526 527 /** … … 547 548 548 549 /** 549 * Register bundled theme packages 550 * Register bundled theme packages. 550 551 * 551 552 * Note that since we currently have complete control over bp-themes and … … 553 554 * later date we need to automate this, an API will need to be built. 554 555 * 555 * @since BuddyPress (1.7 )556 * @since BuddyPress (1.7.0) 556 557 */ 557 558 public function register_theme_packages() { … … 573 574 574 575 /** 575 * Set up the default BuddyPress theme compatability location.576 * 577 * @since BuddyPress (1.7 )576 * Set up the default BuddyPress theme compatability location. 577 * 578 * @since BuddyPress (1.7.0) 578 579 */ 579 580 public function setup_theme() { … … 589 590 590 591 /** 591 * The main function responsible for returning the one true BuddyPress Instance 592 * to functions everywhere. 592 * The main function responsible for returning the one true BuddyPress Instance to functions everywhere. 593 593 * 594 594 * Use this function like you would a global variable, except without needing … … 597 597 * Example: <?php $bp = buddypress(); ?> 598 598 * 599 * @return BuddyPress The one true BuddyPress Instance 599 * @return BuddyPress The one true BuddyPress Instance. 600 600 */ 601 601 function buddypress() { … … 604 604 605 605 /** 606 * Hook BuddyPress early onto the 'plugins_loaded' action. 606 * Hook BuddyPress early onto the 'plugins_loaded' action.. 607 607 * 608 608 * This gives all other plugins the chance to load before BuddyPress, to get
Note: See TracChangeset
for help on using the changeset viewer.