Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/25/2011 08:58:56 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Rename new 'bp-users' component to 'bp-members' for consistency through-out project.
Core, Messages, and Friends Components now use the BP_Component class.
Split Friends and Messages components into smaller files.
Change references to 'profile' to 'xprofile' through-out project for consistency.
Introduce 'bp_actions' and 'bp_screens' standard hooks to replace the usage of 'wp' through-out project.
Move component loader sequence into bp-core-bootstrap.php,
Move old root_component action into 1.3 deprecated file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs/bp-blogs-loader.php

    r3855 r3917  
    1818     */
    1919    function BP_Blogs_Component() {
    20         parent::start( 'blogs', __( 'Blogs Streams', 'buddypress' ) );
     20        parent::start(
     21            'blogs',
     22            __( 'Blogs Streams', 'buddypress' ),
     23            BP_PLUGIN_DIR
     24        );
    2125    }
    2226
     
    3640            define ( 'BP_BLOGS_SLUG', $this->id );
    3741
    38         // Do some slug checks
    39         $this->slug      = BP_BLOGS_SLUG;
    40         $this->root_slug = isset( $bp->pages->blogs->slug ) ? $bp->pages->blogs->slug : $this->slug;
     42        // Global tables for messaging component
     43        $global_tables = array(
     44            'table_name'          => $bp->table_prefix . 'bp_user_blogs',
     45            'table_name_blogmeta' => $bp->table_prefix . 'bp_user_blogs_blogmeta',
     46        );
    4147
    42         // Tables
    43         $this->table_name          = $bp->table_prefix . 'bp_user_blogs';
    44         $this->table_name_blogmeta = $bp->table_prefix . 'bp_user_blogs_blogmeta';
     48        // All globals for messaging component.
     49        // Note that global_tables is included in this array.
     50        $globals = array(
     51            'path'                  => BP_PLUGIN_DIR,
     52            'slug'                  => BP_BLOGS_SLUG,
     53            'root_slug'             => isset( $bp->pages->blogs->slug ) ? $bp->pages->blogs->slug : BP_BLOGS_SLUG,
     54            'notification_callback' => 'bp_blogs_format_notifications',
     55            'search_string'         => __( 'Search Blogs...', 'buddypress' ),
     56            'autocomplete_all'      => defined( 'BP_MESSAGES_AUTOCOMPLETE_ALL' ),
     57            'global_tables'         => $global_tables,
     58        );
    4559
    46         // Notifications
    47         $this->notification_callback = 'bp_blogs_format_notifications';
    48 
    49         // Register this in the active components array
    50         $bp->active_components[$this->id] = $this->id;
    51 
    52         // The default text for the blogs directory search box
    53         $bp->default_search_strings[$this->id] = __( 'Search Blogs...', 'buddypress' );
     60        // Setup the globals
     61        parent::_setup_globals( $globals );
    5462    }
    5563
     
    5866     */
    5967    function _includes() {
    60         require_once( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-cache.php'        );
    61         require_once( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-classes.php'      );
    62         require_once( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-screens.php'      );
    63         require_once( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-actions.php'      );
    64         require_once( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-activity.php'     );
    65         require_once( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-template.php'     );
    66         require_once( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-functions.php'    );
     68        // Files to include
     69        $includes = array(
     70            'cache',
     71            'actions',
     72            'screens',
     73            'classes',
     74            'template',
     75            'activity',
     76            'functions',
     77        );
    6778
    6879        if ( is_multisite() )
    69             require_once( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-widgets.php' );
     80            $includes[] = 'widgets';
     81
     82        // Include the files
     83        parent::_includes( $includes );
    7084    }
    7185
     
    87101
    88102        // Add 'Blogs' to the main navigation
    89         bp_core_new_nav_item( array(
     103        $main_nav = array(
    90104            'name'                => sprintf( __( 'Blogs <span>(%d)</span>', 'buddypress' ), bp_blogs_total_blogs_for_user() ),
    91105            'slug'                => $this->slug,
     
    94108            'default_subnav_slug' => 'my-blogs',
    95109            'item_css_id'         => $this->id
    96         ) );
     110        );
     111
     112        // Setup navigation
     113        parent::_setup_nav( $main_nav, $sub_nav );
     114    }
     115   
     116    /**
     117     * Sets up the title for pages and <title>
     118     *
     119     * @global obj $bp
     120     */
     121    function _setup_title() {
     122        global $bp;
    97123
    98124        // Set up the component options navigation for Blog
    99         if ( $bp->blogs->slug == $bp->current_component ) {
     125        if ( bp_is_blogs_component() ) {
    100126            if ( bp_is_my_profile() ) {
    101127                if ( function_exists('xprofile_setup_nav') ) {
     
    113139            }
    114140        }
     141
     142        parent::_setup_title();
    115143    }
    116144}
Note: See TracChangeset for help on using the changeset viewer.