-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8a331c
commit 95b41c3
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
// Exit if accessed directly | ||
if ( !defined( 'ABSPATH' ) ) exit; | ||
|
||
/** | ||
* Only load the component if BuddyPress is loaded and initialized. | ||
*/ | ||
function bp_courseware_init() { | ||
// Because our loader file uses BP_Component, it requires BP 1.5 or greater. | ||
if ( version_compare( BP_VERSION, '1.5', '>=' ) ) { | ||
add_action( 'bp_loaded', 'bpsp_courseware_load_core_component' ); | ||
} | ||
} | ||
add_action( 'bp_include', 'bp_courseware_init' ); | ||
|
||
/** | ||
* Loads component into the $bp global | ||
*/ | ||
function bpsp_courseware_load_core_component() { | ||
global $bp; | ||
|
||
require_once BPSP_PLUGIN_DIR . '/component/component.class.php'; | ||
$bp->courseware = new BPSP_Courseware_Component(); | ||
} | ||
|
||
// if BuddyPress is not present, use Ian Dunn's loading procedure | ||
if ( ! is_plugin_active( 'buddypress/bp-loader.php' ) ) { | ||
|
||
/** | ||
* On plugins loaded, mimic the component | ||
*/ | ||
function bpsp_on_plugins_load() { | ||
BPSP_Groups::activate_component(); | ||
} | ||
add_action( 'plugins_loaded', 'bpsp_on_plugins_load', 5 ); | ||
|
||
/* Initiate the componenets */ | ||
function bpsp_init() { | ||
new BPSP_WordPress(); | ||
new BPSP_Roles(); | ||
new BPSP_Groups(); | ||
new BPSP_Courses(); | ||
new BPSP_Lectures(); | ||
new BPSP_Assignments(); | ||
new BPSP_Responses(); | ||
new BPSP_Gradebook(); | ||
new BPSP_Bibliography(); | ||
new BPSP_Schedules(); | ||
new BPSP_Dashboards(); | ||
new BPSP_Static(); | ||
new BPSP_Activity(); | ||
new BPSP_Notifications(); | ||
|
||
// @todo maybe some classes like activity will only be loaded if bp is active b/c they're completely tied to it | ||
} | ||
add_action( 'init', 'bpsp_init', 6 ); | ||
|
||
/** | ||
* Register post types and taxonomies | ||
*/ | ||
function bpsp_registration() { | ||
BPSP_Courses::register_post_types(); | ||
BPSP_Lectures::register_post_types(); | ||
BPSP_Assignments::register_post_types(); | ||
BPSP_Responses::register_post_types(); | ||
BPSP_Gradebook::register_post_types(); | ||
BPSP_Bibliography::register_post_types(); | ||
BPSP_Schedules::register_post_types(); | ||
} | ||
add_action( 'init', 'bpsp_registration' ); | ||
|
||
} |