@@ -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 |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class Sensei_Course_Results { |
16 | 16 | |
17 | - /** |
|
18 | - * @var string |
|
19 | - */ |
|
20 | - public $courses_url_base; |
|
17 | + /** |
|
18 | + * @var string |
|
19 | + */ |
|
20 | + public $courses_url_base; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Constructor. |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | global $wp_query, $current_user; |
99 | 99 | |
100 | 100 | if( isset( $wp_query->query_vars['course_results'] ) ) { |
101 | - Sensei_Templates::get_template( 'course-results/course-info.php' ); |
|
101 | + Sensei_Templates::get_template( 'course-results/course-info.php' ); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | } |
@@ -117,20 +117,20 @@ discard block |
||
117 | 117 | |
118 | 118 | sensei_do_deprecated_action( 'sensei_course_results_lessons','1.9.','sensei_course_results_content_inside_after', $course ); |
119 | 119 | |
120 | - sensei_do_deprecated_action( 'sensei_course_results_bottom','1.9.','sensei_course_results_content_inside_after', $course->ID ); |
|
120 | + sensei_do_deprecated_action( 'sensei_course_results_bottom','1.9.','sensei_course_results_content_inside_after', $course->ID ); |
|
121 | 121 | |
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
125 | 125 | * Load template for displaying course lessons |
126 | - * |
|
126 | + * |
|
127 | 127 | * @since 1.4.0 |
128 | 128 | * @return void |
129 | 129 | */ |
130 | 130 | public function course_lessons() { |
131 | 131 | |
132 | 132 | global $course; |
133 | - _deprecated_function( 'Sensei_modules course_lessons ', '1.9.0' ); |
|
133 | + _deprecated_function( 'Sensei_modules course_lessons ', '1.9.0' ); |
|
134 | 134 | |
135 | 135 | } |
136 | 136 | |
@@ -147,62 +147,62 @@ discard block |
||
147 | 147 | return $classes; |
148 | 148 | } |
149 | 149 | |
150 | - /** |
|
151 | - * Deprecate the sensei_course_results_content hook |
|
152 | - * |
|
153 | - * @deprecated since 1.9.0 |
|
154 | - */ |
|
155 | - public static function deprecate_sensei_course_results_content_hook(){ |
|
150 | + /** |
|
151 | + * Deprecate the sensei_course_results_content hook |
|
152 | + * |
|
153 | + * @deprecated since 1.9.0 |
|
154 | + */ |
|
155 | + public static function deprecate_sensei_course_results_content_hook(){ |
|
156 | 156 | |
157 | - sensei_do_deprecated_action('sensei_course_results_content', '1.9.0','sensei_course_results_content_before'); |
|
157 | + sensei_do_deprecated_action('sensei_course_results_content', '1.9.0','sensei_course_results_content_before'); |
|
158 | 158 | |
159 | - } |
|
159 | + } |
|
160 | 160 | |
161 | - /** |
|
162 | - * Fire the sensei frontend message hook |
|
163 | - * |
|
164 | - * @since 1.9.0 |
|
165 | - */ |
|
166 | - public static function fire_sensei_message_hook(){ |
|
161 | + /** |
|
162 | + * Fire the sensei frontend message hook |
|
163 | + * |
|
164 | + * @since 1.9.0 |
|
165 | + */ |
|
166 | + public static function fire_sensei_message_hook(){ |
|
167 | 167 | |
168 | - do_action( 'sensei_frontend_messages' ); |
|
168 | + do_action( 'sensei_frontend_messages' ); |
|
169 | 169 | |
170 | - } |
|
170 | + } |
|
171 | 171 | |
172 | - /** |
|
173 | - * Deprecate the course_results info hook |
|
174 | - * |
|
175 | - * @since 1.9.0 |
|
176 | - */ |
|
177 | - public static function deprecate_course_result_info_hook(){ |
|
172 | + /** |
|
173 | + * Deprecate the course_results info hook |
|
174 | + * |
|
175 | + * @since 1.9.0 |
|
176 | + */ |
|
177 | + public static function deprecate_course_result_info_hook(){ |
|
178 | 178 | |
179 | - sensei_do_deprecated_action( 'sensei_course_results_info', '1.9.0', 'sensei_course_results_content_inside_before' ); |
|
179 | + sensei_do_deprecated_action( 'sensei_course_results_info', '1.9.0', 'sensei_course_results_content_inside_before' ); |
|
180 | 180 | |
181 | - } |
|
181 | + } |
|
182 | 182 | |
183 | - /** |
|
184 | - * Deprecate the sensei_course_results_top hook |
|
185 | - * |
|
186 | - * @deprecate since 1.9.0 |
|
187 | - */ |
|
188 | - public static function deprecate_course_results_top_hook(){ |
|
183 | + /** |
|
184 | + * Deprecate the sensei_course_results_top hook |
|
185 | + * |
|
186 | + * @deprecate since 1.9.0 |
|
187 | + */ |
|
188 | + public static function deprecate_course_results_top_hook(){ |
|
189 | 189 | |
190 | - global $course; |
|
191 | - sensei_do_deprecated_action( 'sensei_course_results_top', '1.9.0' ,'sensei_course_results_content_inside_before',$course->ID ); |
|
190 | + global $course; |
|
191 | + sensei_do_deprecated_action( 'sensei_course_results_top', '1.9.0' ,'sensei_course_results_content_inside_before',$course->ID ); |
|
192 | 192 | |
193 | - } |
|
193 | + } |
|
194 | 194 | |
195 | - /** |
|
196 | - * Fire the course image hook |
|
197 | - * |
|
198 | - * @since 1.8.0 |
|
199 | - */ |
|
200 | - public static function fire_course_image_hook(){ |
|
195 | + /** |
|
196 | + * Fire the course image hook |
|
197 | + * |
|
198 | + * @since 1.8.0 |
|
199 | + */ |
|
200 | + public static function fire_course_image_hook(){ |
|
201 | 201 | |
202 | - global $course; |
|
203 | - sensei_do_deprecated_action('sensei_course_image','1.9.0', 'sensei_single_course_content_inside_before', array( get_the_ID()) ); |
|
202 | + global $course; |
|
203 | + sensei_do_deprecated_action('sensei_course_image','1.9.0', 'sensei_single_course_content_inside_before', array( get_the_ID()) ); |
|
204 | 204 | |
205 | - } |
|
205 | + } |
|
206 | 206 | |
207 | 207 | } // End Class |
208 | 208 |
@@ -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 course results pages in Sensei. |
@@ -20,20 +20,20 @@ discard block |
||
20 | 20 | * Constructor. |
21 | 21 | * @since 1.4.0 |
22 | 22 | */ |
23 | - public function __construct () { |
|
23 | + public function __construct() { |
|
24 | 24 | |
25 | 25 | // Setup learner profile URL base |
26 | - $this->courses_url_base = apply_filters( 'sensei_course_slug', _x( 'course', 'post type single url slug', 'woothemes-sensei' ) ); |
|
26 | + $this->courses_url_base = apply_filters('sensei_course_slug', _x('course', 'post type single url slug', 'woothemes-sensei')); |
|
27 | 27 | |
28 | 28 | // Setup permalink structure for course results |
29 | - add_action( 'init', array( $this, 'setup_permastruct' ) ); |
|
30 | - add_filter( 'wp_title', array( $this, 'page_title' ), 10, 2 ); |
|
29 | + add_action('init', array($this, 'setup_permastruct')); |
|
30 | + add_filter('wp_title', array($this, 'page_title'), 10, 2); |
|
31 | 31 | |
32 | 32 | // Load course results |
33 | - add_action( 'sensei_course_results_content_inside_before', array( $this, 'deprecate_course_result_info_hook' ), 10 ); |
|
33 | + add_action('sensei_course_results_content_inside_before', array($this, 'deprecate_course_result_info_hook'), 10); |
|
34 | 34 | |
35 | 35 | // Add class to body tag |
36 | - add_filter( 'body_class', array( $this, 'body_class' ), 10, 1 ); |
|
36 | + add_filter('body_class', array($this, 'body_class'), 10, 1); |
|
37 | 37 | |
38 | 38 | } // End __construct() |
39 | 39 | |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * @return void |
44 | 44 | */ |
45 | 45 | public function setup_permastruct() { |
46 | - add_rewrite_rule( '^' . $this->courses_url_base . '/([^/]*)/results/?', 'index.php?course_results=$matches[1]', 'top' ); |
|
47 | - add_rewrite_tag( '%course_results%', '([^&]+)' ); |
|
46 | + add_rewrite_rule('^'.$this->courses_url_base.'/([^/]*)/results/?', 'index.php?course_results=$matches[1]', 'top'); |
|
47 | + add_rewrite_tag('%course_results%', '([^&]+)'); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | * @param string $sep Seeparator string |
54 | 54 | * @return string Modified title |
55 | 55 | */ |
56 | - public function page_title( $title, $sep = null ) { |
|
56 | + public function page_title($title, $sep = null) { |
|
57 | 57 | global $wp_query; |
58 | - if( isset( $wp_query->query_vars['course_results'] ) ) { |
|
59 | - $course = get_page_by_path( $wp_query->query_vars['course_results'], OBJECT, 'course' ); |
|
60 | - $title = __( 'Course Results: ', 'woothemes-sensei' ) . $course->post_title . ' ' . $sep . ' '; |
|
58 | + if (isset($wp_query->query_vars['course_results'])) { |
|
59 | + $course = get_page_by_path($wp_query->query_vars['course_results'], OBJECT, 'course'); |
|
60 | + $title = __('Course Results: ', 'woothemes-sensei').$course->post_title.' '.$sep.' '; |
|
61 | 61 | } |
62 | 62 | return $title; |
63 | 63 | } |
@@ -68,18 +68,18 @@ discard block |
||
68 | 68 | * @param integer $course_id ID of course |
69 | 69 | * @return string The course results page permalink |
70 | 70 | */ |
71 | - public function get_permalink( $course_id = 0 ) { |
|
71 | + public function get_permalink($course_id = 0) { |
|
72 | 72 | |
73 | 73 | $permalink = ''; |
74 | 74 | |
75 | - if( $course_id > 0 ) { |
|
75 | + if ($course_id > 0) { |
|
76 | 76 | |
77 | - $course = get_post( $course_id ); |
|
77 | + $course = get_post($course_id); |
|
78 | 78 | |
79 | - if ( get_option('permalink_structure') ) { |
|
80 | - $permalink = trailingslashit( get_home_url() ) . $this->courses_url_base . '/' . $course->post_name . '/results/'; |
|
79 | + if (get_option('permalink_structure')) { |
|
80 | + $permalink = trailingslashit(get_home_url()).$this->courses_url_base.'/'.$course->post_name.'/results/'; |
|
81 | 81 | } else { |
82 | - $permalink = trailingslashit( get_home_url() ) . '?course_results=' . $course->post_name; |
|
82 | + $permalink = trailingslashit(get_home_url()).'?course_results='.$course->post_name; |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | * @return void |
93 | 93 | */ |
94 | 94 | public function content() { |
95 | - global $wp_query, $current_user; |
|
95 | + global $wp_query, $current_user; |
|
96 | 96 | |
97 | - if( isset( $wp_query->query_vars['course_results'] ) ) { |
|
98 | - Sensei_Templates::get_template( 'course-results/course-info.php' ); |
|
97 | + if (isset($wp_query->query_vars['course_results'])) { |
|
98 | + Sensei_Templates::get_template('course-results/course-info.php'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | |
110 | 110 | global $course; |
111 | 111 | |
112 | - Sensei_Utils::sensei_user_course_status_message( $course->ID, get_current_user_id()); |
|
112 | + Sensei_Utils::sensei_user_course_status_message($course->ID, get_current_user_id()); |
|
113 | 113 | |
114 | - sensei_do_deprecated_action( 'sensei_course_results_lessons','1.9.','sensei_course_results_content_inside_after', $course ); |
|
114 | + sensei_do_deprecated_action('sensei_course_results_lessons', '1.9.', 'sensei_course_results_content_inside_after', $course); |
|
115 | 115 | |
116 | - sensei_do_deprecated_action( 'sensei_course_results_bottom','1.9.','sensei_course_results_content_inside_after', $course->ID ); |
|
116 | + sensei_do_deprecated_action('sensei_course_results_bottom', '1.9.', 'sensei_course_results_content_inside_after', $course->ID); |
|
117 | 117 | |
118 | 118 | } |
119 | 119 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | public function course_lessons() { |
127 | 127 | |
128 | 128 | global $course; |
129 | - _deprecated_function( 'Sensei_modules course_lessons ', '1.9.0' ); |
|
129 | + _deprecated_function('Sensei_modules course_lessons ', '1.9.0'); |
|
130 | 130 | |
131 | 131 | } |
132 | 132 | |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | * @param array $classes Existing classes |
136 | 136 | * @return array Modified classes |
137 | 137 | */ |
138 | - public function body_class( $classes ) { |
|
138 | + public function body_class($classes) { |
|
139 | 139 | global $wp_query; |
140 | - if( isset( $wp_query->query_vars['course_results'] ) ) { |
|
140 | + if (isset($wp_query->query_vars['course_results'])) { |
|
141 | 141 | $classes[] = 'course-results'; |
142 | 142 | } |
143 | 143 | return $classes; |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @deprecated since 1.9.0 |
150 | 150 | */ |
151 | - public static function deprecate_sensei_course_results_content_hook(){ |
|
151 | + public static function deprecate_sensei_course_results_content_hook() { |
|
152 | 152 | |
153 | - sensei_do_deprecated_action('sensei_course_results_content', '1.9.0','sensei_course_results_content_before'); |
|
153 | + sensei_do_deprecated_action('sensei_course_results_content', '1.9.0', 'sensei_course_results_content_before'); |
|
154 | 154 | |
155 | 155 | } |
156 | 156 | |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @since 1.9.0 |
161 | 161 | */ |
162 | - public static function fire_sensei_message_hook(){ |
|
162 | + public static function fire_sensei_message_hook() { |
|
163 | 163 | |
164 | - do_action( 'sensei_frontend_messages' ); |
|
164 | + do_action('sensei_frontend_messages'); |
|
165 | 165 | |
166 | 166 | } |
167 | 167 | |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @since 1.9.0 |
172 | 172 | */ |
173 | - public static function deprecate_course_result_info_hook(){ |
|
173 | + public static function deprecate_course_result_info_hook() { |
|
174 | 174 | |
175 | - sensei_do_deprecated_action( 'sensei_course_results_info', '1.9.0', 'sensei_course_results_content_inside_before' ); |
|
175 | + sensei_do_deprecated_action('sensei_course_results_info', '1.9.0', 'sensei_course_results_content_inside_before'); |
|
176 | 176 | |
177 | 177 | } |
178 | 178 | |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @deprecate since 1.9.0 |
183 | 183 | */ |
184 | - public static function deprecate_course_results_top_hook(){ |
|
184 | + public static function deprecate_course_results_top_hook() { |
|
185 | 185 | |
186 | 186 | global $course; |
187 | - sensei_do_deprecated_action( 'sensei_course_results_top', '1.9.0' ,'sensei_course_results_content_inside_before',$course->ID ); |
|
187 | + sensei_do_deprecated_action('sensei_course_results_top', '1.9.0', 'sensei_course_results_content_inside_before', $course->ID); |
|
188 | 188 | |
189 | 189 | } |
190 | 190 | |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @since 1.8.0 |
195 | 195 | */ |
196 | - public static function fire_course_image_hook(){ |
|
196 | + public static function fire_course_image_hook() { |
|
197 | 197 | |
198 | 198 | global $course; |
199 | - sensei_do_deprecated_action('sensei_course_image','1.9.0', 'sensei_single_course_content_inside_before', array( get_the_ID()) ); |
|
199 | + sensei_do_deprecated_action('sensei_course_image', '1.9.0', 'sensei_single_course_content_inside_before', array(get_the_ID())); |
|
200 | 200 | |
201 | 201 | } |
202 | 202 | |
@@ -207,4 +207,4 @@ discard block |
||
207 | 207 | * @ignore only for backward compatibility |
208 | 208 | * @since 1.9.0 |
209 | 209 | */ |
210 | -class WooThemes_Sensei_Course_Results extends Sensei_Course_Results{} |
|
210 | +class WooThemes_Sensei_Course_Results extends Sensei_Course_Results {} |
@@ -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 |
@@ -60,8 +60,8 @@ |
||
60 | 60 | /** |
61 | 61 | * @since 1.9.0 |
62 | 62 | * |
63 | - * @param $setting |
|
64 | - * @param $new_value |
|
63 | + * @param string $setting |
|
64 | + * @param integer $new_value |
|
65 | 65 | */ |
66 | 66 | public function set( $setting, $new_value ){ |
67 | 67 |
@@ -19,57 +19,57 @@ discard block |
||
19 | 19 | * @since 1.0.0 |
20 | 20 | */ |
21 | 21 | public function __construct () { |
22 | - parent::__construct(); // Required in extended classes. |
|
22 | + parent::__construct(); // Required in extended classes. |
|
23 | 23 | |
24 | - $this->token = 'woothemes-sensei-settings'; |
|
25 | - add_action('init', array( __CLASS__, 'flush_rewrite_rules' ) ); |
|
24 | + $this->token = 'woothemes-sensei-settings'; |
|
25 | + add_action('init', array( __CLASS__, 'flush_rewrite_rules' ) ); |
|
26 | 26 | |
27 | - // Setup Admin Settings data |
|
28 | - if ( is_admin() ) { |
|
27 | + // Setup Admin Settings data |
|
28 | + if ( is_admin() ) { |
|
29 | 29 | |
30 | - $this->has_tabs = true; |
|
31 | - $this->name = __( 'Sensei Settings', 'woothemes-sensei' ); |
|
32 | - $this->menu_label = __( 'Settings', 'woothemes-sensei' ); |
|
33 | - $this->page_slug = 'woothemes-sensei-settings'; |
|
30 | + $this->has_tabs = true; |
|
31 | + $this->name = __( 'Sensei Settings', 'woothemes-sensei' ); |
|
32 | + $this->menu_label = __( 'Settings', 'woothemes-sensei' ); |
|
33 | + $this->page_slug = 'woothemes-sensei-settings'; |
|
34 | 34 | |
35 | - } // End If Statement |
|
35 | + } // End If Statement |
|
36 | 36 | |
37 | - $this->register_hook_listener(); |
|
38 | - $this->get_settings(); |
|
37 | + $this->register_hook_listener(); |
|
38 | + $this->get_settings(); |
|
39 | 39 | |
40 | 40 | } // End __construct() |
41 | 41 | |
42 | - /** |
|
43 | - * Get settings value |
|
44 | - * |
|
45 | - * @since 1.9.0 |
|
46 | - * @param string $setting_name |
|
47 | - * @return mixed |
|
48 | - */ |
|
49 | - public function get( $setting_name ){ |
|
42 | + /** |
|
43 | + * Get settings value |
|
44 | + * |
|
45 | + * @since 1.9.0 |
|
46 | + * @param string $setting_name |
|
47 | + * @return mixed |
|
48 | + */ |
|
49 | + public function get( $setting_name ){ |
|
50 | 50 | |
51 | - if( isset( $this->settings[ $setting_name ] ) ){ |
|
51 | + if( isset( $this->settings[ $setting_name ] ) ){ |
|
52 | 52 | |
53 | - return $this->settings[ $setting_name ]; |
|
53 | + return $this->settings[ $setting_name ]; |
|
54 | 54 | |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | - return false; |
|
58 | - } |
|
57 | + return false; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * @since 1.9.0 |
|
62 | - * |
|
63 | - * @param $setting |
|
64 | - * @param $new_value |
|
65 | - */ |
|
66 | - public function set( $setting, $new_value ){ |
|
60 | + /** |
|
61 | + * @since 1.9.0 |
|
62 | + * |
|
63 | + * @param $setting |
|
64 | + * @param $new_value |
|
65 | + */ |
|
66 | + public function set( $setting, $new_value ){ |
|
67 | 67 | |
68 | - $settings = get_option( $this->token, array() ); |
|
68 | + $settings = get_option( $this->token, array() ); |
|
69 | 69 | $settings[ $setting ] = $new_value; |
70 | 70 | return update_option( $this->token,$settings ); |
71 | 71 | |
72 | - } |
|
72 | + } |
|
73 | 73 | |
74 | 74 | /** |
75 | 75 | * Register the settings screen within the WordPress admin. |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $complete_settings = array( 'passed' => __( 'Once all the course lessons have been completed', 'woothemes-sensei' ), 'complete' => __( 'At any time (by clicking the \'Complete Course\' button)', 'woothemes-sensei' ) ); |
158 | 158 | $course_display_settings = array( 'excerpt' => __( 'Course Excerpt', 'woothemes-sensei' ), 'full' => __( 'Full Course Content', 'woothemes-sensei' ) ); |
159 | 159 | |
160 | - $fields = array(); |
|
160 | + $fields = array(); |
|
161 | 161 | |
162 | 162 | $fields['access_permission'] = array( |
163 | 163 | 'name' => __( 'Access Permissions', 'woothemes-sensei' ), |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | 'section' => 'default-settings' |
220 | 220 | ); |
221 | 221 | |
222 | - // Course Settings |
|
222 | + // Course Settings |
|
223 | 223 | |
224 | - $fields['course_completion'] = array( |
|
224 | + $fields['course_completion'] = array( |
|
225 | 225 | 'name' => __( 'Courses are complete:', 'woothemes-sensei' ), |
226 | 226 | 'description' => __( 'This will determine when courses are marked as complete.', 'woothemes-sensei' ), |
227 | 227 | 'type' => 'select', |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | 'options' => $complete_settings |
232 | 232 | ); |
233 | 233 | |
234 | - $fields['course_author'] = array( |
|
234 | + $fields['course_author'] = array( |
|
235 | 235 | 'name' => __( 'Display Course Author', 'woothemes-sensei' ), |
236 | 236 | 'description' => __( 'Output the Course Author on Course archive and My Courses page.', 'woothemes-sensei' ), |
237 | 237 | 'type' => 'checkbox', |
@@ -459,10 +459,10 @@ discard block |
||
459 | 459 | ); |
460 | 460 | |
461 | 461 | $teacher_email_options = array( |
462 | - 'teacher-started-course' => __( 'A learner starts their course', 'woothemes-sensei' ), |
|
463 | - 'teacher-completed-course' => __( 'A learner completes their course', 'woothemes-sensei' ), |
|
464 | - 'teacher-completed-lesson' => __( 'A learner completes a lesson', 'woothemes-sensei' ), |
|
465 | - 'teacher-quiz-submitted' => __( 'A learner submits a quiz for grading', 'woothemes-sensei' ), |
|
462 | + 'teacher-started-course' => __( 'A learner starts their course', 'woothemes-sensei' ), |
|
463 | + 'teacher-completed-course' => __( 'A learner completes their course', 'woothemes-sensei' ), |
|
464 | + 'teacher-completed-lesson' => __( 'A learner completes a lesson', 'woothemes-sensei' ), |
|
465 | + 'teacher-quiz-submitted' => __( 'A learner submits a quiz for grading', 'woothemes-sensei' ), |
|
466 | 466 | 'teacher-new-message' => __( 'A learner sends a private message to a teacher', 'woothemes-sensei' ), |
467 | 467 | ); |
468 | 468 | |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | |
572 | 572 | if ( Sensei_WC::is_woocommerce_present() ) { |
573 | 573 | // WooCommerce Settings |
574 | - $fields['woocommerce_enabled'] = array( |
|
574 | + $fields['woocommerce_enabled'] = array( |
|
575 | 575 | 'name' => __( 'Enable WooCommerce Courses', 'woothemes-sensei' ), |
576 | 576 | 'description' => __( 'Use WooCommerce to sell Courses by linking a Product to a Course.', 'woothemes-sensei' ), |
577 | 577 | 'type' => 'checkbox', |
@@ -659,14 +659,14 @@ discard block |
||
659 | 659 | $page_items[] = __( 'Select a Page:', 'woothemes-sensei' ); |
660 | 660 | |
661 | 661 | foreach ( $pages_split as $k => $v ) { |
662 | - $id = ''; |
|
663 | - // Get the ID value. |
|
664 | - preg_match( '/value="(.*?)"/i', $v, $matches ); |
|
665 | - |
|
666 | - if ( isset( $matches[1] ) ) { |
|
667 | - $id = $matches[1]; |
|
668 | - $page_items[$id] = trim( strip_tags( $v ) ); |
|
669 | - } // End If Statement |
|
662 | + $id = ''; |
|
663 | + // Get the ID value. |
|
664 | + preg_match( '/value="(.*?)"/i', $v, $matches ); |
|
665 | + |
|
666 | + if ( isset( $matches[1] ) ) { |
|
667 | + $id = $matches[1]; |
|
668 | + $page_items[$id] = trim( strip_tags( $v ) ); |
|
669 | + } // End If Statement |
|
670 | 670 | } // End For Loop |
671 | 671 | |
672 | 672 | $pages_array = $page_items; |
@@ -683,22 +683,22 @@ discard block |
||
683 | 683 | Sensei_Language_Pack_Manager::messages(); |
684 | 684 | } |
685 | 685 | |
686 | - /** |
|
687 | - * Flush the rewrite rules after the settings have been updated. |
|
688 | - * This is to ensure that the |
|
689 | - * |
|
690 | - * @since 1.9.0 |
|
691 | - */ |
|
692 | - public static function flush_rewrite_rules(){ |
|
686 | + /** |
|
687 | + * Flush the rewrite rules after the settings have been updated. |
|
688 | + * This is to ensure that the |
|
689 | + * |
|
690 | + * @since 1.9.0 |
|
691 | + */ |
|
692 | + public static function flush_rewrite_rules(){ |
|
693 | 693 | |
694 | - if ( isset( $_POST[ 'option_page' ] ) && 'woothemes-sensei-settings' == $_POST[ 'option_page' ] |
|
695 | - && isset( $_POST[ 'action' ] ) && 'update' == $_POST[ 'action' ] ) { |
|
694 | + if ( isset( $_POST[ 'option_page' ] ) && 'woothemes-sensei-settings' == $_POST[ 'option_page' ] |
|
695 | + && isset( $_POST[ 'action' ] ) && 'update' == $_POST[ 'action' ] ) { |
|
696 | 696 | |
697 | - Sensei()->initiate_rewrite_rules_flush(); |
|
697 | + Sensei()->initiate_rewrite_rules_flush(); |
|
698 | 698 | |
699 | - } |
|
699 | + } |
|
700 | 700 | |
701 | - }//end flush_cache |
|
701 | + }//end flush_cache |
|
702 | 702 | } // End Class |
703 | 703 | |
704 | 704 | /** |
@@ -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 Settings Class |
@@ -18,18 +18,18 @@ discard block |
||
18 | 18 | * @access public |
19 | 19 | * @since 1.0.0 |
20 | 20 | */ |
21 | - public function __construct () { |
|
21 | + public function __construct() { |
|
22 | 22 | parent::__construct(); // Required in extended classes. |
23 | 23 | |
24 | 24 | $this->token = 'woothemes-sensei-settings'; |
25 | - add_action('init', array( __CLASS__, 'flush_rewrite_rules' ) ); |
|
25 | + add_action('init', array(__CLASS__, 'flush_rewrite_rules')); |
|
26 | 26 | |
27 | 27 | // Setup Admin Settings data |
28 | - if ( is_admin() ) { |
|
28 | + if (is_admin()) { |
|
29 | 29 | |
30 | 30 | $this->has_tabs = true; |
31 | - $this->name = __( 'Sensei Settings', 'woothemes-sensei' ); |
|
32 | - $this->menu_label = __( 'Settings', 'woothemes-sensei' ); |
|
31 | + $this->name = __('Sensei Settings', 'woothemes-sensei'); |
|
32 | + $this->menu_label = __('Settings', 'woothemes-sensei'); |
|
33 | 33 | $this->page_slug = 'woothemes-sensei-settings'; |
34 | 34 | |
35 | 35 | } // End If Statement |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | * @param string $setting_name |
47 | 47 | * @return mixed |
48 | 48 | */ |
49 | - public function get( $setting_name ){ |
|
49 | + public function get($setting_name) { |
|
50 | 50 | |
51 | - if( isset( $this->settings[ $setting_name ] ) ){ |
|
51 | + if (isset($this->settings[$setting_name])) { |
|
52 | 52 | |
53 | - return $this->settings[ $setting_name ]; |
|
53 | + return $this->settings[$setting_name]; |
|
54 | 54 | |
55 | 55 | } |
56 | 56 | |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | * @param $setting |
64 | 64 | * @param $new_value |
65 | 65 | */ |
66 | - public function set( $setting, $new_value ){ |
|
66 | + public function set($setting, $new_value) { |
|
67 | 67 | |
68 | - $settings = get_option( $this->token, array() ); |
|
69 | - $settings[ $setting ] = $new_value; |
|
70 | - return update_option( $this->token,$settings ); |
|
68 | + $settings = get_option($this->token, array()); |
|
69 | + $settings[$setting] = $new_value; |
|
70 | + return update_option($this->token, $settings); |
|
71 | 71 | |
72 | 72 | } |
73 | 73 | |
@@ -77,17 +77,17 @@ discard block |
||
77 | 77 | * @since 1.0.0 |
78 | 78 | * @return void |
79 | 79 | */ |
80 | - public function register_settings_screen () { |
|
80 | + public function register_settings_screen() { |
|
81 | 81 | |
82 | 82 | $this->settings_version = Sensei()->version; // Use the global plugin version on this settings screen. |
83 | - $hook = add_submenu_page( 'sensei', $this->name, $this->menu_label, 'manage_sensei', $this->page_slug, array( $this, 'settings_screen' ) ); |
|
83 | + $hook = add_submenu_page('sensei', $this->name, $this->menu_label, 'manage_sensei', $this->page_slug, array($this, 'settings_screen')); |
|
84 | 84 | $this->hook = $hook; |
85 | 85 | |
86 | - if ( isset( $_GET['page'] ) && ( $_GET['page'] == $this->page_slug ) ) { |
|
87 | - add_action( 'admin_notices', array( $this, 'settings_errors' ) ); |
|
88 | - add_action( 'admin_notices', array( $this, 'language_pack_notices' ) ); |
|
89 | - add_action( 'admin_print_scripts', array( $this, 'enqueue_scripts' ) ); |
|
90 | - add_action( 'admin_print_styles', array( $this, 'enqueue_styles' ) ); |
|
86 | + if (isset($_GET['page']) && ($_GET['page'] == $this->page_slug)) { |
|
87 | + add_action('admin_notices', array($this, 'settings_errors')); |
|
88 | + add_action('admin_notices', array($this, 'language_pack_notices')); |
|
89 | + add_action('admin_print_scripts', array($this, 'enqueue_scripts')); |
|
90 | + add_action('admin_print_styles', array($this, 'enqueue_styles')); |
|
91 | 91 | } |
92 | 92 | } // End register_settings_screen() |
93 | 93 | |
@@ -97,49 +97,49 @@ discard block |
||
97 | 97 | * @since 1.0.0 |
98 | 98 | * @return void |
99 | 99 | */ |
100 | - public function init_sections () { |
|
100 | + public function init_sections() { |
|
101 | 101 | $sections = array(); |
102 | 102 | |
103 | 103 | $sections['default-settings'] = array( |
104 | - 'name' => __( 'General', 'woothemes-sensei' ), |
|
105 | - 'description' => __( 'Settings that apply to the entire plugin.', 'woothemes-sensei' ) |
|
104 | + 'name' => __('General', 'woothemes-sensei'), |
|
105 | + 'description' => __('Settings that apply to the entire plugin.', 'woothemes-sensei') |
|
106 | 106 | ); |
107 | 107 | |
108 | 108 | $sections['course-settings'] = array( |
109 | - 'name' => __( 'Courses', 'woothemes-sensei' ), |
|
110 | - 'description' => __( 'Settings that apply to all Courses.', 'woothemes-sensei' ) |
|
109 | + 'name' => __('Courses', 'woothemes-sensei'), |
|
110 | + 'description' => __('Settings that apply to all Courses.', 'woothemes-sensei') |
|
111 | 111 | ); |
112 | 112 | |
113 | 113 | $sections['lesson-settings'] = array( |
114 | - 'name' => __( 'Lessons', 'woothemes-sensei' ), |
|
115 | - 'description' => __( 'Settings that apply to all Lessons.', 'woothemes-sensei' ) |
|
114 | + 'name' => __('Lessons', 'woothemes-sensei'), |
|
115 | + 'description' => __('Settings that apply to all Lessons.', 'woothemes-sensei') |
|
116 | 116 | ); |
117 | 117 | |
118 | 118 | $sections['email-notification-settings'] = array( |
119 | - 'name' => __( 'Email Notifications', 'woothemes-sensei' ), |
|
120 | - 'description' => __( 'Settings for email notifications sent from your site.', 'woothemes-sensei' ) |
|
119 | + 'name' => __('Email Notifications', 'woothemes-sensei'), |
|
120 | + 'description' => __('Settings for email notifications sent from your site.', 'woothemes-sensei') |
|
121 | 121 | ); |
122 | 122 | |
123 | 123 | $sections['learner-profile-settings'] = array( |
124 | - 'name' => __( 'Learner Profiles', 'woothemes-sensei' ), |
|
125 | - 'description' => __( 'Settings for public Learner Profiles.', 'woothemes-sensei' ) |
|
124 | + 'name' => __('Learner Profiles', 'woothemes-sensei'), |
|
125 | + 'description' => __('Settings for public Learner Profiles.', 'woothemes-sensei') |
|
126 | 126 | ); |
127 | 127 | |
128 | - if ( Sensei_WC::is_woocommerce_present() ) { |
|
128 | + if (Sensei_WC::is_woocommerce_present()) { |
|
129 | 129 | $sections['woocommerce-settings'] = array( |
130 | - 'name' => __( 'WooCommerce', 'woothemes-sensei' ), |
|
131 | - 'description' => __( 'Optional settings for WooCommerce functions.', 'woothemes-sensei' ) |
|
130 | + 'name' => __('WooCommerce', 'woothemes-sensei'), |
|
131 | + 'description' => __('Optional settings for WooCommerce functions.', 'woothemes-sensei') |
|
132 | 132 | ); |
133 | 133 | } // End If Statement |
134 | 134 | |
135 | - if ( 'en_US' !== get_locale() ) { |
|
135 | + if ('en_US' !== get_locale()) { |
|
136 | 136 | $sections['language-settings'] = array( |
137 | - 'name' => __( 'Language', 'woothemes-sensei' ), |
|
138 | - 'description' => __( 'Language options.', 'woothemes-sensei' ) |
|
137 | + 'name' => __('Language', 'woothemes-sensei'), |
|
138 | + 'description' => __('Language options.', 'woothemes-sensei') |
|
139 | 139 | ); |
140 | 140 | } |
141 | 141 | |
142 | - $this->sections = apply_filters( 'sensei_settings_tabs', $sections ); |
|
142 | + $this->sections = apply_filters('sensei_settings_tabs', $sections); |
|
143 | 143 | } // End init_sections() |
144 | 144 | |
145 | 145 | /** |
@@ -149,71 +149,71 @@ discard block |
||
149 | 149 | * @uses Sensei_Utils::get_slider_types() |
150 | 150 | * @return void |
151 | 151 | */ |
152 | - public function init_fields () { |
|
152 | + public function init_fields() { |
|
153 | 153 | global $pagenow; |
154 | 154 | |
155 | 155 | $pages_array = $this->pages_array(); |
156 | - $posts_per_page_array = array( '0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20' ); |
|
157 | - $complete_settings = array( 'passed' => __( 'Once all the course lessons have been completed', 'woothemes-sensei' ), 'complete' => __( 'At any time (by clicking the \'Complete Course\' button)', 'woothemes-sensei' ) ); |
|
158 | - $course_display_settings = array( 'excerpt' => __( 'Course Excerpt', 'woothemes-sensei' ), 'full' => __( 'Full Course Content', 'woothemes-sensei' ) ); |
|
156 | + $posts_per_page_array = array('0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20'); |
|
157 | + $complete_settings = array('passed' => __('Once all the course lessons have been completed', 'woothemes-sensei'), 'complete' => __('At any time (by clicking the \'Complete Course\' button)', 'woothemes-sensei')); |
|
158 | + $course_display_settings = array('excerpt' => __('Course Excerpt', 'woothemes-sensei'), 'full' => __('Full Course Content', 'woothemes-sensei')); |
|
159 | 159 | |
160 | 160 | $fields = array(); |
161 | 161 | |
162 | 162 | $fields['access_permission'] = array( |
163 | - 'name' => __( 'Access Permissions', 'woothemes-sensei' ), |
|
164 | - 'description' => __( 'Users must be logged in to view Course and Lesson content.', 'woothemes-sensei', 'woothemes-sensei' ), |
|
163 | + 'name' => __('Access Permissions', 'woothemes-sensei'), |
|
164 | + 'description' => __('Users must be logged in to view Course and Lesson content.', 'woothemes-sensei', 'woothemes-sensei'), |
|
165 | 165 | 'type' => 'checkbox', |
166 | 166 | 'default' => true, |
167 | 167 | 'section' => 'default-settings' |
168 | 168 | ); |
169 | 169 | |
170 | 170 | $fields['messages_disable'] = array( |
171 | - 'name' => __( 'Disable Private Messages', 'woothemes-sensei' ), |
|
172 | - 'description' => __( 'Disable the private message functions between learners and teachers.', 'woothemes-sensei' ), |
|
171 | + 'name' => __('Disable Private Messages', 'woothemes-sensei'), |
|
172 | + 'description' => __('Disable the private message functions between learners and teachers.', 'woothemes-sensei'), |
|
173 | 173 | 'type' => 'checkbox', |
174 | 174 | 'default' => false, |
175 | 175 | 'section' => 'default-settings' |
176 | 176 | ); |
177 | 177 | |
178 | 178 | $fields['course_page'] = array( |
179 | - 'name' => __( 'Course Archive Page', 'woothemes-sensei' ), |
|
180 | - 'description' => __( 'The page to use to display courses. If you leave this blank the default custom post type archive will apply.', 'woothemes-sensei' ), |
|
179 | + 'name' => __('Course Archive Page', 'woothemes-sensei'), |
|
180 | + 'description' => __('The page to use to display courses. If you leave this blank the default custom post type archive will apply.', 'woothemes-sensei'), |
|
181 | 181 | 'type' => 'select', |
182 | - 'default' => get_option( 'woothemes-sensei_courses_page_id', 0 ), |
|
182 | + 'default' => get_option('woothemes-sensei_courses_page_id', 0), |
|
183 | 183 | 'section' => 'default-settings', |
184 | 184 | 'required' => 0, |
185 | 185 | 'options' => $pages_array |
186 | 186 | ); |
187 | 187 | |
188 | 188 | $fields['my_course_page'] = array( |
189 | - 'name' => __( 'My Courses Page', 'woothemes-sensei' ), |
|
190 | - 'description' => __( 'The page to use to display the courses that a user is currently taking as well as the courses a user has complete.', 'woothemes-sensei' ), |
|
189 | + 'name' => __('My Courses Page', 'woothemes-sensei'), |
|
190 | + 'description' => __('The page to use to display the courses that a user is currently taking as well as the courses a user has complete.', 'woothemes-sensei'), |
|
191 | 191 | 'type' => 'select', |
192 | - 'default' => get_option( 'woothemes-sensei_user_dashboard_page_id', 0 ), |
|
192 | + 'default' => get_option('woothemes-sensei_user_dashboard_page_id', 0), |
|
193 | 193 | 'section' => 'default-settings', |
194 | 194 | 'required' => 0, |
195 | 195 | 'options' => $pages_array |
196 | 196 | ); |
197 | 197 | |
198 | 198 | $fields['placeholder_images_enable'] = array( |
199 | - 'name' => __( 'Use placeholder images', 'woothemes-sensei' ), |
|
200 | - 'description' => __( 'Output a placeholder image when no featured image has been specified for Courses and Lessons.', 'woothemes-sensei' ), |
|
199 | + 'name' => __('Use placeholder images', 'woothemes-sensei'), |
|
200 | + 'description' => __('Output a placeholder image when no featured image has been specified for Courses and Lessons.', 'woothemes-sensei'), |
|
201 | 201 | 'type' => 'checkbox', |
202 | 202 | 'default' => false, |
203 | 203 | 'section' => 'default-settings' |
204 | 204 | ); |
205 | 205 | |
206 | 206 | $fields['styles_disable'] = array( |
207 | - 'name' => __( 'Disable Sensei Styles', 'woothemes-sensei' ), |
|
208 | - 'description' => __( 'Prevent the frontend stylesheets from loading. This will remove the default styles for all Sensei elements.', 'woothemes-sensei' ), |
|
207 | + 'name' => __('Disable Sensei Styles', 'woothemes-sensei'), |
|
208 | + 'description' => __('Prevent the frontend stylesheets from loading. This will remove the default styles for all Sensei elements.', 'woothemes-sensei'), |
|
209 | 209 | 'type' => 'checkbox', |
210 | 210 | 'default' => false, |
211 | 211 | 'section' => 'default-settings' |
212 | 212 | ); |
213 | 213 | |
214 | 214 | $fields['js_disable'] = array( |
215 | - 'name' => __( 'Disable Sensei Javascript', 'woothemes-sensei' ), |
|
216 | - 'description' => __( 'Prevent the frontend javascript from loading. This affects the progress bars and the My Courses tabs.', 'woothemes-sensei' ), |
|
215 | + 'name' => __('Disable Sensei Javascript', 'woothemes-sensei'), |
|
216 | + 'description' => __('Prevent the frontend javascript from loading. This affects the progress bars and the My Courses tabs.', 'woothemes-sensei'), |
|
217 | 217 | 'type' => 'checkbox', |
218 | 218 | 'default' => false, |
219 | 219 | 'section' => 'default-settings' |
@@ -222,8 +222,8 @@ discard block |
||
222 | 222 | // Course Settings |
223 | 223 | |
224 | 224 | $fields['course_completion'] = array( |
225 | - 'name' => __( 'Courses are complete:', 'woothemes-sensei' ), |
|
226 | - 'description' => __( 'This will determine when courses are marked as complete.', 'woothemes-sensei' ), |
|
225 | + 'name' => __('Courses are complete:', 'woothemes-sensei'), |
|
226 | + 'description' => __('This will determine when courses are marked as complete.', 'woothemes-sensei'), |
|
227 | 227 | 'type' => 'select', |
228 | 228 | 'default' => 'passed', |
229 | 229 | 'section' => 'course-settings', |
@@ -232,16 +232,16 @@ discard block |
||
232 | 232 | ); |
233 | 233 | |
234 | 234 | $fields['course_author'] = array( |
235 | - 'name' => __( 'Display Course Author', 'woothemes-sensei' ), |
|
236 | - 'description' => __( 'Output the Course Author on Course archive and My Courses page.', 'woothemes-sensei' ), |
|
235 | + 'name' => __('Display Course Author', 'woothemes-sensei'), |
|
236 | + 'description' => __('Output the Course Author on Course archive and My Courses page.', 'woothemes-sensei'), |
|
237 | 237 | 'type' => 'checkbox', |
238 | 238 | 'default' => true, |
239 | 239 | 'section' => 'course-settings' |
240 | 240 | ); |
241 | 241 | |
242 | 242 | $fields['my_course_amount'] = array( |
243 | - 'name' => __( 'My Courses Pagination', 'woothemes-sensei' ), |
|
244 | - 'description' => __( 'The number of courses to output for the my courses page.', 'woothemes-sensei' ), |
|
243 | + 'name' => __('My Courses Pagination', 'woothemes-sensei'), |
|
244 | + 'description' => __('The number of courses to output for the my courses page.', 'woothemes-sensei'), |
|
245 | 245 | 'type' => 'range', |
246 | 246 | 'default' => '0', |
247 | 247 | 'section' => 'course-settings', |
@@ -250,16 +250,16 @@ discard block |
||
250 | 250 | ); |
251 | 251 | |
252 | 252 | $fields['course_archive_image_enable'] = array( |
253 | - 'name' => __( 'Course Archive Image', 'woothemes-sensei' ), |
|
254 | - 'description' => __( 'Output the Course Image on the Course Archive Page.', 'woothemes-sensei' ), |
|
253 | + 'name' => __('Course Archive Image', 'woothemes-sensei'), |
|
254 | + 'description' => __('Output the Course Image on the Course Archive Page.', 'woothemes-sensei'), |
|
255 | 255 | 'type' => 'checkbox', |
256 | 256 | 'default' => true, |
257 | 257 | 'section' => 'course-settings' |
258 | 258 | ); |
259 | 259 | |
260 | 260 | $fields['course_archive_image_width'] = array( |
261 | - 'name' => __( 'Image Width - Archive', 'woothemes-sensei' ), |
|
262 | - 'description' => __( 'The width in pixels of the featured image for the Course Archive page.', 'woothemes-sensei' ), |
|
261 | + 'name' => __('Image Width - Archive', 'woothemes-sensei'), |
|
262 | + 'description' => __('The width in pixels of the featured image for the Course Archive page.', 'woothemes-sensei'), |
|
263 | 263 | 'type' => 'text', |
264 | 264 | 'default' => '100', |
265 | 265 | 'section' => 'course-settings', |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | ); |
268 | 268 | |
269 | 269 | $fields['course_archive_image_height'] = array( |
270 | - 'name' => __( 'Image Height - Archive', 'woothemes-sensei' ), |
|
271 | - 'description' => __( 'The height in pixels of the featured image for the Course Archive page.', 'woothemes-sensei' ), |
|
270 | + 'name' => __('Image Height - Archive', 'woothemes-sensei'), |
|
271 | + 'description' => __('The height in pixels of the featured image for the Course Archive page.', 'woothemes-sensei'), |
|
272 | 272 | 'type' => 'text', |
273 | 273 | 'default' => '100', |
274 | 274 | 'section' => 'course-settings', |
@@ -276,24 +276,24 @@ discard block |
||
276 | 276 | ); |
277 | 277 | |
278 | 278 | $fields['course_archive_image_hard_crop'] = array( |
279 | - 'name' => __( 'Image Hard Crop - Archive', 'woothemes-sensei' ), |
|
280 | - 'description' => sprintf( __( 'After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei' ), '<a href="' . esc_url( 'http://wordpress.org/extend/plugins/regenerate-thumbnails/' ) . '">', '</a>' ), |
|
279 | + 'name' => __('Image Hard Crop - Archive', 'woothemes-sensei'), |
|
280 | + 'description' => sprintf(__('After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei'), '<a href="'.esc_url('http://wordpress.org/extend/plugins/regenerate-thumbnails/').'">', '</a>'), |
|
281 | 281 | 'type' => 'checkbox', |
282 | 282 | 'default' => false, |
283 | 283 | 'section' => 'course-settings' |
284 | 284 | ); |
285 | 285 | |
286 | 286 | $fields['course_single_image_enable'] = array( |
287 | - 'name' => __( 'Single Course Image', 'woothemes-sensei' ), |
|
288 | - 'description' => __( 'Output the Course Image on the Single Course Page.', 'woothemes-sensei' ), |
|
287 | + 'name' => __('Single Course Image', 'woothemes-sensei'), |
|
288 | + 'description' => __('Output the Course Image on the Single Course Page.', 'woothemes-sensei'), |
|
289 | 289 | 'type' => 'checkbox', |
290 | 290 | 'default' => false, |
291 | 291 | 'section' => 'course-settings' |
292 | 292 | ); |
293 | 293 | |
294 | 294 | $fields['course_single_image_width'] = array( |
295 | - 'name' => __( 'Image Width - Single', 'woothemes-sensei' ), |
|
296 | - 'description' => __( 'The width in pixels of the featured image for the Course single post page.', 'woothemes-sensei' ), |
|
295 | + 'name' => __('Image Width - Single', 'woothemes-sensei'), |
|
296 | + 'description' => __('The width in pixels of the featured image for the Course single post page.', 'woothemes-sensei'), |
|
297 | 297 | 'type' => 'text', |
298 | 298 | 'default' => '100', |
299 | 299 | 'section' => 'course-settings', |
@@ -301,8 +301,8 @@ discard block |
||
301 | 301 | ); |
302 | 302 | |
303 | 303 | $fields['course_single_image_height'] = array( |
304 | - 'name' => __( 'Image Height - Single', 'woothemes-sensei' ), |
|
305 | - 'description' => __( 'The height in pixels of the featured image for the Course single post page.', 'woothemes-sensei' ), |
|
304 | + 'name' => __('Image Height - Single', 'woothemes-sensei'), |
|
305 | + 'description' => __('The height in pixels of the featured image for the Course single post page.', 'woothemes-sensei'), |
|
306 | 306 | 'type' => 'text', |
307 | 307 | 'default' => '100', |
308 | 308 | 'section' => 'course-settings', |
@@ -310,16 +310,16 @@ discard block |
||
310 | 310 | ); |
311 | 311 | |
312 | 312 | $fields['course_single_image_hard_crop'] = array( |
313 | - 'name' => __( 'Image Hard Crop - Single', 'woothemes-sensei' ), |
|
314 | - 'description' => sprintf( __( 'After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei' ), '<a href="' . esc_url( 'http://wordpress.org/extend/plugins/regenerate-thumbnails/' ) . '">', '</a>' ), |
|
313 | + 'name' => __('Image Hard Crop - Single', 'woothemes-sensei'), |
|
314 | + 'description' => sprintf(__('After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei'), '<a href="'.esc_url('http://wordpress.org/extend/plugins/regenerate-thumbnails/').'">', '</a>'), |
|
315 | 315 | 'type' => 'checkbox', |
316 | 316 | 'default' => false, |
317 | 317 | 'section' => 'course-settings' |
318 | 318 | ); |
319 | 319 | |
320 | 320 | $fields['course_single_content_display'] = array( |
321 | - 'name' => __( 'Single Course page displays:', 'woothemes-sensei' ), |
|
322 | - 'description' => __( 'Determines what content to display on the single course page.', 'woothemes-sensei' ), |
|
321 | + 'name' => __('Single Course page displays:', 'woothemes-sensei'), |
|
322 | + 'description' => __('Determines what content to display on the single course page.', 'woothemes-sensei'), |
|
323 | 323 | 'type' => 'select', |
324 | 324 | 'default' => 'excerpt', |
325 | 325 | 'section' => 'course-settings', |
@@ -328,18 +328,18 @@ discard block |
||
328 | 328 | ); |
329 | 329 | |
330 | 330 | $fields['course_archive_featured_enable'] = array( |
331 | - 'name' => __( 'Featured Courses Panel', 'woothemes-sensei' ), |
|
332 | - 'description' => __( 'Output the Featured Courses Panel on the Course Archive Page.', 'woothemes-sensei' ), |
|
331 | + 'name' => __('Featured Courses Panel', 'woothemes-sensei'), |
|
332 | + 'description' => __('Output the Featured Courses Panel on the Course Archive Page.', 'woothemes-sensei'), |
|
333 | 333 | 'type' => 'checkbox', |
334 | 334 | 'default' => true, |
335 | 335 | 'section' => 'course-settings' |
336 | 336 | ); |
337 | 337 | |
338 | 338 | $fields['course_archive_more_link_text'] = array( |
339 | - 'name' => __( 'More link text', 'woothemes-sensei' ), |
|
340 | - 'description' => __( 'The text that will be displayed on the Course Archive for the more courses link.', 'woothemes-sensei' ), |
|
339 | + 'name' => __('More link text', 'woothemes-sensei'), |
|
340 | + 'description' => __('The text that will be displayed on the Course Archive for the more courses link.', 'woothemes-sensei'), |
|
341 | 341 | 'type' => 'text', |
342 | - 'default' => __ ( 'More', 'woothemes-sensei' ), |
|
342 | + 'default' => __('More', 'woothemes-sensei'), |
|
343 | 343 | 'section' => 'course-settings', |
344 | 344 | 'required' => 0 |
345 | 345 | ); |
@@ -347,32 +347,32 @@ discard block |
||
347 | 347 | // Lesson Settings |
348 | 348 | |
349 | 349 | $fields['lesson_comments'] = array( |
350 | - 'name' => __( 'Allow Comments for Lessons', 'woothemes-sensei' ), |
|
351 | - 'description' => __( 'This will allow learners to post comments on the single Lesson page, only learner who have access to the Lesson will be allowed to comment.', 'woothemes-sensei' ), |
|
350 | + 'name' => __('Allow Comments for Lessons', 'woothemes-sensei'), |
|
351 | + 'description' => __('This will allow learners to post comments on the single Lesson page, only learner who have access to the Lesson will be allowed to comment.', 'woothemes-sensei'), |
|
352 | 352 | 'type' => 'checkbox', |
353 | 353 | 'default' => true, |
354 | 354 | 'section' => 'lesson-settings' |
355 | 355 | ); |
356 | 356 | |
357 | 357 | $fields['lesson_author'] = array( |
358 | - 'name' => __( 'Display Lesson Author', 'woothemes-sensei' ), |
|
359 | - 'description' => __( 'Output the Lesson Author on Course single page & Lesson archive page.', 'woothemes-sensei' ), |
|
358 | + 'name' => __('Display Lesson Author', 'woothemes-sensei'), |
|
359 | + 'description' => __('Output the Lesson Author on Course single page & Lesson archive page.', 'woothemes-sensei'), |
|
360 | 360 | 'type' => 'checkbox', |
361 | 361 | 'default' => true, |
362 | 362 | 'section' => 'lesson-settings' |
363 | 363 | ); |
364 | 364 | |
365 | 365 | $fields['course_lesson_image_enable'] = array( |
366 | - 'name' => __( 'Course Lesson Images', 'woothemes-sensei' ), |
|
367 | - 'description' => __( 'Output the Lesson Image on the Single Course Page.', 'woothemes-sensei' ), |
|
366 | + 'name' => __('Course Lesson Images', 'woothemes-sensei'), |
|
367 | + 'description' => __('Output the Lesson Image on the Single Course Page.', 'woothemes-sensei'), |
|
368 | 368 | 'type' => 'checkbox', |
369 | 369 | 'default' => false, |
370 | 370 | 'section' => 'lesson-settings' |
371 | 371 | ); |
372 | 372 | |
373 | 373 | $fields['lesson_archive_image_width'] = array( |
374 | - 'name' => __( 'Image Width - Course Lessons', 'woothemes-sensei' ), |
|
375 | - 'description' => __( 'The width in pixels of the featured image for the Lessons on the Course Single page.', 'woothemes-sensei' ), |
|
374 | + 'name' => __('Image Width - Course Lessons', 'woothemes-sensei'), |
|
375 | + 'description' => __('The width in pixels of the featured image for the Lessons on the Course Single page.', 'woothemes-sensei'), |
|
376 | 376 | 'type' => 'text', |
377 | 377 | 'default' => '100', |
378 | 378 | 'section' => 'lesson-settings', |
@@ -380,8 +380,8 @@ discard block |
||
380 | 380 | ); |
381 | 381 | |
382 | 382 | $fields['lesson_archive_image_height'] = array( |
383 | - 'name' => __( 'Image Height - Course Lessons', 'woothemes-sensei' ), |
|
384 | - 'description' => __( 'The height in pixels of the featured image for the Lessons on the Course Single page.', 'woothemes-sensei' ), |
|
383 | + 'name' => __('Image Height - Course Lessons', 'woothemes-sensei'), |
|
384 | + 'description' => __('The height in pixels of the featured image for the Lessons on the Course Single page.', 'woothemes-sensei'), |
|
385 | 385 | 'type' => 'text', |
386 | 386 | 'default' => '100', |
387 | 387 | 'section' => 'lesson-settings', |
@@ -389,24 +389,24 @@ discard block |
||
389 | 389 | ); |
390 | 390 | |
391 | 391 | $fields['lesson_archive_image_hard_crop'] = array( |
392 | - 'name' => __( 'Image Hard Crop - Course Lessons', 'woothemes-sensei' ), |
|
393 | - 'description' => sprintf( __( 'After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei' ), '<a href="' . esc_url( 'http://wordpress.org/extend/plugins/regenerate-thumbnails/' ) . '">', '</a>' ), |
|
392 | + 'name' => __('Image Hard Crop - Course Lessons', 'woothemes-sensei'), |
|
393 | + 'description' => sprintf(__('After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei'), '<a href="'.esc_url('http://wordpress.org/extend/plugins/regenerate-thumbnails/').'">', '</a>'), |
|
394 | 394 | 'type' => 'checkbox', |
395 | 395 | 'default' => false, |
396 | 396 | 'section' => 'lesson-settings' |
397 | 397 | ); |
398 | 398 | |
399 | 399 | $fields['lesson_single_image_enable'] = array( |
400 | - 'name' => __( 'Single Lesson Images', 'woothemes-sensei' ), |
|
401 | - 'description' => __( 'Output the Lesson Image on the Single Lesson Page.', 'woothemes-sensei' ), |
|
400 | + 'name' => __('Single Lesson Images', 'woothemes-sensei'), |
|
401 | + 'description' => __('Output the Lesson Image on the Single Lesson Page.', 'woothemes-sensei'), |
|
402 | 402 | 'type' => 'checkbox', |
403 | 403 | 'default' => false, |
404 | 404 | 'section' => 'lesson-settings' |
405 | 405 | ); |
406 | 406 | |
407 | 407 | $fields['lesson_single_image_width'] = array( |
408 | - 'name' => __( 'Image Width - Single', 'woothemes-sensei' ), |
|
409 | - 'description' => __( 'The width in pixels of the featured image for the Lessons single post page.', 'woothemes-sensei' ), |
|
408 | + 'name' => __('Image Width - Single', 'woothemes-sensei'), |
|
409 | + 'description' => __('The width in pixels of the featured image for the Lessons single post page.', 'woothemes-sensei'), |
|
410 | 410 | 'type' => 'text', |
411 | 411 | 'default' => '100', |
412 | 412 | 'section' => 'lesson-settings', |
@@ -414,8 +414,8 @@ discard block |
||
414 | 414 | ); |
415 | 415 | |
416 | 416 | $fields['lesson_single_image_height'] = array( |
417 | - 'name' => __( 'Image Height - Single', 'woothemes-sensei' ), |
|
418 | - 'description' => __( 'The height in pixels of the featured image for the Lessons single post page.', 'woothemes-sensei' ), |
|
417 | + 'name' => __('Image Height - Single', 'woothemes-sensei'), |
|
418 | + 'description' => __('The height in pixels of the featured image for the Lessons single post page.', 'woothemes-sensei'), |
|
419 | 419 | 'type' => 'text', |
420 | 420 | 'default' => '100', |
421 | 421 | 'section' => 'lesson-settings', |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | ); |
424 | 424 | |
425 | 425 | $fields['lesson_single_image_hard_crop'] = array( |
426 | - 'name' => __( 'Image Hard Crop - Single', 'woothemes-sensei' ), |
|
427 | - 'description' => sprintf( __( 'After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei' ), '<a href="' . esc_url( 'http://wordpress.org/extend/plugins/regenerate-thumbnails/' ) . '">', '</a>' ), |
|
426 | + 'name' => __('Image Hard Crop - Single', 'woothemes-sensei'), |
|
427 | + 'description' => sprintf(__('After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei'), '<a href="'.esc_url('http://wordpress.org/extend/plugins/regenerate-thumbnails/').'">', '</a>'), |
|
428 | 428 | 'type' => 'checkbox', |
429 | 429 | 'default' => false, |
430 | 430 | 'section' => 'lesson-settings' |
@@ -432,20 +432,20 @@ discard block |
||
432 | 432 | |
433 | 433 | // Learner Profile settings |
434 | 434 | |
435 | - $profile_url_base = apply_filters( 'sensei_learner_profiles_url_base', __( 'learner', 'woothemes-sensei') ); |
|
436 | - $profile_url_example = trailingslashit( get_site_url() ) . $profile_url_base . '/%username%'; |
|
435 | + $profile_url_base = apply_filters('sensei_learner_profiles_url_base', __('learner', 'woothemes-sensei')); |
|
436 | + $profile_url_example = trailingslashit(get_site_url()).$profile_url_base.'/%username%'; |
|
437 | 437 | |
438 | 438 | $fields['learner_profile_enable'] = array( |
439 | - 'name' => __( 'Public learner profiles', 'woothemes-sensei' ), |
|
440 | - 'description' => sprintf( __( 'Enable public learner profiles that will be accessible to everyone. Profile URL format: %s', 'woothemes-sensei' ), $profile_url_example ), |
|
439 | + 'name' => __('Public learner profiles', 'woothemes-sensei'), |
|
440 | + 'description' => sprintf(__('Enable public learner profiles that will be accessible to everyone. Profile URL format: %s', 'woothemes-sensei'), $profile_url_example), |
|
441 | 441 | 'type' => 'checkbox', |
442 | 442 | 'default' => true, |
443 | 443 | 'section' => 'learner-profile-settings' |
444 | 444 | ); |
445 | 445 | |
446 | 446 | $fields['learner_profile_show_courses'] = array( |
447 | - 'name' => __( 'Show learner\'s courses', 'woothemes-sensei' ), |
|
448 | - 'description' => __( 'Display the learner\'s active and completed courses on their profile.', 'woothemes-sensei' ), |
|
447 | + 'name' => __('Show learner\'s courses', 'woothemes-sensei'), |
|
448 | + 'description' => __('Display the learner\'s active and completed courses on their profile.', 'woothemes-sensei'), |
|
449 | 449 | 'type' => 'checkbox', |
450 | 450 | 'default' => true, |
451 | 451 | 'section' => 'learner-profile-settings' |
@@ -454,70 +454,70 @@ discard block |
||
454 | 454 | // Email notifications |
455 | 455 | |
456 | 456 | $learner_email_options = array( |
457 | - 'learner-graded-quiz' => __( 'Their quiz is graded (auto and manual grading)', 'woothemes-sensei' ), |
|
458 | - 'learner-completed-course' => __( 'They complete a course', 'woothemes-sensei' ), |
|
457 | + 'learner-graded-quiz' => __('Their quiz is graded (auto and manual grading)', 'woothemes-sensei'), |
|
458 | + 'learner-completed-course' => __('They complete a course', 'woothemes-sensei'), |
|
459 | 459 | ); |
460 | 460 | |
461 | 461 | $teacher_email_options = array( |
462 | - 'teacher-started-course' => __( 'A learner starts their course', 'woothemes-sensei' ), |
|
463 | - 'teacher-completed-course' => __( 'A learner completes their course', 'woothemes-sensei' ), |
|
464 | - 'teacher-completed-lesson' => __( 'A learner completes a lesson', 'woothemes-sensei' ), |
|
465 | - 'teacher-quiz-submitted' => __( 'A learner submits a quiz for grading', 'woothemes-sensei' ), |
|
466 | - 'teacher-new-message' => __( 'A learner sends a private message to a teacher', 'woothemes-sensei' ), |
|
462 | + 'teacher-started-course' => __('A learner starts their course', 'woothemes-sensei'), |
|
463 | + 'teacher-completed-course' => __('A learner completes their course', 'woothemes-sensei'), |
|
464 | + 'teacher-completed-lesson' => __('A learner completes a lesson', 'woothemes-sensei'), |
|
465 | + 'teacher-quiz-submitted' => __('A learner submits a quiz for grading', 'woothemes-sensei'), |
|
466 | + 'teacher-new-message' => __('A learner sends a private message to a teacher', 'woothemes-sensei'), |
|
467 | 467 | ); |
468 | 468 | |
469 | 469 | $global_email_options = array( |
470 | - 'new-message-reply' => __( 'They receive a reply to their private message', 'woothemes-sensei' ), |
|
470 | + 'new-message-reply' => __('They receive a reply to their private message', 'woothemes-sensei'), |
|
471 | 471 | ); |
472 | 472 | |
473 | 473 | $fields['email_learners'] = array( |
474 | - 'name' => __( 'Emails Sent to Learners', 'woothemes-sensei' ), |
|
475 | - 'description' => __( 'Select the notifications that will be sent to learners.', 'woothemes-sensei' ), |
|
474 | + 'name' => __('Emails Sent to Learners', 'woothemes-sensei'), |
|
475 | + 'description' => __('Select the notifications that will be sent to learners.', 'woothemes-sensei'), |
|
476 | 476 | 'type' => 'multicheck', |
477 | 477 | 'options' => $learner_email_options, |
478 | - 'defaults' => array( 'learner-graded-quiz', 'learner-completed-course' ), |
|
478 | + 'defaults' => array('learner-graded-quiz', 'learner-completed-course'), |
|
479 | 479 | 'section' => 'email-notification-settings' |
480 | 480 | ); |
481 | 481 | |
482 | 482 | $fields['email_teachers'] = array( |
483 | - 'name' => __( 'Emails Sent to Teachers', 'woothemes-sensei' ), |
|
484 | - 'description' => __( 'Select the notifications that will be sent to teachers.', 'woothemes-sensei' ), |
|
483 | + 'name' => __('Emails Sent to Teachers', 'woothemes-sensei'), |
|
484 | + 'description' => __('Select the notifications that will be sent to teachers.', 'woothemes-sensei'), |
|
485 | 485 | 'type' => 'multicheck', |
486 | 486 | 'options' => $teacher_email_options, |
487 | - 'defaults' => array( 'teacher-completed-course', 'teacher-started-course', 'teacher-quiz-submitted', 'teacher-new-message' ), |
|
487 | + 'defaults' => array('teacher-completed-course', 'teacher-started-course', 'teacher-quiz-submitted', 'teacher-new-message'), |
|
488 | 488 | 'section' => 'email-notification-settings' |
489 | 489 | ); |
490 | 490 | |
491 | 491 | $fields['email_global'] = array( |
492 | - 'name' => __( 'Emails Sent to All Users', 'woothemes-sensei' ), |
|
493 | - 'description' => __( 'Select the notifications that will be sent to all users.', 'woothemes-sensei' ), |
|
492 | + 'name' => __('Emails Sent to All Users', 'woothemes-sensei'), |
|
493 | + 'description' => __('Select the notifications that will be sent to all users.', 'woothemes-sensei'), |
|
494 | 494 | 'type' => 'multicheck', |
495 | 495 | 'options' => $global_email_options, |
496 | - 'defaults' => array( 'new-message-reply' ), |
|
496 | + 'defaults' => array('new-message-reply'), |
|
497 | 497 | 'section' => 'email-notification-settings' |
498 | 498 | ); |
499 | 499 | |
500 | 500 | $fields['email_from_name'] = array( |
501 | - 'name' => __( '"From" Name', 'woothemes-sensei' ), |
|
502 | - 'description' => __( 'The name from which all emails will be sent.', 'woothemes-sensei' ), |
|
501 | + 'name' => __('"From" Name', 'woothemes-sensei'), |
|
502 | + 'description' => __('The name from which all emails will be sent.', 'woothemes-sensei'), |
|
503 | 503 | 'type' => 'text', |
504 | - 'default' => get_bloginfo( 'name' ), |
|
504 | + 'default' => get_bloginfo('name'), |
|
505 | 505 | 'section' => 'email-notification-settings', |
506 | 506 | 'required' => 1 |
507 | 507 | ); |
508 | 508 | |
509 | 509 | $fields['email_from_address'] = array( |
510 | - 'name' => __( '"From" Address', 'woothemes-sensei' ), |
|
511 | - 'description' => __( 'The address from which all emails will be sent.', 'woothemes-sensei' ), |
|
510 | + 'name' => __('"From" Address', 'woothemes-sensei'), |
|
511 | + 'description' => __('The address from which all emails will be sent.', 'woothemes-sensei'), |
|
512 | 512 | 'type' => 'text', |
513 | - 'default' => get_bloginfo( 'admin_email' ), |
|
513 | + 'default' => get_bloginfo('admin_email'), |
|
514 | 514 | 'section' => 'email-notification-settings', |
515 | 515 | 'required' => 1 |
516 | 516 | ); |
517 | 517 | |
518 | 518 | $fields['email_header_image'] = array( |
519 | - 'name' => __( 'Header Image', 'woothemes-sensei' ), |
|
520 | - 'description' => sprintf( __( 'Enter a URL to an image you want to show in the email\'s header. Upload your image using the %1$smedia uploader%2$s.', 'woothemes-sensei' ), '<a href="' . admin_url( 'media-new.php' ) . '">', '</a>' ), |
|
519 | + 'name' => __('Header Image', 'woothemes-sensei'), |
|
520 | + 'description' => sprintf(__('Enter a URL to an image you want to show in the email\'s header. Upload your image using the %1$smedia uploader%2$s.', 'woothemes-sensei'), '<a href="'.admin_url('media-new.php').'">', '</a>'), |
|
521 | 521 | 'type' => 'text', |
522 | 522 | 'default' => '', |
523 | 523 | 'section' => 'email-notification-settings', |
@@ -525,17 +525,17 @@ discard block |
||
525 | 525 | ); |
526 | 526 | |
527 | 527 | $fields['email_footer_text'] = array( |
528 | - 'name' => __( 'Email Footer Text', 'woothemes-sensei' ), |
|
529 | - 'description' => __( 'The text to appear in the footer of Sensei emails.', 'woothemes-sensei' ), |
|
528 | + 'name' => __('Email Footer Text', 'woothemes-sensei'), |
|
529 | + 'description' => __('The text to appear in the footer of Sensei emails.', 'woothemes-sensei'), |
|
530 | 530 | 'type' => 'textarea', |
531 | - 'default' => sprintf( __( '%1$s - Powered by Sensei', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), |
|
531 | + 'default' => sprintf(__('%1$s - Powered by Sensei', 'woothemes-sensei'), get_bloginfo('name')), |
|
532 | 532 | 'section' => 'email-notification-settings', |
533 | 533 | 'required' => 0 |
534 | 534 | ); |
535 | 535 | |
536 | 536 | $fields['email_base_color'] = array( |
537 | - 'name' => __( 'Base Colour', 'woothemes-sensei' ), |
|
538 | - 'description' => sprintf( __( 'The base colour for Sensei email templates. Default %1$s#557da1%2$s.', 'woothemes-sensei' ), '<code>', '</code>' ), |
|
537 | + 'name' => __('Base Colour', 'woothemes-sensei'), |
|
538 | + 'description' => sprintf(__('The base colour for Sensei email templates. Default %1$s#557da1%2$s.', 'woothemes-sensei'), '<code>', '</code>'), |
|
539 | 539 | 'type' => 'color', |
540 | 540 | 'default' => '#557da1', |
541 | 541 | 'section' => 'email-notification-settings', |
@@ -543,8 +543,8 @@ discard block |
||
543 | 543 | ); |
544 | 544 | |
545 | 545 | $fields['email_background_color'] = array( |
546 | - 'name' => __( 'Background Colour', 'woothemes-sensei' ), |
|
547 | - 'description' => sprintf( __( 'The background colour for Sensei email templates. Default %1$s#f5f5f5%2$s.', 'woothemes-sensei' ), '<code>', '</code>' ), |
|
546 | + 'name' => __('Background Colour', 'woothemes-sensei'), |
|
547 | + 'description' => sprintf(__('The background colour for Sensei email templates. Default %1$s#f5f5f5%2$s.', 'woothemes-sensei'), '<code>', '</code>'), |
|
548 | 548 | 'type' => 'color', |
549 | 549 | 'default' => '#f5f5f5', |
550 | 550 | 'section' => 'email-notification-settings', |
@@ -552,8 +552,8 @@ discard block |
||
552 | 552 | ); |
553 | 553 | |
554 | 554 | $fields['email_body_background_color'] = array( |
555 | - 'name' => __( 'Body Background Colour', 'woothemes-sensei' ), |
|
556 | - 'description' => sprintf( __( 'The main body background colour for Sensei email templates. Default %1$s#fdfdfd%2$s.', 'woothemes-sensei' ), '<code>', '</code>' ), |
|
555 | + 'name' => __('Body Background Colour', 'woothemes-sensei'), |
|
556 | + 'description' => sprintf(__('The main body background colour for Sensei email templates. Default %1$s#fdfdfd%2$s.', 'woothemes-sensei'), '<code>', '</code>'), |
|
557 | 557 | 'type' => 'color', |
558 | 558 | 'default' => '#fdfdfd', |
559 | 559 | 'section' => 'email-notification-settings', |
@@ -561,35 +561,35 @@ discard block |
||
561 | 561 | ); |
562 | 562 | |
563 | 563 | $fields['email_text_color'] = array( |
564 | - 'name' => __( 'Body Text Colour', 'woothemes-sensei' ), |
|
565 | - 'description' => sprintf( __( 'The main body text colour for Sensei email templates. Default %1$s#505050%2$s.', 'woothemes-sensei' ), '<code>', '</code>' ), |
|
564 | + 'name' => __('Body Text Colour', 'woothemes-sensei'), |
|
565 | + 'description' => sprintf(__('The main body text colour for Sensei email templates. Default %1$s#505050%2$s.', 'woothemes-sensei'), '<code>', '</code>'), |
|
566 | 566 | 'type' => 'color', |
567 | 567 | 'default' => '#505050', |
568 | 568 | 'section' => 'email-notification-settings', |
569 | 569 | 'required' => 1 |
570 | 570 | ); |
571 | 571 | |
572 | - if ( Sensei_WC::is_woocommerce_present() ) { |
|
572 | + if (Sensei_WC::is_woocommerce_present()) { |
|
573 | 573 | // WooCommerce Settings |
574 | 574 | $fields['woocommerce_enabled'] = array( |
575 | - 'name' => __( 'Enable WooCommerce Courses', 'woothemes-sensei' ), |
|
576 | - 'description' => __( 'Use WooCommerce to sell Courses by linking a Product to a Course.', 'woothemes-sensei' ), |
|
575 | + 'name' => __('Enable WooCommerce Courses', 'woothemes-sensei'), |
|
576 | + 'description' => __('Use WooCommerce to sell Courses by linking a Product to a Course.', 'woothemes-sensei'), |
|
577 | 577 | 'type' => 'checkbox', |
578 | 578 | 'default' => true, |
579 | 579 | 'section' => 'woocommerce-settings' |
580 | 580 | ); |
581 | 581 | |
582 | 582 | $fields['course_archive_free_enable'] = array( |
583 | - 'name' => __( 'Free Courses Panel', 'woothemes-sensei' ), |
|
584 | - 'description' => __( 'Output the Free Courses Panel on the Course Archive Page.', 'woothemes-sensei' ), |
|
583 | + 'name' => __('Free Courses Panel', 'woothemes-sensei'), |
|
584 | + 'description' => __('Output the Free Courses Panel on the Course Archive Page.', 'woothemes-sensei'), |
|
585 | 585 | 'type' => 'checkbox', |
586 | 586 | 'default' => true, |
587 | 587 | 'section' => 'woocommerce-settings' |
588 | 588 | ); |
589 | 589 | |
590 | 590 | $fields['course_archive_paid_enable'] = array( |
591 | - 'name' => __( 'Paid Courses Panel', 'woothemes-sensei' ), |
|
592 | - 'description' => __( 'Output the Paid Courses Panel on the Course Archive Page.', 'woothemes-sensei' ), |
|
591 | + 'name' => __('Paid Courses Panel', 'woothemes-sensei'), |
|
592 | + 'description' => __('Output the Paid Courses Panel on the Course Archive Page.', 'woothemes-sensei'), |
|
593 | 593 | 'type' => 'checkbox', |
594 | 594 | 'default' => true, |
595 | 595 | 'section' => 'woocommerce-settings' |
@@ -597,18 +597,18 @@ discard block |
||
597 | 597 | |
598 | 598 | } // End If Statement |
599 | 599 | |
600 | - if ( 'en_US' !== get_locale() ) { |
|
600 | + if ('en_US' !== get_locale()) { |
|
601 | 601 | $fields['install_language_pack'] = array( |
602 | - 'name' => __( 'Install Language Pack', 'woothemes-sensei' ), |
|
603 | - 'description' => __( 'Use this action to install or re-install translation for your language if available.', 'woothemes-sensei' ), |
|
602 | + 'name' => __('Install Language Pack', 'woothemes-sensei'), |
|
603 | + 'description' => __('Use this action to install or re-install translation for your language if available.', 'woothemes-sensei'), |
|
604 | 604 | 'type' => 'button', |
605 | 605 | 'section' => 'language-settings', |
606 | 606 | 'target' => Sensei_Language_Pack_Manager::get_install_uri(), |
607 | - 'label' => __( 'Install', 'woothemes-sensei' ) |
|
607 | + 'label' => __('Install', 'woothemes-sensei') |
|
608 | 608 | ); |
609 | 609 | } |
610 | 610 | |
611 | - $this->fields = apply_filters( 'sensei_settings_fields', $fields ); |
|
611 | + $this->fields = apply_filters('sensei_settings_fields', $fields); |
|
612 | 612 | |
613 | 613 | } // End init_fields() |
614 | 614 | |
@@ -618,20 +618,20 @@ discard block |
||
618 | 618 | * @param $include_milliseconds (default: true) Whether or not to include milliseconds between 0 and 1. |
619 | 619 | * @return array Options between 0.1 and 10 seconds. |
620 | 620 | */ |
621 | - private function get_duration_options ( $include_milliseconds = true ) { |
|
622 | - $numbers = array( '1.0', '1.5', '2.0', '2.5', '3.0', '3.5', '4.0', '4.5', '5.0', '5.5', '6.0', '6.5', '7.0', '7.5', '8.0', '8.5', '9.0', '9.5', '10.0' ); |
|
621 | + private function get_duration_options($include_milliseconds = true) { |
|
622 | + $numbers = array('1.0', '1.5', '2.0', '2.5', '3.0', '3.5', '4.0', '4.5', '5.0', '5.5', '6.0', '6.5', '7.0', '7.5', '8.0', '8.5', '9.0', '9.5', '10.0'); |
|
623 | 623 | $options = array(); |
624 | 624 | |
625 | - if ( true == (bool)$include_milliseconds ) { |
|
626 | - $milliseconds = array( '0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9' ); |
|
627 | - foreach ( $milliseconds as $k => $v ) { |
|
625 | + if (true == (bool) $include_milliseconds) { |
|
626 | + $milliseconds = array('0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9'); |
|
627 | + foreach ($milliseconds as $k => $v) { |
|
628 | 628 | $options[$v] = $v; |
629 | 629 | } |
630 | 630 | } else { |
631 | 631 | $options['0.5'] = '0.5'; |
632 | 632 | } |
633 | 633 | |
634 | - foreach ( $numbers as $k => $v ) { |
|
634 | + foreach ($numbers as $k => $v) { |
|
635 | 635 | $options[$v] = $v; |
636 | 636 | } |
637 | 637 | |
@@ -647,25 +647,25 @@ discard block |
||
647 | 647 | private function pages_array() { |
648 | 648 | // REFACTOR - Transform this into a field type instead. |
649 | 649 | // Setup an array of portfolio gallery terms for a dropdown. |
650 | - $args = array( 'echo' => 0, 'hierarchical' => 1, 'sort_column' => 'post_title', 'sort_order' => 'ASC' ); |
|
651 | - $pages_dropdown = wp_dropdown_pages( $args ); |
|
650 | + $args = array('echo' => 0, 'hierarchical' => 1, 'sort_column' => 'post_title', 'sort_order' => 'ASC'); |
|
651 | + $pages_dropdown = wp_dropdown_pages($args); |
|
652 | 652 | $page_items = array(); |
653 | 653 | |
654 | 654 | // Quick string hack to make sure we get the pages with the indents. |
655 | - $pages_dropdown = str_replace( "<select class='' name='page_id' id='page_id'>", '', $pages_dropdown ); |
|
656 | - $pages_dropdown = str_replace( '</select>', '', $pages_dropdown ); |
|
657 | - $pages_split = explode( '</option>', $pages_dropdown ); |
|
655 | + $pages_dropdown = str_replace("<select class='' name='page_id' id='page_id'>", '', $pages_dropdown); |
|
656 | + $pages_dropdown = str_replace('</select>', '', $pages_dropdown); |
|
657 | + $pages_split = explode('</option>', $pages_dropdown); |
|
658 | 658 | |
659 | - $page_items[] = __( 'Select a Page:', 'woothemes-sensei' ); |
|
659 | + $page_items[] = __('Select a Page:', 'woothemes-sensei'); |
|
660 | 660 | |
661 | - foreach ( $pages_split as $k => $v ) { |
|
661 | + foreach ($pages_split as $k => $v) { |
|
662 | 662 | $id = ''; |
663 | 663 | // Get the ID value. |
664 | - preg_match( '/value="(.*?)"/i', $v, $matches ); |
|
664 | + preg_match('/value="(.*?)"/i', $v, $matches); |
|
665 | 665 | |
666 | - if ( isset( $matches[1] ) ) { |
|
666 | + if (isset($matches[1])) { |
|
667 | 667 | $id = $matches[1]; |
668 | - $page_items[$id] = trim( strip_tags( $v ) ); |
|
668 | + $page_items[$id] = trim(strip_tags($v)); |
|
669 | 669 | } // End If Statement |
670 | 670 | } // End For Loop |
671 | 671 | |
@@ -689,10 +689,10 @@ discard block |
||
689 | 689 | * |
690 | 690 | * @since 1.9.0 |
691 | 691 | */ |
692 | - public static function flush_rewrite_rules(){ |
|
692 | + public static function flush_rewrite_rules() { |
|
693 | 693 | |
694 | - if ( isset( $_POST[ 'option_page' ] ) && 'woothemes-sensei-settings' == $_POST[ 'option_page' ] |
|
695 | - && isset( $_POST[ 'action' ] ) && 'update' == $_POST[ 'action' ] ) { |
|
694 | + if (isset($_POST['option_page']) && 'woothemes-sensei-settings' == $_POST['option_page'] |
|
695 | + && isset($_POST['action']) && 'update' == $_POST['action']) { |
|
696 | 696 | |
697 | 697 | Sensei()->initiate_rewrite_rules_flush(); |
698 | 698 | |
@@ -706,4 +706,4 @@ discard block |
||
706 | 706 | * @ignore only for backward compatibility |
707 | 707 | * @since 1.9.0 |
708 | 708 | */ |
709 | -class WooThemes_Sensei_Settings extends Sensei_Settings{} |
|
709 | +class WooThemes_Sensei_Settings extends Sensei_Settings {} |
@@ -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 |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | class Sensei_Notices{ |
15 | 15 | |
16 | 16 | /** |
17 | - * @var $notices |
|
18 | - */ |
|
17 | + * @var $notices |
|
18 | + */ |
|
19 | 19 | protected $notices; |
20 | 20 | |
21 | 21 | /** |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | protected $has_printed; |
25 | 25 | |
26 | 26 | /** |
27 | - * constructor |
|
28 | - */ |
|
27 | + * constructor |
|
28 | + */ |
|
29 | 29 | public function __construct(){ |
30 | 30 | //initialize the notices variable |
31 | 31 | $this->notices = array(); |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | } // end print_notice() |
80 | 80 | |
81 | 81 | /** |
82 | - * Clear all notices |
|
83 | - * |
|
84 | - * @return void |
|
85 | - */ |
|
82 | + * Clear all notices |
|
83 | + * |
|
84 | + * @return void |
|
85 | + */ |
|
86 | 86 | public function clear_notices(){ |
87 | 87 | // assign an empty array to clear all existing notices |
88 | 88 | $this->notices = array(); |
@@ -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 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @since 1.6.3 |
13 | 13 | */ |
14 | -class Sensei_Notices{ |
|
14 | +class Sensei_Notices { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @var $notices |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * constructor |
28 | 28 | */ |
29 | - public function __construct(){ |
|
29 | + public function __construct() { |
|
30 | 30 | //initialize the notices variable |
31 | 31 | $this->notices = array(); |
32 | 32 | $this->has_printed = false; |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | * @return void |
43 | 43 | */ |
44 | 44 | |
45 | - public function add_notice( $content , $type = 'alert' ){ |
|
45 | + public function add_notice($content, $type = 'alert') { |
|
46 | 46 | // append the new notice |
47 | - $this->notices[] = array('content' => $content , 'type'=> $type ); |
|
47 | + $this->notices[] = array('content' => $content, 'type'=> $type); |
|
48 | 48 | |
49 | 49 | // if a notice is added after we've printed print it immediately. |
50 | - if( $this->has_printed ){ |
|
50 | + if ($this->has_printed) { |
|
51 | 51 | $this->maybe_print_notices(); |
52 | 52 | } |
53 | 53 | |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | * @return void |
60 | 60 | */ |
61 | 61 | |
62 | - public function maybe_print_notices(){ |
|
63 | - if( count( $this->notices ) > 0 ){ |
|
62 | + public function maybe_print_notices() { |
|
63 | + if (count($this->notices) > 0) { |
|
64 | 64 | foreach ($this->notices as $notice) { |
65 | 65 | |
66 | - $classes = 'sensei-message '. $notice['type']; |
|
67 | - $html = '<div class="'. $classes . '">'. $notice['content'] . '</div>'; |
|
66 | + $classes = 'sensei-message '.$notice['type']; |
|
67 | + $html = '<div class="'.$classes.'">'.$notice['content'].'</div>'; |
|
68 | 68 | |
69 | 69 | echo $html; |
70 | 70 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return void |
85 | 85 | */ |
86 | - public function clear_notices(){ |
|
86 | + public function clear_notices() { |
|
87 | 87 | // assign an empty array to clear all existing notices |
88 | 88 | $this->notices = array(); |
89 | 89 | } // end clear_notices() |
@@ -95,4 +95,4 @@ discard block |
||
95 | 95 | * @ignore only for backward compatibility |
96 | 96 | * @since 1.9.0 |
97 | 97 | */ |
98 | -class Woothemes_Sensei_Notices extends Sensei_Notices{} |
|
98 | +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 |
@@ -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 | * Renders the [sensei_user_messages] shortcode. The current users messages. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string $content |
30 | 30 | * @param string $shortcode the shortcode that was called for this instance |
31 | 31 | */ |
32 | - public function __construct( $attributes, $content, $shortcode ){ |
|
32 | + public function __construct($attributes, $content, $shortcode) { |
|
33 | 33 | |
34 | 34 | $this->setup_messages_query(); |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return mixed |
42 | 42 | */ |
43 | - public function setup_messages_query(){ |
|
43 | + public function setup_messages_query() { |
|
44 | 44 | |
45 | 45 | $user = wp_get_current_user(); |
46 | 46 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ), |
60 | 60 | ); |
61 | 61 | |
62 | - $this->messages_query = new WP_Query( $args ); |
|
62 | + $this->messages_query = new WP_Query($args); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -67,22 +67,22 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return string $content |
69 | 69 | */ |
70 | - public function render(){ |
|
70 | + public function render() { |
|
71 | 71 | |
72 | - if( !is_user_logged_in() ){ |
|
72 | + if ( ! is_user_logged_in()) { |
|
73 | 73 | |
74 | - Sensei()->notices->add_notice( __('Please login to view your messages.','woothemes-sensei') , 'alert' ); |
|
74 | + Sensei()->notices->add_notice(__('Please login to view your messages.', 'woothemes-sensei'), 'alert'); |
|
75 | 75 | |
76 | - } elseif( 0 == $this->messages_query->post_count ){ |
|
76 | + } elseif (0 == $this->messages_query->post_count) { |
|
77 | 77 | |
78 | - Sensei()->notices->add_notice( __( 'You do not have any messages.', 'woothemes-sensei') , 'alert' ); |
|
78 | + Sensei()->notices->add_notice(__('You do not have any messages.', 'woothemes-sensei'), 'alert'); |
|
79 | 79 | } |
80 | 80 | |
81 | - $messages_disabled_in_settings = ! ( ! isset( Sensei()->settings->settings['messages_disable'] ) |
|
82 | - || ! Sensei()->settings->settings['messages_disable'] ) ; |
|
81 | + $messages_disabled_in_settings = ! ( ! isset(Sensei()->settings->settings['messages_disable']) |
|
82 | + || ! Sensei()->settings->settings['messages_disable']); |
|
83 | 83 | |
84 | 84 | // don't show anything if messages are disable |
85 | - if( $messages_disabled_in_settings ){ |
|
85 | + if ($messages_disabled_in_settings) { |
|
86 | 86 | return ''; |
87 | 87 | } |
88 | 88 |
@@ -17,91 +17,91 @@ |
||
17 | 17 | */ |
18 | 18 | class Sensei_Shortcode_User_Messages implements Sensei_Shortcode_Interface { |
19 | 19 | |
20 | - /** |
|
21 | - * @var WP_Query |
|
22 | - * messages for the current user |
|
23 | - */ |
|
24 | - protected $messages_query; |
|
25 | - |
|
26 | - /** |
|
27 | - * Setup the shortcode object |
|
28 | - * |
|
29 | - * @since 1.9.0 |
|
30 | - * @param array $attributes |
|
31 | - * @param string $content |
|
32 | - * @param string $shortcode the shortcode that was called for this instance |
|
33 | - */ |
|
34 | - public function __construct( $attributes, $content, $shortcode ){ |
|
35 | - |
|
36 | - $this->setup_messages_query(); |
|
37 | - |
|
38 | - } |
|
39 | - |
|
40 | - /** |
|
41 | - * create the messages query . |
|
42 | - * |
|
43 | - * @return mixed |
|
44 | - */ |
|
45 | - public function setup_messages_query(){ |
|
46 | - |
|
47 | - $user = wp_get_current_user(); |
|
48 | - |
|
49 | - $args = array( |
|
50 | - 'post_type' => 'sensei_message', |
|
51 | - 'posts_per_page' => 500, |
|
52 | - 'orderby' => 'date', |
|
53 | - 'order' => 'DESC', |
|
54 | - 'post_status' => 'publish', |
|
55 | - 'meta_query' => array( |
|
56 | - array( |
|
57 | - 'key' => '_sender', |
|
58 | - 'value' => $user->user_login, |
|
59 | - 'compare' => '=', |
|
60 | - ), |
|
61 | - ), |
|
62 | - ); |
|
63 | - |
|
64 | - $this->messages_query = new WP_Query( $args ); |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * Rendering the shortcode this class is responsible for. |
|
69 | - * |
|
70 | - * @return string $content |
|
71 | - */ |
|
72 | - public function render(){ |
|
73 | - |
|
74 | - if( !is_user_logged_in() ){ |
|
75 | - |
|
76 | - Sensei()->notices->add_notice( __('Please login to view your messages.','woothemes-sensei') , 'alert' ); |
|
77 | - |
|
78 | - } elseif( 0 == $this->messages_query->post_count ){ |
|
79 | - |
|
80 | - Sensei()->notices->add_notice( __( 'You do not have any messages.', 'woothemes-sensei') , 'alert' ); |
|
81 | - } |
|
82 | - |
|
83 | - $messages_disabled_in_settings = ! ( ! isset( Sensei()->settings->settings['messages_disable'] ) |
|
84 | - || ! Sensei()->settings->settings['messages_disable'] ) ; |
|
85 | - |
|
86 | - // don't show anything if messages are disable |
|
87 | - if( $messages_disabled_in_settings ){ |
|
88 | - return ''; |
|
89 | - } |
|
90 | - |
|
91 | - //set the wp_query to the current messages query |
|
92 | - global $wp_query; |
|
93 | - $wp_query = $this->messages_query; |
|
94 | - |
|
95 | - ob_start(); |
|
96 | - Sensei()->notices->maybe_print_notices(); |
|
97 | - Sensei_Templates::get_part('loop', 'message'); |
|
98 | - $messages_html = ob_get_clean(); |
|
99 | - |
|
100 | - // set back the global query |
|
101 | - wp_reset_query(); |
|
102 | - |
|
103 | - return $messages_html; |
|
104 | - |
|
105 | - }// end render |
|
20 | + /** |
|
21 | + * @var WP_Query |
|
22 | + * messages for the current user |
|
23 | + */ |
|
24 | + protected $messages_query; |
|
25 | + |
|
26 | + /** |
|
27 | + * Setup the shortcode object |
|
28 | + * |
|
29 | + * @since 1.9.0 |
|
30 | + * @param array $attributes |
|
31 | + * @param string $content |
|
32 | + * @param string $shortcode the shortcode that was called for this instance |
|
33 | + */ |
|
34 | + public function __construct( $attributes, $content, $shortcode ){ |
|
35 | + |
|
36 | + $this->setup_messages_query(); |
|
37 | + |
|
38 | + } |
|
39 | + |
|
40 | + /** |
|
41 | + * create the messages query . |
|
42 | + * |
|
43 | + * @return mixed |
|
44 | + */ |
|
45 | + public function setup_messages_query(){ |
|
46 | + |
|
47 | + $user = wp_get_current_user(); |
|
48 | + |
|
49 | + $args = array( |
|
50 | + 'post_type' => 'sensei_message', |
|
51 | + 'posts_per_page' => 500, |
|
52 | + 'orderby' => 'date', |
|
53 | + 'order' => 'DESC', |
|
54 | + 'post_status' => 'publish', |
|
55 | + 'meta_query' => array( |
|
56 | + array( |
|
57 | + 'key' => '_sender', |
|
58 | + 'value' => $user->user_login, |
|
59 | + 'compare' => '=', |
|
60 | + ), |
|
61 | + ), |
|
62 | + ); |
|
63 | + |
|
64 | + $this->messages_query = new WP_Query( $args ); |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * Rendering the shortcode this class is responsible for. |
|
69 | + * |
|
70 | + * @return string $content |
|
71 | + */ |
|
72 | + public function render(){ |
|
73 | + |
|
74 | + if( !is_user_logged_in() ){ |
|
75 | + |
|
76 | + Sensei()->notices->add_notice( __('Please login to view your messages.','woothemes-sensei') , 'alert' ); |
|
77 | + |
|
78 | + } elseif( 0 == $this->messages_query->post_count ){ |
|
79 | + |
|
80 | + Sensei()->notices->add_notice( __( 'You do not have any messages.', 'woothemes-sensei') , 'alert' ); |
|
81 | + } |
|
82 | + |
|
83 | + $messages_disabled_in_settings = ! ( ! isset( Sensei()->settings->settings['messages_disable'] ) |
|
84 | + || ! Sensei()->settings->settings['messages_disable'] ) ; |
|
85 | + |
|
86 | + // don't show anything if messages are disable |
|
87 | + if( $messages_disabled_in_settings ){ |
|
88 | + return ''; |
|
89 | + } |
|
90 | + |
|
91 | + //set the wp_query to the current messages query |
|
92 | + global $wp_query; |
|
93 | + $wp_query = $this->messages_query; |
|
94 | + |
|
95 | + ob_start(); |
|
96 | + Sensei()->notices->maybe_print_notices(); |
|
97 | + Sensei_Templates::get_part('loop', 'message'); |
|
98 | + $messages_html = ob_get_clean(); |
|
99 | + |
|
100 | + // set back the global query |
|
101 | + wp_reset_query(); |
|
102 | + |
|
103 | + return $messages_html; |
|
104 | + |
|
105 | + }// end render |
|
106 | 106 | |
107 | 107 | }// end class |
108 | 108 | \ No newline at end of file |
@@ -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 | * Renders the [sensei_unpurchased_courses] shortcode when a user is logged in. If the user is not logged in |
@@ -45,21 +45,21 @@ discard block |
||
45 | 45 | * @param string $content |
46 | 46 | * @param string $shortcode the shortcode that was called for this instance |
47 | 47 | */ |
48 | - public function __construct( $attributes, $content, $shortcode ){ |
|
48 | + public function __construct($attributes, $content, $shortcode) { |
|
49 | 49 | |
50 | 50 | // set up all argument need for constructing the course query |
51 | - $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10'; |
|
52 | - $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title'; |
|
51 | + $this->number = isset($attributes['number']) ? $attributes['number'] : '10'; |
|
52 | + $this->orderby = isset($attributes['orderby']) ? $attributes['orderby'] : 'title'; |
|
53 | 53 | |
54 | 54 | // set the default for menu_order to be ASC |
55 | - if( 'menu_order' == $this->orderby && !isset( $attributes['order'] ) ){ |
|
55 | + if ('menu_order' == $this->orderby && ! isset($attributes['order'])) { |
|
56 | 56 | |
57 | - $this->order = 'ASC'; |
|
57 | + $this->order = 'ASC'; |
|
58 | 58 | |
59 | - }else{ |
|
59 | + } else { |
|
60 | 60 | |
61 | 61 | // for everything else use the value passed or the default DESC |
62 | - $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'DESC'; |
|
62 | + $this->order = isset($attributes['order']) ? $attributes['order'] : 'DESC'; |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @since 1.9.0 |
75 | 75 | */ |
76 | - protected function setup_course_query(){ |
|
76 | + protected function setup_course_query() { |
|
77 | 77 | |
78 | 78 | |
79 | 79 | // course query parameters to be used for all courses |
@@ -87,18 +87,18 @@ discard block |
||
87 | 87 | ); |
88 | 88 | |
89 | 89 | // get all the courses that has a product attached |
90 | - $all_courses_query = new WP_Query( $query_args ); |
|
90 | + $all_courses_query = new WP_Query($query_args); |
|
91 | 91 | |
92 | 92 | $paid_courses_not_taken = array(); |
93 | 93 | // look through all course and find the purchasable ones that user has not purchased |
94 | - foreach( $all_courses_query->posts as $course ){ |
|
94 | + foreach ($all_courses_query->posts as $course) { |
|
95 | 95 | |
96 | 96 | // only keep the courses with a product including only courses that the user not taking |
97 | - $course_product_id = get_post_meta( $course->ID, '_course_woocommerce_product',true ); |
|
98 | - if( is_numeric( $course_product_id ) |
|
97 | + $course_product_id = get_post_meta($course->ID, '_course_woocommerce_product', true); |
|
98 | + if (is_numeric($course_product_id) |
|
99 | 99 | && |
100 | - ! Sensei_Utils::user_started_course( $course->ID , get_current_user_id() ) |
|
101 | - ){ |
|
100 | + ! Sensei_Utils::user_started_course($course->ID, get_current_user_id()) |
|
101 | + ) { |
|
102 | 102 | |
103 | 103 | $paid_courses_not_taken[] = $course->ID; |
104 | 104 | |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | |
109 | 109 | // setup the course query again and only use the course the user has not purchased. |
110 | 110 | // this query will be loaded into the global WP_Query in the render function. |
111 | - $query_args[ 'post__in' ] = $paid_courses_not_taken; |
|
112 | - $query_args[ 'posts_per_page' ] = $this->number; |
|
111 | + $query_args['post__in'] = $paid_courses_not_taken; |
|
112 | + $query_args['posts_per_page'] = $this->number; |
|
113 | 113 | |
114 | - $this->query = new WP_Query( $query_args ); |
|
114 | + $this->query = new WP_Query($query_args); |
|
115 | 115 | |
116 | 116 | }// end setup _course_query |
117 | 117 | |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return string $content |
122 | 122 | */ |
123 | - public function render(){ |
|
123 | + public function render() { |
|
124 | 124 | |
125 | 125 | global $wp_query; |
126 | 126 | |
127 | - if ( ! is_user_logged_in() ) { |
|
127 | + if ( ! is_user_logged_in()) { |
|
128 | 128 | |
129 | - $anchor_before = '<a href="' . esc_url( sensei_user_login_url() ) . '" >'; |
|
129 | + $anchor_before = '<a href="'.esc_url(sensei_user_login_url()).'" >'; |
|
130 | 130 | $anchor_after = '</a>'; |
131 | 131 | $notice = sprintf( |
132 | 132 | __('You must be logged in to view the non-purchased courses. Click here to %slogin%s.'), |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $anchor_after |
135 | 135 | ); |
136 | 136 | |
137 | - Sensei()->notices->add_notice( $notice, 'info' ); |
|
137 | + Sensei()->notices->add_notice($notice, 'info'); |
|
138 | 138 | Sensei()->notices->print_notices(); |
139 | 139 | |
140 | 140 | return ''; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | ob_start(); |
150 | 150 | Sensei()->notices->print_notices(); |
151 | 151 | Sensei_Templates::get_template('loop-course.php'); |
152 | - $shortcode_output = ob_get_clean(); |
|
152 | + $shortcode_output = ob_get_clean(); |
|
153 | 153 | |
154 | 154 | //restore old query |
155 | 155 | $wp_query = $current_global_query; |
@@ -16,148 +16,148 @@ |
||
16 | 16 | */ |
17 | 17 | class Sensei_Shortcode_Unpurchased_Courses implements Sensei_Shortcode_Interface { |
18 | 18 | |
19 | - /** |
|
20 | - * @var WP_Query to help setup the query needed by the render method. |
|
21 | - */ |
|
22 | - protected $query; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var string number of items to show on the current page |
|
26 | - * Default: all. |
|
27 | - */ |
|
28 | - protected $number; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var string ordery by course field |
|
32 | - * Default: date |
|
33 | - */ |
|
34 | - protected $orderby; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var string ASC or DESC |
|
38 | - * Default: 'DESC' |
|
39 | - */ |
|
40 | - protected $order; |
|
41 | - |
|
42 | - /** |
|
43 | - * Setup the shortcode object |
|
44 | - * |
|
45 | - * @since 1.9.0 |
|
46 | - * @param array $attributes |
|
47 | - * @param string $content |
|
48 | - * @param string $shortcode the shortcode that was called for this instance |
|
49 | - */ |
|
50 | - public function __construct( $attributes, $content, $shortcode ){ |
|
51 | - |
|
52 | - // set up all argument need for constructing the course query |
|
53 | - $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10'; |
|
54 | - $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title'; |
|
55 | - |
|
56 | - // set the default for menu_order to be ASC |
|
57 | - if( 'menu_order' == $this->orderby && !isset( $attributes['order'] ) ){ |
|
58 | - |
|
59 | - $this->order = 'ASC'; |
|
19 | + /** |
|
20 | + * @var WP_Query to help setup the query needed by the render method. |
|
21 | + */ |
|
22 | + protected $query; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var string number of items to show on the current page |
|
26 | + * Default: all. |
|
27 | + */ |
|
28 | + protected $number; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var string ordery by course field |
|
32 | + * Default: date |
|
33 | + */ |
|
34 | + protected $orderby; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var string ASC or DESC |
|
38 | + * Default: 'DESC' |
|
39 | + */ |
|
40 | + protected $order; |
|
41 | + |
|
42 | + /** |
|
43 | + * Setup the shortcode object |
|
44 | + * |
|
45 | + * @since 1.9.0 |
|
46 | + * @param array $attributes |
|
47 | + * @param string $content |
|
48 | + * @param string $shortcode the shortcode that was called for this instance |
|
49 | + */ |
|
50 | + public function __construct( $attributes, $content, $shortcode ){ |
|
51 | + |
|
52 | + // set up all argument need for constructing the course query |
|
53 | + $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10'; |
|
54 | + $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title'; |
|
55 | + |
|
56 | + // set the default for menu_order to be ASC |
|
57 | + if( 'menu_order' == $this->orderby && !isset( $attributes['order'] ) ){ |
|
58 | + |
|
59 | + $this->order = 'ASC'; |
|
60 | 60 | |
61 | - }else{ |
|
61 | + }else{ |
|
62 | 62 | |
63 | - // for everything else use the value passed or the default DESC |
|
64 | - $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'DESC'; |
|
63 | + // for everything else use the value passed or the default DESC |
|
64 | + $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'DESC'; |
|
65 | 65 | |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | - // setup the course query that will be used when rendering |
|
69 | - $this->setup_course_query(); |
|
70 | - } |
|
68 | + // setup the course query that will be used when rendering |
|
69 | + $this->setup_course_query(); |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * Sets up the object course query |
|
74 | - * that will be used int he render method. |
|
75 | - * |
|
76 | - * @since 1.9.0 |
|
77 | - */ |
|
78 | - protected function setup_course_query(){ |
|
72 | + /** |
|
73 | + * Sets up the object course query |
|
74 | + * that will be used int he render method. |
|
75 | + * |
|
76 | + * @since 1.9.0 |
|
77 | + */ |
|
78 | + protected function setup_course_query(){ |
|
79 | 79 | |
80 | 80 | |
81 | - // course query parameters to be used for all courses |
|
82 | - $query_args = array( |
|
83 | - 'post_type' => 'course', |
|
84 | - 'post_status' => 'publish', |
|
85 | - // the number specified by the user will be used later in this function |
|
86 | - 'posts_per_page' => 1000, |
|
87 | - 'orderby' => $this->orderby, |
|
88 | - 'order' => $this->order |
|
89 | - ); |
|
81 | + // course query parameters to be used for all courses |
|
82 | + $query_args = array( |
|
83 | + 'post_type' => 'course', |
|
84 | + 'post_status' => 'publish', |
|
85 | + // the number specified by the user will be used later in this function |
|
86 | + 'posts_per_page' => 1000, |
|
87 | + 'orderby' => $this->orderby, |
|
88 | + 'order' => $this->order |
|
89 | + ); |
|
90 | 90 | |
91 | - // get all the courses that has a product attached |
|
92 | - $all_courses_query = new WP_Query( $query_args ); |
|
91 | + // get all the courses that has a product attached |
|
92 | + $all_courses_query = new WP_Query( $query_args ); |
|
93 | 93 | |
94 | - $paid_courses_not_taken = array(); |
|
95 | - // look through all course and find the purchasable ones that user has not purchased |
|
96 | - foreach( $all_courses_query->posts as $course ){ |
|
94 | + $paid_courses_not_taken = array(); |
|
95 | + // look through all course and find the purchasable ones that user has not purchased |
|
96 | + foreach( $all_courses_query->posts as $course ){ |
|
97 | 97 | |
98 | - // only keep the courses with a product including only courses that the user not taking |
|
99 | - $course_product_id = get_post_meta( $course->ID, '_course_woocommerce_product',true ); |
|
100 | - if( is_numeric( $course_product_id ) |
|
101 | - && |
|
102 | - ! Sensei_Utils::user_started_course( $course->ID , get_current_user_id() ) |
|
103 | - ){ |
|
98 | + // only keep the courses with a product including only courses that the user not taking |
|
99 | + $course_product_id = get_post_meta( $course->ID, '_course_woocommerce_product',true ); |
|
100 | + if( is_numeric( $course_product_id ) |
|
101 | + && |
|
102 | + ! Sensei_Utils::user_started_course( $course->ID , get_current_user_id() ) |
|
103 | + ){ |
|
104 | 104 | |
105 | - $paid_courses_not_taken[] = $course->ID; |
|
105 | + $paid_courses_not_taken[] = $course->ID; |
|
106 | 106 | |
107 | - } |
|
107 | + } |
|
108 | 108 | |
109 | - } // end foreach |
|
109 | + } // end foreach |
|
110 | 110 | |
111 | - // setup the course query again and only use the course the user has not purchased. |
|
112 | - // this query will be loaded into the global WP_Query in the render function. |
|
113 | - $query_args[ 'post__in' ] = $paid_courses_not_taken; |
|
114 | - $query_args[ 'posts_per_page' ] = $this->number; |
|
111 | + // setup the course query again and only use the course the user has not purchased. |
|
112 | + // this query will be loaded into the global WP_Query in the render function. |
|
113 | + $query_args[ 'post__in' ] = $paid_courses_not_taken; |
|
114 | + $query_args[ 'posts_per_page' ] = $this->number; |
|
115 | 115 | |
116 | - $this->query = new WP_Query( $query_args ); |
|
116 | + $this->query = new WP_Query( $query_args ); |
|
117 | 117 | |
118 | - }// end setup _course_query |
|
118 | + }// end setup _course_query |
|
119 | 119 | |
120 | - /** |
|
121 | - * Rendering the shortcode this class is responsible for. |
|
122 | - * |
|
123 | - * @return string $content |
|
124 | - */ |
|
125 | - public function render(){ |
|
120 | + /** |
|
121 | + * Rendering the shortcode this class is responsible for. |
|
122 | + * |
|
123 | + * @return string $content |
|
124 | + */ |
|
125 | + public function render(){ |
|
126 | 126 | |
127 | - global $wp_query; |
|
127 | + global $wp_query; |
|
128 | 128 | |
129 | - if ( ! is_user_logged_in() ) { |
|
129 | + if ( ! is_user_logged_in() ) { |
|
130 | 130 | |
131 | - $anchor_before = '<a href="' . esc_url( sensei_user_login_url() ) . '" >'; |
|
132 | - $anchor_after = '</a>'; |
|
133 | - $notice = sprintf( |
|
134 | - __('You must be logged in to view the non-purchased courses. Click here to %slogin%s.'), |
|
135 | - $anchor_before, |
|
136 | - $anchor_after |
|
137 | - ); |
|
131 | + $anchor_before = '<a href="' . esc_url( sensei_user_login_url() ) . '" >'; |
|
132 | + $anchor_after = '</a>'; |
|
133 | + $notice = sprintf( |
|
134 | + __('You must be logged in to view the non-purchased courses. Click here to %slogin%s.'), |
|
135 | + $anchor_before, |
|
136 | + $anchor_after |
|
137 | + ); |
|
138 | 138 | |
139 | - Sensei()->notices->add_notice( $notice, 'info' ); |
|
140 | - Sensei()->notices->maybe_print_notices(); |
|
139 | + Sensei()->notices->add_notice( $notice, 'info' ); |
|
140 | + Sensei()->notices->maybe_print_notices(); |
|
141 | 141 | |
142 | - return ''; |
|
142 | + return ''; |
|
143 | 143 | |
144 | - } |
|
144 | + } |
|
145 | 145 | |
146 | - // keep a reference to old query |
|
147 | - $current_global_query = $wp_query; |
|
148 | - // assign the query setup in $this-> setup_course_query |
|
149 | - $wp_query = $this->query; |
|
146 | + // keep a reference to old query |
|
147 | + $current_global_query = $wp_query; |
|
148 | + // assign the query setup in $this-> setup_course_query |
|
149 | + $wp_query = $this->query; |
|
150 | 150 | |
151 | - ob_start(); |
|
152 | - Sensei()->notices->maybe_print_notices(); |
|
153 | - Sensei_Templates::get_template('loop-course.php'); |
|
154 | - $shortcode_output = ob_get_clean(); |
|
151 | + ob_start(); |
|
152 | + Sensei()->notices->maybe_print_notices(); |
|
153 | + Sensei_Templates::get_template('loop-course.php'); |
|
154 | + $shortcode_output = ob_get_clean(); |
|
155 | 155 | |
156 | - //restore old query |
|
157 | - $wp_query = $current_global_query; |
|
156 | + //restore old query |
|
157 | + $wp_query = $current_global_query; |
|
158 | 158 | |
159 | - return $shortcode_output; |
|
159 | + return $shortcode_output; |
|
160 | 160 | |
161 | - }// end render |
|
161 | + }// end render |
|
162 | 162 | |
163 | 163 | } |
164 | 164 | \ No newline at end of file |
@@ -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 |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | * @since 1.4.0 |
11 | 11 | */ |
12 | 12 | class Sensei_Learner_Profiles { |
13 | - /** |
|
14 | - * @var string |
|
15 | - */ |
|
16 | - private $profile_url_base; |
|
13 | + /** |
|
14 | + * @var string |
|
15 | + */ |
|
16 | + private $profile_url_base; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Constructor. |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function setup_permastruct() { |
44 | 44 | |
45 | - if( isset( Sensei()->settings->settings[ 'learner_profile_enable' ] ) |
|
46 | - && Sensei()->settings->settings[ 'learner_profile_enable' ] ) { |
|
45 | + if( isset( Sensei()->settings->settings[ 'learner_profile_enable' ] ) |
|
46 | + && Sensei()->settings->settings[ 'learner_profile_enable' ] ) { |
|
47 | 47 | |
48 | 48 | add_rewrite_rule( '^' . $this->profile_url_base . '/([^/]*)/?', 'index.php?learner_profile=$matches[1]', 'top' ); |
49 | 49 | add_rewrite_tag( '%learner_profile%', '([^&]+)' ); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if( isset( $wp_query->query_vars['learner_profile'] ) ) { |
63 | 63 | $learner_user = get_user_by( 'login', $wp_query->query_vars['learner_profile'] ); |
64 | 64 | |
65 | - $name = Sensei_Learner::get_full_name( $learner_user->ID ); |
|
65 | + $name = Sensei_Learner::get_full_name( $learner_user->ID ); |
|
66 | 66 | |
67 | 67 | $title = apply_filters( 'sensei_learner_profile_courses_heading', sprintf( __( 'Courses %s is taking', 'woothemes-sensei' ), $name ) ) . ' ' . $sep . ' '; |
68 | 68 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | if( isset( $wp_query->query_vars['learner_profile'] ) ) { |
112 | 112 | |
113 | - Sensei_Templates::get_template( 'learner-profile/learner-info.php' ); |
|
113 | + Sensei_Templates::get_template( 'learner-profile/learner-info.php' ); |
|
114 | 114 | |
115 | 115 | } |
116 | 116 | } |
@@ -140,43 +140,43 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public static function user_info( $user ) { |
142 | 142 | |
143 | - /** |
|
144 | - * This hooke fires inside the Sensei_Learner_Profiles::user_info function. |
|
145 | - * just before the htmls is generated. |
|
146 | - * @since 1.0.0 |
|
147 | - */ |
|
148 | - do_action( 'sensei_learner_profile_info', $user ); |
|
149 | - |
|
150 | - /** |
|
151 | - * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
|
152 | - * Here you can change the user avatar. |
|
153 | - * |
|
154 | - * @since 1.0.0 |
|
155 | - * |
|
156 | - * @param false|string `<img>` $user_avatar |
|
157 | - */ |
|
143 | + /** |
|
144 | + * This hooke fires inside the Sensei_Learner_Profiles::user_info function. |
|
145 | + * just before the htmls is generated. |
|
146 | + * @since 1.0.0 |
|
147 | + */ |
|
148 | + do_action( 'sensei_learner_profile_info', $user ); |
|
149 | + |
|
150 | + /** |
|
151 | + * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
|
152 | + * Here you can change the user avatar. |
|
153 | + * |
|
154 | + * @since 1.0.0 |
|
155 | + * |
|
156 | + * @param false|string `<img>` $user_avatar |
|
157 | + */ |
|
158 | 158 | $learner_avatar = apply_filters( 'sensei_learner_profile_info_avatar', get_avatar( $user->ID, 120 ), $user->ID ); |
159 | 159 | |
160 | - /** |
|
161 | - * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
|
162 | - * Here you can change the learner profile user display name. |
|
163 | - * @since 1.0.0 |
|
164 | - * |
|
165 | - * @param string $user_display_name |
|
166 | - * @param string $user_id |
|
167 | - */ |
|
160 | + /** |
|
161 | + * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
|
162 | + * Here you can change the learner profile user display name. |
|
163 | + * @since 1.0.0 |
|
164 | + * |
|
165 | + * @param string $user_display_name |
|
166 | + * @param string $user_id |
|
167 | + */ |
|
168 | 168 | $learner_name = apply_filters( 'sensei_learner_profile_info_name', $user->display_name, $user->ID ); |
169 | 169 | |
170 | - /** |
|
171 | - * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
|
172 | - * With this filter can change the users description on the learner user info |
|
173 | - * output. |
|
174 | - * |
|
175 | - * @since 1.0.0 |
|
176 | - * |
|
177 | - * @param string $user_description |
|
178 | - * @param string $user_id |
|
179 | - */ |
|
170 | + /** |
|
171 | + * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
|
172 | + * With this filter can change the users description on the learner user info |
|
173 | + * output. |
|
174 | + * |
|
175 | + * @since 1.0.0 |
|
176 | + * |
|
177 | + * @param string $user_description |
|
178 | + * @param string $user_id |
|
179 | + */ |
|
180 | 180 | $learner_bio = apply_filters( 'sensei_learner_profile_info_bio', $user->description, $user->ID ); |
181 | 181 | ?> |
182 | 182 | |
@@ -210,16 +210,16 @@ discard block |
||
210 | 210 | return $classes; |
211 | 211 | } |
212 | 212 | |
213 | - /** |
|
214 | - * Deprecate the deprecate_sensei_learner_profile_content hook |
|
215 | - * |
|
216 | - * @since 1.9.0 |
|
217 | - */ |
|
218 | - public static function deprecate_sensei_learner_profile_content_hook(){ |
|
213 | + /** |
|
214 | + * Deprecate the deprecate_sensei_learner_profile_content hook |
|
215 | + * |
|
216 | + * @since 1.9.0 |
|
217 | + */ |
|
218 | + public static function deprecate_sensei_learner_profile_content_hook(){ |
|
219 | 219 | |
220 | - sensei_do_deprecated_action( 'sensei_learner_profile_content', '1.9.0', 'sensei_learner_profile_content_before' ); |
|
220 | + sensei_do_deprecated_action( 'sensei_learner_profile_content', '1.9.0', 'sensei_learner_profile_content_before' ); |
|
221 | 221 | |
222 | - } |
|
222 | + } |
|
223 | 223 | |
224 | 224 | |
225 | 225 | } // End Class |
@@ -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 learner profiles in Sensei. |
@@ -19,20 +19,20 @@ discard block |
||
19 | 19 | * Constructor. |
20 | 20 | * @since 1.4.0 |
21 | 21 | */ |
22 | - public function __construct () { |
|
22 | + public function __construct() { |
|
23 | 23 | |
24 | 24 | // Setup learner profile URL base |
25 | - $this->profile_url_base = apply_filters( 'sensei_learner_profiles_url_base', __( 'learner', 'woothemes-sensei') ); |
|
25 | + $this->profile_url_base = apply_filters('sensei_learner_profiles_url_base', __('learner', 'woothemes-sensei')); |
|
26 | 26 | |
27 | 27 | // Setup permalink structure for learner profiles |
28 | - add_action( 'init', array( $this, 'setup_permastruct' ) ); |
|
29 | - add_filter( 'wp_title', array( $this, 'page_title' ), 10, 2 ); |
|
28 | + add_action('init', array($this, 'setup_permastruct')); |
|
29 | + add_filter('wp_title', array($this, 'page_title'), 10, 2); |
|
30 | 30 | |
31 | 31 | // Set heading for courses section of learner profiles |
32 | - add_action( 'sensei_learner_profile_info', array( $this, 'learner_profile_courses_heading' ), 30, 1 ); |
|
32 | + add_action('sensei_learner_profile_info', array($this, 'learner_profile_courses_heading'), 30, 1); |
|
33 | 33 | |
34 | 34 | // Add class to body tag |
35 | - add_filter( 'body_class', array( $this, 'learner_profile_body_class' ), 10, 1 ); |
|
35 | + add_filter('body_class', array($this, 'learner_profile_body_class'), 10, 1); |
|
36 | 36 | } // End __construct() |
37 | 37 | |
38 | 38 | /** |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function setup_permastruct() { |
44 | 44 | |
45 | - if( isset( Sensei()->settings->settings[ 'learner_profile_enable' ] ) |
|
46 | - && Sensei()->settings->settings[ 'learner_profile_enable' ] ) { |
|
45 | + if (isset(Sensei()->settings->settings['learner_profile_enable']) |
|
46 | + && Sensei()->settings->settings['learner_profile_enable']) { |
|
47 | 47 | |
48 | - add_rewrite_rule( '^' . $this->profile_url_base . '/([^/]*)/?', 'index.php?learner_profile=$matches[1]', 'top' ); |
|
49 | - add_rewrite_tag( '%learner_profile%', '([^&]+)' ); |
|
48 | + add_rewrite_rule('^'.$this->profile_url_base.'/([^/]*)/?', 'index.php?learner_profile=$matches[1]', 'top'); |
|
49 | + add_rewrite_tag('%learner_profile%', '([^&]+)'); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | } |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | * @param string $sep Seeparator string |
58 | 58 | * @return string Modified title |
59 | 59 | */ |
60 | - public function page_title( $title, $sep = null ) { |
|
60 | + public function page_title($title, $sep = null) { |
|
61 | 61 | global $wp_query; |
62 | - if( isset( $wp_query->query_vars['learner_profile'] ) ) { |
|
63 | - $learner_user = get_user_by( 'login', $wp_query->query_vars['learner_profile'] ); |
|
62 | + if (isset($wp_query->query_vars['learner_profile'])) { |
|
63 | + $learner_user = get_user_by('login', $wp_query->query_vars['learner_profile']); |
|
64 | 64 | |
65 | - $name = Sensei_Learner::get_full_name( $learner_user->ID ); |
|
65 | + $name = Sensei_Learner::get_full_name($learner_user->ID); |
|
66 | 66 | |
67 | - $title = apply_filters( 'sensei_learner_profile_courses_heading', sprintf( __( 'Courses %s is taking', 'woothemes-sensei' ), $name ) ) . ' ' . $sep . ' '; |
|
67 | + $title = apply_filters('sensei_learner_profile_courses_heading', sprintf(__('Courses %s is taking', 'woothemes-sensei'), $name)).' '.$sep.' '; |
|
68 | 68 | } |
69 | 69 | return $title; |
70 | 70 | } |
@@ -75,23 +75,23 @@ discard block |
||
75 | 75 | * @param integer $user_id ID of user |
76 | 76 | * @return string The learner profile permalink |
77 | 77 | */ |
78 | - public function get_permalink( $user_id = 0 ) { |
|
78 | + public function get_permalink($user_id = 0) { |
|
79 | 79 | $user = false; |
80 | - if( $user_id == 0 ) { |
|
80 | + if ($user_id == 0) { |
|
81 | 81 | global $current_user; |
82 | 82 | wp_get_current_user(); |
83 | 83 | $user = $current_user; |
84 | 84 | } else { |
85 | - $user = get_userdata( $user_id ); |
|
85 | + $user = get_userdata($user_id); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $permalink = ''; |
89 | 89 | |
90 | - if( $user ) { |
|
91 | - if ( get_option('permalink_structure') ) { |
|
92 | - $permalink = trailingslashit( get_site_url() ) . $this->profile_url_base . '/' . $user->user_nicename; |
|
90 | + if ($user) { |
|
91 | + if (get_option('permalink_structure')) { |
|
92 | + $permalink = trailingslashit(get_site_url()).$this->profile_url_base.'/'.$user->user_nicename; |
|
93 | 93 | } else { |
94 | - $permalink = trailingslashit( get_site_url() ) . '?learner_profile=' . $user->user_nicename; |
|
94 | + $permalink = trailingslashit(get_site_url()).'?learner_profile='.$user->user_nicename; |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | * @return void |
105 | 105 | */ |
106 | 106 | public function content() { |
107 | - global $wp_query, $learner_user, $current_user; |
|
107 | + global $wp_query, $learner_user, $current_user; |
|
108 | 108 | |
109 | - if( isset( Sensei()->settings->settings[ 'learner_profile_enable' ] ) && Sensei()->settings->settings[ 'learner_profile_enable' ] ) { |
|
109 | + if (isset(Sensei()->settings->settings['learner_profile_enable']) && Sensei()->settings->settings['learner_profile_enable']) { |
|
110 | 110 | |
111 | - if( isset( $wp_query->query_vars['learner_profile'] ) ) { |
|
111 | + if (isset($wp_query->query_vars['learner_profile'])) { |
|
112 | 112 | |
113 | - Sensei_Templates::get_template( 'learner-profile/learner-info.php' ); |
|
113 | + Sensei_Templates::get_template('learner-profile/learner-info.php'); |
|
114 | 114 | |
115 | 115 | } |
116 | 116 | } |
@@ -122,14 +122,14 @@ discard block |
||
122 | 122 | * @param object $user Queried user object |
123 | 123 | * @return void |
124 | 124 | */ |
125 | - public function learner_profile_courses_heading( $user ) { |
|
126 | - if( strlen( $user->first_name ) > 0 ) { |
|
125 | + public function learner_profile_courses_heading($user) { |
|
126 | + if (strlen($user->first_name) > 0) { |
|
127 | 127 | $name = $user->first_name; |
128 | 128 | } else { |
129 | 129 | $name = $user->display_name; |
130 | 130 | } |
131 | - $name = apply_filters( 'sensei_learner_profile_courses_heading_name', $name ); |
|
132 | - echo '<h2>' . apply_filters( 'sensei_learner_profile_courses_heading', sprintf( __( 'Courses %s is taking', 'woothemes-sensei' ), $name ) ) . '</h2>'; |
|
131 | + $name = apply_filters('sensei_learner_profile_courses_heading_name', $name); |
|
132 | + echo '<h2>'.apply_filters('sensei_learner_profile_courses_heading', sprintf(__('Courses %s is taking', 'woothemes-sensei'), $name)).'</h2>'; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | * @param object $user Queried user object |
139 | 139 | * @return void |
140 | 140 | */ |
141 | - public static function user_info( $user ) { |
|
141 | + public static function user_info($user) { |
|
142 | 142 | |
143 | 143 | /** |
144 | 144 | * This hooke fires inside the Sensei_Learner_Profiles::user_info function. |
145 | 145 | * just before the htmls is generated. |
146 | 146 | * @since 1.0.0 |
147 | 147 | */ |
148 | - do_action( 'sensei_learner_profile_info', $user ); |
|
148 | + do_action('sensei_learner_profile_info', $user); |
|
149 | 149 | |
150 | 150 | /** |
151 | 151 | * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @param false|string `<img>` $user_avatar |
157 | 157 | */ |
158 | - $learner_avatar = apply_filters( 'sensei_learner_profile_info_avatar', get_avatar( $user->ID, 120 ), $user->ID ); |
|
158 | + $learner_avatar = apply_filters('sensei_learner_profile_info_avatar', get_avatar($user->ID, 120), $user->ID); |
|
159 | 159 | |
160 | 160 | /** |
161 | 161 | * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @param string $user_display_name |
166 | 166 | * @param string $user_id |
167 | 167 | */ |
168 | - $learner_name = apply_filters( 'sensei_learner_profile_info_name', $user->display_name, $user->ID ); |
|
168 | + $learner_name = apply_filters('sensei_learner_profile_info_name', $user->display_name, $user->ID); |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * @param string $user_description |
178 | 178 | * @param string $user_id |
179 | 179 | */ |
180 | - $learner_bio = apply_filters( 'sensei_learner_profile_info_bio', $user->description, $user->ID ); |
|
180 | + $learner_bio = apply_filters('sensei_learner_profile_info_bio', $user->description, $user->ID); |
|
181 | 181 | ?> |
182 | 182 | |
183 | 183 | <div id="learner-info"> |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | <h2><?php echo $learner_name; ?></h2> |
190 | 190 | |
191 | - <div class="description"><?php echo wpautop( $learner_bio ); ?></div> |
|
191 | + <div class="description"><?php echo wpautop($learner_bio); ?></div> |
|
192 | 192 | |
193 | 193 | </div> |
194 | 194 | |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | * @param array $classes Existing classes |
203 | 203 | * @return array Modified classes |
204 | 204 | */ |
205 | - public function learner_profile_body_class( $classes ) { |
|
205 | + public function learner_profile_body_class($classes) { |
|
206 | 206 | global $wp_query; |
207 | - if( isset( $wp_query->query_vars['learner_profile'] ) ) { |
|
207 | + if (isset($wp_query->query_vars['learner_profile'])) { |
|
208 | 208 | $classes[] = 'learner-profile'; |
209 | 209 | } |
210 | 210 | return $classes; |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @since 1.9.0 |
217 | 217 | */ |
218 | - public static function deprecate_sensei_learner_profile_content_hook(){ |
|
218 | + public static function deprecate_sensei_learner_profile_content_hook() { |
|
219 | 219 | |
220 | - sensei_do_deprecated_action( 'sensei_learner_profile_content', '1.9.0', 'sensei_learner_profile_content_before' ); |
|
220 | + sensei_do_deprecated_action('sensei_learner_profile_content', '1.9.0', 'sensei_learner_profile_content_before'); |
|
221 | 221 | |
222 | 222 | } |
223 | 223 |
@@ -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 |
@@ -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_Learner_Completed_Course' ) ) : |
|
5 | +if ( ! class_exists('WooThemes_Sensei_Email_Learner_Completed_Course')) : |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Learner Completed Course |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function __construct() { |
32 | 32 | $this->template = 'learner-completed-course'; |
33 | - $this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] You have completed a course', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template ); |
|
34 | - $this->heading = apply_filters( 'sensei_email_heading', __( 'You have completed a course', 'woothemes-sensei' ), $this->template ); |
|
33 | + $this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] You have completed a course', 'woothemes-sensei'), get_bloginfo('name')), $this->template); |
|
34 | + $this->heading = apply_filters('sensei_email_heading', __('You have completed a course', 'woothemes-sensei'), $this->template); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -40,32 +40,32 @@ discard block |
||
40 | 40 | * @access public |
41 | 41 | * @return void |
42 | 42 | */ |
43 | - function trigger( $user_id = 0, $course_id = 0 ) { |
|
43 | + function trigger($user_id = 0, $course_id = 0) { |
|
44 | 44 | global $sensei_email_data; |
45 | 45 | |
46 | 46 | // Get learner user object |
47 | - $this->user = new WP_User( $user_id ); |
|
47 | + $this->user = new WP_User($user_id); |
|
48 | 48 | |
49 | 49 | // Get passed status |
50 | - $passed = __( 'passed', 'woothemes-sensei' ); |
|
51 | - if( ! Sensei_Utils::sensei_user_passed_course( $course_id, $user_id ) ) { |
|
52 | - $passed = __( 'failed', 'woothemes-sensei' ); |
|
50 | + $passed = __('passed', 'woothemes-sensei'); |
|
51 | + if ( ! Sensei_Utils::sensei_user_passed_course($course_id, $user_id)) { |
|
52 | + $passed = __('failed', 'woothemes-sensei'); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | // Construct data array |
56 | - $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
56 | + $sensei_email_data = apply_filters('sensei_email_data', array( |
|
57 | 57 | 'template' => $this->template, |
58 | 58 | 'heading' => $this->heading, |
59 | 59 | 'user_id' => $user_id, |
60 | 60 | 'course_id' => $course_id, |
61 | 61 | 'passed' => $passed, |
62 | - ), $this->template ); |
|
62 | + ), $this->template); |
|
63 | 63 | |
64 | 64 | // Set recipient (learner) |
65 | - $this->recipient = stripslashes( $this->user->user_email ); |
|
65 | + $this->recipient = stripslashes($this->user->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 |
@@ -38,10 +38,10 @@ |
||
38 | 38 | * trigger function. |
39 | 39 | * |
40 | 40 | * @access public |
41 | - * |
|
42 | - * @param int $user_id |
|
43 | - * @param int $course_id |
|
44 | - * |
|
41 | + * |
|
42 | + * @param int $user_id |
|
43 | + * @param int $course_id |
|
44 | + * |
|
45 | 45 | * @return void |
46 | 46 | */ |
47 | 47 | function trigger( $user_id = 0, $course_id = 0 ) { |
@@ -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 |
@@ -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_Course' ) ) : |
|
5 | +if ( ! class_exists('WooThemes_Sensei_Email_Teacher_Completed_Course')) : |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Teacher Completed Course |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function __construct() { |
33 | 33 | $this->template = 'teacher-completed-course'; |
34 | - $this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] Your student has completed a course', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template ); |
|
35 | - $this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has completed a course', 'woothemes-sensei' ), $this->template ); |
|
34 | + $this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] Your student has completed a course', 'woothemes-sensei'), get_bloginfo('name')), $this->template); |
|
35 | + $this->heading = apply_filters('sensei_email_heading', __('Your student has completed a course', 'woothemes-sensei'), $this->template); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -41,24 +41,24 @@ 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 | // Get passed status |
55 | - $passed = __( 'passed', 'woothemes-sensei' ); |
|
56 | - if( ! Sensei_Utils::sensei_user_passed_course( $course_id, $learner_id ) ) { |
|
57 | - $passed = __( 'failed', 'woothemes-sensei' ); |
|
55 | + $passed = __('passed', 'woothemes-sensei'); |
|
56 | + if ( ! Sensei_Utils::sensei_user_passed_course($course_id, $learner_id)) { |
|
57 | + $passed = __('failed', 'woothemes-sensei'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // Construct data array |
61 | - $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
61 | + $sensei_email_data = apply_filters('sensei_email_data', array( |
|
62 | 62 | 'template' => $this->template, |
63 | 63 | 'heading' => $this->heading, |
64 | 64 | 'teacher_id' => $teacher_id, |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | 'learner_name' => $this->learner->display_name, |
67 | 67 | 'course_id' => $course_id, |
68 | 68 | 'passed' => $passed, |
69 | - ), $this->template ); |
|
69 | + ), $this->template); |
|
70 | 70 | |
71 | 71 | // Set recipient (learner) |
72 | - $this->recipient = stripslashes( $this->teacher->user_email ); |
|
72 | + $this->recipient = stripslashes($this->teacher->user_email); |
|
73 | 73 | |
74 | 74 | // Send mail |
75 | - Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) ); |
|
75 | + Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template)); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 |
@@ -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 @@ |
||
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 |
@@ -16,38 +16,38 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class WooThemes_Sensei_Email_New_Message_Reply { |
18 | 18 | |
19 | - /** |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - var $template; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var string |
|
26 | - */ |
|
19 | + /** |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + var $template; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var string |
|
26 | + */ |
|
27 | 27 | var $subject; |
28 | 28 | |
29 | - /** |
|
30 | - * @var string |
|
31 | - */ |
|
32 | - var $heading; |
|
29 | + /** |
|
30 | + * @var string |
|
31 | + */ |
|
32 | + var $heading; |
|
33 | 33 | |
34 | - /** |
|
35 | - * @var string |
|
36 | - */ |
|
34 | + /** |
|
35 | + * @var string |
|
36 | + */ |
|
37 | 37 | var $recipient; |
38 | 38 | |
39 | 39 | var $original_sender; |
40 | 40 | var $original_receiver; |
41 | 41 | var $commenter; |
42 | 42 | |
43 | - /** |
|
44 | - * @var WP_Post |
|
45 | - */ |
|
43 | + /** |
|
44 | + * @var WP_Post |
|
45 | + */ |
|
46 | 46 | var $message; |
47 | 47 | |
48 | - /** |
|
49 | - * @var WP_Comment |
|
50 | - */ |
|
48 | + /** |
|
49 | + * @var WP_Comment |
|
50 | + */ |
|
51 | 51 | var $comment; |
52 | 52 | |
53 | 53 | /** |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * trigger function. |
66 | 66 | * |
67 | - * @param WP_Comment $comment |
|
68 | - * @param string $message |
|
69 | - * |
|
67 | + * @param WP_Comment $comment |
|
68 | + * @param string $message |
|
69 | + * |
|
70 | 70 | * @return void |
71 | 71 | */ |
72 | 72 | function trigger ( $comment, $message ) { |
@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | |
91 | 91 | $comment_link = get_comment_link( $comment ); |
92 | 92 | |
93 | - // setup the post type parameter |
|
94 | - $content_type = get_post_type( $content_id ); |
|
95 | - if( !$content_type ){ |
|
96 | - $content_type =''; |
|
97 | - } |
|
93 | + // setup the post type parameter |
|
94 | + $content_type = get_post_type( $content_id ); |
|
95 | + if( !$content_type ){ |
|
96 | + $content_type =''; |
|
97 | + } |
|
98 | 98 | |
99 | - // Construct data array |
|
100 | - $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
101 | - 'template' => $this->template, |
|
102 | - $content_type.'_id' => $content_id, |
|
99 | + // Construct data array |
|
100 | + $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
101 | + 'template' => $this->template, |
|
102 | + $content_type.'_id' => $content_id, |
|
103 | 103 | 'heading' => $this->heading, |
104 | 104 | 'commenter_name' => $this->commenter->display_name, |
105 | 105 | 'message' => $this->comment->comment_content, |
@@ -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_New_Message_Reply' ) ) : |
|
5 | +if ( ! class_exists('WooThemes_Sensei_Email_New_Message_Reply')) : |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Teacher New Message |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | */ |
58 | 58 | function __construct() { |
59 | 59 | $this->template = 'new-message-reply'; |
60 | - $this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] You have a new message', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template ); |
|
61 | - $this->heading = apply_filters( 'sensei_email_heading', __( 'You have received a reply to your private message', 'woothemes-sensei' ), $this->template ); |
|
60 | + $this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] You have a new message', 'woothemes-sensei'), get_bloginfo('name')), $this->template); |
|
61 | + $this->heading = apply_filters('sensei_email_heading', __('You have received a reply to your private message', 'woothemes-sensei'), $this->template); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -69,35 +69,35 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return void |
71 | 71 | */ |
72 | - function trigger ( $comment, $message ) { |
|
72 | + function trigger($comment, $message) { |
|
73 | 73 | |
74 | 74 | global $sensei_email_data; |
75 | 75 | |
76 | 76 | $this->comment = $comment; |
77 | 77 | $this->message = $message; |
78 | 78 | |
79 | - $this->commenter = get_userdata( $comment->user_id ); |
|
79 | + $this->commenter = get_userdata($comment->user_id); |
|
80 | 80 | |
81 | - $original_sender = get_post_meta( $this->message->ID, '_sender', true ); |
|
82 | - $this->original_sender = get_user_by( 'login', $original_sender ); |
|
81 | + $original_sender = get_post_meta($this->message->ID, '_sender', true); |
|
82 | + $this->original_sender = get_user_by('login', $original_sender); |
|
83 | 83 | |
84 | - $original_receiver = get_post_meta( $this->message->ID, '_receiver', true ); |
|
85 | - $this->original_receiver = get_user_by( 'login', $original_receiver ); |
|
84 | + $original_receiver = get_post_meta($this->message->ID, '_receiver', true); |
|
85 | + $this->original_receiver = get_user_by('login', $original_receiver); |
|
86 | 86 | |
87 | - $content_type = get_post_meta( $this->message->ID, '_posttype', true ); |
|
88 | - $content_id = get_post_meta( $this->message->ID, '_post', true ); |
|
89 | - $content_title = get_the_title( $content_id ); |
|
87 | + $content_type = get_post_meta($this->message->ID, '_posttype', true); |
|
88 | + $content_id = get_post_meta($this->message->ID, '_post', true); |
|
89 | + $content_title = get_the_title($content_id); |
|
90 | 90 | |
91 | - $comment_link = get_comment_link( $comment ); |
|
91 | + $comment_link = get_comment_link($comment); |
|
92 | 92 | |
93 | 93 | // setup the post type parameter |
94 | - $content_type = get_post_type( $content_id ); |
|
95 | - if( !$content_type ){ |
|
96 | - $content_type =''; |
|
94 | + $content_type = get_post_type($content_id); |
|
95 | + if ( ! $content_type) { |
|
96 | + $content_type = ''; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | // Construct data array |
100 | - $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
100 | + $sensei_email_data = apply_filters('sensei_email_data', array( |
|
101 | 101 | 'template' => $this->template, |
102 | 102 | $content_type.'_id' => $content_id, |
103 | 103 | 'heading' => $this->heading, |
@@ -106,17 +106,17 @@ discard block |
||
106 | 106 | 'comment_link' => $comment_link, |
107 | 107 | 'content_title' => $content_title, |
108 | 108 | 'content_type' => $content_type, |
109 | - ), $this->template ); |
|
109 | + ), $this->template); |
|
110 | 110 | |
111 | 111 | // Set recipient |
112 | - if( $this->commenter->user_login == $original_sender ) { |
|
113 | - $this->recipient = stripslashes( $this->original_receiver->user_email ); |
|
112 | + if ($this->commenter->user_login == $original_sender) { |
|
113 | + $this->recipient = stripslashes($this->original_receiver->user_email); |
|
114 | 114 | } else { |
115 | - $this->recipient = stripslashes( $this->original_sender->user_email ); |
|
115 | + $this->recipient = stripslashes($this->original_sender->user_email); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | // Send mail |
119 | - Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) ); |
|
119 | + Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template)); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 |