Completed
Push — master ( 41ac09...b67cca )
by Dwain
05:16
created

woothemes-sensei.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 46 and the first side effect is on line 31.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

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