Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/22/2011 07:32:48 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Prebeta code clean-up - see #3367:

  • Remove PHP4 constructors on loader classes
  • Remove class functions that start with underscores
  • Use require() rather than require_once() where appropriate
  • Remove background color on messages activity time
File:
1 edited

Legend:

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

    r4631 r4775  
    6969     *  - query: The loop for this component (WP_Query)
    7070     *  - current_id: The current ID of the queried object
    71      * @uses bp_Component::_setup_globals() Setup the globals needed
    72      * @uses bp_Component::_includes() Include the required files
    73      * @uses bp_Component::_setup_actions() Setup the hooks and actions
     71     * @uses bp_Component::setup_globals() Setup the globals needed
     72     * @uses bp_Component::includes() Include the required files
     73     * @uses bp_Component::setup_actions() Setup the hooks and actions
    7474     */
    7575    function start( $id, $name, $path ) {
     
    8484
    8585        // Move on to the next step
    86         $this->_setup_actions();
     86        $this->setup_actions();
    8787    }
    8888
     
    9898     * @param arr $args Used to
    9999     */
    100     function _setup_globals( $args = '' ) {
     100    function setup_globals( $args = '' ) {
    101101        global $bp;
    102102
     
    135135
    136136        // Call action
    137         do_action( 'bp_' . $this->id . '_setup_globals' );
     137        do_action( 'bp_' . $this->id . 'setup_globals' );
    138138    }
    139139
     
    144144     * @access private
    145145     *
    146      * @uses do_action() Calls 'bp_{@link bp_Component::name}_includes'
    147      */
    148     function _includes( $includes = '' ) {
     146     * @uses do_action() Calls 'bp_{@link bp_Component::name}includes'
     147     */
     148    function includes( $includes = '' ) {
    149149        if ( empty( $includes ) )
    150150            return;
     
    155155            // Check path + file
    156156            if ( @is_file( $this->path . '/' . $file ) )
    157                 require_once( $this->path . '/' . $file );
     157                require( $this->path . '/' . $file );
    158158
    159159            // Check path + /bp-component/ + file
    160160            elseif ( @is_file( $this->path . '/bp-' . $this->id . '/' . $file ) )
    161                 require_once( $this->path . '/bp-' . $this->id . '/' . $file );
     161                require( $this->path . '/bp-' . $this->id . '/' . $file );
    162162
    163163            // Check buddypress/bp-component/bp-component-$file.php
    164164            elseif ( @is_file( $this->path . '/bp-' . $this->id . '/bp-' . $this->id . '-' . $file  . '.php' ) )
    165                 require_once( $this->path . '/bp-' . $this->id . '/bp-' . $this->id . '-' . $file . '.php' );
     165                require( $this->path . '/bp-' . $this->id . '/bp-' . $this->id . '-' . $file . '.php' );
    166166
    167167        }
    168168
    169169        // Call action
    170         do_action( 'bp_' . $this->id . '_includes' );
     170        do_action( 'bp_' . $this->id . 'includes' );
    171171    }
    172172
     
    178178     *
    179179     * @uses add_action() To add various actions
    180      * @uses do_action() Calls 'bp_{@link BP_Component::name}_setup_actions'
    181      */
    182     function _setup_actions() {
    183         // Register post types
    184         add_action( 'bp_setup_globals',            array ( $this, '_setup_globals'           ), 10 );
     180     * @uses do_action() Calls 'bp_{@link BP_Component::name}setup_actions'
     181     */
     182    function setup_actions() {
     183        // Register post types
     184        add_action( 'bp_setup_globals',            array ( $this, 'setup_globals'            ), 10 );
    185185
    186186        // Include required files. Called early to ensure that BP core components are
     
    188188        // the default priority of 10. This is for backwards compatibility; henceforth,
    189189        // plugins should register themselves by extending this base class.
    190         add_action( 'bp_include',                  array ( $this, '_includes'                ), 8 );
    191 
    192         // Register post types
    193         add_action( 'bp_setup_nav',                array ( $this, '_setup_nav'               ), 10 );
    194 
    195         // Register post types
    196         add_action( 'bp_setup_admin_bar',          array ( $this, '_setup_admin_bar'         ), 10 );
    197 
    198         // Register post types
    199         add_action( 'bp_setup_title',              array ( $this, '_setup_title'             ), 10 );
     190        add_action( 'bp_include',                  array ( $this, 'includes'                 ), 8 );
     191
     192        // Register post types
     193        add_action( 'bp_setup_nav',                array ( $this, 'setup_nav'                ), 10 );
     194
     195        // Register post types
     196        add_action( 'bp_setup_admin_bar',          array ( $this, 'setup_admin_bar'          ), 10 );
     197
     198        // Register post types
     199        add_action( 'bp_setup_title',              array ( $this, 'setup_title'              ), 10 );
    200200
    201201        // Register post types
     
    212212
    213213        // Additional actions can be attached here
    214         do_action( 'bp_' . $this->id . '_setup_actions' );
     214        do_action( 'bp_' . $this->id . 'setup_actions' );
    215215    }
    216216
     
    221221     * @param arr $sub_nav Optional
    222222     */
    223     function _setup_nav( $main_nav = '', $sub_nav = '' ) {
     223    function setup_nav( $main_nav = '', $sub_nav = '' ) {
    224224
    225225        // No sub nav items without a main nav item
     
    236236
    237237        // Call action
    238         do_action( 'bp_' . $this->id . '_setup_nav' );
     238        do_action( 'bp_' . $this->id . 'setup_nav' );
    239239    }
    240240
     
    245245     * @param array $wp_admin_menus
    246246     */
    247     function _setup_admin_bar( $wp_admin_nav = '' ) {
     247    function setup_admin_bar( $wp_admin_nav = '' ) {
    248248
    249249        // Bail if this is an ajax request
     
    270270
    271271        // Call action
    272         do_action( 'bp_' . $this->id . '_setup_admin_bar' );
     272        do_action( 'bp_' . $this->id . 'setup_admin_bar' );
    273273    }
    274274
     
    278278     * @since Buddypress {unknown}
    279279     *
    280      * @uses do_action() Calls 'bp_{@link bp_Component::name}_setup_title'
    281      */
    282     function _setup_title( ) {
    283         do_action(  'bp_' . $this->id . '_setup_title' );
     280     * @uses do_action() Calls 'bp_{@link bp_Component::name}setup_title'
     281     */
     282    function setup_title( ) {
     283        do_action(  'bp_' . $this->id . 'setup_title' );
    284284    }
    285285
Note: See TracChangeset for help on using the changeset viewer.