@@ -1,5 +1,8 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // security check, don't load file outside WP |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
5 | +// security check, don't load file outside WP |
|
3 | 6 | /** |
4 | 7 | * Sensei Autoloader Class |
5 | 8 | * |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // security check, don't load file outside WP |
|
2 | +if ( ! defined('ABSPATH')) exit; // security check, don't load file outside WP |
|
3 | 3 | /** |
4 | 4 | * Sensei Autoloader Class |
5 | 5 | * |
@@ -27,21 +27,21 @@ discard block |
||
27 | 27 | * Constructor |
28 | 28 | * @since 1.9.0 |
29 | 29 | */ |
30 | - public function __construct(){ |
|
30 | + public function __construct() { |
|
31 | 31 | |
32 | 32 | // make sure we do not override an existing autoload function |
33 | - if( function_exists('__autoload') ){ |
|
34 | - spl_autoload_register( '__autoload' ); |
|
33 | + if (function_exists('__autoload')) { |
|
34 | + spl_autoload_register('__autoload'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | // setup a relative path for the current autoload instance |
38 | - $this->include_path = trailingslashit( untrailingslashit( dirname( __FILE__ ) ) ); |
|
38 | + $this->include_path = trailingslashit(untrailingslashit(dirname(__FILE__))); |
|
39 | 39 | |
40 | 40 | //setup the class file map |
41 | 41 | $this->initialize_class_file_map(); |
42 | 42 | |
43 | 43 | // add Sensei custom auto loader |
44 | - spl_autoload_register( array( $this, 'autoload' ) ); |
|
44 | + spl_autoload_register(array($this, 'autoload')); |
|
45 | 45 | |
46 | 46 | } |
47 | 47 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @since 1.9.0 |
53 | 53 | */ |
54 | - public function initialize_class_file_map(){ |
|
54 | + public function initialize_class_file_map() { |
|
55 | 55 | |
56 | 56 | $this->class_file_map = array( |
57 | 57 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | /** |
64 | 64 | * Admin |
65 | 65 | */ |
66 | - 'Sensei_Welcome' => 'admin/class-sensei-welcome.php' , |
|
67 | - 'Sensei_Learner_Management' => 'admin/class-sensei-learner-management.php' , |
|
66 | + 'Sensei_Welcome' => 'admin/class-sensei-welcome.php', |
|
67 | + 'Sensei_Learner_Management' => 'admin/class-sensei-learner-management.php', |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Shortcodes |
@@ -93,38 +93,38 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * Autoload all sensei files as the class names are used. |
95 | 95 | */ |
96 | - public function autoload( $class ){ |
|
96 | + public function autoload($class) { |
|
97 | 97 | |
98 | 98 | // only handle classes with the word `sensei` in it |
99 | - if( ! is_numeric( strpos ( strtolower( $class ), 'sensei') ) ){ |
|
99 | + if ( ! is_numeric(strpos(strtolower($class), 'sensei'))) { |
|
100 | 100 | |
101 | 101 | return; |
102 | 102 | |
103 | 103 | } |
104 | 104 | |
105 | 105 | // exit if we didn't provide mapping for this class |
106 | - if( isset( $this->class_file_map[ $class ] ) ){ |
|
106 | + if (isset($this->class_file_map[$class])) { |
|
107 | 107 | |
108 | - $file_location = $this->include_path . $this->class_file_map[ $class ]; |
|
109 | - require_once( $file_location); |
|
108 | + $file_location = $this->include_path.$this->class_file_map[$class]; |
|
109 | + require_once($file_location); |
|
110 | 110 | return; |
111 | 111 | |
112 | 112 | } |
113 | 113 | |
114 | 114 | // check for file in the main includes directory |
115 | - $class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $class ) ) . '.php'; |
|
116 | - if( file_exists( $class_file_path ) ){ |
|
115 | + $class_file_path = $this->include_path.'class-'.str_replace('_', '-', strtolower($class)).'.php'; |
|
116 | + if (file_exists($class_file_path)) { |
|
117 | 117 | |
118 | - require_once( $class_file_path ); |
|
118 | + require_once($class_file_path); |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | 122 | // lastly check legacy types |
123 | - $stripped_woothemes_from_class = str_replace( 'woothemes_','', strtolower( $class ) ); // remove woothemes |
|
124 | - $legacy_class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $stripped_woothemes_from_class ) ) . '.php'; |
|
125 | - if( file_exists( $legacy_class_file_path ) ){ |
|
123 | + $stripped_woothemes_from_class = str_replace('woothemes_', '', strtolower($class)); // remove woothemes |
|
124 | + $legacy_class_file_path = $this->include_path.'class-'.str_replace('_', '-', strtolower($stripped_woothemes_from_class)).'.php'; |
|
125 | + if (file_exists($legacy_class_file_path)) { |
|
126 | 126 | |
127 | - require_once( $legacy_class_file_path ); |
|
127 | + require_once($legacy_class_file_path); |
|
128 | 128 | return; |
129 | 129 | } |
130 | 130 |
@@ -13,137 +13,137 @@ |
||
13 | 13 | */ |
14 | 14 | class Sensei_Autoloader { |
15 | 15 | |
16 | - /** |
|
17 | - * @var path to the includes directory within Sensei. |
|
18 | - */ |
|
19 | - private $include_path = 'includes'; |
|
20 | - |
|
21 | - /** |
|
22 | - * @var array $class_file_map. List of classes mapped to their files |
|
23 | - */ |
|
24 | - private $class_file_map = array(); |
|
25 | - |
|
26 | - /** |
|
27 | - * Constructor |
|
28 | - * @since 1.9.0 |
|
29 | - */ |
|
30 | - public function __construct(){ |
|
31 | - |
|
32 | - // make sure we do not override an existing autoload function |
|
33 | - if( function_exists('__autoload') ){ |
|
34 | - spl_autoload_register( '__autoload' ); |
|
35 | - } |
|
36 | - |
|
37 | - // setup a relative path for the current autoload instance |
|
38 | - $this->include_path = trailingslashit( untrailingslashit( dirname( __FILE__ ) ) ); |
|
39 | - |
|
40 | - //setup the class file map |
|
41 | - $this->initialize_class_file_map(); |
|
42 | - |
|
43 | - // add Sensei custom auto loader |
|
44 | - spl_autoload_register( array( $this, 'autoload' ) ); |
|
45 | - |
|
46 | - } |
|
47 | - |
|
48 | - /** |
|
49 | - * Generate a list of Sensei class and map them the their respective |
|
50 | - * files within the includes directory |
|
51 | - * |
|
52 | - * @since 1.9.0 |
|
53 | - */ |
|
54 | - public function initialize_class_file_map(){ |
|
55 | - |
|
56 | - $this->class_file_map = array( |
|
57 | - |
|
58 | - /** |
|
59 | - * Main Sensei class |
|
60 | - */ |
|
61 | - 'Sensei_Main' => 'class-sensei.php', |
|
62 | - |
|
63 | - /** |
|
64 | - * Admin |
|
65 | - */ |
|
66 | - 'Sensei_Welcome' => 'admin/class-sensei-welcome.php' , |
|
67 | - 'Sensei_Learner_Management' => 'admin/class-sensei-learner-management.php' , |
|
68 | - |
|
69 | - /** |
|
70 | - * Shortcodes |
|
71 | - */ |
|
72 | - 'Sensei_Shortcode_Loader' => 'shortcodes/class-sensei-shortcode-loader.php', |
|
73 | - 'Sensei_Shortcode_Interface' => 'shortcodes/interface-sensei-shortcode.php', |
|
74 | - 'Sensei_Shortcode_Featured_Courses' => 'shortcodes/class-sensei-shortcode-featured-courses.php', |
|
75 | - 'Sensei_Shortcode_User_Courses' => 'shortcodes/class-sensei-shortcode-user-courses.php', |
|
76 | - 'Sensei_Shortcode_Courses' => 'shortcodes/class-sensei-shortcode-courses.php', |
|
77 | - 'Sensei_Shortcode_Teachers' => 'shortcodes/class-sensei-shortcode-teachers.php', |
|
78 | - 'Sensei_Shortcode_User_Messages' => 'shortcodes/class-sensei-shortcode-user-messages.php', |
|
79 | - 'Sensei_Shortcode_Course_Page' => 'shortcodes/class-sensei-shortcode-course-page.php', |
|
80 | - 'Sensei_Shortcode_Lesson_Page' => 'shortcodes/class-sensei-shortcode-lesson-page.php', |
|
81 | - 'Sensei_Shortcode_Course_Categories' => 'shortcodes/class-sensei-shortcode-course-categories.php', |
|
82 | - 'Sensei_Shortcode_Unpurchased_Courses' => 'shortcodes/class-sensei-shortcode-unpurchased-courses.php', |
|
83 | - 'Sensei_Legacy_Shortcodes' => 'shortcodes/class-sensei-legacy-shortcodes.php', |
|
84 | - |
|
85 | - /** |
|
86 | - * Built in theme integration support |
|
87 | - */ |
|
88 | - 'Sensei_Theme_Integration_Loader' => 'theme-integrations/theme-integration-loader.php', |
|
89 | - 'Sensei__S' => 'theme-integrations/_s.php', |
|
90 | - 'Sensei_Twentyeleven' => 'theme-integrations/twentyeleven.php', |
|
91 | - 'Sensei_Twentytwelve' => 'theme-integrations/twentytwelve.php', |
|
92 | - 'Sensei_Twentythirteen' => 'theme-integrations/Twentythirteen.php', |
|
93 | - 'Sensei_Twentyfourteen' => 'theme-integrations/Twentyfourteen.php', |
|
94 | - 'Sensei_Twentyfifteen' => 'theme-integrations/Twentyfifteen.php', |
|
95 | - 'Sensei_Twentysixteen' => 'theme-integrations/Twentysixteen.php', |
|
96 | - 'Sensei_Storefront' => 'theme-integrations/Storefront.php', |
|
97 | - |
|
98 | - /** |
|
99 | - * WooCommerce |
|
100 | - */ |
|
101 | - 'Sensei_WC' => 'class-sensei-wc.php', |
|
102 | - |
|
103 | - ); |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * Autoload all sensei files as the class names are used. |
|
108 | - */ |
|
109 | - public function autoload( $class ){ |
|
110 | - |
|
111 | - // only handle classes with the word `sensei` in it |
|
112 | - if( ! is_numeric( strpos ( strtolower( $class ), 'sensei') ) ){ |
|
113 | - |
|
114 | - return; |
|
115 | - |
|
116 | - } |
|
117 | - |
|
118 | - // exit if we didn't provide mapping for this class |
|
119 | - if( isset( $this->class_file_map[ $class ] ) ){ |
|
120 | - |
|
121 | - $file_location = $this->include_path . $this->class_file_map[ $class ]; |
|
122 | - require_once( $file_location); |
|
123 | - return; |
|
124 | - |
|
125 | - } |
|
126 | - |
|
127 | - // check for file in the main includes directory |
|
128 | - $class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $class ) ) . '.php'; |
|
129 | - if( file_exists( $class_file_path ) ){ |
|
130 | - |
|
131 | - require_once( $class_file_path ); |
|
132 | - return; |
|
133 | - } |
|
134 | - |
|
135 | - // lastly check legacy types |
|
136 | - $stripped_woothemes_from_class = str_replace( 'woothemes_','', strtolower( $class ) ); // remove woothemes |
|
137 | - $legacy_class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $stripped_woothemes_from_class ) ) . '.php'; |
|
138 | - if( file_exists( $legacy_class_file_path ) ){ |
|
139 | - |
|
140 | - require_once( $legacy_class_file_path ); |
|
141 | - return; |
|
142 | - } |
|
143 | - |
|
144 | - return; |
|
145 | - |
|
146 | - }// end autoload |
|
16 | + /** |
|
17 | + * @var path to the includes directory within Sensei. |
|
18 | + */ |
|
19 | + private $include_path = 'includes'; |
|
20 | + |
|
21 | + /** |
|
22 | + * @var array $class_file_map. List of classes mapped to their files |
|
23 | + */ |
|
24 | + private $class_file_map = array(); |
|
25 | + |
|
26 | + /** |
|
27 | + * Constructor |
|
28 | + * @since 1.9.0 |
|
29 | + */ |
|
30 | + public function __construct(){ |
|
31 | + |
|
32 | + // make sure we do not override an existing autoload function |
|
33 | + if( function_exists('__autoload') ){ |
|
34 | + spl_autoload_register( '__autoload' ); |
|
35 | + } |
|
36 | + |
|
37 | + // setup a relative path for the current autoload instance |
|
38 | + $this->include_path = trailingslashit( untrailingslashit( dirname( __FILE__ ) ) ); |
|
39 | + |
|
40 | + //setup the class file map |
|
41 | + $this->initialize_class_file_map(); |
|
42 | + |
|
43 | + // add Sensei custom auto loader |
|
44 | + spl_autoload_register( array( $this, 'autoload' ) ); |
|
45 | + |
|
46 | + } |
|
47 | + |
|
48 | + /** |
|
49 | + * Generate a list of Sensei class and map them the their respective |
|
50 | + * files within the includes directory |
|
51 | + * |
|
52 | + * @since 1.9.0 |
|
53 | + */ |
|
54 | + public function initialize_class_file_map(){ |
|
55 | + |
|
56 | + $this->class_file_map = array( |
|
57 | + |
|
58 | + /** |
|
59 | + * Main Sensei class |
|
60 | + */ |
|
61 | + 'Sensei_Main' => 'class-sensei.php', |
|
62 | + |
|
63 | + /** |
|
64 | + * Admin |
|
65 | + */ |
|
66 | + 'Sensei_Welcome' => 'admin/class-sensei-welcome.php' , |
|
67 | + 'Sensei_Learner_Management' => 'admin/class-sensei-learner-management.php' , |
|
68 | + |
|
69 | + /** |
|
70 | + * Shortcodes |
|
71 | + */ |
|
72 | + 'Sensei_Shortcode_Loader' => 'shortcodes/class-sensei-shortcode-loader.php', |
|
73 | + 'Sensei_Shortcode_Interface' => 'shortcodes/interface-sensei-shortcode.php', |
|
74 | + 'Sensei_Shortcode_Featured_Courses' => 'shortcodes/class-sensei-shortcode-featured-courses.php', |
|
75 | + 'Sensei_Shortcode_User_Courses' => 'shortcodes/class-sensei-shortcode-user-courses.php', |
|
76 | + 'Sensei_Shortcode_Courses' => 'shortcodes/class-sensei-shortcode-courses.php', |
|
77 | + 'Sensei_Shortcode_Teachers' => 'shortcodes/class-sensei-shortcode-teachers.php', |
|
78 | + 'Sensei_Shortcode_User_Messages' => 'shortcodes/class-sensei-shortcode-user-messages.php', |
|
79 | + 'Sensei_Shortcode_Course_Page' => 'shortcodes/class-sensei-shortcode-course-page.php', |
|
80 | + 'Sensei_Shortcode_Lesson_Page' => 'shortcodes/class-sensei-shortcode-lesson-page.php', |
|
81 | + 'Sensei_Shortcode_Course_Categories' => 'shortcodes/class-sensei-shortcode-course-categories.php', |
|
82 | + 'Sensei_Shortcode_Unpurchased_Courses' => 'shortcodes/class-sensei-shortcode-unpurchased-courses.php', |
|
83 | + 'Sensei_Legacy_Shortcodes' => 'shortcodes/class-sensei-legacy-shortcodes.php', |
|
84 | + |
|
85 | + /** |
|
86 | + * Built in theme integration support |
|
87 | + */ |
|
88 | + 'Sensei_Theme_Integration_Loader' => 'theme-integrations/theme-integration-loader.php', |
|
89 | + 'Sensei__S' => 'theme-integrations/_s.php', |
|
90 | + 'Sensei_Twentyeleven' => 'theme-integrations/twentyeleven.php', |
|
91 | + 'Sensei_Twentytwelve' => 'theme-integrations/twentytwelve.php', |
|
92 | + 'Sensei_Twentythirteen' => 'theme-integrations/Twentythirteen.php', |
|
93 | + 'Sensei_Twentyfourteen' => 'theme-integrations/Twentyfourteen.php', |
|
94 | + 'Sensei_Twentyfifteen' => 'theme-integrations/Twentyfifteen.php', |
|
95 | + 'Sensei_Twentysixteen' => 'theme-integrations/Twentysixteen.php', |
|
96 | + 'Sensei_Storefront' => 'theme-integrations/Storefront.php', |
|
97 | + |
|
98 | + /** |
|
99 | + * WooCommerce |
|
100 | + */ |
|
101 | + 'Sensei_WC' => 'class-sensei-wc.php', |
|
102 | + |
|
103 | + ); |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * Autoload all sensei files as the class names are used. |
|
108 | + */ |
|
109 | + public function autoload( $class ){ |
|
110 | + |
|
111 | + // only handle classes with the word `sensei` in it |
|
112 | + if( ! is_numeric( strpos ( strtolower( $class ), 'sensei') ) ){ |
|
113 | + |
|
114 | + return; |
|
115 | + |
|
116 | + } |
|
117 | + |
|
118 | + // exit if we didn't provide mapping for this class |
|
119 | + if( isset( $this->class_file_map[ $class ] ) ){ |
|
120 | + |
|
121 | + $file_location = $this->include_path . $this->class_file_map[ $class ]; |
|
122 | + require_once( $file_location); |
|
123 | + return; |
|
124 | + |
|
125 | + } |
|
126 | + |
|
127 | + // check for file in the main includes directory |
|
128 | + $class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $class ) ) . '.php'; |
|
129 | + if( file_exists( $class_file_path ) ){ |
|
130 | + |
|
131 | + require_once( $class_file_path ); |
|
132 | + return; |
|
133 | + } |
|
134 | + |
|
135 | + // lastly check legacy types |
|
136 | + $stripped_woothemes_from_class = str_replace( 'woothemes_','', strtolower( $class ) ); // remove woothemes |
|
137 | + $legacy_class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $stripped_woothemes_from_class ) ) . '.php'; |
|
138 | + if( file_exists( $legacy_class_file_path ) ){ |
|
139 | + |
|
140 | + require_once( $legacy_class_file_path ); |
|
141 | + return; |
|
142 | + } |
|
143 | + |
|
144 | + return; |
|
145 | + |
|
146 | + }// end autoload |
|
147 | 147 | |
148 | 148 | } |
149 | 149 | new Sensei_Autoloader(); |
@@ -1,5 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
5 | +// Exit if accessed directly |
|
3 | 6 | |
4 | 7 | /** |
5 | 8 | * Sensei Post Types Class |
@@ -146,7 +149,7 @@ discard block |
||
146 | 149 | |
147 | 150 | return get_page_uri( $settings_course_page->ID ); |
148 | 151 | |
149 | - }else{ |
|
152 | + } else{ |
|
150 | 153 | |
151 | 154 | return 'courses'; |
152 | 155 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
2 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Sensei Post Types Class |
@@ -41,43 +41,43 @@ discard block |
||
41 | 41 | * Constructor |
42 | 42 | * @since 1.0.0 |
43 | 43 | */ |
44 | - public function __construct () { |
|
44 | + public function __construct() { |
|
45 | 45 | |
46 | 46 | // Setup Post Types |
47 | 47 | $this->labels = array(); |
48 | 48 | $this->token = 'woothemes-sensei-posttypes'; |
49 | 49 | |
50 | 50 | $this->setup_post_type_labels_base(); |
51 | - add_action( 'init', array( $this, 'setup_course_post_type' ), 100 ); |
|
52 | - add_action( 'init', array( $this, 'setup_lesson_post_type' ), 100 ); |
|
53 | - add_action( 'init', array( $this, 'setup_quiz_post_type' ), 100 ); |
|
54 | - add_action( 'init', array( $this, 'setup_question_post_type' ), 100 ); |
|
55 | - add_action( 'init', array( $this, 'setup_multiple_question_post_type' ), 100 ); |
|
56 | - add_action( 'init', array( $this, 'setup_sensei_message_post_type' ), 100 ); |
|
51 | + add_action('init', array($this, 'setup_course_post_type'), 100); |
|
52 | + add_action('init', array($this, 'setup_lesson_post_type'), 100); |
|
53 | + add_action('init', array($this, 'setup_quiz_post_type'), 100); |
|
54 | + add_action('init', array($this, 'setup_question_post_type'), 100); |
|
55 | + add_action('init', array($this, 'setup_multiple_question_post_type'), 100); |
|
56 | + add_action('init', array($this, 'setup_sensei_message_post_type'), 100); |
|
57 | 57 | |
58 | 58 | // Setup Taxonomies |
59 | - add_action( 'init', array( $this, 'setup_course_category_taxonomy' ), 100 ); |
|
60 | - add_action( 'init', array( $this, 'setup_quiz_type_taxonomy' ), 100 ); |
|
61 | - add_action( 'init', array( $this, 'setup_question_type_taxonomy' ), 100 ); |
|
62 | - add_action( 'init', array( $this, 'setup_question_category_taxonomy' ), 100 ); |
|
63 | - add_action( 'init', array( $this, 'setup_lesson_tag_taxonomy' ), 100 ); |
|
59 | + add_action('init', array($this, 'setup_course_category_taxonomy'), 100); |
|
60 | + add_action('init', array($this, 'setup_quiz_type_taxonomy'), 100); |
|
61 | + add_action('init', array($this, 'setup_question_type_taxonomy'), 100); |
|
62 | + add_action('init', array($this, 'setup_question_category_taxonomy'), 100); |
|
63 | + add_action('init', array($this, 'setup_lesson_tag_taxonomy'), 100); |
|
64 | 64 | |
65 | 65 | // Load Post Type Objects |
66 | - $default_post_types = array( 'course' => 'Course', 'lesson' => 'Lesson', 'quiz' => 'Quiz', 'question' => 'Question', 'messages' => 'Messages' ) ; |
|
67 | - $this->load_posttype_objects( $default_post_types ); |
|
66 | + $default_post_types = array('course' => 'Course', 'lesson' => 'Lesson', 'quiz' => 'Quiz', 'question' => 'Question', 'messages' => 'Messages'); |
|
67 | + $this->load_posttype_objects($default_post_types); |
|
68 | 68 | |
69 | 69 | // Admin functions |
70 | - if ( is_admin() ) { |
|
71 | - $this->set_role_cap_defaults( $default_post_types ); |
|
70 | + if (is_admin()) { |
|
71 | + $this->set_role_cap_defaults($default_post_types); |
|
72 | 72 | global $pagenow; |
73 | - if ( ( $pagenow == 'post.php' || $pagenow == 'post-new.php' ) ) { |
|
74 | - add_filter( 'enter_title_here', array( $this, 'enter_title_here' ), 10 ); |
|
75 | - add_filter( 'post_updated_messages', array( $this, 'setup_post_type_messages' ) ); |
|
73 | + if (($pagenow == 'post.php' || $pagenow == 'post-new.php')) { |
|
74 | + add_filter('enter_title_here', array($this, 'enter_title_here'), 10); |
|
75 | + add_filter('post_updated_messages', array($this, 'setup_post_type_messages')); |
|
76 | 76 | } // End If Statement |
77 | 77 | } // End If Statement |
78 | 78 | |
79 | 79 | // Add 'Edit Quiz' link to admin bar |
80 | - add_action( 'admin_bar_menu', array( $this, 'quiz_admin_bar_menu' ), 81 ); |
|
80 | + add_action('admin_bar_menu', array($this, 'quiz_admin_bar_menu'), 81); |
|
81 | 81 | |
82 | 82 | } // End __construct() |
83 | 83 | |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | * @param array $posttypes (default: array()) |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function load_posttype_objects( $posttypes = array() ) { |
|
91 | + public function load_posttype_objects($posttypes = array()) { |
|
92 | 92 | |
93 | - foreach ( $posttypes as $posttype_token => $posttype_name ) { |
|
93 | + foreach ($posttypes as $posttype_token => $posttype_name) { |
|
94 | 94 | |
95 | 95 | // Load the files |
96 | - $class_name = 'WooThemes_Sensei_' . $posttype_name; |
|
96 | + $class_name = 'WooThemes_Sensei_'.$posttype_name; |
|
97 | 97 | $this->$posttype_token = new $class_name(); |
98 | 98 | $this->$posttype_token->token = $posttype_token; |
99 | 99 | |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | * @uses Sensei() |
108 | 108 | * @return void |
109 | 109 | */ |
110 | - public function setup_course_post_type () { |
|
110 | + public function setup_course_post_type() { |
|
111 | 111 | |
112 | 112 | $args = array( |
113 | - 'labels' => $this->create_post_type_labels( $this->labels['course']['singular'], $this->labels['course']['plural'], $this->labels['course']['menu'] ), |
|
113 | + 'labels' => $this->create_post_type_labels($this->labels['course']['singular'], $this->labels['course']['plural'], $this->labels['course']['menu']), |
|
114 | 114 | 'public' => true, |
115 | 115 | 'publicly_queryable' => true, |
116 | 116 | 'show_ui' => true, |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | 'show_in_admin_bar' => true, |
119 | 119 | 'query_var' => true, |
120 | 120 | 'rewrite' => array( |
121 | - 'slug' => esc_attr( apply_filters( 'sensei_course_slug', _x( 'course', 'post type single url base', 'woothemes-sensei' ) ) ) , |
|
121 | + 'slug' => esc_attr(apply_filters('sensei_course_slug', _x('course', 'post type single url base', 'woothemes-sensei'))), |
|
122 | 122 | 'with_front' => true, |
123 | 123 | 'feeds' => true, |
124 | 124 | 'pages' => true |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | 'has_archive' => $this->get_course_post_type_archive_slug(), |
129 | 129 | 'hierarchical' => false, |
130 | 130 | 'menu_position' => 51, |
131 | - 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ) |
|
131 | + 'supports' => array('title', 'editor', 'excerpt', 'thumbnail') |
|
132 | 132 | ); |
133 | 133 | |
134 | 134 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @since 1.9.0 |
138 | 138 | * @param array $args |
139 | 139 | */ |
140 | - register_post_type( 'course', apply_filters( 'sensei_register_post_type_course', $args ) ); |
|
140 | + register_post_type('course', apply_filters('sensei_register_post_type_course', $args)); |
|
141 | 141 | |
142 | 142 | } // End setup_course_post_type() |
143 | 143 | |
@@ -156,17 +156,17 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @return false|string |
158 | 158 | */ |
159 | - public function get_course_post_type_archive_slug(){ |
|
159 | + public function get_course_post_type_archive_slug() { |
|
160 | 160 | |
161 | - $settings_course_page = get_post( Sensei()->settings->get( 'course_page' ) ); |
|
161 | + $settings_course_page = get_post(Sensei()->settings->get('course_page')); |
|
162 | 162 | |
163 | 163 | // for a valid post that doesn't have any of the old short codes set the archive the same |
164 | 164 | // as the page URI |
165 | - if( is_a( $settings_course_page, 'WP_Post') && ! $this->has_old_shortcodes( $settings_course_page->post_content ) ){ |
|
165 | + if (is_a($settings_course_page, 'WP_Post') && ! $this->has_old_shortcodes($settings_course_page->post_content)) { |
|
166 | 166 | |
167 | - return get_page_uri( $settings_course_page->ID ); |
|
167 | + return get_page_uri($settings_course_page->ID); |
|
168 | 168 | |
169 | - }else{ |
|
169 | + } else { |
|
170 | 170 | |
171 | 171 | return 'courses'; |
172 | 172 | |
@@ -184,12 +184,12 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @return bool |
186 | 186 | */ |
187 | - public function has_old_shortcodes( $content ){ |
|
187 | + public function has_old_shortcodes($content) { |
|
188 | 188 | |
189 | - return ( has_shortcode( $content, 'newcourses') |
|
190 | - || has_shortcode( $content, 'featuredcourses') |
|
191 | - || has_shortcode( $content, 'freecourses') |
|
192 | - || has_shortcode( $content, 'paidcourses') ); |
|
189 | + return (has_shortcode($content, 'newcourses') |
|
190 | + || has_shortcode($content, 'featuredcourses') |
|
191 | + || has_shortcode($content, 'freecourses') |
|
192 | + || has_shortcode($content, 'paidcourses')); |
|
193 | 193 | |
194 | 194 | }// end has old shortcodes |
195 | 195 | |
@@ -200,27 +200,27 @@ discard block |
||
200 | 200 | * @uses Sensei() |
201 | 201 | * @return void |
202 | 202 | */ |
203 | - public function setup_lesson_post_type () { |
|
203 | + public function setup_lesson_post_type() { |
|
204 | 204 | |
205 | 205 | |
206 | - $supports_array = array( 'title', 'editor', 'excerpt', 'thumbnail', 'page-attributes' ); |
|
206 | + $supports_array = array('title', 'editor', 'excerpt', 'thumbnail', 'page-attributes'); |
|
207 | 207 | $allow_comments = false; |
208 | - if ( isset( Sensei()->settings->settings[ 'lesson_comments' ] ) ) { |
|
209 | - $allow_comments = Sensei()->settings->settings[ 'lesson_comments' ]; |
|
208 | + if (isset(Sensei()->settings->settings['lesson_comments'])) { |
|
209 | + $allow_comments = Sensei()->settings->settings['lesson_comments']; |
|
210 | 210 | } // End If Statement |
211 | - if ( $allow_comments ) { |
|
212 | - array_push( $supports_array, 'comments' ); |
|
211 | + if ($allow_comments) { |
|
212 | + array_push($supports_array, 'comments'); |
|
213 | 213 | } // End If Statement |
214 | 214 | |
215 | 215 | $args = array( |
216 | - 'labels' => $this->create_post_type_labels( $this->labels['lesson']['singular'], $this->labels['lesson']['plural'], $this->labels['lesson']['menu'] ), |
|
216 | + 'labels' => $this->create_post_type_labels($this->labels['lesson']['singular'], $this->labels['lesson']['plural'], $this->labels['lesson']['menu']), |
|
217 | 217 | 'public' => true, |
218 | 218 | 'publicly_queryable' => true, |
219 | 219 | 'show_ui' => true, |
220 | 220 | 'show_in_menu' => true, |
221 | 221 | 'query_var' => true, |
222 | 222 | 'rewrite' => array( |
223 | - 'slug' => esc_attr( apply_filters( 'sensei_lesson_slug', _x( 'lesson', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
223 | + 'slug' => esc_attr(apply_filters('sensei_lesson_slug', _x('lesson', 'post type single slug', 'woothemes-sensei'))), |
|
224 | 224 | 'with_front' => true, |
225 | 225 | 'feeds' => true, |
226 | 226 | 'pages' => true |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * @since 1.9.0 |
240 | 240 | * @param array $args |
241 | 241 | */ |
242 | - register_post_type( 'lesson', apply_filters( 'sensei_register_post_type_lesson', $args ) ); |
|
242 | + register_post_type('lesson', apply_filters('sensei_register_post_type_lesson', $args)); |
|
243 | 243 | |
244 | 244 | } // End setup_lesson_post_type() |
245 | 245 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * @uses Sensei() |
250 | 250 | * @return void |
251 | 251 | */ |
252 | - public function setup_quiz_post_type () { |
|
252 | + public function setup_quiz_post_type() { |
|
253 | 253 | |
254 | 254 | |
255 | 255 | $args = array( |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | 'query_var' => true, |
267 | 267 | 'exclude_from_search' => true, |
268 | 268 | 'rewrite' => array( |
269 | - 'slug' => esc_attr( apply_filters( 'sensei_quiz_slug', _x( 'quiz', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
269 | + 'slug' => esc_attr(apply_filters('sensei_quiz_slug', _x('quiz', 'post type single slug', 'woothemes-sensei'))), |
|
270 | 270 | 'with_front' => true, |
271 | 271 | 'feeds' => true, |
272 | 272 | 'pages' => true |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | 'has_archive' => false, |
277 | 277 | 'hierarchical' => false, |
278 | 278 | 'menu_position' => 20, // Below "Pages" |
279 | - 'supports' => array( '' ) |
|
279 | + 'supports' => array('') |
|
280 | 280 | ); |
281 | 281 | |
282 | 282 | /** |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @since 1.9.0 |
286 | 286 | * @param array $args |
287 | 287 | */ |
288 | - register_post_type( 'quiz', apply_filters( 'sensei_register_post_type_quiz', $args ) ); |
|
288 | + register_post_type('quiz', apply_filters('sensei_register_post_type_quiz', $args)); |
|
289 | 289 | |
290 | 290 | } // End setup_quiz_post_type() |
291 | 291 | |
@@ -295,10 +295,10 @@ discard block |
||
295 | 295 | * @since 1.0.0 |
296 | 296 | * @return void |
297 | 297 | */ |
298 | - public function setup_question_post_type () { |
|
298 | + public function setup_question_post_type() { |
|
299 | 299 | |
300 | 300 | $args = array( |
301 | - 'labels' => $this->create_post_type_labels( $this->labels['question']['singular'], $this->labels['question']['plural'], $this->labels['question']['menu'] ), |
|
301 | + 'labels' => $this->create_post_type_labels($this->labels['question']['singular'], $this->labels['question']['plural'], $this->labels['question']['menu']), |
|
302 | 302 | 'public' => false, |
303 | 303 | 'publicly_queryable' => true, |
304 | 304 | 'show_ui' => true, |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | 'query_var' => true, |
308 | 308 | 'exclude_from_search' => true, |
309 | 309 | 'rewrite' => array( |
310 | - 'slug' => esc_attr( apply_filters( 'sensei_question_slug', _x( 'question', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
310 | + 'slug' => esc_attr(apply_filters('sensei_question_slug', _x('question', 'post type single slug', 'woothemes-sensei'))), |
|
311 | 311 | 'with_front' => true, |
312 | 312 | 'feeds' => true, |
313 | 313 | 'pages' => true |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | 'has_archive' => true, |
318 | 318 | 'hierarchical' => false, |
319 | 319 | 'menu_position' => 51, |
320 | - 'supports' => array( 'title' ) |
|
320 | + 'supports' => array('title') |
|
321 | 321 | ); |
322 | 322 | |
323 | 323 | /** |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @since 1.9.0 |
327 | 327 | * @param array $args |
328 | 328 | */ |
329 | - register_post_type( 'question', apply_filters('sensei_register_post_type_question', $args ) ); |
|
329 | + register_post_type('question', apply_filters('sensei_register_post_type_question', $args)); |
|
330 | 330 | |
331 | 331 | } // End setup_question_post_type() |
332 | 332 | |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | * @since 1.6.0 |
336 | 336 | * @return void |
337 | 337 | */ |
338 | - public function setup_multiple_question_post_type () { |
|
338 | + public function setup_multiple_question_post_type() { |
|
339 | 339 | |
340 | 340 | $args = array( |
341 | - 'labels' => $this->create_post_type_labels( $this->labels['multiple_question']['singular'], $this->labels['multiple_question']['plural'], $this->labels['multiple_question']['menu'] ), |
|
341 | + 'labels' => $this->create_post_type_labels($this->labels['multiple_question']['singular'], $this->labels['multiple_question']['plural'], $this->labels['multiple_question']['menu']), |
|
342 | 342 | 'public' => false, |
343 | 343 | 'publicly_queryable' => false, |
344 | 344 | 'show_ui' => false, |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | 'query_var' => false, |
348 | 348 | 'exclude_from_search' => true, |
349 | 349 | 'rewrite' => array( |
350 | - 'slug' => esc_attr( apply_filters( 'sensei_multiple_question_slug', _x( 'multiple_question', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
350 | + 'slug' => esc_attr(apply_filters('sensei_multiple_question_slug', _x('multiple_question', 'post type single slug', 'woothemes-sensei'))), |
|
351 | 351 | 'with_front' => false, |
352 | 352 | 'feeds' => false, |
353 | 353 | 'pages' => false |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | 'has_archive' => false, |
358 | 358 | 'hierarchical' => false, |
359 | 359 | 'menu_position' => 51, |
360 | - 'supports' => array( 'title', 'custom-fields' ) |
|
360 | + 'supports' => array('title', 'custom-fields') |
|
361 | 361 | ); |
362 | 362 | |
363 | - register_post_type( 'multiple_question', $args ); |
|
363 | + register_post_type('multiple_question', $args); |
|
364 | 364 | } // End setup_multiple_question_post_type() |
365 | 365 | |
366 | 366 | /** |
@@ -368,13 +368,13 @@ discard block |
||
368 | 368 | * @since 1.6.0 |
369 | 369 | * @return void |
370 | 370 | */ |
371 | - public function setup_sensei_message_post_type () { |
|
371 | + public function setup_sensei_message_post_type() { |
|
372 | 372 | |
373 | 373 | |
374 | - if( ! isset( Sensei()->settings->settings['messages_disable'] ) || ! Sensei()->settings->settings['messages_disable'] ) { |
|
374 | + if ( ! isset(Sensei()->settings->settings['messages_disable']) || ! Sensei()->settings->settings['messages_disable']) { |
|
375 | 375 | |
376 | 376 | $args = array( |
377 | - 'labels' => $this->create_post_type_labels( $this->labels['sensei_message']['singular'], $this->labels['sensei_message']['plural'], $this->labels['sensei_message']['menu'] ), |
|
377 | + 'labels' => $this->create_post_type_labels($this->labels['sensei_message']['singular'], $this->labels['sensei_message']['plural'], $this->labels['sensei_message']['menu']), |
|
378 | 378 | 'public' => true, |
379 | 379 | 'publicly_queryable' => true, |
380 | 380 | 'show_ui' => true, |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | 'query_var' => true, |
384 | 384 | 'exclude_from_search' => true, |
385 | 385 | 'rewrite' => array( |
386 | - 'slug' => esc_attr( apply_filters( 'sensei_messages_slug', _x( 'messages', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
386 | + 'slug' => esc_attr(apply_filters('sensei_messages_slug', _x('messages', 'post type single slug', 'woothemes-sensei'))), |
|
387 | 387 | 'with_front' => false, |
388 | 388 | 'feeds' => false, |
389 | 389 | 'pages' => true |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | 'has_archive' => true, |
394 | 394 | 'hierarchical' => false, |
395 | 395 | 'menu_position' => 50, |
396 | - 'supports' => array( 'title', 'editor', 'comments' ), |
|
396 | + 'supports' => array('title', 'editor', 'comments'), |
|
397 | 397 | ); |
398 | 398 | |
399 | 399 | /** |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | * @since 1.9.0 |
403 | 403 | * @param array $args |
404 | 404 | */ |
405 | - register_post_type( 'sensei_message', apply_filters('sensei_register_post_type_sensei_message', $args ) ); |
|
405 | + register_post_type('sensei_message', apply_filters('sensei_register_post_type_sensei_message', $args)); |
|
406 | 406 | } |
407 | 407 | } // End setup_sensei_message_post_type() |
408 | 408 | |
@@ -411,20 +411,20 @@ discard block |
||
411 | 411 | * @since 1.1.0 |
412 | 412 | * @return void |
413 | 413 | */ |
414 | - public function setup_course_category_taxonomy () { |
|
414 | + public function setup_course_category_taxonomy() { |
|
415 | 415 | // "Course Categories" Custom Taxonomy |
416 | 416 | $labels = array( |
417 | - 'name' => _x( 'Course Categories', 'taxonomy general name', 'woothemes-sensei' ), |
|
418 | - 'singular_name' => _x( 'Course Category', 'taxonomy singular name', 'woothemes-sensei' ), |
|
419 | - 'search_items' => __( 'Search Course Categories', 'woothemes-sensei' ), |
|
420 | - 'all_items' => __( 'All Course Categories', 'woothemes-sensei' ), |
|
421 | - 'parent_item' => __( 'Parent Course Category', 'woothemes-sensei' ), |
|
422 | - 'parent_item_colon' => __( 'Parent Course Category:', 'woothemes-sensei' ), |
|
423 | - 'edit_item' => __( 'Edit Course Category', 'woothemes-sensei' ), |
|
424 | - 'update_item' => __( 'Update Course Category', 'woothemes-sensei' ), |
|
425 | - 'add_new_item' => __( 'Add New Course Category', 'woothemes-sensei' ), |
|
426 | - 'new_item_name' => __( 'New Course Category Name', 'woothemes-sensei' ), |
|
427 | - 'menu_name' => __( 'Course Categories', 'woothemes-sensei' ), |
|
417 | + 'name' => _x('Course Categories', 'taxonomy general name', 'woothemes-sensei'), |
|
418 | + 'singular_name' => _x('Course Category', 'taxonomy singular name', 'woothemes-sensei'), |
|
419 | + 'search_items' => __('Search Course Categories', 'woothemes-sensei'), |
|
420 | + 'all_items' => __('All Course Categories', 'woothemes-sensei'), |
|
421 | + 'parent_item' => __('Parent Course Category', 'woothemes-sensei'), |
|
422 | + 'parent_item_colon' => __('Parent Course Category:', 'woothemes-sensei'), |
|
423 | + 'edit_item' => __('Edit Course Category', 'woothemes-sensei'), |
|
424 | + 'update_item' => __('Update Course Category', 'woothemes-sensei'), |
|
425 | + 'add_new_item' => __('Add New Course Category', 'woothemes-sensei'), |
|
426 | + 'new_item_name' => __('New Course Category Name', 'woothemes-sensei'), |
|
427 | + 'menu_name' => __('Course Categories', 'woothemes-sensei'), |
|
428 | 428 | 'popular_items' => null // Hides the "Popular" section above the "add" form in the admin. |
429 | 429 | ); |
430 | 430 | |
@@ -439,10 +439,10 @@ discard block |
||
439 | 439 | 'edit_terms' => 'edit_courses', |
440 | 440 | 'delete_terms' => 'manage_categories', |
441 | 441 | 'assign_terms' => 'edit_courses',), |
442 | - 'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_course_category_slug', _x( 'course-category', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) ) |
|
442 | + 'rewrite' => array('slug' => esc_attr(apply_filters('sensei_course_category_slug', _x('course-category', 'taxonomy archive slug', 'woothemes-sensei')))) |
|
443 | 443 | ); |
444 | 444 | |
445 | - register_taxonomy( 'course-category', array( 'course' ), $args ); |
|
445 | + register_taxonomy('course-category', array('course'), $args); |
|
446 | 446 | |
447 | 447 | } // End setup_course_category_taxonomy() |
448 | 448 | |
@@ -451,20 +451,20 @@ discard block |
||
451 | 451 | * @since 1.0.0 |
452 | 452 | * @return void |
453 | 453 | */ |
454 | - public function setup_quiz_type_taxonomy () { |
|
454 | + public function setup_quiz_type_taxonomy() { |
|
455 | 455 | // "Quiz Types" Custom Taxonomy |
456 | 456 | $labels = array( |
457 | - 'name' => _x( 'Quiz Types', 'taxonomy general name', 'woothemes-sensei' ), |
|
458 | - 'singular_name' => _x( 'Quiz Type', 'taxonomy singular name', 'woothemes-sensei' ), |
|
459 | - 'search_items' => __( 'Search Quiz Types', 'woothemes-sensei' ), |
|
460 | - 'all_items' => __( 'All Quiz Types', 'woothemes-sensei' ), |
|
461 | - 'parent_item' => __( 'Parent Quiz Type', 'woothemes-sensei' ), |
|
462 | - 'parent_item_colon' => __( 'Parent Quiz Type:', 'woothemes-sensei' ), |
|
463 | - 'edit_item' => __( 'Edit Quiz Type', 'woothemes-sensei' ), |
|
464 | - 'update_item' => __( 'Update Quiz Type', 'woothemes-sensei' ), |
|
465 | - 'add_new_item' => __( 'Add New Quiz Type', 'woothemes-sensei' ), |
|
466 | - 'new_item_name' => __( 'New Quiz Type Name', 'woothemes-sensei' ), |
|
467 | - 'menu_name' => __( 'Quiz Types', 'woothemes-sensei' ), |
|
457 | + 'name' => _x('Quiz Types', 'taxonomy general name', 'woothemes-sensei'), |
|
458 | + 'singular_name' => _x('Quiz Type', 'taxonomy singular name', 'woothemes-sensei'), |
|
459 | + 'search_items' => __('Search Quiz Types', 'woothemes-sensei'), |
|
460 | + 'all_items' => __('All Quiz Types', 'woothemes-sensei'), |
|
461 | + 'parent_item' => __('Parent Quiz Type', 'woothemes-sensei'), |
|
462 | + 'parent_item_colon' => __('Parent Quiz Type:', 'woothemes-sensei'), |
|
463 | + 'edit_item' => __('Edit Quiz Type', 'woothemes-sensei'), |
|
464 | + 'update_item' => __('Update Quiz Type', 'woothemes-sensei'), |
|
465 | + 'add_new_item' => __('Add New Quiz Type', 'woothemes-sensei'), |
|
466 | + 'new_item_name' => __('New Quiz Type Name', 'woothemes-sensei'), |
|
467 | + 'menu_name' => __('Quiz Types', 'woothemes-sensei'), |
|
468 | 468 | 'popular_items' => null // Hides the "Popular" section above the "add" form in the admin. |
469 | 469 | ); |
470 | 470 | |
@@ -475,10 +475,10 @@ discard block |
||
475 | 475 | 'query_var' => true, |
476 | 476 | 'show_in_nav_menus' => false, |
477 | 477 | 'public' => false, |
478 | - 'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_quiz_type_slug', _x( 'quiz-type', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) ) |
|
478 | + 'rewrite' => array('slug' => esc_attr(apply_filters('sensei_quiz_type_slug', _x('quiz-type', 'taxonomy archive slug', 'woothemes-sensei')))) |
|
479 | 479 | ); |
480 | 480 | |
481 | - register_taxonomy( 'quiz-type', array( 'quiz' ), $args ); |
|
481 | + register_taxonomy('quiz-type', array('quiz'), $args); |
|
482 | 482 | } // End setup_quiz_type_taxonomy() |
483 | 483 | |
484 | 484 | /** |
@@ -486,20 +486,20 @@ discard block |
||
486 | 486 | * @since 1.3.0 |
487 | 487 | * @return void |
488 | 488 | */ |
489 | - public function setup_question_type_taxonomy () { |
|
489 | + public function setup_question_type_taxonomy() { |
|
490 | 490 | // "Question Types" Custom Taxonomy |
491 | 491 | $labels = array( |
492 | - 'name' => _x( 'Question Types', 'taxonomy general name', 'woothemes-sensei' ), |
|
493 | - 'singular_name' => _x( 'Question Type', 'taxonomy singular name', 'woothemes-sensei' ), |
|
494 | - 'search_items' => __( 'Search Question Types', 'woothemes-sensei' ), |
|
495 | - 'all_items' => __( 'All Question Types', 'woothemes-sensei' ), |
|
496 | - 'parent_item' => __( 'Parent Question Type', 'woothemes-sensei' ), |
|
497 | - 'parent_item_colon' => __( 'Parent Question Type:', 'woothemes-sensei' ), |
|
498 | - 'edit_item' => __( 'Edit Question Type', 'woothemes-sensei' ), |
|
499 | - 'update_item' => __( 'Update Question Type', 'woothemes-sensei' ), |
|
500 | - 'add_new_item' => __( 'Add New Question Type', 'woothemes-sensei' ), |
|
501 | - 'new_item_name' => __( 'New Question Type Name', 'woothemes-sensei' ), |
|
502 | - 'menu_name' => __( 'Question Types', 'woothemes-sensei' ), |
|
492 | + 'name' => _x('Question Types', 'taxonomy general name', 'woothemes-sensei'), |
|
493 | + 'singular_name' => _x('Question Type', 'taxonomy singular name', 'woothemes-sensei'), |
|
494 | + 'search_items' => __('Search Question Types', 'woothemes-sensei'), |
|
495 | + 'all_items' => __('All Question Types', 'woothemes-sensei'), |
|
496 | + 'parent_item' => __('Parent Question Type', 'woothemes-sensei'), |
|
497 | + 'parent_item_colon' => __('Parent Question Type:', 'woothemes-sensei'), |
|
498 | + 'edit_item' => __('Edit Question Type', 'woothemes-sensei'), |
|
499 | + 'update_item' => __('Update Question Type', 'woothemes-sensei'), |
|
500 | + 'add_new_item' => __('Add New Question Type', 'woothemes-sensei'), |
|
501 | + 'new_item_name' => __('New Question Type Name', 'woothemes-sensei'), |
|
502 | + 'menu_name' => __('Question Types', 'woothemes-sensei'), |
|
503 | 503 | 'popular_items' => null // Hides the "Popular" section above the "add" form in the admin. |
504 | 504 | ); |
505 | 505 | |
@@ -511,10 +511,10 @@ discard block |
||
511 | 511 | 'query_var' => false, |
512 | 512 | 'show_in_nav_menus' => false, |
513 | 513 | 'show_admin_column' => true, |
514 | - 'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_question_type_slug', _x( 'question-type', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) ) |
|
514 | + 'rewrite' => array('slug' => esc_attr(apply_filters('sensei_question_type_slug', _x('question-type', 'taxonomy archive slug', 'woothemes-sensei')))) |
|
515 | 515 | ); |
516 | 516 | |
517 | - register_taxonomy( 'question-type', array( 'question' ), $args ); |
|
517 | + register_taxonomy('question-type', array('question'), $args); |
|
518 | 518 | } // End setup_question_type_taxonomy() |
519 | 519 | |
520 | 520 | /** |
@@ -522,20 +522,20 @@ discard block |
||
522 | 522 | * @since 1.3.0 |
523 | 523 | * @return void |
524 | 524 | */ |
525 | - public function setup_question_category_taxonomy () { |
|
525 | + public function setup_question_category_taxonomy() { |
|
526 | 526 | // "Question Categories" Custom Taxonomy |
527 | 527 | $labels = array( |
528 | - 'name' => _x( 'Question Categories', 'taxonomy general name', 'woothemes-sensei' ), |
|
529 | - 'singular_name' => _x( 'Question Category', 'taxonomy singular name', 'woothemes-sensei' ), |
|
530 | - 'search_items' => __( 'Search Question Categories', 'woothemes-sensei' ), |
|
531 | - 'all_items' => __( 'All Question Categories', 'woothemes-sensei' ), |
|
532 | - 'parent_item' => __( 'Parent Question Category', 'woothemes-sensei' ), |
|
533 | - 'parent_item_colon' => __( 'Parent Question Category:', 'woothemes-sensei' ), |
|
534 | - 'edit_item' => __( 'Edit Question Category', 'woothemes-sensei' ), |
|
535 | - 'update_item' => __( 'Update Question Category', 'woothemes-sensei' ), |
|
536 | - 'add_new_item' => __( 'Add New Question Category', 'woothemes-sensei' ), |
|
537 | - 'new_item_name' => __( 'New Question Category Name', 'woothemes-sensei' ), |
|
538 | - 'menu_name' => __( 'Categories', 'woothemes-sensei' ), |
|
528 | + 'name' => _x('Question Categories', 'taxonomy general name', 'woothemes-sensei'), |
|
529 | + 'singular_name' => _x('Question Category', 'taxonomy singular name', 'woothemes-sensei'), |
|
530 | + 'search_items' => __('Search Question Categories', 'woothemes-sensei'), |
|
531 | + 'all_items' => __('All Question Categories', 'woothemes-sensei'), |
|
532 | + 'parent_item' => __('Parent Question Category', 'woothemes-sensei'), |
|
533 | + 'parent_item_colon' => __('Parent Question Category:', 'woothemes-sensei'), |
|
534 | + 'edit_item' => __('Edit Question Category', 'woothemes-sensei'), |
|
535 | + 'update_item' => __('Update Question Category', 'woothemes-sensei'), |
|
536 | + 'add_new_item' => __('Add New Question Category', 'woothemes-sensei'), |
|
537 | + 'new_item_name' => __('New Question Category Name', 'woothemes-sensei'), |
|
538 | + 'menu_name' => __('Categories', 'woothemes-sensei'), |
|
539 | 539 | ); |
540 | 540 | |
541 | 541 | $args = array( |
@@ -551,10 +551,10 @@ discard block |
||
551 | 551 | 'edit_terms' => 'edit_questions', |
552 | 552 | 'delete_terms' => 'manage_categories', |
553 | 553 | 'assign_terms' => 'edit_questions',), |
554 | - 'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_question_category_slug', _x( 'question-category', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) ) |
|
554 | + 'rewrite' => array('slug' => esc_attr(apply_filters('sensei_question_category_slug', _x('question-category', 'taxonomy archive slug', 'woothemes-sensei')))) |
|
555 | 555 | ); |
556 | 556 | |
557 | - register_taxonomy( 'question-category', array( 'question' ), $args ); |
|
557 | + register_taxonomy('question-category', array('question'), $args); |
|
558 | 558 | } // End setup_question_type_taxonomy() |
559 | 559 | |
560 | 560 | /** |
@@ -562,20 +562,20 @@ discard block |
||
562 | 562 | * @since 1.5.0 |
563 | 563 | * @return void |
564 | 564 | */ |
565 | - public function setup_lesson_tag_taxonomy () { |
|
565 | + public function setup_lesson_tag_taxonomy() { |
|
566 | 566 | // "Lesson Tags" Custom Taxonomy |
567 | 567 | $labels = array( |
568 | - 'name' => _x( 'Lesson Tags', 'taxonomy general name', 'woothemes-sensei' ), |
|
569 | - 'singular_name' => _x( 'Lesson Tag', 'taxonomy singular name', 'woothemes-sensei' ), |
|
570 | - 'search_items' => __( 'Search Lesson Tags', 'woothemes-sensei' ), |
|
571 | - 'all_items' => __( 'All Lesson Tags', 'woothemes-sensei' ), |
|
572 | - 'parent_item' => __( 'Parent Tag', 'woothemes-sensei' ), |
|
573 | - 'parent_item_colon' => __( 'Parent Tag:', 'woothemes-sensei' ), |
|
574 | - 'edit_item' => __( 'Edit Lesson Tag', 'woothemes-sensei' ), |
|
575 | - 'update_item' => __( 'Update Lesson Tag', 'woothemes-sensei' ), |
|
576 | - 'add_new_item' => __( 'Add New Lesson Tag', 'woothemes-sensei' ), |
|
577 | - 'new_item_name' => __( 'New Tag Name', 'woothemes-sensei' ), |
|
578 | - 'menu_name' => __( 'Lesson Tags', 'woothemes-sensei' ) |
|
568 | + 'name' => _x('Lesson Tags', 'taxonomy general name', 'woothemes-sensei'), |
|
569 | + 'singular_name' => _x('Lesson Tag', 'taxonomy singular name', 'woothemes-sensei'), |
|
570 | + 'search_items' => __('Search Lesson Tags', 'woothemes-sensei'), |
|
571 | + 'all_items' => __('All Lesson Tags', 'woothemes-sensei'), |
|
572 | + 'parent_item' => __('Parent Tag', 'woothemes-sensei'), |
|
573 | + 'parent_item_colon' => __('Parent Tag:', 'woothemes-sensei'), |
|
574 | + 'edit_item' => __('Edit Lesson Tag', 'woothemes-sensei'), |
|
575 | + 'update_item' => __('Update Lesson Tag', 'woothemes-sensei'), |
|
576 | + 'add_new_item' => __('Add New Lesson Tag', 'woothemes-sensei'), |
|
577 | + 'new_item_name' => __('New Tag Name', 'woothemes-sensei'), |
|
578 | + 'menu_name' => __('Lesson Tags', 'woothemes-sensei') |
|
579 | 579 | ); |
580 | 580 | |
581 | 581 | $args = array( |
@@ -589,10 +589,10 @@ discard block |
||
589 | 589 | 'edit_terms' => 'edit_lessons', |
590 | 590 | 'delete_terms' => 'manage_categories', |
591 | 591 | 'assign_terms' => 'edit_lessons',), |
592 | - 'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_lesson_tag_slug', _x( 'lesson-tag', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) ) |
|
592 | + 'rewrite' => array('slug' => esc_attr(apply_filters('sensei_lesson_tag_slug', _x('lesson-tag', 'taxonomy archive slug', 'woothemes-sensei')))) |
|
593 | 593 | ); |
594 | 594 | |
595 | - register_taxonomy( 'lesson-tag', array( 'lesson' ), $args ); |
|
595 | + register_taxonomy('lesson-tag', array('lesson'), $args); |
|
596 | 596 | } // End setup_lesson_tag_taxonomy() |
597 | 597 | |
598 | 598 | /** |
@@ -600,15 +600,15 @@ discard block |
||
600 | 600 | * @since 1.0.0 |
601 | 601 | * @return void |
602 | 602 | */ |
603 | - private function setup_post_type_labels_base () { |
|
604 | - $this->labels = array( 'course' => array(), 'lesson' => array(), 'quiz' => array(), 'question' => array() ); |
|
603 | + private function setup_post_type_labels_base() { |
|
604 | + $this->labels = array('course' => array(), 'lesson' => array(), 'quiz' => array(), 'question' => array()); |
|
605 | 605 | |
606 | - $this->labels['course'] = array( 'singular' => __( 'Course', 'woothemes-sensei' ), 'plural' => __( 'Courses', 'woothemes-sensei' ), 'menu' => __( 'Courses', 'woothemes-sensei' ) ); |
|
607 | - $this->labels['lesson'] = array( 'singular' => __( 'Lesson', 'woothemes-sensei' ), 'plural' => __( 'Lessons', 'woothemes-sensei' ), 'menu' => __( 'Lessons', 'woothemes-sensei' ) ); |
|
608 | - $this->labels['quiz'] = array( 'singular' => __( 'Quiz', 'woothemes-sensei' ), 'plural' => __( 'Quizzes', 'woothemes-sensei' ), 'menu' => __( 'Quizzes', 'woothemes-sensei' ) ); |
|
609 | - $this->labels['question'] = array( 'singular' => __( 'Question', 'woothemes-sensei' ), 'plural' => __( 'Questions', 'woothemes-sensei' ), 'menu' => __( 'Questions', 'woothemes-sensei' ) ); |
|
610 | - $this->labels['multiple_question'] = array( 'singular' => __( 'Multiple Question', 'woothemes-sensei' ), 'plural' => __( 'Multiple Questions', 'woothemes-sensei' ), 'menu' => __( 'Multiple Questions', 'woothemes-sensei' ) ); |
|
611 | - $this->labels['sensei_message'] = array( 'singular' => __( 'Message', 'woothemes-sensei' ), 'plural' => __( 'Messages', 'woothemes-sensei' ), 'menu' => __( 'Messages', 'woothemes-sensei' ) ); |
|
606 | + $this->labels['course'] = array('singular' => __('Course', 'woothemes-sensei'), 'plural' => __('Courses', 'woothemes-sensei'), 'menu' => __('Courses', 'woothemes-sensei')); |
|
607 | + $this->labels['lesson'] = array('singular' => __('Lesson', 'woothemes-sensei'), 'plural' => __('Lessons', 'woothemes-sensei'), 'menu' => __('Lessons', 'woothemes-sensei')); |
|
608 | + $this->labels['quiz'] = array('singular' => __('Quiz', 'woothemes-sensei'), 'plural' => __('Quizzes', 'woothemes-sensei'), 'menu' => __('Quizzes', 'woothemes-sensei')); |
|
609 | + $this->labels['question'] = array('singular' => __('Question', 'woothemes-sensei'), 'plural' => __('Questions', 'woothemes-sensei'), 'menu' => __('Questions', 'woothemes-sensei')); |
|
610 | + $this->labels['multiple_question'] = array('singular' => __('Multiple Question', 'woothemes-sensei'), 'plural' => __('Multiple Questions', 'woothemes-sensei'), 'menu' => __('Multiple Questions', 'woothemes-sensei')); |
|
611 | + $this->labels['sensei_message'] = array('singular' => __('Message', 'woothemes-sensei'), 'plural' => __('Messages', 'woothemes-sensei'), 'menu' => __('Messages', 'woothemes-sensei')); |
|
612 | 612 | |
613 | 613 | } // End setup_post_type_labels_base() |
614 | 614 | |
@@ -620,21 +620,21 @@ discard block |
||
620 | 620 | * @param string $menu The menu item label |
621 | 621 | * @return array An array of the labels to be used |
622 | 622 | */ |
623 | - private function create_post_type_labels ( $singular, $plural, $menu ) { |
|
623 | + private function create_post_type_labels($singular, $plural, $menu) { |
|
624 | 624 | $labels = array( |
625 | - 'name' => sprintf( _x( '%s', 'post type general name', 'woothemes-sensei' ), $plural ), |
|
626 | - 'singular_name' => sprintf( _x( '%s', 'post type singular name', 'woothemes-sensei' ), $singular ), |
|
627 | - 'add_new' => __( 'Add New', 'woothemes-sensei' ), |
|
628 | - 'add_new_item' => sprintf( __( 'Add New %s', 'woothemes-sensei' ), $singular ), |
|
629 | - 'edit_item' => sprintf( __( 'Edit %s', 'woothemes-sensei' ), $singular ), |
|
630 | - 'new_item' => sprintf( __( 'New %s', 'woothemes-sensei' ), $singular ), |
|
631 | - 'all_items' => sprintf( __( 'All %s', 'woothemes-sensei' ), $plural ), |
|
632 | - 'view_item' => sprintf( __( 'View %s', 'woothemes-sensei' ), $singular ), |
|
633 | - 'search_items' => sprintf( __( 'Search %s', 'woothemes-sensei' ), $plural ), |
|
634 | - 'not_found' => sprintf( __( 'No %s found', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ), |
|
635 | - 'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ), |
|
625 | + 'name' => sprintf(_x('%s', 'post type general name', 'woothemes-sensei'), $plural), |
|
626 | + 'singular_name' => sprintf(_x('%s', 'post type singular name', 'woothemes-sensei'), $singular), |
|
627 | + 'add_new' => __('Add New', 'woothemes-sensei'), |
|
628 | + 'add_new_item' => sprintf(__('Add New %s', 'woothemes-sensei'), $singular), |
|
629 | + 'edit_item' => sprintf(__('Edit %s', 'woothemes-sensei'), $singular), |
|
630 | + 'new_item' => sprintf(__('New %s', 'woothemes-sensei'), $singular), |
|
631 | + 'all_items' => sprintf(__('All %s', 'woothemes-sensei'), $plural), |
|
632 | + 'view_item' => sprintf(__('View %s', 'woothemes-sensei'), $singular), |
|
633 | + 'search_items' => sprintf(__('Search %s', 'woothemes-sensei'), $plural), |
|
634 | + 'not_found' => sprintf(__('No %s found', 'woothemes-sensei'), mb_strtolower($plural, 'UTF-8')), |
|
635 | + 'not_found_in_trash' => sprintf(__('No %s found in Trash', 'woothemes-sensei'), mb_strtolower($plural, 'UTF-8')), |
|
636 | 636 | 'parent_item_colon' => '', |
637 | - 'menu_name' => sprintf( __( '%s', 'woothemes-sensei' ), $menu ) |
|
637 | + 'menu_name' => sprintf(__('%s', 'woothemes-sensei'), $menu) |
|
638 | 638 | ); |
639 | 639 | |
640 | 640 | return $labels; |
@@ -646,14 +646,14 @@ discard block |
||
646 | 646 | * @param array $messages The existing array of messages for post types. |
647 | 647 | * @return array The modified array of messages for post types. |
648 | 648 | */ |
649 | - public function setup_post_type_messages ( $messages ) { |
|
649 | + public function setup_post_type_messages($messages) { |
|
650 | 650 | global $post, $post_ID; |
651 | 651 | |
652 | - $messages['course'] = $this->create_post_type_messages( 'course' ); |
|
653 | - $messages['lesson'] = $this->create_post_type_messages( 'lesson' ); |
|
654 | - $messages['quiz'] = $this->create_post_type_messages( 'quiz' ); |
|
655 | - $messages['question'] = $this->create_post_type_messages( 'question' ); |
|
656 | - $messages['multiple_question'] = $this->create_post_type_messages( 'multiple_question' ); |
|
652 | + $messages['course'] = $this->create_post_type_messages('course'); |
|
653 | + $messages['lesson'] = $this->create_post_type_messages('lesson'); |
|
654 | + $messages['quiz'] = $this->create_post_type_messages('quiz'); |
|
655 | + $messages['question'] = $this->create_post_type_messages('question'); |
|
656 | + $messages['multiple_question'] = $this->create_post_type_messages('multiple_question'); |
|
657 | 657 | |
658 | 658 | return $messages; |
659 | 659 | } // End setup_post_type_messages() |
@@ -664,23 +664,23 @@ discard block |
||
664 | 664 | * @param string $post_type The post type for which to create messages. |
665 | 665 | * @return array An array of messages (empty array if the post type isn't one we're looking to work with). |
666 | 666 | */ |
667 | - private function create_post_type_messages ( $post_type ) { |
|
667 | + private function create_post_type_messages($post_type) { |
|
668 | 668 | global $post, $post_ID; |
669 | 669 | |
670 | - if ( ! isset( $this->labels[$post_type] ) ) { return array(); } |
|
670 | + if ( ! isset($this->labels[$post_type])) { return array(); } |
|
671 | 671 | |
672 | 672 | $messages = array( |
673 | 673 | 0 => '', |
674 | - 1 => sprintf( __( '%1$s updated. %2$sView %1$s%3$s.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'], '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), |
|
675 | - 2 => __( 'Custom field updated.' , 'woothemes-sensei' ), |
|
676 | - 3 => __( 'Custom field deleted.' , 'woothemes-sensei' ), |
|
677 | - 4 => sprintf( __( '%1$s updated.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'] ), |
|
678 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'], wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
679 | - 6 => sprintf( __( '%1$s published. %2$sView %1$s%3$s.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'], '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), |
|
680 | - 7 => sprintf( __( '%1$s saved.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'] ), |
|
681 | - 8 => sprintf( __( '%1$s submitted. %2$sPreview %1$s%3$s.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'], '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) . '">', '</a>' ), |
|
682 | - 9 => sprintf( __( '%1$s scheduled for: %2$s. %3$sPreview %4$s%5$s.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'], '<strong>' . date_i18n( __( 'M j, Y @ G:i' , 'woothemes-sensei' ), strtotime( $post->post_date ) ) . '</strong>', '<a target="_blank" href="' . esc_url( get_permalink( $post_ID ) ) . '">', $this->labels[$post_type]['singular'], '</a>' ), |
|
683 | - 10 => sprintf( __( '%1$s draft updated. %2$sPreview %3$s%4$s.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'], '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) . '">', $this->labels[$post_type]['singular'], '</a>' ), |
|
674 | + 1 => sprintf(__('%1$s updated. %2$sView %1$s%3$s.', 'woothemes-sensei'), $this->labels[$post_type]['singular'], '<a href="'.esc_url(get_permalink($post_ID)).'">', '</a>'), |
|
675 | + 2 => __('Custom field updated.', 'woothemes-sensei'), |
|
676 | + 3 => __('Custom field deleted.', 'woothemes-sensei'), |
|
677 | + 4 => sprintf(__('%1$s updated.', 'woothemes-sensei'), $this->labels[$post_type]['singular']), |
|
678 | + 5 => isset($_GET['revision']) ? sprintf(__('%1$s restored to revision from %2$s.', 'woothemes-sensei'), $this->labels[$post_type]['singular'], wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
679 | + 6 => sprintf(__('%1$s published. %2$sView %1$s%3$s.', 'woothemes-sensei'), $this->labels[$post_type]['singular'], '<a href="'.esc_url(get_permalink($post_ID)).'">', '</a>'), |
|
680 | + 7 => sprintf(__('%1$s saved.', 'woothemes-sensei'), $this->labels[$post_type]['singular']), |
|
681 | + 8 => sprintf(__('%1$s submitted. %2$sPreview %1$s%3$s.', 'woothemes-sensei'), $this->labels[$post_type]['singular'], '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))).'">', '</a>'), |
|
682 | + 9 => sprintf(__('%1$s scheduled for: %2$s. %3$sPreview %4$s%5$s.', 'woothemes-sensei'), $this->labels[$post_type]['singular'], '<strong>'.date_i18n(__('M j, Y @ G:i', 'woothemes-sensei'), strtotime($post->post_date)).'</strong>', '<a target="_blank" href="'.esc_url(get_permalink($post_ID)).'">', $this->labels[$post_type]['singular'], '</a>'), |
|
683 | + 10 => sprintf(__('%1$s draft updated. %2$sPreview %3$s%4$s.', 'woothemes-sensei'), $this->labels[$post_type]['singular'], '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))).'">', $this->labels[$post_type]['singular'], '</a>'), |
|
684 | 684 | ); |
685 | 685 | |
686 | 686 | return $messages; |
@@ -693,11 +693,11 @@ discard block |
||
693 | 693 | * @param string $title |
694 | 694 | * @return string $title |
695 | 695 | */ |
696 | - public function enter_title_here ( $title ) { |
|
697 | - if ( get_post_type() == 'course' ) { |
|
698 | - $title = __( 'Enter a title for this course here', 'woothemes-sensei' ); |
|
699 | - } elseif ( get_post_type() == 'lesson' ) { |
|
700 | - $title = __( 'Enter a title for this lesson here', 'woothemes-sensei' ); |
|
696 | + public function enter_title_here($title) { |
|
697 | + if (get_post_type() == 'course') { |
|
698 | + $title = __('Enter a title for this course here', 'woothemes-sensei'); |
|
699 | + } elseif (get_post_type() == 'lesson') { |
|
700 | + $title = __('Enter a title for this lesson here', 'woothemes-sensei'); |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | return $title; |
@@ -711,60 +711,60 @@ discard block |
||
711 | 711 | * @param array $post_types |
712 | 712 | * @return void |
713 | 713 | */ |
714 | - public function set_role_cap_defaults( $post_types = array() ) { |
|
714 | + public function set_role_cap_defaults($post_types = array()) { |
|
715 | 715 | |
716 | - foreach ( $post_types as $post_type_item => $post_type_name ) { |
|
716 | + foreach ($post_types as $post_type_item => $post_type_name) { |
|
717 | 717 | // Super Admin |
718 | - $this->role_caps[] = array( 'administrator' => array( 'edit_' . $post_type_item, |
|
719 | - 'read_' . $post_type_item, |
|
720 | - 'delete_' . $post_type_item, |
|
721 | - 'create_' . $post_type_item . 's', |
|
722 | - 'edit_' . $post_type_item . 's', |
|
723 | - 'edit_others_' . $post_type_item . 's', |
|
724 | - 'publish_' . $post_type_item . 's', |
|
725 | - 'read_private_' . $post_type_item . 's', |
|
718 | + $this->role_caps[] = array('administrator' => array('edit_'.$post_type_item, |
|
719 | + 'read_'.$post_type_item, |
|
720 | + 'delete_'.$post_type_item, |
|
721 | + 'create_'.$post_type_item.'s', |
|
722 | + 'edit_'.$post_type_item.'s', |
|
723 | + 'edit_others_'.$post_type_item.'s', |
|
724 | + 'publish_'.$post_type_item.'s', |
|
725 | + 'read_private_'.$post_type_item.'s', |
|
726 | 726 | 'read', |
727 | - 'delete_' . $post_type_item . 's', |
|
728 | - 'delete_private_' . $post_type_item . 's', |
|
729 | - 'delete_published_' . $post_type_item . 's', |
|
730 | - 'delete_others_' . $post_type_item . 's', |
|
731 | - 'edit_private_' . $post_type_item . 's', |
|
732 | - 'edit_published_' . $post_type_item . 's', |
|
727 | + 'delete_'.$post_type_item.'s', |
|
728 | + 'delete_private_'.$post_type_item.'s', |
|
729 | + 'delete_published_'.$post_type_item.'s', |
|
730 | + 'delete_others_'.$post_type_item.'s', |
|
731 | + 'edit_private_'.$post_type_item.'s', |
|
732 | + 'edit_published_'.$post_type_item.'s', |
|
733 | 733 | 'manage_sensei', |
734 | - 'manage_sensei_grades' ), |
|
735 | - 'editor' => array( 'edit_' . $post_type_item, |
|
736 | - 'read_' . $post_type_item, |
|
737 | - 'delete_' . $post_type_item, |
|
738 | - 'create_' . $post_type_item . 's', |
|
739 | - 'edit_' . $post_type_item . 's', |
|
740 | - 'edit_others_' . $post_type_item . 's', |
|
741 | - 'publish_' . $post_type_item . 's', |
|
742 | - 'read_private_' . $post_type_item . 's', |
|
734 | + 'manage_sensei_grades'), |
|
735 | + 'editor' => array('edit_'.$post_type_item, |
|
736 | + 'read_'.$post_type_item, |
|
737 | + 'delete_'.$post_type_item, |
|
738 | + 'create_'.$post_type_item.'s', |
|
739 | + 'edit_'.$post_type_item.'s', |
|
740 | + 'edit_others_'.$post_type_item.'s', |
|
741 | + 'publish_'.$post_type_item.'s', |
|
742 | + 'read_private_'.$post_type_item.'s', |
|
743 | 743 | 'read', |
744 | - 'delete_' . $post_type_item . 's', |
|
745 | - 'delete_private_' . $post_type_item . 's', |
|
746 | - 'delete_published_' . $post_type_item . 's', |
|
747 | - 'delete_others_' . $post_type_item . 's', |
|
748 | - 'edit_private_' . $post_type_item . 's', |
|
749 | - 'edit_published_' . $post_type_item . 's' ), |
|
750 | - 'author' => array( 'edit_' . $post_type_item, |
|
751 | - 'read_' . $post_type_item, |
|
752 | - 'delete_' . $post_type_item, |
|
753 | - 'create_' . $post_type_item . 's', |
|
754 | - 'edit_' . $post_type_item . 's', |
|
755 | - 'publish_' . $post_type_item . 's', |
|
744 | + 'delete_'.$post_type_item.'s', |
|
745 | + 'delete_private_'.$post_type_item.'s', |
|
746 | + 'delete_published_'.$post_type_item.'s', |
|
747 | + 'delete_others_'.$post_type_item.'s', |
|
748 | + 'edit_private_'.$post_type_item.'s', |
|
749 | + 'edit_published_'.$post_type_item.'s'), |
|
750 | + 'author' => array('edit_'.$post_type_item, |
|
751 | + 'read_'.$post_type_item, |
|
752 | + 'delete_'.$post_type_item, |
|
753 | + 'create_'.$post_type_item.'s', |
|
754 | + 'edit_'.$post_type_item.'s', |
|
755 | + 'publish_'.$post_type_item.'s', |
|
756 | 756 | 'read', |
757 | - 'delete_' . $post_type_item . 's', |
|
758 | - 'delete_published_' . $post_type_item . 's', |
|
759 | - 'edit_published_' . $post_type_item . 's' ), |
|
760 | - 'contributor' => array( 'edit_' . $post_type_item, |
|
761 | - 'read_' . $post_type_item, |
|
762 | - 'delete_' . $post_type_item, |
|
763 | - 'create_' . $post_type_item . 's', |
|
764 | - 'edit_' . $post_type_item . 's', |
|
757 | + 'delete_'.$post_type_item.'s', |
|
758 | + 'delete_published_'.$post_type_item.'s', |
|
759 | + 'edit_published_'.$post_type_item.'s'), |
|
760 | + 'contributor' => array('edit_'.$post_type_item, |
|
761 | + 'read_'.$post_type_item, |
|
762 | + 'delete_'.$post_type_item, |
|
763 | + 'create_'.$post_type_item.'s', |
|
764 | + 'edit_'.$post_type_item.'s', |
|
765 | 765 | 'read', |
766 | - 'delete_' . $post_type_item . 's' ), |
|
767 | - 'subscriber' => array( 'read' ) |
|
766 | + 'delete_'.$post_type_item.'s'), |
|
767 | + 'subscriber' => array('read') |
|
768 | 768 | |
769 | 769 | ); |
770 | 770 | } // End For Loop |
@@ -778,16 +778,16 @@ discard block |
||
778 | 778 | * @param WP_Admin_Bar $bar |
779 | 779 | * @return void |
780 | 780 | */ |
781 | - public function quiz_admin_bar_menu( $bar ) { |
|
782 | - if ( is_single() && 'quiz' == get_queried_object()->post_type ) { |
|
783 | - $lesson_id = get_post_meta( get_queried_object()->ID, '_quiz_lesson', true ); |
|
784 | - if ( $lesson_id ) { |
|
781 | + public function quiz_admin_bar_menu($bar) { |
|
782 | + if (is_single() && 'quiz' == get_queried_object()->post_type) { |
|
783 | + $lesson_id = get_post_meta(get_queried_object()->ID, '_quiz_lesson', true); |
|
784 | + if ($lesson_id) { |
|
785 | 785 | $object_type = get_post_type_object('quiz'); |
786 | - $bar->add_menu( array( |
|
786 | + $bar->add_menu(array( |
|
787 | 787 | 'id' => 'edit', |
788 | 788 | 'title' => $object_type->labels->edit_item, |
789 | - 'href' => get_edit_post_link( $lesson_id ), |
|
790 | - ) ); |
|
789 | + 'href' => get_edit_post_link($lesson_id), |
|
790 | + )); |
|
791 | 791 | } |
792 | 792 | } |
793 | 793 | } |
@@ -799,4 +799,4 @@ discard block |
||
799 | 799 | * for backward compatibility |
800 | 800 | * @since 1.9.0 |
801 | 801 | */ |
802 | -class WooThemes_Sensei_PostTypes extends Sensei_PostTypes{} |
|
802 | +class WooThemes_Sensei_PostTypes extends Sensei_PostTypes {} |
@@ -16,25 +16,25 @@ discard block |
||
16 | 16 | public $slider_labels; |
17 | 17 | public $role_caps; |
18 | 18 | |
19 | - /** |
|
20 | - * @var Sensei_Course |
|
21 | - */ |
|
22 | - public $course; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var Sensei_Lesson |
|
26 | - */ |
|
27 | - public $lesson; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var Sensei_Question |
|
31 | - */ |
|
32 | - public $question; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var Sensei_Quiz |
|
36 | - */ |
|
37 | - public $quiz; |
|
19 | + /** |
|
20 | + * @var Sensei_Course |
|
21 | + */ |
|
22 | + public $course; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var Sensei_Lesson |
|
26 | + */ |
|
27 | + public $lesson; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var Sensei_Question |
|
31 | + */ |
|
32 | + public $question; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var Sensei_Quiz |
|
36 | + */ |
|
37 | + public $quiz; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Constructor |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | // Setup Post Types |
46 | 46 | $this->labels = array(); |
47 | - $this->token = 'woothemes-sensei-posttypes'; |
|
47 | + $this->token = 'woothemes-sensei-posttypes'; |
|
48 | 48 | |
49 | 49 | $this->setup_post_type_labels_base(); |
50 | 50 | add_action( 'init', array( $this, 'setup_course_post_type' ), 100 ); |
@@ -103,94 +103,94 @@ discard block |
||
103 | 103 | /** |
104 | 104 | * Setup the "course" post type, it's admin menu item and the appropriate labels and permissions. |
105 | 105 | * @since 1.0.0 |
106 | - * @uses Sensei() |
|
106 | + * @uses Sensei() |
|
107 | 107 | * @return void |
108 | 108 | */ |
109 | 109 | public function setup_course_post_type () { |
110 | 110 | |
111 | 111 | $args = array( |
112 | - 'labels' => $this->create_post_type_labels( $this->labels['course']['singular'], $this->labels['course']['plural'], $this->labels['course']['menu'] ), |
|
113 | - 'public' => true, |
|
114 | - 'publicly_queryable' => true, |
|
115 | - 'show_ui' => true, |
|
116 | - 'show_in_menu' => true, |
|
117 | - 'show_in_admin_bar' => true, |
|
118 | - 'query_var' => true, |
|
119 | - 'rewrite' => array( |
|
120 | - 'slug' => esc_attr( apply_filters( 'sensei_course_slug', _x( 'course', 'post type single url base', 'woothemes-sensei' ) ) ) , |
|
121 | - 'with_front' => true, |
|
122 | - 'feeds' => true, |
|
123 | - 'pages' => true |
|
124 | - ), |
|
125 | - 'map_meta_cap' => true, |
|
126 | - 'capability_type' => 'course', |
|
127 | - 'has_archive' => $this->get_course_post_type_archive_slug(), |
|
128 | - 'hierarchical' => false, |
|
129 | - 'menu_position' => 51, |
|
130 | - 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ) |
|
112 | + 'labels' => $this->create_post_type_labels( $this->labels['course']['singular'], $this->labels['course']['plural'], $this->labels['course']['menu'] ), |
|
113 | + 'public' => true, |
|
114 | + 'publicly_queryable' => true, |
|
115 | + 'show_ui' => true, |
|
116 | + 'show_in_menu' => true, |
|
117 | + 'show_in_admin_bar' => true, |
|
118 | + 'query_var' => true, |
|
119 | + 'rewrite' => array( |
|
120 | + 'slug' => esc_attr( apply_filters( 'sensei_course_slug', _x( 'course', 'post type single url base', 'woothemes-sensei' ) ) ) , |
|
121 | + 'with_front' => true, |
|
122 | + 'feeds' => true, |
|
123 | + 'pages' => true |
|
124 | + ), |
|
125 | + 'map_meta_cap' => true, |
|
126 | + 'capability_type' => 'course', |
|
127 | + 'has_archive' => $this->get_course_post_type_archive_slug(), |
|
128 | + 'hierarchical' => false, |
|
129 | + 'menu_position' => 51, |
|
130 | + 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ) |
|
131 | 131 | ); |
132 | 132 | |
133 | - /** |
|
134 | - * Filter the arguments passed in when registering the Sensei Course post type. |
|
135 | - * |
|
136 | - * @since 1.9.0 |
|
137 | - * @param array $args |
|
138 | - */ |
|
133 | + /** |
|
134 | + * Filter the arguments passed in when registering the Sensei Course post type. |
|
135 | + * |
|
136 | + * @since 1.9.0 |
|
137 | + * @param array $args |
|
138 | + */ |
|
139 | 139 | register_post_type( 'course', apply_filters( 'sensei_register_post_type_course', $args ) ); |
140 | 140 | |
141 | 141 | } // End setup_course_post_type() |
142 | 142 | |
143 | - /** |
|
144 | - * Figure out of the course post type has an archive and what it should be. |
|
145 | - * |
|
146 | - * This function should return 'courses' or the page_uri for the course page setting. |
|
147 | - * |
|
148 | - * For backward compatibility sake ( pre 1.9 )If the course page set in settings |
|
149 | - * still has any of the old shortcodes: [newcourses][featuredcourses][freecourses][paidcourses] the |
|
150 | - * page slug will not be returned. For any other pages without it the page URI will be returned. |
|
151 | - * |
|
152 | - * |
|
153 | - * @sine 1.9.0 |
|
154 | - * |
|
155 | - * |
|
156 | - * @return false|string |
|
157 | - */ |
|
158 | - public function get_course_post_type_archive_slug(){ |
|
143 | + /** |
|
144 | + * Figure out of the course post type has an archive and what it should be. |
|
145 | + * |
|
146 | + * This function should return 'courses' or the page_uri for the course page setting. |
|
147 | + * |
|
148 | + * For backward compatibility sake ( pre 1.9 )If the course page set in settings |
|
149 | + * still has any of the old shortcodes: [newcourses][featuredcourses][freecourses][paidcourses] the |
|
150 | + * page slug will not be returned. For any other pages without it the page URI will be returned. |
|
151 | + * |
|
152 | + * |
|
153 | + * @sine 1.9.0 |
|
154 | + * |
|
155 | + * |
|
156 | + * @return false|string |
|
157 | + */ |
|
158 | + public function get_course_post_type_archive_slug(){ |
|
159 | 159 | |
160 | - $settings_course_page = get_post( Sensei()->settings->get( 'course_page' ) ); |
|
160 | + $settings_course_page = get_post( Sensei()->settings->get( 'course_page' ) ); |
|
161 | 161 | |
162 | - // for a valid post that doesn't have any of the old short codes set the archive the same |
|
163 | - // as the page URI |
|
164 | - if( is_a( $settings_course_page, 'WP_Post') && ! $this->has_old_shortcodes( $settings_course_page->post_content ) ){ |
|
162 | + // for a valid post that doesn't have any of the old short codes set the archive the same |
|
163 | + // as the page URI |
|
164 | + if( is_a( $settings_course_page, 'WP_Post') && ! $this->has_old_shortcodes( $settings_course_page->post_content ) ){ |
|
165 | 165 | |
166 | - return get_page_uri( $settings_course_page->ID ); |
|
166 | + return get_page_uri( $settings_course_page->ID ); |
|
167 | 167 | |
168 | - }else{ |
|
168 | + }else{ |
|
169 | 169 | |
170 | - return 'courses'; |
|
170 | + return 'courses'; |
|
171 | 171 | |
172 | - } |
|
172 | + } |
|
173 | 173 | |
174 | - }// end course_post_type_determine_archive |
|
174 | + }// end course_post_type_determine_archive |
|
175 | 175 | |
176 | - /** |
|
177 | - * Check if given content has any of these old shortcodes: |
|
178 | - * [newcourses][featuredcourses][freecourses][paidcourses] |
|
179 | - * |
|
180 | - * @since 1.9.0 |
|
181 | - * |
|
182 | - * @param string $content |
|
183 | - * |
|
184 | - * @return bool |
|
185 | - */ |
|
186 | - public function has_old_shortcodes( $content ){ |
|
176 | + /** |
|
177 | + * Check if given content has any of these old shortcodes: |
|
178 | + * [newcourses][featuredcourses][freecourses][paidcourses] |
|
179 | + * |
|
180 | + * @since 1.9.0 |
|
181 | + * |
|
182 | + * @param string $content |
|
183 | + * |
|
184 | + * @return bool |
|
185 | + */ |
|
186 | + public function has_old_shortcodes( $content ){ |
|
187 | 187 | |
188 | - return ( has_shortcode( $content, 'newcourses') |
|
189 | - || has_shortcode( $content, 'featuredcourses') |
|
190 | - || has_shortcode( $content, 'freecourses') |
|
191 | - || has_shortcode( $content, 'paidcourses') ); |
|
188 | + return ( has_shortcode( $content, 'newcourses') |
|
189 | + || has_shortcode( $content, 'featuredcourses') |
|
190 | + || has_shortcode( $content, 'freecourses') |
|
191 | + || has_shortcode( $content, 'paidcourses') ); |
|
192 | 192 | |
193 | - }// end has old shortcodes |
|
193 | + }// end has old shortcodes |
|
194 | 194 | |
195 | 195 | |
196 | 196 | /** |
@@ -211,32 +211,32 @@ discard block |
||
211 | 211 | } // End If Statement |
212 | 212 | |
213 | 213 | $args = array( |
214 | - 'labels' => $this->create_post_type_labels( $this->labels['lesson']['singular'], $this->labels['lesson']['plural'], $this->labels['lesson']['menu'] ), |
|
215 | - 'public' => true, |
|
216 | - 'publicly_queryable' => true, |
|
217 | - 'show_ui' => true, |
|
218 | - 'show_in_menu' => true, |
|
219 | - 'query_var' => true, |
|
220 | - 'rewrite' => array( |
|
221 | - 'slug' => esc_attr( apply_filters( 'sensei_lesson_slug', _x( 'lesson', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
222 | - 'with_front' => true, |
|
223 | - 'feeds' => true, |
|
224 | - 'pages' => true |
|
225 | - ), |
|
226 | - 'map_meta_cap' => true, |
|
227 | - 'capability_type' => 'lesson', |
|
228 | - 'has_archive' => true, |
|
229 | - 'hierarchical' => false, |
|
230 | - 'menu_position' => 52, |
|
231 | - 'supports' => $supports_array |
|
214 | + 'labels' => $this->create_post_type_labels( $this->labels['lesson']['singular'], $this->labels['lesson']['plural'], $this->labels['lesson']['menu'] ), |
|
215 | + 'public' => true, |
|
216 | + 'publicly_queryable' => true, |
|
217 | + 'show_ui' => true, |
|
218 | + 'show_in_menu' => true, |
|
219 | + 'query_var' => true, |
|
220 | + 'rewrite' => array( |
|
221 | + 'slug' => esc_attr( apply_filters( 'sensei_lesson_slug', _x( 'lesson', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
222 | + 'with_front' => true, |
|
223 | + 'feeds' => true, |
|
224 | + 'pages' => true |
|
225 | + ), |
|
226 | + 'map_meta_cap' => true, |
|
227 | + 'capability_type' => 'lesson', |
|
228 | + 'has_archive' => true, |
|
229 | + 'hierarchical' => false, |
|
230 | + 'menu_position' => 52, |
|
231 | + 'supports' => $supports_array |
|
232 | 232 | ); |
233 | 233 | |
234 | - /** |
|
235 | - * Filter the arguments passed in when registering the Sensei Lesson post type. |
|
236 | - * |
|
237 | - * @since 1.9.0 |
|
238 | - * @param array $args |
|
239 | - */ |
|
234 | + /** |
|
235 | + * Filter the arguments passed in when registering the Sensei Lesson post type. |
|
236 | + * |
|
237 | + * @since 1.9.0 |
|
238 | + * @param array $args |
|
239 | + */ |
|
240 | 240 | register_post_type( 'lesson', apply_filters( 'sensei_register_post_type_lesson', $args ) ); |
241 | 241 | |
242 | 242 | } // End setup_lesson_post_type() |
@@ -244,44 +244,44 @@ discard block |
||
244 | 244 | /** |
245 | 245 | * Setup the "quiz" post type, it's admin menu item and the appropriate labels and permissions. |
246 | 246 | * @since 1.0.0 |
247 | - * @uses Sensei() |
|
247 | + * @uses Sensei() |
|
248 | 248 | * @return void |
249 | 249 | */ |
250 | 250 | public function setup_quiz_post_type () { |
251 | 251 | |
252 | 252 | $args = array( |
253 | - 'labels' => $this->create_post_type_labels( |
|
254 | - $this->labels['quiz']['singular'], |
|
255 | - $this->labels['quiz']['plural'], |
|
256 | - $this->labels['quiz']['menu'] |
|
257 | - ), |
|
258 | - 'public' => true, |
|
259 | - 'publicly_queryable' => true, |
|
260 | - 'show_ui' => true, |
|
261 | - 'show_in_menu' => false, |
|
262 | - 'show_in_nav_menus' => false, |
|
263 | - 'query_var' => true, |
|
264 | - 'exclude_from_search' => true, |
|
265 | - 'rewrite' => array( |
|
266 | - 'slug' => esc_attr( apply_filters( 'sensei_quiz_slug', _x( 'quiz', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
267 | - 'with_front' => true, |
|
268 | - 'feeds' => true, |
|
269 | - 'pages' => true |
|
270 | - ), |
|
271 | - 'map_meta_cap' => true, |
|
272 | - 'capability_type' => 'quiz', |
|
273 | - 'has_archive' => false, |
|
274 | - 'hierarchical' => false, |
|
275 | - 'menu_position' => 20, // Below "Pages" |
|
276 | - 'supports' => array( '' ) |
|
253 | + 'labels' => $this->create_post_type_labels( |
|
254 | + $this->labels['quiz']['singular'], |
|
255 | + $this->labels['quiz']['plural'], |
|
256 | + $this->labels['quiz']['menu'] |
|
257 | + ), |
|
258 | + 'public' => true, |
|
259 | + 'publicly_queryable' => true, |
|
260 | + 'show_ui' => true, |
|
261 | + 'show_in_menu' => false, |
|
262 | + 'show_in_nav_menus' => false, |
|
263 | + 'query_var' => true, |
|
264 | + 'exclude_from_search' => true, |
|
265 | + 'rewrite' => array( |
|
266 | + 'slug' => esc_attr( apply_filters( 'sensei_quiz_slug', _x( 'quiz', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
267 | + 'with_front' => true, |
|
268 | + 'feeds' => true, |
|
269 | + 'pages' => true |
|
270 | + ), |
|
271 | + 'map_meta_cap' => true, |
|
272 | + 'capability_type' => 'quiz', |
|
273 | + 'has_archive' => false, |
|
274 | + 'hierarchical' => false, |
|
275 | + 'menu_position' => 20, // Below "Pages" |
|
276 | + 'supports' => array( '' ) |
|
277 | 277 | ); |
278 | 278 | |
279 | - /** |
|
280 | - * Filter the arguments passed in when registering the Sensei Quiz post type. |
|
281 | - * |
|
282 | - * @since 1.9.0 |
|
283 | - * @param array $args |
|
284 | - */ |
|
279 | + /** |
|
280 | + * Filter the arguments passed in when registering the Sensei Quiz post type. |
|
281 | + * |
|
282 | + * @since 1.9.0 |
|
283 | + * @param array $args |
|
284 | + */ |
|
285 | 285 | register_post_type( 'quiz', apply_filters( 'sensei_register_post_type_quiz', $args ) ); |
286 | 286 | |
287 | 287 | } // End setup_quiz_post_type() |
@@ -295,34 +295,34 @@ discard block |
||
295 | 295 | public function setup_question_post_type () { |
296 | 296 | |
297 | 297 | $args = array( |
298 | - 'labels' => $this->create_post_type_labels( $this->labels['question']['singular'], $this->labels['question']['plural'], $this->labels['question']['menu'] ), |
|
299 | - 'public' => false, |
|
300 | - 'publicly_queryable' => true, |
|
301 | - 'show_ui' => true, |
|
302 | - 'show_in_menu' => true, |
|
303 | - 'show_in_nav_menus' => false, |
|
304 | - 'query_var' => true, |
|
305 | - 'exclude_from_search' => true, |
|
306 | - 'rewrite' => array( |
|
307 | - 'slug' => esc_attr( apply_filters( 'sensei_question_slug', _x( 'question', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
308 | - 'with_front' => true, |
|
309 | - 'feeds' => true, |
|
310 | - 'pages' => true |
|
311 | - ), |
|
312 | - 'map_meta_cap' => true, |
|
313 | - 'capability_type' => 'question', |
|
314 | - 'has_archive' => true, |
|
315 | - 'hierarchical' => false, |
|
316 | - 'menu_position' => 51, |
|
317 | - 'supports' => array( 'title' ) |
|
298 | + 'labels' => $this->create_post_type_labels( $this->labels['question']['singular'], $this->labels['question']['plural'], $this->labels['question']['menu'] ), |
|
299 | + 'public' => false, |
|
300 | + 'publicly_queryable' => true, |
|
301 | + 'show_ui' => true, |
|
302 | + 'show_in_menu' => true, |
|
303 | + 'show_in_nav_menus' => false, |
|
304 | + 'query_var' => true, |
|
305 | + 'exclude_from_search' => true, |
|
306 | + 'rewrite' => array( |
|
307 | + 'slug' => esc_attr( apply_filters( 'sensei_question_slug', _x( 'question', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
308 | + 'with_front' => true, |
|
309 | + 'feeds' => true, |
|
310 | + 'pages' => true |
|
311 | + ), |
|
312 | + 'map_meta_cap' => true, |
|
313 | + 'capability_type' => 'question', |
|
314 | + 'has_archive' => true, |
|
315 | + 'hierarchical' => false, |
|
316 | + 'menu_position' => 51, |
|
317 | + 'supports' => array( 'title' ) |
|
318 | 318 | ); |
319 | 319 | |
320 | - /** |
|
321 | - * Filter the arguments passed in when registering the Sensei Question post type. |
|
322 | - * |
|
323 | - * @since 1.9.0 |
|
324 | - * @param array $args |
|
325 | - */ |
|
320 | + /** |
|
321 | + * Filter the arguments passed in when registering the Sensei Question post type. |
|
322 | + * |
|
323 | + * @since 1.9.0 |
|
324 | + * @param array $args |
|
325 | + */ |
|
326 | 326 | register_post_type( 'question', apply_filters('sensei_register_post_type_question', $args ) ); |
327 | 327 | |
328 | 328 | } // End setup_question_post_type() |
@@ -335,26 +335,26 @@ discard block |
||
335 | 335 | public function setup_multiple_question_post_type () { |
336 | 336 | |
337 | 337 | $args = array( |
338 | - 'labels' => $this->create_post_type_labels( $this->labels['multiple_question']['singular'], $this->labels['multiple_question']['plural'], $this->labels['multiple_question']['menu'] ), |
|
339 | - 'public' => false, |
|
340 | - 'publicly_queryable' => false, |
|
341 | - 'show_ui' => false, |
|
342 | - 'show_in_menu' => false, |
|
343 | - 'show_in_nav_menus' => false, |
|
344 | - 'query_var' => false, |
|
345 | - 'exclude_from_search' => true, |
|
346 | - 'rewrite' => array( |
|
347 | - 'slug' => esc_attr( apply_filters( 'sensei_multiple_question_slug', _x( 'multiple_question', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
348 | - 'with_front' => false, |
|
349 | - 'feeds' => false, |
|
350 | - 'pages' => false |
|
351 | - ), |
|
352 | - 'map_meta_cap' => true, |
|
353 | - 'capability_type' => 'question', |
|
354 | - 'has_archive' => false, |
|
355 | - 'hierarchical' => false, |
|
356 | - 'menu_position' => 51, |
|
357 | - 'supports' => array( 'title', 'custom-fields' ) |
|
338 | + 'labels' => $this->create_post_type_labels( $this->labels['multiple_question']['singular'], $this->labels['multiple_question']['plural'], $this->labels['multiple_question']['menu'] ), |
|
339 | + 'public' => false, |
|
340 | + 'publicly_queryable' => false, |
|
341 | + 'show_ui' => false, |
|
342 | + 'show_in_menu' => false, |
|
343 | + 'show_in_nav_menus' => false, |
|
344 | + 'query_var' => false, |
|
345 | + 'exclude_from_search' => true, |
|
346 | + 'rewrite' => array( |
|
347 | + 'slug' => esc_attr( apply_filters( 'sensei_multiple_question_slug', _x( 'multiple_question', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
348 | + 'with_front' => false, |
|
349 | + 'feeds' => false, |
|
350 | + 'pages' => false |
|
351 | + ), |
|
352 | + 'map_meta_cap' => true, |
|
353 | + 'capability_type' => 'question', |
|
354 | + 'has_archive' => false, |
|
355 | + 'hierarchical' => false, |
|
356 | + 'menu_position' => 51, |
|
357 | + 'supports' => array( 'title', 'custom-fields' ) |
|
358 | 358 | ); |
359 | 359 | |
360 | 360 | register_post_type( 'multiple_question', $args ); |
@@ -370,34 +370,34 @@ discard block |
||
370 | 370 | if( ! isset( Sensei()->settings->settings['messages_disable'] ) || ! Sensei()->settings->settings['messages_disable'] ) { |
371 | 371 | |
372 | 372 | $args = array( |
373 | - 'labels' => $this->create_post_type_labels( $this->labels['sensei_message']['singular'], $this->labels['sensei_message']['plural'], $this->labels['sensei_message']['menu'] ), |
|
374 | - 'public' => true, |
|
375 | - 'publicly_queryable' => true, |
|
376 | - 'show_ui' => true, |
|
377 | - 'show_in_menu' => 'admin.php?page=sensei', |
|
378 | - 'show_in_nav_menus' => true, |
|
379 | - 'query_var' => true, |
|
380 | - 'exclude_from_search' => true, |
|
381 | - 'rewrite' => array( |
|
382 | - 'slug' => esc_attr( apply_filters( 'sensei_messages_slug', _x( 'messages', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
383 | - 'with_front' => false, |
|
384 | - 'feeds' => false, |
|
385 | - 'pages' => true |
|
386 | - ), |
|
387 | - 'map_meta_cap' => true, |
|
388 | - 'capability_type' => 'question', |
|
389 | - 'has_archive' => true, |
|
390 | - 'hierarchical' => false, |
|
391 | - 'menu_position' => 50, |
|
392 | - 'supports' => array( 'title', 'editor', 'comments' ), |
|
373 | + 'labels' => $this->create_post_type_labels( $this->labels['sensei_message']['singular'], $this->labels['sensei_message']['plural'], $this->labels['sensei_message']['menu'] ), |
|
374 | + 'public' => true, |
|
375 | + 'publicly_queryable' => true, |
|
376 | + 'show_ui' => true, |
|
377 | + 'show_in_menu' => 'admin.php?page=sensei', |
|
378 | + 'show_in_nav_menus' => true, |
|
379 | + 'query_var' => true, |
|
380 | + 'exclude_from_search' => true, |
|
381 | + 'rewrite' => array( |
|
382 | + 'slug' => esc_attr( apply_filters( 'sensei_messages_slug', _x( 'messages', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
383 | + 'with_front' => false, |
|
384 | + 'feeds' => false, |
|
385 | + 'pages' => true |
|
386 | + ), |
|
387 | + 'map_meta_cap' => true, |
|
388 | + 'capability_type' => 'question', |
|
389 | + 'has_archive' => true, |
|
390 | + 'hierarchical' => false, |
|
391 | + 'menu_position' => 50, |
|
392 | + 'supports' => array( 'title', 'editor', 'comments' ), |
|
393 | 393 | ); |
394 | 394 | |
395 | - /** |
|
396 | - * Filter the arguments passed in when registering the Sensei sensei_message post type. |
|
397 | - * |
|
398 | - * @since 1.9.0 |
|
399 | - * @param array $args |
|
400 | - */ |
|
395 | + /** |
|
396 | + * Filter the arguments passed in when registering the Sensei sensei_message post type. |
|
397 | + * |
|
398 | + * @since 1.9.0 |
|
399 | + * @param array $args |
|
400 | + */ |
|
401 | 401 | register_post_type( 'sensei_message', apply_filters('sensei_register_post_type_sensei_message', $args ) ); |
402 | 402 | } |
403 | 403 | } // End setup_sensei_message_post_type() |
@@ -430,11 +430,11 @@ discard block |
||
430 | 430 | 'show_ui' => true, |
431 | 431 | 'query_var' => true, |
432 | 432 | 'show_in_nav_menus' => true, |
433 | - 'capabilities' => array( |
|
434 | - 'manage_terms' => 'manage_categories', |
|
435 | - 'edit_terms' => 'edit_courses', |
|
436 | - 'delete_terms' => 'manage_categories', |
|
437 | - 'assign_terms' => 'edit_courses',), |
|
433 | + 'capabilities' => array( |
|
434 | + 'manage_terms' => 'manage_categories', |
|
435 | + 'edit_terms' => 'edit_courses', |
|
436 | + 'delete_terms' => 'manage_categories', |
|
437 | + 'assign_terms' => 'edit_courses',), |
|
438 | 438 | 'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_course_category_slug', _x( 'course-category', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) ) |
439 | 439 | ); |
440 | 440 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | 'show_ui' => true, /* TO DO - future releases */ |
472 | 472 | 'query_var' => true, |
473 | 473 | 'show_in_nav_menus' => false, |
474 | - 'public' => false, |
|
474 | + 'public' => false, |
|
475 | 475 | 'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_quiz_type_slug', _x( 'quiz-type', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) ) |
476 | 476 | ); |
477 | 477 | |
@@ -544,11 +544,11 @@ discard block |
||
544 | 544 | 'query_var' => false, |
545 | 545 | 'show_in_nav_menus' => false, |
546 | 546 | 'show_admin_column' => true, |
547 | - 'capabilities' => array( |
|
548 | - 'manage_terms' => 'manage_categories', |
|
549 | - 'edit_terms' => 'edit_questions', |
|
550 | - 'delete_terms' => 'manage_categories', |
|
551 | - 'assign_terms' => 'edit_questions',), |
|
547 | + 'capabilities' => array( |
|
548 | + 'manage_terms' => 'manage_categories', |
|
549 | + 'edit_terms' => 'edit_questions', |
|
550 | + 'delete_terms' => 'manage_categories', |
|
551 | + 'assign_terms' => 'edit_questions',), |
|
552 | 552 | 'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_question_category_slug', _x( 'question-category', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) ) |
553 | 553 | ); |
554 | 554 | |
@@ -582,11 +582,11 @@ discard block |
||
582 | 582 | 'show_ui' => true, |
583 | 583 | 'query_var' => true, |
584 | 584 | 'show_in_nav_menus' => true, |
585 | - 'capabilities' => array( |
|
586 | - 'manage_terms' => 'manage_categories', |
|
587 | - 'edit_terms' => 'edit_lessons', |
|
588 | - 'delete_terms' => 'manage_categories', |
|
589 | - 'assign_terms' => 'edit_lessons',), |
|
585 | + 'capabilities' => array( |
|
586 | + 'manage_terms' => 'manage_categories', |
|
587 | + 'edit_terms' => 'edit_lessons', |
|
588 | + 'delete_terms' => 'manage_categories', |
|
589 | + 'assign_terms' => 'edit_lessons',), |
|
590 | 590 | 'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_lesson_tag_slug', _x( 'lesson-tag', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) ) |
591 | 591 | ); |
592 | 592 | |
@@ -620,19 +620,19 @@ discard block |
||
620 | 620 | */ |
621 | 621 | private function create_post_type_labels ( $singular, $plural, $menu ) { |
622 | 622 | $labels = array( |
623 | - 'name' => sprintf( _x( '%s', 'post type general name', 'woothemes-sensei' ), $plural ), |
|
624 | - 'singular_name' => sprintf( _x( '%s', 'post type singular name', 'woothemes-sensei' ), $singular ), |
|
625 | - 'add_new' => __( 'Add New', 'woothemes-sensei' ), |
|
626 | - 'add_new_item' => sprintf( __( 'Add New %s', 'woothemes-sensei' ), $singular ), |
|
627 | - 'edit_item' => sprintf( __( 'Edit %s', 'woothemes-sensei' ), $singular ), |
|
628 | - 'new_item' => sprintf( __( 'New %s', 'woothemes-sensei' ), $singular ), |
|
629 | - 'all_items' => sprintf( __( 'All %s', 'woothemes-sensei' ), $plural ), |
|
630 | - 'view_item' => sprintf( __( 'View %s', 'woothemes-sensei' ), $singular ), |
|
631 | - 'search_items' => sprintf( __( 'Search %s', 'woothemes-sensei' ), $plural ), |
|
632 | - 'not_found' => sprintf( __( 'No %s found', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ), |
|
633 | - 'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ), |
|
634 | - 'parent_item_colon' => '', |
|
635 | - 'menu_name' => sprintf( __( '%s', 'woothemes-sensei' ), $menu ) |
|
623 | + 'name' => sprintf( _x( '%s', 'post type general name', 'woothemes-sensei' ), $plural ), |
|
624 | + 'singular_name' => sprintf( _x( '%s', 'post type singular name', 'woothemes-sensei' ), $singular ), |
|
625 | + 'add_new' => __( 'Add New', 'woothemes-sensei' ), |
|
626 | + 'add_new_item' => sprintf( __( 'Add New %s', 'woothemes-sensei' ), $singular ), |
|
627 | + 'edit_item' => sprintf( __( 'Edit %s', 'woothemes-sensei' ), $singular ), |
|
628 | + 'new_item' => sprintf( __( 'New %s', 'woothemes-sensei' ), $singular ), |
|
629 | + 'all_items' => sprintf( __( 'All %s', 'woothemes-sensei' ), $plural ), |
|
630 | + 'view_item' => sprintf( __( 'View %s', 'woothemes-sensei' ), $singular ), |
|
631 | + 'search_items' => sprintf( __( 'Search %s', 'woothemes-sensei' ), $plural ), |
|
632 | + 'not_found' => sprintf( __( 'No %s found', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ), |
|
633 | + 'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ), |
|
634 | + 'parent_item_colon' => '', |
|
635 | + 'menu_name' => sprintf( __( '%s', 'woothemes-sensei' ), $menu ) |
|
636 | 636 | ); |
637 | 637 | |
638 | 638 | return $labels; |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | * Assigns the defaults for each user role capabilities. |
706 | 706 | * |
707 | 707 | * @since 1.1.0 |
708 | - * |
|
708 | + * |
|
709 | 709 | * @param array $post_types |
710 | 710 | * @return void |
711 | 711 | */ |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | * Adds a 'Edit Quiz' link to the admin bar when viewing a Quiz linked to a corresponding Lesson |
774 | 774 | * |
775 | 775 | * @since 1.7.0 |
776 | - * @param WP_Admin_Bar $bar |
|
776 | + * @param WP_Admin_Bar $bar |
|
777 | 777 | * @return void |
778 | 778 | */ |
779 | 779 | public function quiz_admin_bar_menu( $bar ) { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
2 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Sensei Notices Class |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @since 1.6.3 |
14 | 14 | */ |
15 | 15 | |
16 | -class Sensei_Notices{ |
|
16 | +class Sensei_Notices { |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @var $notices |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * constructor |
25 | 25 | */ |
26 | - public function __construct(){ |
|
26 | + public function __construct() { |
|
27 | 27 | //initialize the notices variable |
28 | 28 | $this->notices = array(); |
29 | 29 | } |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @return void |
40 | 40 | */ |
41 | 41 | |
42 | - public function add_notice( $content , $type = 'alert' ){ |
|
42 | + public function add_notice($content, $type = 'alert') { |
|
43 | 43 | // append the new notice |
44 | - $this->notices[] = array('content' => $content , 'type'=> $type ); |
|
44 | + $this->notices[] = array('content' => $content, 'type'=> $type); |
|
45 | 45 | } // end add_notice() |
46 | 46 | |
47 | 47 | /** |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | * @return void |
54 | 54 | */ |
55 | 55 | |
56 | - public function print_notices(){ |
|
57 | - if( count( $this->notices ) > 0 ){ |
|
56 | + public function print_notices() { |
|
57 | + if (count($this->notices) > 0) { |
|
58 | 58 | foreach ($this->notices as $notice) { |
59 | 59 | |
60 | - $classes = 'sensei-message '. $notice['type']; |
|
61 | - $html = '<div class="'. $classes . '">'. $notice['content'] . '</div>'; |
|
60 | + $classes = 'sensei-message '.$notice['type']; |
|
61 | + $html = '<div class="'.$classes.'">'.$notice['content'].'</div>'; |
|
62 | 62 | |
63 | 63 | echo $html; |
64 | 64 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return void |
74 | 74 | */ |
75 | 75 | |
76 | - public function clear_notices(){ |
|
76 | + public function clear_notices() { |
|
77 | 77 | // assign an empty array to clear all existing notices |
78 | 78 | $this->notices = array(); |
79 | 79 | } // end clear_notices() |
@@ -85,4 +85,4 @@ discard block |
||
85 | 85 | * for backward compatibility |
86 | 86 | * @since 1.9.0 |
87 | 87 | */ |
88 | -class Woothemes_Sensei_Notices extends Sensei_Notices{} |
|
88 | +class Woothemes_Sensei_Notices extends Sensei_Notices {} |
@@ -1,5 +1,8 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
5 | +// Exit if accessed directly |
|
3 | 6 | |
4 | 7 | /** |
5 | 8 | * Sensei Analysis User Profile List Table Class |
@@ -33,10 +33,6 @@ discard block |
||
33 | 33 | * |
34 | 34 | * |
35 | 35 | * |
36 | - * @param string $message |
|
37 | - * @param string $type defaults to alert options( alert, tick , download , info ) |
|
38 | - * |
|
39 | - * @return void |
|
40 | 36 | */ |
41 | 37 | |
42 | 38 | public function add_notice( $content , $type = 'alert' ){ |
@@ -47,10 +43,6 @@ discard block |
||
47 | 43 | /** |
48 | 44 | * Output all notices added |
49 | 45 | * |
50 | - * @param string $message |
|
51 | - * @param string $type |
|
52 | - * |
|
53 | - * @return void |
|
54 | 46 | */ |
55 | 47 | |
56 | 48 | public function print_notices(){ |
@@ -16,28 +16,28 @@ discard block |
||
16 | 16 | class Sensei_Notices{ |
17 | 17 | |
18 | 18 | /** |
19 | - * @var $notices |
|
20 | - */ |
|
19 | + * @var $notices |
|
20 | + */ |
|
21 | 21 | protected $notices; |
22 | 22 | |
23 | 23 | /** |
24 | - * constructor |
|
25 | - */ |
|
24 | + * constructor |
|
25 | + */ |
|
26 | 26 | public function __construct(){ |
27 | 27 | //initialize the notices variable |
28 | 28 | $this->notices = array(); |
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | - * Add a notice to the array of notices for display at a later stage. |
|
33 | - * |
|
34 | - * |
|
35 | - * |
|
36 | - * @param string $message |
|
37 | - * @param string $type defaults to alert options( alert, tick , download , info ) |
|
38 | - * |
|
39 | - * @return void |
|
40 | - */ |
|
32 | + * Add a notice to the array of notices for display at a later stage. |
|
33 | + * |
|
34 | + * |
|
35 | + * |
|
36 | + * @param string $message |
|
37 | + * @param string $type defaults to alert options( alert, tick , download , info ) |
|
38 | + * |
|
39 | + * @return void |
|
40 | + */ |
|
41 | 41 | |
42 | 42 | public function add_notice( $content , $type = 'alert' ){ |
43 | 43 | // append the new notice |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | } // end add_notice() |
46 | 46 | |
47 | 47 | /** |
48 | - * Output all notices added |
|
49 | - * |
|
50 | - * @param string $message |
|
51 | - * @param string $type |
|
52 | - * |
|
53 | - * @return void |
|
54 | - */ |
|
48 | + * Output all notices added |
|
49 | + * |
|
50 | + * @param string $message |
|
51 | + * @param string $type |
|
52 | + * |
|
53 | + * @return void |
|
54 | + */ |
|
55 | 55 | |
56 | 56 | public function print_notices(){ |
57 | 57 | if( count( $this->notices ) > 0 ){ |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | } // end print_notice() |
69 | 69 | |
70 | 70 | /** |
71 | - * Clear all notices |
|
72 | - * |
|
73 | - * @return void |
|
74 | - */ |
|
71 | + * Clear all notices |
|
72 | + * |
|
73 | + * @return void |
|
74 | + */ |
|
75 | 75 | |
76 | 76 | public function clear_notices(){ |
77 | 77 | // assign an empty array to clear all existing notices |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
3 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
4 | 4 | |
5 | -if ( ! class_exists( 'WooThemes_Sensei_Email_Teacher_Completed_Lesson' ) ) : |
|
5 | +if ( ! class_exists('WooThemes_Sensei_Email_Teacher_Completed_Lesson')) : |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Teacher Completed Lesson |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function __construct() { |
33 | 33 | $this->template = 'teacher-completed-lesson'; |
34 | - $this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] Your student has completed a lesson', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template ); |
|
35 | - $this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has completed a lesson', 'woothemes-sensei' ), $this->template ); |
|
34 | + $this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] Your student has completed a lesson', 'woothemes-sensei'), get_bloginfo('name')), $this->template); |
|
35 | + $this->heading = apply_filters('sensei_email_heading', __('Your student has completed a lesson', 'woothemes-sensei'), $this->template); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -41,31 +41,31 @@ discard block |
||
41 | 41 | * @access public |
42 | 42 | * @return void |
43 | 43 | */ |
44 | - function trigger( $learner_id = 0, $lesson_id = 0 ) { |
|
44 | + function trigger($learner_id = 0, $lesson_id = 0) { |
|
45 | 45 | global $sensei_email_data; |
46 | 46 | |
47 | 47 | // Get learner user object |
48 | - $this->learner = new WP_User( $learner_id ); |
|
48 | + $this->learner = new WP_User($learner_id); |
|
49 | 49 | |
50 | 50 | // Get teacher ID and user object |
51 | - $teacher_id = get_post_field( 'post_author', $lesson_id, 'raw' ); |
|
52 | - $this->teacher = new WP_User( $teacher_id ); |
|
51 | + $teacher_id = get_post_field('post_author', $lesson_id, 'raw'); |
|
52 | + $this->teacher = new WP_User($teacher_id); |
|
53 | 53 | |
54 | 54 | // Construct data array |
55 | - $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
55 | + $sensei_email_data = apply_filters('sensei_email_data', array( |
|
56 | 56 | 'template' => $this->template, |
57 | 57 | 'heading' => $this->heading, |
58 | 58 | 'teacher_id' => $teacher_id, |
59 | 59 | 'learner_id' => $learner_id, |
60 | 60 | 'learner_name' => $this->learner->display_name, |
61 | 61 | 'lesson_id' => $lesson_id, |
62 | - ), $this->template ); |
|
62 | + ), $this->template); |
|
63 | 63 | |
64 | 64 | // Set recipient (teacher) |
65 | - $this->recipient = stripslashes( $this->teacher->user_email ); |
|
65 | + $this->recipient = stripslashes($this->teacher->user_email); |
|
66 | 66 | |
67 | 67 | // Send mail |
68 | - Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) ); |
|
68 | + Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template)); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 |
@@ -1,5 +1,8 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
5 | +// Exit if accessed directly |
|
3 | 6 | |
4 | 7 | /** |
5 | 8 | * Sensei Analysis User Profile List Table Class |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * trigger function. |
37 | 37 | * |
38 | - * @param int $learner_id |
|
39 | - * @param int $lesson_id |
|
40 | - * |
|
38 | + * @param int $learner_id |
|
39 | + * @param int $lesson_id |
|
40 | + * |
|
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | function trigger( $learner_id = 0, $lesson_id = 0 ) { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $teacher_id = get_post_field( 'post_author', $lesson_id, 'raw' ); |
52 | 52 | $this->teacher = new WP_User( $teacher_id ); |
53 | 53 | |
54 | - // Construct data array |
|
54 | + // Construct data array |
|
55 | 55 | $sensei_email_data = apply_filters( 'sensei_email_data', array( |
56 | 56 | 'template' => $this->template, |
57 | 57 | 'heading' => $this->heading, |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $this->recipient = stripslashes( $this->teacher->user_email ); |
66 | 66 | |
67 | 67 | // Send mail |
68 | - Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) ); |
|
68 | + Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) ); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
3 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
4 | 4 | |
5 | -if ( ! class_exists( 'WooThemes_Sensei_Email_Teacher_Quiz_Submitted' ) ) : |
|
5 | +if ( ! class_exists('WooThemes_Sensei_Email_Teacher_Quiz_Submitted')) : |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Teacher Quiz Submitted |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function __construct() { |
33 | 33 | $this->template = 'teacher-quiz-submitted'; |
34 | - $this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] Your student has submitted a quiz for grading', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template ); |
|
35 | - $this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has submitted a quiz for grading', 'woothemes-sensei' ), $this->template ); |
|
34 | + $this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] Your student has submitted a quiz for grading', 'woothemes-sensei'), get_bloginfo('name')), $this->template); |
|
35 | + $this->heading = apply_filters('sensei_email_heading', __('Your student has submitted a quiz for grading', 'woothemes-sensei'), $this->template); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | * @access public |
42 | 42 | * @return void |
43 | 43 | */ |
44 | - function trigger( $learner_id = 0, $quiz_id = 0 ) { |
|
44 | + function trigger($learner_id = 0, $quiz_id = 0) { |
|
45 | 45 | global $sensei_email_data; |
46 | 46 | |
47 | 47 | // Get learner user object |
48 | - $this->learner = new WP_User( $learner_id ); |
|
48 | + $this->learner = new WP_User($learner_id); |
|
49 | 49 | |
50 | 50 | // Get teacher ID and user object |
51 | - $lesson_id = get_post_meta( $quiz_id, '_quiz_lesson', true ); |
|
52 | - $course_id = get_post_meta( $lesson_id, '_lesson_course', true ); |
|
53 | - $teacher_id = get_post_field( 'post_author', $course_id, 'raw' ); |
|
54 | - $this->teacher = new WP_User( $teacher_id ); |
|
51 | + $lesson_id = get_post_meta($quiz_id, '_quiz_lesson', true); |
|
52 | + $course_id = get_post_meta($lesson_id, '_lesson_course', true); |
|
53 | + $teacher_id = get_post_field('post_author', $course_id, 'raw'); |
|
54 | + $this->teacher = new WP_User($teacher_id); |
|
55 | 55 | |
56 | 56 | // Construct data array |
57 | - $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
57 | + $sensei_email_data = apply_filters('sensei_email_data', array( |
|
58 | 58 | 'template' => $this->template, |
59 | 59 | 'heading' => $this->heading, |
60 | 60 | 'teacher_id' => $teacher_id, |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | 'learner_name' => $this->learner->display_name, |
63 | 63 | 'quiz_id' => $quiz_id, |
64 | 64 | 'lesson_id' => $lesson_id, |
65 | - ), $this->template ); |
|
65 | + ), $this->template); |
|
66 | 66 | |
67 | 67 | // Set recipient (teacher) |
68 | - $this->recipient = stripslashes( $this->teacher->user_email ); |
|
68 | + $this->recipient = stripslashes($this->teacher->user_email); |
|
69 | 69 | |
70 | 70 | // Send mail |
71 | - Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) ); |
|
71 | + Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template)); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 |
@@ -1,5 +1,8 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
5 | +// Exit if accessed directly |
|
3 | 6 | |
4 | 7 | /** |
5 | 8 | * Sensei Analysis User Profile List Table Class |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | |
35 | 35 | /** |
36 | 36 | * trigger function. |
37 | - * |
|
38 | - * @param integer $learner_id |
|
39 | - * @param integer $quiz_id |
|
40 | - * |
|
37 | + * |
|
38 | + * @param integer $learner_id |
|
39 | + * @param integer $quiz_id |
|
40 | + * |
|
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | function trigger( $learner_id = 0, $quiz_id = 0 ) { |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | $this->learner = new WP_User( $learner_id ); |
48 | 48 | |
49 | 49 | // Get teacher ID and user object |
50 | - $lesson_id = get_post_meta( $quiz_id, '_quiz_lesson', true ); |
|
51 | - $course_id = get_post_meta( $lesson_id, '_lesson_course', true ); |
|
50 | + $lesson_id = get_post_meta( $quiz_id, '_quiz_lesson', true ); |
|
51 | + $course_id = get_post_meta( $lesson_id, '_lesson_course', true ); |
|
52 | 52 | $teacher_id = get_post_field( 'post_author', $course_id, 'raw' ); |
53 | 53 | $this->teacher = new WP_User( $teacher_id ); |
54 | 54 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
3 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
4 | 4 | |
5 | -if ( ! class_exists( 'WooThemes_Sensei_Email_Teacher_New_Message' ) ) : |
|
5 | +if ( ! class_exists('WooThemes_Sensei_Email_Teacher_New_Message')) : |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Teacher New Message |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | */ |
33 | 33 | function __construct() { |
34 | 34 | $this->template = 'teacher-new-message'; |
35 | - $this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] You have received a new private message', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template ); |
|
36 | - $this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has sent you a private message', 'woothemes-sensei' ), $this->template ); |
|
35 | + $this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] You have received a new private message', 'woothemes-sensei'), get_bloginfo('name')), $this->template); |
|
36 | + $this->heading = apply_filters('sensei_email_heading', __('Your student has sent you a private message', 'woothemes-sensei'), $this->template); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -42,29 +42,29 @@ discard block |
||
42 | 42 | * @access public |
43 | 43 | * @return void |
44 | 44 | */ |
45 | - function trigger( $message_id = 0 ) { |
|
45 | + function trigger($message_id = 0) { |
|
46 | 46 | global $sensei_email_data; |
47 | 47 | |
48 | - $this->message = get_post( $message_id ); |
|
48 | + $this->message = get_post($message_id); |
|
49 | 49 | |
50 | - $learner_username = get_post_meta( $message_id, '_sender', true ); |
|
51 | - $this->learner = get_user_by( 'login', $learner_username ); |
|
50 | + $learner_username = get_post_meta($message_id, '_sender', true); |
|
51 | + $this->learner = get_user_by('login', $learner_username); |
|
52 | 52 | |
53 | - $teacher_username = get_post_meta( $message_id, '_receiver', true ); |
|
54 | - $this->teacher = get_user_by( 'login', $teacher_username ); |
|
53 | + $teacher_username = get_post_meta($message_id, '_receiver', true); |
|
54 | + $this->teacher = get_user_by('login', $teacher_username); |
|
55 | 55 | |
56 | - $content_type = get_post_meta( $message_id, '_posttype', true ); |
|
57 | - $content_id = get_post_meta( $message_id, '_post', true ); |
|
58 | - $content_title = get_the_title( $content_id ); |
|
56 | + $content_type = get_post_meta($message_id, '_posttype', true); |
|
57 | + $content_id = get_post_meta($message_id, '_post', true); |
|
58 | + $content_title = get_the_title($content_id); |
|
59 | 59 | |
60 | 60 | // setup the post type parameter |
61 | - $content_type = get_post_type( $content_id ); |
|
62 | - if( !$content_type ){ |
|
63 | - $content_type =''; |
|
61 | + $content_type = get_post_type($content_id); |
|
62 | + if ( ! $content_type) { |
|
63 | + $content_type = ''; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | // Construct data array |
67 | - $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
67 | + $sensei_email_data = apply_filters('sensei_email_data', array( |
|
68 | 68 | 'template' => $this->template, |
69 | 69 | $content_type.'_id' => $content_id, |
70 | 70 | 'heading' => $this->heading, |
@@ -75,15 +75,15 @@ discard block |
||
75 | 75 | 'message' => $this->message->post_content, |
76 | 76 | 'content_title' => $content_title, |
77 | 77 | 'content_type' => $content_type, |
78 | - ), $this->template ); |
|
78 | + ), $this->template); |
|
79 | 79 | |
80 | 80 | // Set recipient (teacher) |
81 | - $this->recipient = stripslashes( $this->teacher->user_email ); |
|
81 | + $this->recipient = stripslashes($this->teacher->user_email); |
|
82 | 82 | |
83 | 83 | // Send mail |
84 | - Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) ); |
|
84 | + Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template)); |
|
85 | 85 | |
86 | - wp_safe_redirect( esc_url_raw( add_query_arg( array( 'send' => 'complete' ) ) ) ); |
|
86 | + wp_safe_redirect(esc_url_raw(add_query_arg(array('send' => 'complete')))); |
|
87 | 87 | exit; |
88 | 88 | } |
89 | 89 | } |
@@ -1,5 +1,8 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
5 | +// Exit if accessed directly |
|
3 | 6 | |
4 | 7 | /** |
5 | 8 | * Sensei Analysis User Profile List Table Class |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * trigger function. |
38 | 38 | * |
39 | 39 | * @access public |
40 | - * @param integer $message_id |
|
40 | + * @param integer $message_id |
|
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | function trigger( $message_id = 0 ) { |
@@ -55,16 +55,16 @@ discard block |
||
55 | 55 | $content_id = get_post_meta( $message_id, '_post', true ); |
56 | 56 | $content_title = get_the_title( $content_id ); |
57 | 57 | |
58 | - // setup the post type parameter |
|
59 | - $content_type = get_post_type( $content_id ); |
|
60 | - if( !$content_type ){ |
|
61 | - $content_type =''; |
|
62 | - } |
|
58 | + // setup the post type parameter |
|
59 | + $content_type = get_post_type( $content_id ); |
|
60 | + if( !$content_type ){ |
|
61 | + $content_type =''; |
|
62 | + } |
|
63 | 63 | |
64 | 64 | // Construct data array |
65 | 65 | $sensei_email_data = apply_filters( 'sensei_email_data', array( |
66 | 66 | 'template' => $this->template, |
67 | - $content_type.'_id' => $content_id, |
|
67 | + $content_type.'_id' => $content_id, |
|
68 | 68 | 'heading' => $this->heading, |
69 | 69 | 'teacher_id' => $this->teacher->ID, |
70 | 70 | 'learner_id' => $this->learner->ID, |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
3 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
4 | 4 | |
5 | -if ( ! class_exists( 'WooThemes_Sensei_Email_Teacher_Started_Course' ) ) : |
|
5 | +if ( ! class_exists('WooThemes_Sensei_Email_Teacher_Started_Course')) : |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Teacher Started Course |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function __construct() { |
33 | 33 | $this->template = 'teacher-started-course'; |
34 | - $this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] Your student has started a course', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template ); |
|
35 | - $this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has started a course', 'woothemes-sensei' ), $this->template ); |
|
34 | + $this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] Your student has started a course', 'woothemes-sensei'), get_bloginfo('name')), $this->template); |
|
35 | + $this->heading = apply_filters('sensei_email_heading', __('Your student has started a course', 'woothemes-sensei'), $this->template); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -41,31 +41,31 @@ discard block |
||
41 | 41 | * @access public |
42 | 42 | * @return void |
43 | 43 | */ |
44 | - function trigger( $learner_id = 0, $course_id = 0 ) { |
|
44 | + function trigger($learner_id = 0, $course_id = 0) { |
|
45 | 45 | global $sensei_email_data; |
46 | 46 | |
47 | 47 | // Get learner user object |
48 | - $this->learner = new WP_User( $learner_id ); |
|
48 | + $this->learner = new WP_User($learner_id); |
|
49 | 49 | |
50 | 50 | // Get teacher ID and user object |
51 | - $teacher_id = get_post_field( 'post_author', $course_id, 'raw' ); |
|
52 | - $this->teacher = new WP_User( $teacher_id ); |
|
51 | + $teacher_id = get_post_field('post_author', $course_id, 'raw'); |
|
52 | + $this->teacher = new WP_User($teacher_id); |
|
53 | 53 | |
54 | 54 | // Construct data array |
55 | - $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
55 | + $sensei_email_data = apply_filters('sensei_email_data', array( |
|
56 | 56 | 'template' => $this->template, |
57 | 57 | 'heading' => $this->heading, |
58 | 58 | 'teacher_id' => $teacher_id, |
59 | 59 | 'learner_id' => $learner_id, |
60 | 60 | 'learner_name' => $this->learner->display_name, |
61 | 61 | 'course_id' => $course_id, |
62 | - ), $this->template ); |
|
62 | + ), $this->template); |
|
63 | 63 | |
64 | 64 | // Set recipient (learner) |
65 | - $this->recipient = stripslashes( $this->teacher->user_email ); |
|
65 | + $this->recipient = stripslashes($this->teacher->user_email); |
|
66 | 66 | |
67 | 67 | // Send mail |
68 | - Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) ); |
|
68 | + Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template)); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 |
@@ -1,5 +1,8 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
5 | +// Exit if accessed directly |
|
3 | 6 | |
4 | 7 | /** |
5 | 8 | * Sensei Analysis User Profile List Table Class |
@@ -37,9 +37,9 @@ |
||
37 | 37 | /** |
38 | 38 | * trigger function. |
39 | 39 | * |
40 | - * @param int $learner_id |
|
41 | - * @param int $course_id |
|
42 | - * |
|
40 | + * @param int $learner_id |
|
41 | + * @param int $course_id |
|
42 | + * |
|
43 | 43 | * @return void |
44 | 44 | */ |
45 | 45 | function trigger( $learner_id = 0, $course_id = 0 ) { |
@@ -1,5 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
5 | +// Exit if accessed directly |
|
3 | 6 | |
4 | 7 | /** |
5 | 8 | * Sensei Analysis Class |
@@ -153,24 +156,19 @@ discard block |
||
153 | 156 | if ( 0 < $lesson_id ) { |
154 | 157 | // Viewing a specific Lesson and all its Learners |
155 | 158 | $this->analysis_lesson_users_view( $lesson_id ); |
156 | - } |
|
157 | - elseif ( 0 < $course_id && !$user_id && 'user' == $type ) { |
|
159 | + } elseif ( 0 < $course_id && !$user_id && 'user' == $type ) { |
|
158 | 160 | // Viewing a specific Course and all its Learners |
159 | 161 | $this->analysis_course_users_view( $course_id ); |
160 | - } |
|
161 | - elseif ( 0 < $course_id && 0 < $user_id ) { |
|
162 | + } elseif ( 0 < $course_id && 0 < $user_id ) { |
|
162 | 163 | // Viewing a specific Learner on a specific Course, showing their Lessons |
163 | 164 | $this->analysis_user_course_view( $course_id, $user_id ); |
164 | - } |
|
165 | - elseif( 0 < $course_id ) { |
|
165 | + } elseif( 0 < $course_id ) { |
|
166 | 166 | // Viewing a specific Course and all it's Lessons |
167 | 167 | $this->analysis_course_view( $course_id ); |
168 | - } |
|
169 | - elseif ( 0 < $user_id ) { |
|
168 | + } elseif ( 0 < $user_id ) { |
|
170 | 169 | // Viewing a specific Learner, and their Courses |
171 | 170 | $this->analysis_user_profile_view( $user_id ); |
172 | - } |
|
173 | - else { |
|
171 | + } else { |
|
174 | 172 | // Overview of all Learners, all Courses, or all Lessons |
175 | 173 | $this->analysis_default_view( $type ); |
176 | 174 | } // End If Statement |
@@ -569,20 +567,16 @@ discard block |
||
569 | 567 | if ( 0 < $lesson_id ) { |
570 | 568 | // Viewing a specific Lesson and all its Learners |
571 | 569 | $sensei_analysis_report_object = $this->load_report_object( 'Lesson', $lesson_id ); |
572 | - } |
|
573 | - elseif ( 0 < $course_id && 0 < $user_id ) { |
|
570 | + } elseif ( 0 < $course_id && 0 < $user_id ) { |
|
574 | 571 | // Viewing a specific User on a specific Course |
575 | 572 | $sensei_analysis_report_object = $this->load_report_object( 'Course', $course_id, $user_id ); |
576 | - } |
|
577 | - elseif( 0 < $course_id ) { |
|
573 | + } elseif( 0 < $course_id ) { |
|
578 | 574 | // Viewing a specific Course and all it's Lessons, or it's Learners |
579 | 575 | $sensei_analysis_report_object = $this->load_report_object( 'Course', $course_id ); |
580 | - } |
|
581 | - elseif ( 0 < $user_id ) { |
|
576 | + } elseif ( 0 < $user_id ) { |
|
582 | 577 | // Viewing a specific Learner, and their Courses |
583 | 578 | $sensei_analysis_report_object = $this->load_report_object( 'User_Profile', $user_id ); |
584 | - } |
|
585 | - else { |
|
579 | + } else { |
|
586 | 580 | // Overview of all Learners, all Courses, or all Lessons |
587 | 581 | $sensei_analysis_report_object = $this->load_report_object( 'Overview', $type ); |
588 | 582 | } // End If Statement |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | if ( current_user_can( 'manage_sensei_grades' ) ) { |
54 | 54 | |
55 | - add_submenu_page( 'sensei', __('Analysis', 'woothemes-sensei'), __('Analysis', 'woothemes-sensei') , 'manage_sensei_grades', 'sensei_analysis', array( $this, 'analysis_page' ) ); |
|
55 | + add_submenu_page( 'sensei', __('Analysis', 'woothemes-sensei'), __('Analysis', 'woothemes-sensei') , 'manage_sensei_grades', 'sensei_analysis', array( $this, 'analysis_page' ) ); |
|
56 | 56 | |
57 | 57 | } |
58 | 58 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | 'analysis-lesson' |
90 | 90 | ); |
91 | 91 | foreach ( $classes_to_load as $class_file ) { |
92 | - Sensei()->load_class( $class_file ); |
|
92 | + Sensei()->load_class( $class_file ); |
|
93 | 93 | } // End For Loop |
94 | 94 | } // End load_data_table_files() |
95 | 95 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | |
434 | 434 | $user_id = intval( $_GET['user_id'] ); |
435 | 435 | $url = esc_url( add_query_arg( array( 'page' => $this->page_slug, 'user' => $user_id ), admin_url( 'admin.php' ) ) ); |
436 | - $user_name = Sensei_Learner::get_full_name( $user_id ); |
|
436 | + $user_name = Sensei_Learner::get_full_name( $user_id ); |
|
437 | 437 | $title .= sprintf( ' <span class="user-title">> <a href="%s">%s</a></span>', $url, $user_name ); |
438 | 438 | |
439 | 439 | } // End If Statement |
@@ -454,8 +454,8 @@ discard block |
||
454 | 454 | $user_id = intval( $_GET['user_id'] ); |
455 | 455 | $user_data = get_userdata( $user_id ); |
456 | 456 | $url = add_query_arg( array( 'page' => $this->page_slug, 'user_id' => $user_id ), admin_url( 'admin.php' ) ); |
457 | - $user_name = Sensei_Learner::get_full_name( $user_id ); |
|
458 | - $title .= sprintf( ' <span class="user-title">> <a href="%s">%s</a></span>', $url, $user_name ); |
|
457 | + $user_name = Sensei_Learner::get_full_name( $user_id ); |
|
458 | + $title .= sprintf( ' <span class="user-title">> <a href="%s">%s</a></span>', $url, $user_name ); |
|
459 | 459 | $title .= sprintf( ' <span class="user-title">> <a href="%s">%s</a></span>', esc_url( $url ), $user_data->display_name ); |
460 | 460 | } // End If Statement |
461 | 461 | if ( isset( $_GET['course_id'] ) ) { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
2 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * All functionality pertaining to the Admin Analysis in Sensei. |
@@ -19,24 +19,24 @@ discard block |
||
19 | 19 | * @since 1.0.0 |
20 | 20 | * @param string $file |
21 | 21 | */ |
22 | - public function __construct ( $file ) { |
|
22 | + public function __construct($file) { |
|
23 | 23 | $this->name = __('Analysis', 'woothemes-sensei'); |
24 | 24 | $this->file = $file; |
25 | 25 | $this->page_slug = 'sensei_analysis'; |
26 | 26 | |
27 | 27 | // Admin functions |
28 | - if ( is_admin() ) { |
|
29 | - add_action( 'admin_menu', array( $this, 'analysis_admin_menu' ), 10); |
|
30 | - add_action( 'analysis_wrapper_container', array( $this, 'wrapper_container' ) ); |
|
31 | - if ( isset( $_GET['page'] ) && ( $_GET['page'] == $this->page_slug ) ) { |
|
28 | + if (is_admin()) { |
|
29 | + add_action('admin_menu', array($this, 'analysis_admin_menu'), 10); |
|
30 | + add_action('analysis_wrapper_container', array($this, 'wrapper_container')); |
|
31 | + if (isset($_GET['page']) && ($_GET['page'] == $this->page_slug)) { |
|
32 | 32 | |
33 | - add_action( 'admin_print_styles', array( $this, 'enqueue_styles' ) ); |
|
33 | + add_action('admin_print_styles', array($this, 'enqueue_styles')); |
|
34 | 34 | |
35 | 35 | } |
36 | 36 | |
37 | - add_action( 'admin_init', array( $this, 'report_download_page' ) ); |
|
37 | + add_action('admin_init', array($this, 'report_download_page')); |
|
38 | 38 | |
39 | - add_filter( 'user_search_columns', array( $this, 'user_search_columns_filter' ), 10, 3 ); |
|
39 | + add_filter('user_search_columns', array($this, 'user_search_columns_filter'), 10, 3); |
|
40 | 40 | } // End If Statement |
41 | 41 | } // End __construct() |
42 | 42 | |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | public function analysis_admin_menu() { |
51 | 51 | global $menu, $woocommerce; |
52 | 52 | |
53 | - if ( current_user_can( 'manage_sensei_grades' ) ) { |
|
53 | + if (current_user_can('manage_sensei_grades')) { |
|
54 | 54 | |
55 | - add_submenu_page( 'sensei', __('Analysis', 'woothemes-sensei'), __('Analysis', 'woothemes-sensei') , 'manage_sensei_grades', 'sensei_analysis', array( $this, 'analysis_page' ) ); |
|
55 | + add_submenu_page('sensei', __('Analysis', 'woothemes-sensei'), __('Analysis', 'woothemes-sensei'), 'manage_sensei_grades', 'sensei_analysis', array($this, 'analysis_page')); |
|
56 | 56 | |
57 | 57 | } |
58 | 58 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | * @since 1.0.0 |
67 | 67 | * @return void |
68 | 68 | */ |
69 | - public function enqueue_styles () { |
|
69 | + public function enqueue_styles() { |
|
70 | 70 | |
71 | - wp_enqueue_style( 'woothemes-sensei-admin' ); |
|
71 | + wp_enqueue_style('woothemes-sensei-admin'); |
|
72 | 72 | |
73 | - wp_enqueue_style( 'woothemes-sensei-settings-api', Sensei()->plugin_url . 'assets/css/settings.css', '', Sensei()->version ); |
|
73 | + wp_enqueue_style('woothemes-sensei-settings-api', Sensei()->plugin_url.'assets/css/settings.css', '', Sensei()->version); |
|
74 | 74 | |
75 | 75 | } // End enqueue_styles() |
76 | 76 | |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | public function load_data_table_files() { |
83 | 83 | |
84 | 84 | // Load Analysis Classes |
85 | - $classes_to_load = array( 'list-table', |
|
85 | + $classes_to_load = array('list-table', |
|
86 | 86 | 'analysis-overview', |
87 | 87 | 'analysis-user-profile', |
88 | 88 | 'analysis-course', |
89 | 89 | 'analysis-lesson' |
90 | 90 | ); |
91 | - foreach ( $classes_to_load as $class_file ) { |
|
92 | - Sensei()->load_class( $class_file ); |
|
91 | + foreach ($classes_to_load as $class_file) { |
|
92 | + Sensei()->load_class($class_file); |
|
93 | 93 | } // End For Loop |
94 | 94 | } // End load_data_table_files() |
95 | 95 | |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | * @param undefined $optional_data optional constructor arguments |
101 | 101 | * @return object class instance object |
102 | 102 | */ |
103 | - public function load_data_object( $name = '', $data = 0, $optional_data = null ) { |
|
103 | + public function load_data_object($name = '', $data = 0, $optional_data = null) { |
|
104 | 104 | // Load Analysis data |
105 | - $object_name = 'Sensei_Analysis_' . $name . '_List_Table'; |
|
106 | - if ( is_null($optional_data) ) { |
|
107 | - $sensei_analysis_object = new $object_name( $data ); |
|
105 | + $object_name = 'Sensei_Analysis_'.$name.'_List_Table'; |
|
106 | + if (is_null($optional_data)) { |
|
107 | + $sensei_analysis_object = new $object_name($data); |
|
108 | 108 | } else { |
109 | - $sensei_analysis_object = new $object_name( $data, $optional_data ); |
|
109 | + $sensei_analysis_object = new $object_name($data, $optional_data); |
|
110 | 110 | } |
111 | 111 | $sensei_analysis_object->prepare_items(); |
112 | 112 | return $sensei_analysis_object; |
@@ -123,40 +123,40 @@ discard block |
||
123 | 123 | $course_id = 0; |
124 | 124 | $lesson_id = 0; |
125 | 125 | $user_id = 0; |
126 | - if( isset( $_GET['course_id'] ) ) { |
|
127 | - $course_id = intval( $_GET['course_id'] ); |
|
126 | + if (isset($_GET['course_id'])) { |
|
127 | + $course_id = intval($_GET['course_id']); |
|
128 | 128 | } |
129 | - if( isset( $_GET['lesson_id'] ) ) { |
|
130 | - $lesson_id = intval( $_GET['lesson_id'] ); |
|
129 | + if (isset($_GET['lesson_id'])) { |
|
130 | + $lesson_id = intval($_GET['lesson_id']); |
|
131 | 131 | } |
132 | - if( isset( $_GET['user_id'] ) ) { |
|
133 | - $user_id = intval( $_GET['user_id'] ); |
|
132 | + if (isset($_GET['user_id'])) { |
|
133 | + $user_id = intval($_GET['user_id']); |
|
134 | 134 | } |
135 | - $type = isset( $_GET['view'] ) ? esc_html( $_GET['view'] ) : false; |
|
135 | + $type = isset($_GET['view']) ? esc_html($_GET['view']) : false; |
|
136 | 136 | |
137 | - if ( 0 < $lesson_id ) { |
|
137 | + if (0 < $lesson_id) { |
|
138 | 138 | // Viewing a specific Lesson and all its Learners |
139 | - $this->analysis_lesson_users_view( $lesson_id ); |
|
139 | + $this->analysis_lesson_users_view($lesson_id); |
|
140 | 140 | } |
141 | - elseif ( 0 < $course_id && !$user_id && 'user' == $type ) { |
|
141 | + elseif (0 < $course_id && ! $user_id && 'user' == $type) { |
|
142 | 142 | // Viewing a specific Course and all its Learners |
143 | - $this->analysis_course_users_view( $course_id ); |
|
143 | + $this->analysis_course_users_view($course_id); |
|
144 | 144 | } |
145 | - elseif ( 0 < $course_id && 0 < $user_id ) { |
|
145 | + elseif (0 < $course_id && 0 < $user_id) { |
|
146 | 146 | // Viewing a specific Learner on a specific Course, showing their Lessons |
147 | - $this->analysis_user_course_view( $course_id, $user_id ); |
|
147 | + $this->analysis_user_course_view($course_id, $user_id); |
|
148 | 148 | } |
149 | - elseif( 0 < $course_id ) { |
|
149 | + elseif (0 < $course_id) { |
|
150 | 150 | // Viewing a specific Course and all it's Lessons |
151 | - $this->analysis_course_view( $course_id ); |
|
151 | + $this->analysis_course_view($course_id); |
|
152 | 152 | } |
153 | - elseif ( 0 < $user_id ) { |
|
153 | + elseif (0 < $user_id) { |
|
154 | 154 | // Viewing a specific Learner, and their Courses |
155 | - $this->analysis_user_profile_view( $user_id ); |
|
155 | + $this->analysis_user_profile_view($user_id); |
|
156 | 156 | } |
157 | 157 | else { |
158 | 158 | // Overview of all Learners, all Courses, or all Lessons |
159 | - $this->analysis_default_view( $type ); |
|
159 | + $this->analysis_default_view($type); |
|
160 | 160 | } // End If Statement |
161 | 161 | } // End analysis_page() |
162 | 162 | |
@@ -165,35 +165,35 @@ discard block |
||
165 | 165 | * @since 1.2.0 |
166 | 166 | * @return void |
167 | 167 | */ |
168 | - public function analysis_default_view( $type ) { |
|
168 | + public function analysis_default_view($type) { |
|
169 | 169 | |
170 | 170 | // Load Analysis data |
171 | - $sensei_analysis_overview = $this->load_data_object( 'Overview', $type ); |
|
171 | + $sensei_analysis_overview = $this->load_data_object('Overview', $type); |
|
172 | 172 | // Wrappers |
173 | - do_action( 'analysis_before_container' ); |
|
174 | - do_action( 'analysis_wrapper_container', 'top' ); |
|
173 | + do_action('analysis_before_container'); |
|
174 | + do_action('analysis_wrapper_container', 'top'); |
|
175 | 175 | $this->analysis_headers(); |
176 | 176 | ?> |
177 | 177 | <div id="poststuff" class="sensei-analysis-wrap"> |
178 | 178 | <div class="sensei-analysis-sidebar"> |
179 | 179 | <?php |
180 | - do_action( 'sensei_analysis_before_stats_boxes' ); |
|
181 | - foreach ( $sensei_analysis_overview->stats_boxes() as $key => $value ) { |
|
182 | - $this->render_stats_box( esc_html( $key ), esc_html( $value ) ); |
|
180 | + do_action('sensei_analysis_before_stats_boxes'); |
|
181 | + foreach ($sensei_analysis_overview->stats_boxes() as $key => $value) { |
|
182 | + $this->render_stats_box(esc_html($key), esc_html($value)); |
|
183 | 183 | } // End For Loop |
184 | - do_action( 'sensei_analysis_after_stats_boxes' ); |
|
184 | + do_action('sensei_analysis_after_stats_boxes'); |
|
185 | 185 | ?> |
186 | 186 | </div> |
187 | 187 | <div class="sensei-analysis-main"> |
188 | 188 | <?php $sensei_analysis_overview->display(); ?> |
189 | 189 | </div> |
190 | 190 | <div class="sensei-analysis-extra"> |
191 | - <?php do_action( 'sensei_analysis_extra' ); ?> |
|
191 | + <?php do_action('sensei_analysis_extra'); ?> |
|
192 | 192 | </div> |
193 | 193 | </div> |
194 | 194 | <?php |
195 | - do_action( 'analysis_wrapper_container', 'bottom' ); |
|
196 | - do_action( 'analysis_after_container' ); |
|
195 | + do_action('analysis_wrapper_container', 'bottom'); |
|
196 | + do_action('analysis_after_container'); |
|
197 | 197 | } // End analysis_default_view() |
198 | 198 | |
199 | 199 | /** |
@@ -202,26 +202,26 @@ discard block |
||
202 | 202 | * @param integer $user_id |
203 | 203 | * @return void |
204 | 204 | */ |
205 | - public function analysis_user_profile_view( $user_id ) { |
|
205 | + public function analysis_user_profile_view($user_id) { |
|
206 | 206 | |
207 | 207 | // Load Analysis data |
208 | - $sensei_analysis_user_profile = $this->load_data_object( 'User_Profile', $user_id ); |
|
208 | + $sensei_analysis_user_profile = $this->load_data_object('User_Profile', $user_id); |
|
209 | 209 | // Wrappers |
210 | - do_action( 'analysis_before_container' ); |
|
211 | - do_action( 'analysis_wrapper_container', 'top' ); |
|
212 | - $this->analysis_headers( array( 'nav' => 'user_profile' ) ); |
|
210 | + do_action('analysis_before_container'); |
|
211 | + do_action('analysis_wrapper_container', 'top'); |
|
212 | + $this->analysis_headers(array('nav' => 'user_profile')); |
|
213 | 213 | ?> |
214 | 214 | <div id="poststuff" class="sensei-analysis-wrap user-profile"> |
215 | 215 | <div class="sensei-analysis-main"> |
216 | 216 | <?php $sensei_analysis_user_profile->display(); ?> |
217 | 217 | </div> |
218 | 218 | <div class="sensei-analysis-extra"> |
219 | - <?php do_action( 'sensei_analysis_extra' ); ?> |
|
219 | + <?php do_action('sensei_analysis_extra'); ?> |
|
220 | 220 | </div> |
221 | 221 | </div> |
222 | 222 | <?php |
223 | - do_action( 'analysis_wrapper_container', 'bottom' ); |
|
224 | - do_action( 'analysis_after_container' ); |
|
223 | + do_action('analysis_wrapper_container', 'bottom'); |
|
224 | + do_action('analysis_after_container'); |
|
225 | 225 | } // End analysis_user_profile_view() |
226 | 226 | |
227 | 227 | /** |
@@ -230,26 +230,26 @@ discard block |
||
230 | 230 | * @param integer $course_id |
231 | 231 | * @return void |
232 | 232 | */ |
233 | - public function analysis_course_view( $course_id ) { |
|
233 | + public function analysis_course_view($course_id) { |
|
234 | 234 | |
235 | 235 | // Load Analysis data |
236 | - $sensei_analysis_course = $this->load_data_object( 'Course', $course_id ); |
|
236 | + $sensei_analysis_course = $this->load_data_object('Course', $course_id); |
|
237 | 237 | // Wrappers |
238 | - do_action( 'analysis_before_container' ); |
|
239 | - do_action( 'analysis_wrapper_container', 'top' ); |
|
240 | - $this->analysis_headers( array( 'nav' => 'course' ) ); |
|
238 | + do_action('analysis_before_container'); |
|
239 | + do_action('analysis_wrapper_container', 'top'); |
|
240 | + $this->analysis_headers(array('nav' => 'course')); |
|
241 | 241 | ?> |
242 | 242 | <div id="poststuff" class="sensei-analysis-wrap course-profile"> |
243 | 243 | <div class="sensei-analysis-main"> |
244 | 244 | <?php $sensei_analysis_course->display(); ?> |
245 | 245 | </div> |
246 | 246 | <div class="sensei-analysis-extra"> |
247 | - <?php do_action( 'sensei_analysis_extra' ); ?> |
|
247 | + <?php do_action('sensei_analysis_extra'); ?> |
|
248 | 248 | </div> |
249 | 249 | </div> |
250 | 250 | <?php |
251 | - do_action( 'analysis_wrapper_container', 'bottom' ); |
|
252 | - do_action( 'analysis_after_container' ); |
|
251 | + do_action('analysis_wrapper_container', 'bottom'); |
|
252 | + do_action('analysis_after_container'); |
|
253 | 253 | } // End analysis_course_view() |
254 | 254 | |
255 | 255 | /** |
@@ -259,26 +259,26 @@ discard block |
||
259 | 259 | * @param integer $user_id |
260 | 260 | * @return void |
261 | 261 | */ |
262 | - public function analysis_user_course_view( $course_id, $user_id ) { |
|
262 | + public function analysis_user_course_view($course_id, $user_id) { |
|
263 | 263 | |
264 | 264 | // Load Analysis data |
265 | - $sensei_analysis_user_course = $this->load_data_object( 'Course', $course_id, $user_id ); |
|
265 | + $sensei_analysis_user_course = $this->load_data_object('Course', $course_id, $user_id); |
|
266 | 266 | // Wrappers |
267 | - do_action( 'analysis_before_container' ); |
|
268 | - do_action( 'analysis_wrapper_container', 'top' ); |
|
269 | - $this->analysis_headers( array( 'nav' => 'user_course' ) ); |
|
267 | + do_action('analysis_before_container'); |
|
268 | + do_action('analysis_wrapper_container', 'top'); |
|
269 | + $this->analysis_headers(array('nav' => 'user_course')); |
|
270 | 270 | ?> |
271 | 271 | <div id="poststuff" class="sensei-analysis-wrap course-profile"> |
272 | 272 | <div class="sensei-analysis-main"> |
273 | 273 | <?php $sensei_analysis_user_course->display(); ?> |
274 | 274 | </div> |
275 | 275 | <div class="sensei-analysis-extra"> |
276 | - <?php do_action( 'sensei_analysis_extra' ); ?> |
|
276 | + <?php do_action('sensei_analysis_extra'); ?> |
|
277 | 277 | </div> |
278 | 278 | </div> |
279 | 279 | <?php |
280 | - do_action( 'analysis_wrapper_container', 'bottom' ); |
|
281 | - do_action( 'analysis_after_container' ); |
|
280 | + do_action('analysis_wrapper_container', 'bottom'); |
|
281 | + do_action('analysis_after_container'); |
|
282 | 282 | } // End analysis_user_course_view() |
283 | 283 | |
284 | 284 | /** |
@@ -287,26 +287,26 @@ discard block |
||
287 | 287 | * @param integer $course_id |
288 | 288 | * @return void |
289 | 289 | */ |
290 | - public function analysis_course_users_view( $course_id ) { |
|
290 | + public function analysis_course_users_view($course_id) { |
|
291 | 291 | |
292 | 292 | // Load Analysis data |
293 | - $sensei_analysis_course_users = $this->load_data_object( 'Course', $course_id ); |
|
293 | + $sensei_analysis_course_users = $this->load_data_object('Course', $course_id); |
|
294 | 294 | // Wrappers |
295 | - do_action( 'analysis_before_container' ); |
|
296 | - do_action( 'analysis_wrapper_container', 'top' ); |
|
297 | - $this->analysis_headers( array( 'nav' => 'course_users' ) ); |
|
295 | + do_action('analysis_before_container'); |
|
296 | + do_action('analysis_wrapper_container', 'top'); |
|
297 | + $this->analysis_headers(array('nav' => 'course_users')); |
|
298 | 298 | ?> |
299 | 299 | <div id="poststuff" class="sensei-analysis-wrap course-profile"> |
300 | 300 | <div class="sensei-analysis-main"> |
301 | 301 | <?php $sensei_analysis_course_users->display(); ?> |
302 | 302 | </div> |
303 | 303 | <div class="sensei-analysis-extra"> |
304 | - <?php do_action( 'sensei_analysis_extra' ); ?> |
|
304 | + <?php do_action('sensei_analysis_extra'); ?> |
|
305 | 305 | </div> |
306 | 306 | </div> |
307 | 307 | <?php |
308 | - do_action( 'analysis_wrapper_container', 'bottom' ); |
|
309 | - do_action( 'analysis_after_container' ); |
|
308 | + do_action('analysis_wrapper_container', 'bottom'); |
|
309 | + do_action('analysis_after_container'); |
|
310 | 310 | } // End analysis_course_users_view() |
311 | 311 | |
312 | 312 | /** |
@@ -315,26 +315,26 @@ discard block |
||
315 | 315 | * @param integer $lesson_id |
316 | 316 | * @return void |
317 | 317 | */ |
318 | - public function analysis_lesson_users_view( $lesson_id ) { |
|
318 | + public function analysis_lesson_users_view($lesson_id) { |
|
319 | 319 | |
320 | 320 | // Load Analysis data |
321 | - $sensei_analysis_lesson_users = $this->load_data_object( 'Lesson', $lesson_id ); |
|
321 | + $sensei_analysis_lesson_users = $this->load_data_object('Lesson', $lesson_id); |
|
322 | 322 | // Wrappers |
323 | - do_action( 'analysis_before_container' ); |
|
324 | - do_action( 'analysis_wrapper_container', 'top' ); |
|
325 | - $this->analysis_headers( array( 'nav' => 'lesson_users' ) ); |
|
323 | + do_action('analysis_before_container'); |
|
324 | + do_action('analysis_wrapper_container', 'top'); |
|
325 | + $this->analysis_headers(array('nav' => 'lesson_users')); |
|
326 | 326 | ?> |
327 | 327 | <div id="poststuff" class="sensei-analysis-wrap course-profile"> |
328 | 328 | <div class="sensei-analysis-main"> |
329 | 329 | <?php $sensei_analysis_lesson_users->display(); ?> |
330 | 330 | </div> |
331 | 331 | <div class="sensei-analysis-extra"> |
332 | - <?php do_action( 'sensei_analysis_extra' ); ?> |
|
332 | + <?php do_action('sensei_analysis_extra'); ?> |
|
333 | 333 | </div> |
334 | 334 | </div> |
335 | 335 | <?php |
336 | - do_action( 'analysis_wrapper_container', 'bottom' ); |
|
337 | - do_action( 'analysis_after_container' ); |
|
336 | + do_action('analysis_wrapper_container', 'bottom'); |
|
337 | + do_action('analysis_after_container'); |
|
338 | 338 | } // End analysis_lesson_users_view() |
339 | 339 | |
340 | 340 | /** |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * @param $data string stats data |
345 | 345 | * @return void |
346 | 346 | */ |
347 | - public function render_stats_box( $title, $data ) { |
|
347 | + public function render_stats_box($title, $data) { |
|
348 | 348 | ?><div class="postbox"> |
349 | 349 | <h2><span><?php echo $title; ?></span></h2> |
350 | 350 | <div class="inside"> |
@@ -358,14 +358,14 @@ discard block |
||
358 | 358 | * @since 1.2.0 |
359 | 359 | * @return void |
360 | 360 | */ |
361 | - public function analysis_headers( $args = array( 'nav' => 'default' ) ) { |
|
361 | + public function analysis_headers($args = array('nav' => 'default')) { |
|
362 | 362 | |
363 | - $function = 'analysis_' . $args['nav'] . '_nav'; |
|
363 | + $function = 'analysis_'.$args['nav'].'_nav'; |
|
364 | 364 | $this->$function(); |
365 | 365 | ?> |
366 | 366 | <p class="powered-by-woo"> |
367 | 367 | |
368 | - <?php _e( 'Powered by', 'woothemes-sensei' ); ?> |
|
368 | + <?php _e('Powered by', 'woothemes-sensei'); ?> |
|
369 | 369 | |
370 | 370 | <a href="http://www.woothemes.com/" title="WooThemes"> |
371 | 371 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | </p> |
377 | 377 | |
378 | 378 | <?php |
379 | - do_action( 'sensei_analysis_after_headers' ); |
|
379 | + do_action('sensei_analysis_after_headers'); |
|
380 | 380 | } // End analysis_headers() |
381 | 381 | |
382 | 382 | /** |
@@ -385,10 +385,10 @@ discard block |
||
385 | 385 | * @param $which string |
386 | 386 | * @return void |
387 | 387 | */ |
388 | - public function wrapper_container( $which ) { |
|
389 | - if ( 'top' == $which ) { |
|
388 | + public function wrapper_container($which) { |
|
389 | + if ('top' == $which) { |
|
390 | 390 | ?><div id="woothemes-sensei" class="wrap woothemes-sensei"><?php |
391 | - } elseif ( 'bottom' == $which ) { |
|
391 | + } elseif ('bottom' == $which) { |
|
392 | 392 | ?></div><!--/#woothemes-sensei--><?php |
393 | 393 | } // End If Statement |
394 | 394 | } // End wrapper_container() |
@@ -400,24 +400,24 @@ discard block |
||
400 | 400 | */ |
401 | 401 | public function analysis_default_nav() { |
402 | 402 | |
403 | - $title = sprintf( '<a href="%s">%s</a>', esc_url( add_query_arg( array( 'page' => $this->page_slug ), admin_url( 'admin.php' ) ) ), esc_html( $this->name ) ); |
|
404 | - $view = isset($_GET['view']) ? esc_html( $_GET['view'] ) : ''; |
|
405 | - switch ( $view ) { |
|
403 | + $title = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('page' => $this->page_slug), admin_url('admin.php'))), esc_html($this->name)); |
|
404 | + $view = isset($_GET['view']) ? esc_html($_GET['view']) : ''; |
|
405 | + switch ($view) { |
|
406 | 406 | case 'courses' : |
407 | - $title .= sprintf( ' <span class="course-title">> %s</span>', __( 'Courses', 'woothemes-sensei' ) ); |
|
407 | + $title .= sprintf(' <span class="course-title">> %s</span>', __('Courses', 'woothemes-sensei')); |
|
408 | 408 | break; |
409 | 409 | |
410 | 410 | case 'lessons' : |
411 | - $title .= sprintf( ' <span class="lesson-title">> %s</span>', __( 'Lessons', 'woothemes-sensei' ) ); |
|
411 | + $title .= sprintf(' <span class="lesson-title">> %s</span>', __('Lessons', 'woothemes-sensei')); |
|
412 | 412 | break; |
413 | 413 | |
414 | 414 | case 'users' : |
415 | 415 | default : |
416 | - $title .= sprintf( ' <span class="user-title">> %s</span>', __( 'Learners', 'woothemes-sensei' ) ); |
|
416 | + $title .= sprintf(' <span class="user-title">> %s</span>', __('Learners', 'woothemes-sensei')); |
|
417 | 417 | break; |
418 | 418 | } |
419 | 419 | ?> |
420 | - <h1><?php echo apply_filters( 'sensei_analysis_nav_title', $title ); ?></h1> |
|
420 | + <h1><?php echo apply_filters('sensei_analysis_nav_title', $title); ?></h1> |
|
421 | 421 | <?php |
422 | 422 | } // End analysis_default_nav() |
423 | 423 | |
@@ -428,17 +428,17 @@ discard block |
||
428 | 428 | */ |
429 | 429 | public function analysis_user_profile_nav() { |
430 | 430 | |
431 | - $title = sprintf( '<a href="%s">%s</a>', esc_url( add_query_arg( array( 'page' => $this->page_slug ), admin_url( 'admin.php' ) ) ), esc_html( $this->name ) ); |
|
432 | - if ( isset( $_GET['user_id'] ) && 0 < intval( $_GET['user_id'] ) ) { |
|
431 | + $title = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('page' => $this->page_slug), admin_url('admin.php'))), esc_html($this->name)); |
|
432 | + if (isset($_GET['user_id']) && 0 < intval($_GET['user_id'])) { |
|
433 | 433 | |
434 | - $user_id = intval( $_GET['user_id'] ); |
|
435 | - $url = esc_url( add_query_arg( array( 'page' => $this->page_slug, 'user' => $user_id ), admin_url( 'admin.php' ) ) ); |
|
436 | - $user_name = Sensei_Learner::get_full_name( $user_id ); |
|
437 | - $title .= sprintf( ' <span class="user-title">> <a href="%s">%s</a></span>', $url, $user_name ); |
|
434 | + $user_id = intval($_GET['user_id']); |
|
435 | + $url = esc_url(add_query_arg(array('page' => $this->page_slug, 'user' => $user_id), admin_url('admin.php'))); |
|
436 | + $user_name = Sensei_Learner::get_full_name($user_id); |
|
437 | + $title .= sprintf(' <span class="user-title">> <a href="%s">%s</a></span>', $url, $user_name); |
|
438 | 438 | |
439 | 439 | } // End If Statement |
440 | 440 | ?> |
441 | - <h1><?php echo apply_filters( 'sensei_analysis_nav_title', $title ); ?></h1> |
|
441 | + <h1><?php echo apply_filters('sensei_analysis_nav_title', $title); ?></h1> |
|
442 | 442 | <?php |
443 | 443 | } // End analysis_user_profile_nav() |
444 | 444 | |
@@ -449,22 +449,22 @@ discard block |
||
449 | 449 | */ |
450 | 450 | public function analysis_user_course_nav() { |
451 | 451 | |
452 | - $title = sprintf( '<a href="%s">%s</a>', esc_url( add_query_arg( array( 'page' => $this->page_slug ), admin_url( 'admin.php' ) ) ), esc_html( $this->name ) ); |
|
453 | - if ( isset( $_GET['user_id'] ) && 0 < intval( $_GET['user_id'] ) ) { |
|
454 | - $user_id = intval( $_GET['user_id'] ); |
|
455 | - $user_data = get_userdata( $user_id ); |
|
456 | - $url = add_query_arg( array( 'page' => $this->page_slug, 'user_id' => $user_id ), admin_url( 'admin.php' ) ); |
|
457 | - $user_name = Sensei_Learner::get_full_name( $user_id ); |
|
458 | - $title .= sprintf( ' <span class="user-title">> <a href="%s">%s</a></span>', $url, $user_name ); |
|
459 | - $title .= sprintf( ' <span class="user-title">> <a href="%s">%s</a></span>', esc_url( $url ), $user_data->display_name ); |
|
452 | + $title = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('page' => $this->page_slug), admin_url('admin.php'))), esc_html($this->name)); |
|
453 | + if (isset($_GET['user_id']) && 0 < intval($_GET['user_id'])) { |
|
454 | + $user_id = intval($_GET['user_id']); |
|
455 | + $user_data = get_userdata($user_id); |
|
456 | + $url = add_query_arg(array('page' => $this->page_slug, 'user_id' => $user_id), admin_url('admin.php')); |
|
457 | + $user_name = Sensei_Learner::get_full_name($user_id); |
|
458 | + $title .= sprintf(' <span class="user-title">> <a href="%s">%s</a></span>', $url, $user_name); |
|
459 | + $title .= sprintf(' <span class="user-title">> <a href="%s">%s</a></span>', esc_url($url), $user_data->display_name); |
|
460 | 460 | } // End If Statement |
461 | - if ( isset( $_GET['course_id'] ) ) { |
|
462 | - $course_id = intval( $_GET['course_id'] ); |
|
463 | - $url = add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $course_id ), admin_url( 'admin.php' ) ); |
|
464 | - $title .= sprintf( ' <span class="course-title">> <a href="%s">%s</a></span>', esc_url( $url ), get_the_title( $course_id ) ); |
|
461 | + if (isset($_GET['course_id'])) { |
|
462 | + $course_id = intval($_GET['course_id']); |
|
463 | + $url = add_query_arg(array('page' => $this->page_slug, 'course_id' => $course_id), admin_url('admin.php')); |
|
464 | + $title .= sprintf(' <span class="course-title">> <a href="%s">%s</a></span>', esc_url($url), get_the_title($course_id)); |
|
465 | 465 | } |
466 | 466 | ?> |
467 | - <h1><?php echo apply_filters( 'sensei_analysis_nav_title', $title ); ?></h1> |
|
467 | + <h1><?php echo apply_filters('sensei_analysis_nav_title', $title); ?></h1> |
|
468 | 468 | <?php |
469 | 469 | } // End analysis_user_course_nav() |
470 | 470 | |
@@ -475,14 +475,14 @@ discard block |
||
475 | 475 | */ |
476 | 476 | public function analysis_course_nav() { |
477 | 477 | |
478 | - $title = sprintf( '<a href="%s">%s</a>', add_query_arg( array( 'page' => $this->page_slug ), admin_url( 'admin.php' ) ), esc_html( $this->name ) ); |
|
479 | - if ( isset( $_GET['course_id'] ) ) { |
|
480 | - $course_id = intval( $_GET['course_id'] ); |
|
481 | - $url = add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $course_id ), admin_url( 'admin.php' ) ); |
|
482 | - $title .= sprintf( ' <span class="course-title">> <a href="%s">%s</a></span>',esc_url( $url ), get_the_title( $course_id ) ); |
|
478 | + $title = sprintf('<a href="%s">%s</a>', add_query_arg(array('page' => $this->page_slug), admin_url('admin.php')), esc_html($this->name)); |
|
479 | + if (isset($_GET['course_id'])) { |
|
480 | + $course_id = intval($_GET['course_id']); |
|
481 | + $url = add_query_arg(array('page' => $this->page_slug, 'course_id' => $course_id), admin_url('admin.php')); |
|
482 | + $title .= sprintf(' <span class="course-title">> <a href="%s">%s</a></span>', esc_url($url), get_the_title($course_id)); |
|
483 | 483 | } |
484 | 484 | ?> |
485 | - <h1><?php echo apply_filters( 'sensei_analysis_nav_title', $title ); ?></h1> |
|
485 | + <h1><?php echo apply_filters('sensei_analysis_nav_title', $title); ?></h1> |
|
486 | 486 | <?php |
487 | 487 | } // End analysis_course_nav() |
488 | 488 | |
@@ -493,14 +493,14 @@ discard block |
||
493 | 493 | */ |
494 | 494 | public function analysis_course_users_nav() { |
495 | 495 | |
496 | - $title = sprintf( '<a href="%s">%s</a>', add_query_arg( array( 'page' => $this->page_slug ), admin_url( 'admin.php' ) ), esc_html( $this->name ) ); |
|
497 | - if ( isset( $_GET['course_id'] ) ) { |
|
498 | - $course_id = intval( $_GET['course_id'] ); |
|
499 | - $url = add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $course_id ), admin_url( 'admin.php' ) ); |
|
500 | - $title .= sprintf( ' <span class="course-title">> <a href="%s">%s</a></span>', esc_url( $url ), get_the_title( $course_id ) ); |
|
496 | + $title = sprintf('<a href="%s">%s</a>', add_query_arg(array('page' => $this->page_slug), admin_url('admin.php')), esc_html($this->name)); |
|
497 | + if (isset($_GET['course_id'])) { |
|
498 | + $course_id = intval($_GET['course_id']); |
|
499 | + $url = add_query_arg(array('page' => $this->page_slug, 'course_id' => $course_id), admin_url('admin.php')); |
|
500 | + $title .= sprintf(' <span class="course-title">> <a href="%s">%s</a></span>', esc_url($url), get_the_title($course_id)); |
|
501 | 501 | } |
502 | 502 | ?> |
503 | - <h1><?php echo apply_filters( 'sensei_analysis_nav_title', $title ); ?></h1> |
|
503 | + <h1><?php echo apply_filters('sensei_analysis_nav_title', $title); ?></h1> |
|
504 | 504 | <?php |
505 | 505 | } // End analysis_course_users_nav() |
506 | 506 | |
@@ -511,17 +511,17 @@ discard block |
||
511 | 511 | */ |
512 | 512 | public function analysis_lesson_users_nav() { |
513 | 513 | |
514 | - $title = sprintf( '<a href="%s">%s</a>', add_query_arg( array( 'page' => $this->page_slug ), admin_url( 'admin.php' ) ), esc_html( $this->name ) ); |
|
515 | - if ( isset( $_GET['lesson_id'] ) ) { |
|
516 | - $lesson_id = intval( $_GET['lesson_id'] ); |
|
517 | - $course_id = intval( get_post_meta( $lesson_id, '_lesson_course', true ) ); |
|
518 | - $url = add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $course_id ), admin_url( 'admin.php' ) ); |
|
519 | - $title .= sprintf( ' <span class="course-title">> <a href="%s">%s</a></span>', esc_url( $url ), get_the_title( $course_id ) ); |
|
520 | - $url = add_query_arg( array( 'page' => $this->page_slug, 'lesson_id' => $lesson_id ), admin_url( 'admin.php' ) ); |
|
521 | - $title .= sprintf( ' <span class="lesson-title">> <a href="%s">%s</a></span>', esc_url( $url ), get_the_title( $lesson_id ) ); |
|
514 | + $title = sprintf('<a href="%s">%s</a>', add_query_arg(array('page' => $this->page_slug), admin_url('admin.php')), esc_html($this->name)); |
|
515 | + if (isset($_GET['lesson_id'])) { |
|
516 | + $lesson_id = intval($_GET['lesson_id']); |
|
517 | + $course_id = intval(get_post_meta($lesson_id, '_lesson_course', true)); |
|
518 | + $url = add_query_arg(array('page' => $this->page_slug, 'course_id' => $course_id), admin_url('admin.php')); |
|
519 | + $title .= sprintf(' <span class="course-title">> <a href="%s">%s</a></span>', esc_url($url), get_the_title($course_id)); |
|
520 | + $url = add_query_arg(array('page' => $this->page_slug, 'lesson_id' => $lesson_id), admin_url('admin.php')); |
|
521 | + $title .= sprintf(' <span class="lesson-title">> <a href="%s">%s</a></span>', esc_url($url), get_the_title($lesson_id)); |
|
522 | 522 | } |
523 | 523 | ?> |
524 | - <h1><?php echo apply_filters( 'sensei_analysis_nav_title', $title ); ?></h1> |
|
524 | + <h1><?php echo apply_filters('sensei_analysis_nav_title', $title); ?></h1> |
|
525 | 525 | <?php |
526 | 526 | } // End analysis_lesson_users_nav() |
527 | 527 | |
@@ -532,59 +532,59 @@ discard block |
||
532 | 532 | */ |
533 | 533 | public function report_download_page() { |
534 | 534 | // Check if is a report |
535 | - if ( !empty( $_GET['sensei_report_download'] ) ) { |
|
536 | - $report = sanitize_text_field( $_GET['sensei_report_download'] ); |
|
535 | + if ( ! empty($_GET['sensei_report_download'])) { |
|
536 | + $report = sanitize_text_field($_GET['sensei_report_download']); |
|
537 | 537 | |
538 | 538 | // Simple verification to ensure intent, Note that a Nonce is per user, so the URL can't be shared |
539 | - if ( !wp_verify_nonce( $_REQUEST['_sdl_nonce'], 'sensei_csv_download-' . $report ) ) { |
|
540 | - wp_die( __('Invalid request', 'woothemes-sensei') ); |
|
539 | + if ( ! wp_verify_nonce($_REQUEST['_sdl_nonce'], 'sensei_csv_download-'.$report)) { |
|
540 | + wp_die(__('Invalid request', 'woothemes-sensei')); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | // Setup the variables we might need |
544 | - $filename = apply_filters( 'sensei_csv_export_filename', $report ); |
|
544 | + $filename = apply_filters('sensei_csv_export_filename', $report); |
|
545 | 545 | $course_id = 0; |
546 | 546 | $lesson_id = 0; |
547 | 547 | $user_id = 0; |
548 | - if( isset( $_GET['course_id'] ) ) { |
|
549 | - $course_id = intval( $_GET['course_id'] ); |
|
548 | + if (isset($_GET['course_id'])) { |
|
549 | + $course_id = intval($_GET['course_id']); |
|
550 | 550 | } |
551 | - if( isset( $_GET['lesson_id'] ) ) { |
|
552 | - $lesson_id = intval( $_GET['lesson_id'] ); |
|
551 | + if (isset($_GET['lesson_id'])) { |
|
552 | + $lesson_id = intval($_GET['lesson_id']); |
|
553 | 553 | } |
554 | - if( isset( $_GET['user_id'] ) ) { |
|
555 | - $user_id = intval( $_GET['user_id'] ); |
|
554 | + if (isset($_GET['user_id'])) { |
|
555 | + $user_id = intval($_GET['user_id']); |
|
556 | 556 | } |
557 | - $type = isset( $_GET['view'] ) ? esc_html( $_GET['view'] ) : false; |
|
557 | + $type = isset($_GET['view']) ? esc_html($_GET['view']) : false; |
|
558 | 558 | |
559 | - if ( 0 < $lesson_id ) { |
|
559 | + if (0 < $lesson_id) { |
|
560 | 560 | // Viewing a specific Lesson and all its Learners |
561 | - $sensei_analysis_report_object = $this->load_report_object( 'Lesson', $lesson_id ); |
|
561 | + $sensei_analysis_report_object = $this->load_report_object('Lesson', $lesson_id); |
|
562 | 562 | } |
563 | - elseif ( 0 < $course_id && 0 < $user_id ) { |
|
563 | + elseif (0 < $course_id && 0 < $user_id) { |
|
564 | 564 | // Viewing a specific User on a specific Course |
565 | - $sensei_analysis_report_object = $this->load_report_object( 'Course', $course_id, $user_id ); |
|
565 | + $sensei_analysis_report_object = $this->load_report_object('Course', $course_id, $user_id); |
|
566 | 566 | } |
567 | - elseif( 0 < $course_id ) { |
|
567 | + elseif (0 < $course_id) { |
|
568 | 568 | // Viewing a specific Course and all it's Lessons, or it's Learners |
569 | - $sensei_analysis_report_object = $this->load_report_object( 'Course', $course_id ); |
|
569 | + $sensei_analysis_report_object = $this->load_report_object('Course', $course_id); |
|
570 | 570 | } |
571 | - elseif ( 0 < $user_id ) { |
|
571 | + elseif (0 < $user_id) { |
|
572 | 572 | // Viewing a specific Learner, and their Courses |
573 | - $sensei_analysis_report_object = $this->load_report_object( 'User_Profile', $user_id ); |
|
573 | + $sensei_analysis_report_object = $this->load_report_object('User_Profile', $user_id); |
|
574 | 574 | } |
575 | 575 | else { |
576 | 576 | // Overview of all Learners, all Courses, or all Lessons |
577 | - $sensei_analysis_report_object = $this->load_report_object( 'Overview', $type ); |
|
577 | + $sensei_analysis_report_object = $this->load_report_object('Overview', $type); |
|
578 | 578 | } // End If Statement |
579 | 579 | |
580 | 580 | // Handle the headers |
581 | - $this->report_set_headers( $filename ); |
|
581 | + $this->report_set_headers($filename); |
|
582 | 582 | |
583 | 583 | // Collate the data, there could be many different reports for a single object |
584 | - $report_data_array = $sensei_analysis_report_object->generate_report( $report ); |
|
584 | + $report_data_array = $sensei_analysis_report_object->generate_report($report); |
|
585 | 585 | |
586 | 586 | // Output the data |
587 | - $this->report_write_download( $report_data_array ); |
|
587 | + $this->report_write_download($report_data_array); |
|
588 | 588 | |
589 | 589 | // Cleanly exit |
590 | 590 | exit; |
@@ -597,9 +597,9 @@ discard block |
||
597 | 597 | * @param string $filename name of report file |
598 | 598 | * @return void |
599 | 599 | */ |
600 | - public function report_set_headers( $filename = '' ) { |
|
601 | - header( 'Content-Type: text/csv' ); |
|
602 | - header( 'Content-Disposition: attachment;filename=' . $filename . '.csv'); |
|
600 | + public function report_set_headers($filename = '') { |
|
601 | + header('Content-Type: text/csv'); |
|
602 | + header('Content-Disposition: attachment;filename='.$filename.'.csv'); |
|
603 | 603 | } // End report_set_headers() |
604 | 604 | |
605 | 605 | /** |
@@ -610,12 +610,12 @@ discard block |
||
610 | 610 | * @param undefined $optional_data optional constructor arguments |
611 | 611 | * @return object class instance object |
612 | 612 | */ |
613 | - public function load_report_object( $name = '', $data = 0, $optional_data = null ) { |
|
614 | - $object_name = 'WooThemes_Sensei_Analysis_' . $name . '_List_Table'; |
|
615 | - if ( is_null($optional_data) ) { |
|
616 | - $sensei_analysis_report_object = new $object_name( $data ); |
|
613 | + public function load_report_object($name = '', $data = 0, $optional_data = null) { |
|
614 | + $object_name = 'WooThemes_Sensei_Analysis_'.$name.'_List_Table'; |
|
615 | + if (is_null($optional_data)) { |
|
616 | + $sensei_analysis_report_object = new $object_name($data); |
|
617 | 617 | } else { |
618 | - $sensei_analysis_report_object = new $object_name( $data, $optional_data ); |
|
618 | + $sensei_analysis_report_object = new $object_name($data, $optional_data); |
|
619 | 619 | } |
620 | 620 | return $sensei_analysis_report_object; |
621 | 621 | } // End load_report_object() |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | * @param array $report_data data array |
627 | 627 | * @return void |
628 | 628 | */ |
629 | - public function report_write_download( $report_data = array() ) { |
|
629 | + public function report_write_download($report_data = array()) { |
|
630 | 630 | $fp = fopen('php://output', 'w'); |
631 | 631 | foreach ($report_data as $row) { |
632 | 632 | fputcsv($fp, $row); |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | * @param object $user_query_object WP_User_Query Object |
643 | 643 | * @return array $search_columns array of user columns to search |
644 | 644 | */ |
645 | - public function user_search_columns_filter( $search_columns, $search, $user_query_object ) { |
|
645 | + public function user_search_columns_filter($search_columns, $search, $user_query_object) { |
|
646 | 646 | // Alter $search_columns to include the fields you want to search on |
647 | - array_push( $search_columns, 'display_name' ); |
|
647 | + array_push($search_columns, 'display_name'); |
|
648 | 648 | return $search_columns; |
649 | 649 | } |
650 | 650 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @version 1.8.0 |
13 | 13 | */ |
14 | 14 | |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; // Exit if accessed directly |
17 | 17 | } |
18 | 18 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function __construct() { |
31 | 31 | |
32 | - add_action( 'admin_menu', array( $this, 'admin_menus') ); |
|
33 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
32 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
33 | + add_action('admin_head', array($this, 'admin_head')); |
|
34 | 34 | |
35 | 35 | } |
36 | 36 | |
@@ -40,23 +40,23 @@ discard block |
||
40 | 40 | * Hooked into activated_plugin |
41 | 41 | * @since 1.8.0 |
42 | 42 | */ |
43 | - public static function redirect( $plugin ) { |
|
43 | + public static function redirect($plugin) { |
|
44 | 44 | |
45 | 45 | // Bail if activating from network, or bulk, or within an iFrame |
46 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) ) { |
|
46 | + if (is_network_admin() || isset($_GET['activate-multi']) || defined('IFRAME_REQUEST')) { |
|
47 | 47 | |
48 | 48 | return; |
49 | 49 | |
50 | 50 | } |
51 | 51 | // don't run for upgrades and for pages already on the welcome screen |
52 | - if ( ( isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action'] ) |
|
53 | - || ( ! empty( $_GET['page'] ) && $_GET['page'] === 'sensei-welcome' ) ) { |
|
52 | + if ((isset($_GET['action']) && 'upgrade-plugin' == $_GET['action']) |
|
53 | + || ( ! empty($_GET['page']) && $_GET['page'] === 'sensei-welcome')) { |
|
54 | 54 | |
55 | 55 | return; |
56 | 56 | |
57 | 57 | } |
58 | 58 | |
59 | - wp_redirect( admin_url( 'index.php?page=sensei-welcome' ) ); |
|
59 | + wp_redirect(admin_url('index.php?page=sensei-welcome')); |
|
60 | 60 | exit; |
61 | 61 | } |
62 | 62 | |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function admin_menus() { |
69 | 69 | |
70 | - if ( ! isset( $_GET['page'] ) || 'sensei-welcome' != $_GET[ 'page' ] ) { |
|
70 | + if ( ! isset($_GET['page']) || 'sensei-welcome' != $_GET['page']) { |
|
71 | 71 | return; |
72 | 72 | } |
73 | 73 | |
74 | - $welcome_page_name = __( 'Sensei Activation', 'woothemes-sensei' ); |
|
75 | - $welcome_page_title = __( 'Welcome to Sensei', 'woothemes-sensei' ); |
|
76 | - add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'sensei-welcome', array( $this, 'welcome_screen' ) ); |
|
74 | + $welcome_page_name = __('Sensei Activation', 'woothemes-sensei'); |
|
75 | + $welcome_page_title = __('Welcome to Sensei', 'woothemes-sensei'); |
|
76 | + add_dashboard_page($welcome_page_title, $welcome_page_name, 'manage_options', 'sensei-welcome', array($this, 'welcome_screen')); |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | <hr /> |
133 | 133 | |
134 | 134 | <div class="return-to-dashboard"> |
135 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'woothemes-sensei-settings' ), 'admin.php' ) ) ); ?>"><?php _e( 'Go to Sensei Settings', 'woothemes-sensei' ); ?></a> |
|
135 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'woothemes-sensei-settings'), 'admin.php'))); ?>"><?php _e('Go to Sensei Settings', 'woothemes-sensei'); ?></a> |
|
136 | 136 | </div> |
137 | 137 | </div> |
138 | 138 | <?php |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function admin_head() { |
145 | 145 | // remove the menu page so it is not visible in the admin side bar |
146 | - remove_submenu_page( 'index.php', 'sensei-welcome' ); |
|
146 | + remove_submenu_page('index.php', 'sensei-welcome'); |
|
147 | 147 | ?> |
148 | 148 | <style type="text/css"> |
149 | 149 | /*<![CDATA[*/ |
@@ -262,47 +262,47 @@ discard block |
||
262 | 262 | private function intro() { |
263 | 263 | |
264 | 264 | // Drop minor version if 0 |
265 | - $major_version = substr( Sensei()->version, 0, 3 ); |
|
265 | + $major_version = substr(Sensei()->version, 0, 3); |
|
266 | 266 | |
267 | 267 | // Random tweet - must be kept to 102 chars to "fit" |
268 | 268 | $tweets = array( |
269 | 269 | 'I\'ve just installed Sensei - A premium Learning Management plugin for #WordPress.' |
270 | 270 | ); |
271 | - shuffle( $tweets ); |
|
271 | + shuffle($tweets); |
|
272 | 272 | ?> |
273 | - <h1><?php printf( __( 'Welcome to Sensei %s', 'woothemes-sensei' ), $major_version ); ?></h1> |
|
273 | + <h1><?php printf(__('Welcome to Sensei %s', 'woothemes-sensei'), $major_version); ?></h1> |
|
274 | 274 | |
275 | 275 | <div class="about-text sensei-about-text"> |
276 | 276 | <?php |
277 | - if ( ! empty( $_GET['sensei-installed'] ) ) { |
|
278 | - $message = __( 'Thanks, all done!', 'woothemes-sensei' ); |
|
279 | - } elseif ( ! empty( $_GET['sensei-updated'] ) ) { |
|
280 | - $message = __( 'Thank you for updating to the latest version!', 'woothemes-sensei' ); |
|
277 | + if ( ! empty($_GET['sensei-installed'])) { |
|
278 | + $message = __('Thanks, all done!', 'woothemes-sensei'); |
|
279 | + } elseif ( ! empty($_GET['sensei-updated'])) { |
|
280 | + $message = __('Thank you for updating to the latest version!', 'woothemes-sensei'); |
|
281 | 281 | } else { |
282 | - $message = __( 'Thanks for installing!', 'woothemes-sensei' ); |
|
282 | + $message = __('Thanks for installing!', 'woothemes-sensei'); |
|
283 | 283 | } |
284 | 284 | |
285 | - printf( __( '%s We hope you enjoy using Sensei %s.', 'woothemes-sensei' ), $message, $major_version ); |
|
285 | + printf(__('%s We hope you enjoy using Sensei %s.', 'woothemes-sensei'), $message, $major_version); |
|
286 | 286 | ?> |
287 | 287 | </div> |
288 | 288 | |
289 | 289 | <div class="sensei-badge"> |
290 | 290 | <?php |
291 | - _e('Sensei by WooThemes','woothemes-sensei'); |
|
291 | + _e('Sensei by WooThemes', 'woothemes-sensei'); |
|
292 | 292 | echo '<br />'; |
293 | 293 | |
294 | - printf( __( 'Version %s', 'woothemes-sensei' ), Sensei()->version ); |
|
294 | + printf(__('Version %s', 'woothemes-sensei'), Sensei()->version); |
|
295 | 295 | ?> |
296 | 296 | </div> |
297 | 297 | |
298 | 298 | <p class="sensei-actions"> |
299 | - <a href="<?php echo admin_url('admin.php?page=woothemes-sensei-settings'); ?>" class="button button-primary"><?php _e( 'Settings', 'woothemes-sensei' ); ?></a> |
|
300 | - <a href="<?php echo esc_url( apply_filters( 'sensei_docs_url', 'http://docs.woothemes.com/documentation/plugins/sensei/', 'woothemes-sensei' ) ); ?>" class="docs button button-primary"><?php _e( 'Docs', 'woothemes-sensei' ); ?></a> |
|
301 | - <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/products/sensei" data-text="<?php echo esc_attr( $tweets[0] ); ?>" data-via="WooThemes" data-size="large">Tweet</a> |
|
299 | + <a href="<?php echo admin_url('admin.php?page=woothemes-sensei-settings'); ?>" class="button button-primary"><?php _e('Settings', 'woothemes-sensei'); ?></a> |
|
300 | + <a href="<?php echo esc_url(apply_filters('sensei_docs_url', 'http://docs.woothemes.com/documentation/plugins/sensei/', 'woothemes-sensei')); ?>" class="docs button button-primary"><?php _e('Docs', 'woothemes-sensei'); ?></a> |
|
301 | + <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/products/sensei" data-text="<?php echo esc_attr($tweets[0]); ?>" data-via="WooThemes" data-size="large">Tweet</a> |
|
302 | 302 | <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> |
303 | 303 | </p> |
304 | 304 | |
305 | - <h2 > <?php _e( "What's New", 'woothemes-sensei' ); ?> </h2> |
|
305 | + <h2 > <?php _e("What's New", 'woothemes-sensei'); ?> </h2> |
|
306 | 306 | |
307 | 307 | <?php |
308 | 308 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
3 | - exit; // Exit if accessed directly |
|
3 | + exit; // Exit if accessed directly |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -17,45 +17,45 @@ discard block |
||
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Hook in tabs. |
20 | - * @since 1.8.0 |
|
20 | + * @since 1.8.0 |
|
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - add_action( 'admin_menu', array( $this, 'admin_menus') ); |
|
24 | + add_action( 'admin_menu', array( $this, 'admin_menus') ); |
|
25 | 25 | add_action( 'admin_head', array( $this, 'admin_head' ) ); |
26 | 26 | |
27 | 27 | } |
28 | 28 | |
29 | - /** |
|
30 | - * Sends user to the welcome page on first activation. |
|
31 | - * |
|
32 | - * Hooked into activated_plugin |
|
33 | - * @since 1.8.0 |
|
34 | - */ |
|
35 | - public static function redirect( $plugin ) { |
|
29 | + /** |
|
30 | + * Sends user to the welcome page on first activation. |
|
31 | + * |
|
32 | + * Hooked into activated_plugin |
|
33 | + * @since 1.8.0 |
|
34 | + */ |
|
35 | + public static function redirect( $plugin ) { |
|
36 | 36 | |
37 | - // Bail if activating from network, or bulk, or within an iFrame |
|
38 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) ) { |
|
37 | + // Bail if activating from network, or bulk, or within an iFrame |
|
38 | + if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) ) { |
|
39 | 39 | |
40 | - return; |
|
40 | + return; |
|
41 | 41 | |
42 | - } |
|
43 | - // don't run for upgrades and for pages already on the welcome screen |
|
44 | - if ( ( isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action'] ) |
|
45 | - || ( ! empty( $_GET['page'] ) && $_GET['page'] === 'sensei-welcome' ) ) { |
|
42 | + } |
|
43 | + // don't run for upgrades and for pages already on the welcome screen |
|
44 | + if ( ( isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action'] ) |
|
45 | + || ( ! empty( $_GET['page'] ) && $_GET['page'] === 'sensei-welcome' ) ) { |
|
46 | 46 | |
47 | - return; |
|
47 | + return; |
|
48 | 48 | |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - wp_redirect( admin_url( 'index.php?page=sensei-welcome' ) ); |
|
52 | - exit; |
|
53 | - } |
|
51 | + wp_redirect( admin_url( 'index.php?page=sensei-welcome' ) ); |
|
52 | + exit; |
|
53 | + } |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Add admin menus/screens. |
57 | - * |
|
58 | - * @since 1.8.0 |
|
57 | + * |
|
58 | + * @since 1.8.0 |
|
59 | 59 | */ |
60 | 60 | public function admin_menus() { |
61 | 61 | |
@@ -65,17 +65,17 @@ discard block |
||
65 | 65 | |
66 | 66 | $welcome_page_name = __( 'Sensei Activation', 'woothemes-sensei' ); |
67 | 67 | $welcome_page_title = __( 'Welcome to Sensei', 'woothemes-sensei' ); |
68 | - add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'sensei-welcome', array( $this, 'welcome_screen' ) ); |
|
68 | + add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'sensei-welcome', array( $this, 'welcome_screen' ) ); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
72 | - /** |
|
73 | - * Output the Welcome screen. |
|
74 | - * |
|
75 | - * @since 1.8.0 |
|
76 | - */ |
|
77 | - public function welcome_screen() { |
|
78 | - ?> |
|
72 | + /** |
|
73 | + * Output the Welcome screen. |
|
74 | + * |
|
75 | + * @since 1.8.0 |
|
76 | + */ |
|
77 | + public function welcome_screen() { |
|
78 | + ?> |
|
79 | 79 | <div class="wrap about-wrap"> |
80 | 80 | |
81 | 81 | <?php $this->intro(); ?> |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | </div> |
129 | 129 | </div> |
130 | 130 | <?php |
131 | - } |
|
131 | + } |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Add styles just for this page, and remove dashboard page links. |
135 | 135 | */ |
136 | 136 | public function admin_head() { |
137 | - // remove the menu page so it is not visible in the admin side bar |
|
137 | + // remove the menu page so it is not visible in the admin side bar |
|
138 | 138 | remove_submenu_page( 'index.php', 'sensei-welcome' ); |
139 | 139 | ?> |
140 | 140 | <style type="text/css"> |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | // Random tweet - must be kept to 102 chars to "fit" |
260 | 260 | $tweets = array( |
261 | - 'I\'ve just installed Sensei - A premium Learning Management plugin for #WordPress.' |
|
261 | + 'I\'ve just installed Sensei - A premium Learning Management plugin for #WordPress.' |
|
262 | 262 | ); |
263 | 263 | shuffle( $tweets ); |
264 | 264 | ?> |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | |
281 | 281 | <div class="sensei-badge"> |
282 | 282 | <?php |
283 | - _e('Sensei by WooThemes','woothemes-sensei'); |
|
284 | - echo '<br />'; |
|
283 | + _e('Sensei by WooThemes','woothemes-sensei'); |
|
284 | + echo '<br />'; |
|
285 | 285 | |
286 | - printf( __( 'Version %s', 'woothemes-sensei' ), Sensei()->version ); |
|
287 | - ?> |
|
286 | + printf( __( 'Version %s', 'woothemes-sensei' ), Sensei()->version ); |
|
287 | + ?> |
|
288 | 288 | </div> |
289 | 289 | |
290 | 290 | <p class="sensei-actions"> |