forked from Automattic/sensei
-
Notifications
You must be signed in to change notification settings - Fork 0
/
woothemes-sensei.php
109 lines (86 loc) · 3.25 KB
/
woothemes-sensei.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
/*
Plugin Name: Sensei
Plugin URI: http://www.woothemes.com/products/sensei/
Description: A course management plugin that offers the smoothest platform for helping you teach anything.
Version: 1.9.2
Author: WooThemes
Author URI: http://www.woothemes.com/
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
Requires at least: 4.1
Tested up to: 4.2
Text Domain: woothemes-sensei
Domain path: /lang/
*/
/* Copyright 2013 WooThemes (email : info@woothemes.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
require_once( 'includes/class-sensei-autoloader.php' );
require_once( 'includes/lib/woo-functions.php' );
require_once( 'includes/sensei-functions.php' );
if ( ! is_admin() ) {
require_once( 'includes/template-functions.php' );
}
/**
* Returns the global Sensei Instance.
*
* @since 1.8.0
*/
function Sensei(){
return Sensei_Main::instance();
}
// set the sensei version number
Sensei()->version = '1.9.2';
//backwards compatibility
global $woothemes_sensei;
$woothemes_sensei = Sensei();
/**
* Hook in WooCommerce functionality
*/
if( Sensei_WC::is_woocommerce_active() ){
add_action('init', array( 'Sensei_WC', 'load_woocommerce_integration_hooks' ) );
}
/**
* Load all Template hooks
*/
if(! is_admin() ){
require_once( 'includes/hooks/template.php' );
}
/**
* Plugin updates
* @since 1.0.1
*/
woothemes_queue_update( plugin_basename( __FILE__ ), 'bad2a02a063555b7e2bee59924690763', 152116 );
/**
* Sensei Activation Hook registration
* @since 1.8.0
*/
register_activation_hook( __FILE__, 'activate_sensei' );
/**
* Activate_sensei
*
* All the activation checks needed to ensure Sensei is ready for use
* @since 1.8.0
*/
function activate_sensei () {
// create the teacher role on activation and ensure that it has all the needed capabilities
Sensei()->teacher->create_role();
//Setup all the role capabilities needed
Sensei()->updates->add_sensei_caps();
Sensei()->updates->add_editor_caps();
Sensei()->updates->assign_role_caps();
//Flush rules
add_action( 'activated_plugin' , array( 'Sensei_Main','activation_flush_rules' ), 10 );
//Load the Welcome Screen
add_action( 'activated_plugin' , array( 'Sensei_Welcome','redirect' ), 20 );
}// end activate_sensei