Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/15/2015 07:57:03 PM (9 years ago)
Author:
tw2113
Message:

[Samus Aran]
I first battled the documentation inconsistencies on planet Zebes. It was there that I foiled the plans of the
Space Pirate leader Mother Brain to use the issues to attack galactic civilization...

I next fought the inconsistencies on their homeworld SR388. I completely eradicated them except for an @since tag,
which after hatching followed me like a confused child...

I personally delivered it to the Galactic Research Station at Ceres so scientists could study its energy production qualities...

The scientists' findings were astounding! They discovered that the powers of the docs inconsistencies
might be harnessed for the good of galactic civilization!

Satisfied that all was well, I left the station to seek a new bounty to hunt. But, I had hardly gone beyond the asteroid
belt when I picked up a distress signal!

Ceres station was under attack!

More documentation cleanup for part of BP-Core component.

See #6398.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-component.php

    r10110 r10356  
    1919 * internally by BuddyPress to create the bundled components, but can be
    2020 * extended to create other really neat things.
    21  *
    22  * @package BuddyPress
    23  * @subpackage Component
    2421 *
    2522 * @since 1.5.0
     
    161158    public function start( $id = '', $name = '', $path = '', $params = array() ) {
    162159
    163         // Internal identifier of component
     160        // Internal identifier of component.
    164161        $this->id   = $id;
    165162
    166         // Internal component name
     163        // Internal component name.
    167164        $this->name = $name;
    168165
    169         // Path for includes
     166        // Path for includes.
    170167        $this->path = $path;
    171168
    172         // Miscellaneous component parameters that need to be set early on
     169        // Miscellaneous component parameters that need to be set early on.
    173170        if ( ! empty( $params ) ) {
    174             // Sets the position for our menu under the WP Toolbar's "My Account" menu
     171            // Sets the position for our menu under the WP Toolbar's "My Account" menu.
    175172            if ( ! empty( $params['adminbar_myaccount_order'] ) ) {
    176173                $this->adminbar_myaccount_order = (int) $params['adminbar_myaccount_order'];
    177174            }
    178175
    179             // Register features
     176            // Register features.
    180177            if ( ! empty( $params['features'] ) ) {
    181178                $this->features = array_map( 'sanitize_title', (array) $params['features'] );
     
    186183            }
    187184
    188         // Set defaults if not passed
     185        // Set defaults if not passed.
    189186        } else {
    190             // new component menus are added before the settings menu if not set
     187            // New component menus are added before the settings menu if not set.
    191188            $this->adminbar_myaccount_order = 90;
    192189        }
    193190
    194         // Move on to the next step
     191        // Move on to the next step.
    195192        $this->setup_actions();
    196193    }
     
    222219    public function setup_globals( $args = array() ) {
    223220
    224         /** Slugs *************************************************************/
     221        /** Slugs ************************************************************
     222         */
    225223
    226224        // If a WP directory page exists for the component, it should
     
    293291        $this->notification_callback = apply_filters( 'bp_' . $this->id . '_notification_callback', $r['notification_callback'] );
    294292
    295         // Set the global table names, if applicable
     293        // Set the global table names, if applicable.
    296294        if ( ! empty( $r['global_tables'] ) ) {
    297295            $this->register_global_tables( $r['global_tables'] );
    298296        }
    299297
    300         // Set the metadata table, if applicable
     298        // Set the metadata table, if applicable.
    301299        if ( ! empty( $r['meta_tables'] ) ) {
    302300            $this->register_meta_tables( $r['meta_tables'] );
    303301        }
    304302
    305         /** BuddyPress ********************************************************/
    306 
    307         // Register this component in the loaded components array
     303        /** BuddyPress *******************************************************
     304         */
     305
     306        // Register this component in the loaded components array.
    308307        buddypress()->loaded_components[$this->slug] = $this->id;
    309308
     
    350349    public function includes( $includes = array() ) {
    351350
    352         // Bail if no files to include
     351        // Bail if no files to include.
    353352        if ( ! empty( $includes ) ) {
    354353            $slashed_path = trailingslashit( $this->path );
    355354
    356             // Loop through files to be included
     355            // Loop through files to be included.
    357356            foreach ( (array) $includes as $file ) {
    358357
    359358                $paths = array(
    360359
    361                     // Passed with no extension
     360                    // Passed with no extension.
    362361                    'bp-' . $this->id . '/bp-' . $this->id . '-' . $file  . '.php',
    363362                    'bp-' . $this->id . '-' . $file . '.php',
    364363                    'bp-' . $this->id . '/' . $file . '.php',
    365364
    366                     // Passed with extension
     365                    // Passed with extension.
    367366                    $file,
    368367                    'bp-' . $this->id . '-' . $file,
     
    399398    public function setup_actions() {
    400399
    401         // Setup globals
     400        // Setup globals.
    402401        add_action( 'bp_setup_globals',          array( $this, 'setup_globals'          ), 10 );
    403402
    404         // Set up canonical stack
     403        // Set up canonical stack.
    405404        add_action( 'bp_setup_canonical_stack',  array( $this, 'setup_canonical_stack'  ), 10 );
    406405
     
    412411        add_action( 'bp_include',                array( $this, 'includes'               ), 8 );
    413412
    414         // Setup navigation
     413        // Setup navigation.
    415414        add_action( 'bp_setup_nav',              array( $this, 'setup_nav'              ), 10 );
    416415
    417         // Setup WP Toolbar menus
     416        // Setup WP Toolbar menus.
    418417        add_action( 'bp_setup_admin_bar',        array( $this, 'setup_admin_bar'        ), $this->adminbar_myaccount_order );
    419418
    420         // Setup component title
     419        // Setup component title.
    421420        add_action( 'bp_setup_title',            array( $this, 'setup_title'            ), 10 );
    422421
    423         // Setup cache groups
     422        // Setup cache groups.
    424423        add_action( 'bp_setup_cache_groups',     array( $this, 'setup_cache_groups'     ), 10 );
    425424
    426         // Register post types
     425        // Register post types.
    427426        add_action( 'bp_register_post_types',    array( $this, 'register_post_types'    ), 10 );
    428427
    429         // Register taxonomies
     428        // Register taxonomies.
    430429        add_action( 'bp_register_taxonomies',    array( $this, 'register_taxonomies'    ), 10 );
    431430
    432         // Add the rewrite tags
     431        // Add the rewrite tags.
    433432        add_action( 'bp_add_rewrite_tags',       array( $this, 'add_rewrite_tags'       ), 10 );
    434433
    435         // Add the rewrite rules
     434        // Add the rewrite rules.
    436435        add_action( 'bp_add_rewrite_rules',      array( $this, 'add_rewrite_rules'      ), 10 );
    437436
    438         // Add the permalink structure
     437        // Add the permalink structure.
    439438        add_action( 'bp_add_permastructs',       array( $this, 'add_permastructs'       ), 10 );
    440439
    441         // Allow components to parse the main query
     440        // Allow components to parse the main query.
    442441        add_action( 'bp_parse_query',            array( $this, 'parse_query'            ), 10 );
    443442
    444         // Generate rewrite rules
     443        // Generate rewrite rules.
    445444        add_action( 'bp_generate_rewrite_rules', array( $this, 'generate_rewrite_rules' ), 10 );
    446445
     
    478477    public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
    479478
    480         // No sub nav items without a main nav item
     479        // No sub nav items without a main nav item.
    481480        if ( !empty( $main_nav ) ) {
    482481            bp_core_new_nav_item( $main_nav );
    483482
    484             // Sub nav items are not required
     483            // Sub nav items are not required.
    485484            if ( !empty( $sub_nav ) ) {
    486485                foreach( (array) $sub_nav as $nav ) {
     
    514513    public function setup_admin_bar( $wp_admin_nav = array() ) {
    515514
    516         // Bail if this is an ajax request
     515        // Bail if this is an ajax request.
    517516        if ( defined( 'DOING_AJAX' ) ) {
    518517            return;
    519518        }
    520519
    521         // Do not proceed if BP_USE_WP_ADMIN_BAR constant is not set or is false
     520        // Do not proceed if BP_USE_WP_ADMIN_BAR constant is not set or is false.
    522521        if ( ! bp_use_wp_admin_bar() ) {
    523522            return;
     
    538537        if ( !empty( $wp_admin_nav ) ) {
    539538
    540             // Set this objects menus
     539            // Set this objects menus.
    541540            $this->admin_menu = $wp_admin_nav;
    542541
    543             // Define the WordPress global
     542            // Define the WordPress global.
    544543            global $wp_admin_bar;
    545544
    546             // Add each admin menu
     545            // Add each admin menu.
    547546            foreach( $this->admin_menu as $admin_menu ) {
    548547                $wp_admin_bar->add_menu( $admin_menu );
     
    618617        $tables = apply_filters( 'bp_' . $this->id . '_global_tables', $tables );
    619618
    620         // Add to the BuddyPress global object
     619        // Add to the BuddyPress global object.
    621620        if ( !empty( $tables ) && is_array( $tables ) ) {
    622621            foreach ( $tables as $global_name => $table_name ) {
     
    624623            }
    625624
    626             // Keep a record of the metadata tables in the component
     625            // Keep a record of the metadata tables in the component.
    627626            $this->global_tables = $tables;
    628627        }
     
    671670            }
    672671
    673             // Keep a record of the metadata tables in the component
     672            // Keep a record of the metadata tables in the component.
    674673            $this->meta_tables = $tables;
    675674        }
Note: See TracChangeset for help on using the changeset viewer.