Skip to:
Content

BuddyPress.org

Changeset 7760


Ignore:
Timestamp:
01/27/2014 08:58:31 PM (13 years ago)
Author:
boonebgorges
Message:

Improve inline docs in bp-loader.php. See #5022

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-loader.php

    r7756 r7760  
    3434 * Tap tap tap... Is this thing on?
    3535 *
    36  * @since BuddyPress (1.6)
     36 * @since BuddyPress (1.6.0)
    3737 */
    3838class BuddyPress {
    3939
    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.
    4849         *
    4950         * @see BuddyPress::setup_globals()
     
    5253        private $data;
    5354
    54         /** Not Magic *************************************************************/
    55 
    56         /**
    57          * @var array Primary BuddyPress navigation
     55        /** Not Magic *********************************************************/
     56
     57        /**
     58         * @var array Primary BuddyPress navigation.
    5859         */
    5960        public $bp_nav = array();
    6061
    6162        /**
    62          * @var array Secondary BuddyPress navigation to $bp_nav
     63         * @var array Secondary BuddyPress navigation to $bp_nav.
    6364         */
    6465        public $bp_options_nav = array();
    6566
    6667        /**
    67          * @var array The unfiltered URI broken down into chunks
     68         * @var array The unfiltered URI broken down into chunks.
    6869         * @see bp_core_set_uri_globals()
    6970         */
     
    7172
    7273        /**
    73          * @var array The canonical URI stack
     74         * @var array The canonical URI stack.
    7475         * @see bp_redirect_canonical()
    7576         * @see bp_core_new_nav_item()
     
    7879
    7980        /**
    80          * @var array Additional navigation elements (supplemental)
     81         * @var array Additional navigation elements (supplemental).
    8182         */
    8283        public $action_variables = array();
    8384
    8485        /**
    85          * @var array Required components (core, members)
     86         * @var array Required components (core, members).
    8687         */
    8788        public $required_components = array();
    8889
    8990        /**
    90          * @var array Additional active components
     91         * @var array Additional active components.
    9192         */
    9293        public $loaded_components = array();
    9394
    9495        /**
    95          * @var array Active components
     96         * @var array Active components.
    9697         */
    9798        public $active_components = array();
    9899
    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().
    103104         */
    104105        public $options = array();
    105106
    106         /** Singleton *************************************************************/
    107 
    108         /**
    109          * Main BuddyPress Instance
     107        /** Singleton *********************************************************/
     108
     109        /**
     110         * Main BuddyPress Instance.
    110111         *
    111112         * BuddyPress is great
     
    113114         * For this, we thank you
    114115         *
    115          * Insures that only one instance of BuddyPress exists in memory at any one
    116          * time. Also prevents needing to define globals all over the place.
    117          *
    118          * @since BuddyPress (1.7)
    119          *
    120          * @staticvar object $instance
    121          * @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.
    126127         * @see buddypress()
    127128         *
    128          * @return BuddyPress The one true BuddyPress
     129         * @return BuddyPress The one true BuddyPress.
    129130         */
    130131        public static function instance() {
     
    133134                static $instance = null;
    134135
    135                 // Only run these methods if they haven't been ran previously
     136                // Only run these methods if they haven't been run previously
    136137                if ( null === $instance ) {
    137138                        $instance = new BuddyPress;
     
    147148        }
    148149
    149         /** Magic Methods *********************************************************/
     150        /** Magic Methods *****************************************************/
    150151
    151152        /**
    152153         * A dummy constructor to prevent BuddyPress from being loaded more than once.
    153154         *
    154          * @since BuddyPress (1.7)
     155         * @since BuddyPress (1.7.0)
    155156         * @see BuddyPress::instance()
    156157         * @see buddypress()
     
    159160
    160161        /**
    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)
    164165         */
    165166        public function __clone() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'buddypress' ), '1.7' ); }
    166167
    167168        /**
    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)
    171172         */
    172173        public function __wakeup() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'buddypress' ), '1.7' ); }
    173174
    174175        /**
    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)
    178179         */
    179180        public function __isset( $key ) { return isset( $this->data[$key] ); }
    180181
    181182        /**
    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)
    185186         */
    186187        public function __get( $key ) { return isset( $this->data[$key] ) ? $this->data[$key] : null; }
    187188
    188189        /**
    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)
    192193         */
    193194        public function __set( $key, $value ) { $this->data[$key] = $value; }
    194195
    195196        /**
    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)
    199200         */
    200201        public function __unset( $key ) { if ( isset( $this->data[$key] ) ) unset( $this->data[$key] ); }
    201202
    202203        /**
    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)
    206207         */
    207208        public function __call( $name = '', $args = array() ) { unset( $name, $args ); return null; }
    208209
    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)
    215216         *
    216217         * @uses is_multisite()
     
    285286
    286287        /**
    287          * Component global variables
    288          *
    289          * @since BuddyPress (1.6)
     288         * Component global variables.
     289         *
     290         * @since BuddyPress (1.6.0)
    290291         * @access private
    291292         *
    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.
    295296         */
    296297        private function setup_globals() {
    297298
    298                 /** Versions **********************************************************/
     299                /** Versions **************************************************/
    299300
    300301                $this->version    = '2.0-alpha-7752';
    301302                $this->db_version = 7553;
    302303
    303                 /** Loading ***********************************************************/
     304                /** Loading ***************************************************/
    304305
    305306                $this->load_deprecated  = true;
    306307
    307                 /** Toolbar ***********************************************************/
     308                /** Toolbar ***************************************************/
    308309
    309310                /**
     
    312313                $this->my_account_menu_id = '';
    313314
    314                 /** URI's *************************************************************/
     315                /** URIs ******************************************************/
    315316
    316317                /**
    317                  * @var int The current offset of the URI
     318                 * @var int The current offset of the URI.
    318319                 * @see bp_core_set_uri_globals()
    319320                 */
     
    325326                $this->no_status_set = false;
    326327
    327                 /** Components ********************************************************/
     328                /** Components ************************************************/
    328329
    329330                /**
     
    347348                $this->is_single_item = false;
    348349
    349                 /** Root **************************************************************/
     350                /** Root ******************************************************/
    350351
    351352                // BuddyPress Root blog ID
    352353                $this->root_blog_id = (int) apply_filters( 'bp_get_root_blog_id', BP_ROOT_BLOG );
    353354
    354                 /** Paths *************************************************************/
     355                /** Paths******************************************************/
    355356
    356357                // BuddyPress root directory
     
    371372                $this->old_themes_url = $this->plugin_url . 'bp-themes';
    372373
    373                 /** Theme Compat ******************************************************/
     374                /** Theme Compat **********************************************/
    374375
    375376                $this->theme_compat   = new stdClass(); // Base theme compatibility class
    376377                $this->filters        = new stdClass(); // Used when adding/removing filters
    377378
    378                 /** Users *************************************************************/
     379                /** Users *****************************************************/
    379380
    380381                $this->current_user   = new stdClass();
     
    383384
    384385        /**
    385          * Legacy BuddyPress constants
     386         * Legacy BuddyPress constants.
    386387         *
    387388         * Try to avoid using these. Their values have been moved into variables
    388389         * in the instance, and have matching functions to get/set their values.
    389390         *
    390          * @since BuddyPress (1.7)
     391         * @since BuddyPress (1.7.0)
    391392         */
    392393        private function legacy_constants() {
     
    400401
    401402        /**
    402          * Include required files
    403          *
    404          * @since BuddyPress (1.6)
     403         * Include required files.
     404         *
     405         * @since BuddyPress (1.6.0)
    405406         * @access private
    406407         *
    407          * @uses is_admin() If in WordPress admin, load additional file
     408         * @uses is_admin() If in WordPress admin, load additional file.
    408409         */
    409410        private function includes() {
     
    415416                $this->versions();
    416417
    417                 /** Update/Install ****************************************************/
     418                /** Update/Install ********************************************/
    418419
    419420                // Theme compatability
     
    452453
    453454        /**
    454          * Setup the default hooks and actions
    455          *
    456          * @since BuddyPress (1.6)
     455         * Set up the default hooks and actions.
     456         *
     457         * @since BuddyPress (1.6.0)
    457458         * @access private
    458459         *
    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.
    462463         */
    463464        private function setup_actions() {
     
    495496
    496497        /**
    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)
    500501         */
    501502        private function versions() {
     
    522523        }
    523524
    524         /** Public Methods ********************************************************/
     525        /** Public Methods ****************************************************/
    525526
    526527        /**
     
    547548
    548549        /**
    549          * Register bundled theme packages
     550         * Register bundled theme packages.
    550551         *
    551552         * Note that since we currently have complete control over bp-themes and
     
    553554         * later date we need to automate this, an API will need to be built.
    554555         *
    555          * @since BuddyPress (1.7)
     556         * @since BuddyPress (1.7.0)
    556557         */
    557558        public function register_theme_packages() {
     
    573574
    574575        /**
    575          * Setup 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)
    578579         */
    579580        public function setup_theme() {
     
    589590
    590591/**
    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.
    593593 *
    594594 * Use this function like you would a global variable, except without needing
     
    597597 * Example: <?php $bp = buddypress(); ?>
    598598 *
    599  * @return BuddyPress The one true BuddyPress Instance
     599 * @return BuddyPress The one true BuddyPress Instance.
    600600 */
    601601function buddypress() {
     
    604604
    605605/**
    606  * Hook BuddyPress early onto the 'plugins_loaded' action.
     606 * Hook BuddyPress early onto the 'plugins_loaded' action..
    607607 *
    608608 * This gives all other plugins the chance to load before BuddyPress, to get
Note: See TracChangeset for help on using the changeset viewer.