@@ -42,22 +42,22 @@ discard block |
||
42 | 42 | * @access public |
43 | 43 | * @return void |
44 | 44 | */ |
45 | - function __construct( $file ) { |
|
45 | + function __construct($file) { |
|
46 | 46 | |
47 | 47 | $this->init(); |
48 | 48 | |
49 | 49 | // Hooks for sending emails during Sensei events |
50 | - add_action( 'sensei_user_quiz_grade', array( $this, 'learner_graded_quiz' ), 10, 4 ); |
|
51 | - add_action( 'sensei_course_status_updated', array( $this, 'learner_completed_course' ), 10, 4 ); |
|
52 | - add_action( 'sensei_course_status_updated', array( $this, 'teacher_completed_course' ), 10, 4 ); |
|
53 | - add_action( 'sensei_user_course_start', array( $this, 'teacher_started_course' ), 10, 2 ); |
|
54 | - add_action( 'sensei_user_lesson_end', array( $this, 'teacher_completed_lesson' ), 10, 2 ); |
|
55 | - add_action( 'sensei_user_quiz_submitted', array( $this, 'teacher_quiz_submitted' ), 10, 5 ); |
|
56 | - add_action( 'sensei_new_private_message', array( $this, 'teacher_new_message' ), 10, 1 ); |
|
57 | - add_action( 'sensei_private_message_reply', array( $this, 'new_message_reply' ), 10, 2 ); |
|
50 | + add_action('sensei_user_quiz_grade', array($this, 'learner_graded_quiz'), 10, 4); |
|
51 | + add_action('sensei_course_status_updated', array($this, 'learner_completed_course'), 10, 4); |
|
52 | + add_action('sensei_course_status_updated', array($this, 'teacher_completed_course'), 10, 4); |
|
53 | + add_action('sensei_user_course_start', array($this, 'teacher_started_course'), 10, 2); |
|
54 | + add_action('sensei_user_lesson_end', array($this, 'teacher_completed_lesson'), 10, 2); |
|
55 | + add_action('sensei_user_quiz_submitted', array($this, 'teacher_quiz_submitted'), 10, 5); |
|
56 | + add_action('sensei_new_private_message', array($this, 'teacher_new_message'), 10, 1); |
|
57 | + add_action('sensei_private_message_reply', array($this, 'new_message_reply'), 10, 2); |
|
58 | 58 | |
59 | 59 | // Let 3rd parties unhook the above via this hook |
60 | - do_action( 'sensei_emails', $this ); |
|
60 | + do_action('sensei_emails', $this); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -65,15 +65,15 @@ discard block |
||
65 | 65 | */ |
66 | 66 | function init() { |
67 | 67 | |
68 | - $this->emails['learner-graded-quiz'] = include( 'emails/class-woothemes-sensei-email-learner-graded-quiz.php' ); |
|
69 | - $this->emails['learner-completed-course'] = include( 'emails/class-woothemes-sensei-email-learner-completed-course.php' ); |
|
70 | - $this->emails['teacher-completed-course'] = include( 'emails/class-woothemes-sensei-email-teacher-completed-course.php' ); |
|
71 | - $this->emails['teacher-started-course'] = include( 'emails/class-woothemes-sensei-email-teacher-started-course.php' ); |
|
72 | - $this->emails['teacher-completed-lesson'] = include( 'emails/class-woothemes-sensei-email-teacher-completed-lesson.php' ); |
|
73 | - $this->emails['teacher-quiz-submitted'] = include( 'emails/class-woothemes-sensei-email-teacher-quiz-submitted.php' ); |
|
74 | - $this->emails['teacher-new-message'] = include( 'emails/class-woothemes-sensei-email-teacher-new-message.php' ); |
|
75 | - $this->emails['new-message-reply'] = include( 'emails/class-woothemes-sensei-email-new-message-reply.php' ); |
|
76 | - $this->emails = apply_filters( 'sensei_email_classes', $this->emails ); |
|
68 | + $this->emails['learner-graded-quiz'] = include('emails/class-woothemes-sensei-email-learner-graded-quiz.php'); |
|
69 | + $this->emails['learner-completed-course'] = include('emails/class-woothemes-sensei-email-learner-completed-course.php'); |
|
70 | + $this->emails['teacher-completed-course'] = include('emails/class-woothemes-sensei-email-teacher-completed-course.php'); |
|
71 | + $this->emails['teacher-started-course'] = include('emails/class-woothemes-sensei-email-teacher-started-course.php'); |
|
72 | + $this->emails['teacher-completed-lesson'] = include('emails/class-woothemes-sensei-email-teacher-completed-lesson.php'); |
|
73 | + $this->emails['teacher-quiz-submitted'] = include('emails/class-woothemes-sensei-email-teacher-quiz-submitted.php'); |
|
74 | + $this->emails['teacher-new-message'] = include('emails/class-woothemes-sensei-email-teacher-new-message.php'); |
|
75 | + $this->emails['new-message-reply'] = include('emails/class-woothemes-sensei-email-new-message-reply.php'); |
|
76 | + $this->emails = apply_filters('sensei_email_classes', $this->emails); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | function get_from_name() { |
96 | 96 | |
97 | 97 | |
98 | - if ( ! $this->_from_name ) { |
|
99 | - if( isset( Sensei()->settings->settings['email_from_name'] ) && '' != Sensei()->settings->settings['email_from_name'] ) { |
|
98 | + if ( ! $this->_from_name) { |
|
99 | + if (isset(Sensei()->settings->settings['email_from_name']) && '' != Sensei()->settings->settings['email_from_name']) { |
|
100 | 100 | $this->_from_name = Sensei()->settings->settings['email_from_name']; |
101 | 101 | } else { |
102 | - $this->_from_name = get_bloginfo( 'name' ); |
|
102 | + $this->_from_name = get_bloginfo('name'); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | - return wp_specialchars_decode( $this->_from_name ); |
|
106 | + return wp_specialchars_decode($this->_from_name); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | function get_from_address() { |
116 | 116 | |
117 | 117 | |
118 | - if ( ! $this->_from_address ) { |
|
119 | - if( isset( Sensei()->settings->settings['email_from_address'] ) && '' != Sensei()->settings->settings['email_from_address'] ) { |
|
118 | + if ( ! $this->_from_address) { |
|
119 | + if (isset(Sensei()->settings->settings['email_from_address']) && '' != Sensei()->settings->settings['email_from_address']) { |
|
120 | 120 | $this->_from_address = Sensei()->settings->settings['email_from_address']; |
121 | 121 | } else { |
122 | - $this->_from_address = get_bloginfo( 'admin_email' ); |
|
122 | + $this->_from_address = get_bloginfo('admin_email'); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | * @param mixed $content |
144 | 144 | * @return string |
145 | 145 | */ |
146 | - function wrap_message( $content ) { |
|
146 | + function wrap_message($content) { |
|
147 | 147 | |
148 | 148 | $html = ''; |
149 | 149 | |
150 | - $html .= $this->load_template( 'header' ); |
|
151 | - $html .= wpautop( wptexturize( $content ) ); |
|
152 | - $html .= $this->load_template( 'footer' ); |
|
150 | + $html .= $this->load_template('header'); |
|
151 | + $html .= wpautop(wptexturize($content)); |
|
152 | + $html .= $this->load_template('footer'); |
|
153 | 153 | |
154 | 154 | return $html; |
155 | 155 | } |
@@ -166,16 +166,16 @@ discard block |
||
166 | 166 | * @param string $content_type (default: "text/html") |
167 | 167 | * @return void |
168 | 168 | */ |
169 | - function send( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "", $content_type = 'text/html' ) { |
|
169 | + function send($to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "", $content_type = 'text/html') { |
|
170 | 170 | global $email_template; |
171 | 171 | |
172 | 172 | // Set content type |
173 | 173 | $this->_content_type = $content_type; |
174 | 174 | |
175 | 175 | // Filters for the email |
176 | - add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
177 | - add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
178 | - add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
176 | + add_filter('wp_mail_from', array($this, 'get_from_address')); |
|
177 | + add_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
178 | + add_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
179 | 179 | |
180 | 180 | // Send |
181 | 181 | $send_email = true; |
@@ -186,40 +186,40 @@ discard block |
||
186 | 186 | * @since 1.8.0 |
187 | 187 | * @param bool $send_email default true |
188 | 188 | */ |
189 | - if( apply_filters('sensei_send_emails', $send_email,$to, $subject, $message ) ){ |
|
189 | + if (apply_filters('sensei_send_emails', $send_email, $to, $subject, $message)) { |
|
190 | 190 | |
191 | - wp_mail( $to, $subject, $message, $headers, $attachments ); |
|
191 | + wp_mail($to, $subject, $message, $headers, $attachments); |
|
192 | 192 | |
193 | 193 | } |
194 | 194 | |
195 | 195 | // Unhook filters |
196 | - remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
197 | - remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
198 | - remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
196 | + remove_filter('wp_mail_from', array($this, 'get_from_address')); |
|
197 | + remove_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
198 | + remove_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
199 | 199 | } |
200 | 200 | |
201 | - function get_content( $email_template ) { |
|
201 | + function get_content($email_template) { |
|
202 | 202 | |
203 | - $message = $this->load_template( $email_template ); |
|
203 | + $message = $this->load_template($email_template); |
|
204 | 204 | |
205 | - $html = $this->wrap_message( $message ); |
|
205 | + $html = $this->wrap_message($message); |
|
206 | 206 | |
207 | - return apply_filters( 'sensei_email', $html, $email_template ); |
|
207 | + return apply_filters('sensei_email', $html, $email_template); |
|
208 | 208 | } |
209 | 209 | |
210 | - function load_template( $template = '' ) { |
|
210 | + function load_template($template = '') { |
|
211 | 211 | global $email_template; |
212 | 212 | |
213 | - if( ! $template ) return; |
|
213 | + if ( ! $template) return; |
|
214 | 214 | |
215 | - $email_template = $template . '.php'; |
|
216 | - $template = Sensei_Templates::template_loader( '' ); |
|
215 | + $email_template = $template.'.php'; |
|
216 | + $template = Sensei_Templates::template_loader(''); |
|
217 | 217 | |
218 | 218 | ob_start(); |
219 | 219 | |
220 | - do_action( 'sensei_before_email_template', $email_template ); |
|
221 | - include( $template ); |
|
222 | - do_action( 'sensei_after_email_template', $email_template ); |
|
220 | + do_action('sensei_before_email_template', $email_template); |
|
221 | + include($template); |
|
222 | + do_action('sensei_after_email_template', $email_template); |
|
223 | 223 | |
224 | 224 | return ob_get_clean(); |
225 | 225 | } |
@@ -230,22 +230,22 @@ discard block |
||
230 | 230 | * @access public |
231 | 231 | * @return void |
232 | 232 | */ |
233 | - function learner_graded_quiz( $user_id, $quiz_id, $grade, $passmark ) { |
|
233 | + function learner_graded_quiz($user_id, $quiz_id, $grade, $passmark) { |
|
234 | 234 | |
235 | 235 | |
236 | 236 | $send = false; |
237 | 237 | |
238 | - if( isset( Sensei()->settings->settings['email_learners'] ) ) { |
|
239 | - if( in_array( 'learner-graded-quiz', (array) Sensei()->settings->settings['email_learners'] ) ) { |
|
238 | + if (isset(Sensei()->settings->settings['email_learners'])) { |
|
239 | + if (in_array('learner-graded-quiz', (array) Sensei()->settings->settings['email_learners'])) { |
|
240 | 240 | $send = true; |
241 | 241 | } |
242 | 242 | } else { |
243 | 243 | $send = true; |
244 | 244 | } |
245 | 245 | |
246 | - if( $send ) { |
|
246 | + if ($send) { |
|
247 | 247 | $email = $this->emails['learner-graded-quiz']; |
248 | - $email->trigger( $user_id, $quiz_id, $grade, $passmark ); |
|
248 | + $email->trigger($user_id, $quiz_id, $grade, $passmark); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
@@ -255,26 +255,26 @@ discard block |
||
255 | 255 | * @access public |
256 | 256 | * @return void |
257 | 257 | */ |
258 | - function learner_completed_course( $status = 'in-progress', $user_id = 0, $course_id = 0, $comment_id = 0 ) { |
|
258 | + function learner_completed_course($status = 'in-progress', $user_id = 0, $course_id = 0, $comment_id = 0) { |
|
259 | 259 | |
260 | 260 | |
261 | - if( 'complete' != $status ) { |
|
261 | + if ('complete' != $status) { |
|
262 | 262 | return; |
263 | 263 | } |
264 | 264 | |
265 | 265 | $send = false; |
266 | 266 | |
267 | - if( isset( Sensei()->settings->settings['email_learners'] ) ) { |
|
268 | - if( in_array( 'learner-completed-course', (array) Sensei()->settings->settings['email_learners'] ) ) { |
|
267 | + if (isset(Sensei()->settings->settings['email_learners'])) { |
|
268 | + if (in_array('learner-completed-course', (array) Sensei()->settings->settings['email_learners'])) { |
|
269 | 269 | $send = true; |
270 | 270 | } |
271 | 271 | } else { |
272 | 272 | $send = true; |
273 | 273 | } |
274 | 274 | |
275 | - if( $send ) { |
|
275 | + if ($send) { |
|
276 | 276 | $email = $this->emails['learner-completed-course']; |
277 | - $email->trigger( $user_id, $course_id ); |
|
277 | + $email->trigger($user_id, $course_id); |
|
278 | 278 | } |
279 | 279 | } |
280 | 280 | |
@@ -284,26 +284,26 @@ discard block |
||
284 | 284 | * @access public |
285 | 285 | * @return void |
286 | 286 | */ |
287 | - function teacher_completed_course( $status = 'in-progress', $learner_id = 0, $course_id = 0, $comment_id = 0 ) { |
|
287 | + function teacher_completed_course($status = 'in-progress', $learner_id = 0, $course_id = 0, $comment_id = 0) { |
|
288 | 288 | |
289 | 289 | |
290 | - if( 'complete' != $status ) { |
|
290 | + if ('complete' != $status) { |
|
291 | 291 | return; |
292 | 292 | } |
293 | 293 | |
294 | 294 | $send = false; |
295 | 295 | |
296 | - if( isset( Sensei()->settings->settings['email_teachers'] ) ) { |
|
297 | - if( in_array( 'teacher-completed-course', (array) Sensei()->settings->settings['email_teachers'] ) ) { |
|
296 | + if (isset(Sensei()->settings->settings['email_teachers'])) { |
|
297 | + if (in_array('teacher-completed-course', (array) Sensei()->settings->settings['email_teachers'])) { |
|
298 | 298 | $send = true; |
299 | 299 | } |
300 | 300 | } else { |
301 | 301 | $send = true; |
302 | 302 | } |
303 | 303 | |
304 | - if( $send ) { |
|
304 | + if ($send) { |
|
305 | 305 | $email = $this->emails['teacher-completed-course']; |
306 | - $email->trigger( $learner_id, $course_id ); |
|
306 | + $email->trigger($learner_id, $course_id); |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
@@ -313,22 +313,22 @@ discard block |
||
313 | 313 | * @access public |
314 | 314 | * @return void |
315 | 315 | */ |
316 | - function teacher_started_course( $learner_id = 0, $course_id = 0 ) { |
|
316 | + function teacher_started_course($learner_id = 0, $course_id = 0) { |
|
317 | 317 | |
318 | 318 | |
319 | 319 | $send = false; |
320 | 320 | |
321 | - if( isset( Sensei()->settings->settings['email_teachers'] ) ) { |
|
322 | - if( in_array( 'teacher-started-course', (array) Sensei()->settings->settings['email_teachers'] ) ) { |
|
321 | + if (isset(Sensei()->settings->settings['email_teachers'])) { |
|
322 | + if (in_array('teacher-started-course', (array) Sensei()->settings->settings['email_teachers'])) { |
|
323 | 323 | $send = true; |
324 | 324 | } |
325 | 325 | } else { |
326 | 326 | $send = true; |
327 | 327 | } |
328 | 328 | |
329 | - if( $send ) { |
|
329 | + if ($send) { |
|
330 | 330 | $email = $this->emails['teacher-started-course']; |
331 | - $email->trigger( $learner_id, $course_id ); |
|
331 | + $email->trigger($learner_id, $course_id); |
|
332 | 332 | } |
333 | 333 | } |
334 | 334 | |
@@ -341,22 +341,22 @@ discard block |
||
341 | 341 | * @return void |
342 | 342 | * @since 1.9.0 |
343 | 343 | */ |
344 | - function teacher_completed_lesson( $learner_id = 0, $lesson_id = 0 ) { |
|
344 | + function teacher_completed_lesson($learner_id = 0, $lesson_id = 0) { |
|
345 | 345 | |
346 | 346 | |
347 | 347 | $send = false; |
348 | 348 | |
349 | - if( isset( Sensei()->settings->settings[ 'email_teachers' ] ) ) { |
|
350 | - if( in_array( 'teacher-completed-lesson', (array) Sensei()->settings->settings[ 'email_teachers' ]) ) { |
|
349 | + if (isset(Sensei()->settings->settings['email_teachers'])) { |
|
350 | + if (in_array('teacher-completed-lesson', (array) Sensei()->settings->settings['email_teachers'])) { |
|
351 | 351 | $send = true; |
352 | 352 | } |
353 | 353 | } else { |
354 | 354 | $send = true; |
355 | 355 | } |
356 | 356 | |
357 | - if( $send ) { |
|
357 | + if ($send) { |
|
358 | 358 | $email = $this->emails['teacher-completed-lesson']; |
359 | - $email->trigger( $learner_id, $lesson_id ); |
|
359 | + $email->trigger($learner_id, $lesson_id); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | |
@@ -366,25 +366,25 @@ discard block |
||
366 | 366 | * @access public |
367 | 367 | * @return void |
368 | 368 | */ |
369 | - function teacher_quiz_submitted( $learner_id = 0, $quiz_id = 0, $grade = 0, $passmark = 0, $quiz_grade_type = 'manual' ) { |
|
369 | + function teacher_quiz_submitted($learner_id = 0, $quiz_id = 0, $grade = 0, $passmark = 0, $quiz_grade_type = 'manual') { |
|
370 | 370 | |
371 | 371 | |
372 | 372 | |
373 | 373 | $send = false; |
374 | 374 | |
375 | 375 | // Only trigger if the quiz was marked as manual grading, or auto grading didn't complete |
376 | - if( 'manual' == $quiz_grade_type || is_wp_error( $grade ) ) { |
|
377 | - if( isset( Sensei()->settings->settings['email_teachers'] ) ) { |
|
378 | - if( in_array( 'teacher-quiz-submitted', (array) Sensei()->settings->settings['email_teachers'] ) ) { |
|
376 | + if ('manual' == $quiz_grade_type || is_wp_error($grade)) { |
|
377 | + if (isset(Sensei()->settings->settings['email_teachers'])) { |
|
378 | + if (in_array('teacher-quiz-submitted', (array) Sensei()->settings->settings['email_teachers'])) { |
|
379 | 379 | $send = true; |
380 | 380 | } |
381 | 381 | } else { |
382 | 382 | $send = true; |
383 | 383 | } |
384 | 384 | |
385 | - if( $send ) { |
|
385 | + if ($send) { |
|
386 | 386 | $email = $this->emails['teacher-quiz-submitted']; |
387 | - $email->trigger( $learner_id, $quiz_id ); |
|
387 | + $email->trigger($learner_id, $quiz_id); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | } |
@@ -396,22 +396,22 @@ discard block |
||
396 | 396 | * @access public |
397 | 397 | * @return void |
398 | 398 | */ |
399 | - function teacher_new_message( $message_id = 0 ) { |
|
399 | + function teacher_new_message($message_id = 0) { |
|
400 | 400 | |
401 | 401 | |
402 | 402 | $send = false; |
403 | 403 | |
404 | - if( isset( Sensei()->settings->settings['email_teachers'] ) ) { |
|
405 | - if( in_array( 'teacher-new-message', (array) Sensei()->settings->settings['email_teachers'] ) ) { |
|
404 | + if (isset(Sensei()->settings->settings['email_teachers'])) { |
|
405 | + if (in_array('teacher-new-message', (array) Sensei()->settings->settings['email_teachers'])) { |
|
406 | 406 | $send = true; |
407 | 407 | } |
408 | 408 | } else { |
409 | 409 | $send = true; |
410 | 410 | } |
411 | 411 | |
412 | - if( $send ) { |
|
412 | + if ($send) { |
|
413 | 413 | $email = $this->emails['teacher-new-message']; |
414 | - $email->trigger( $message_id ); |
|
414 | + $email->trigger($message_id); |
|
415 | 415 | } |
416 | 416 | } |
417 | 417 | |
@@ -421,22 +421,22 @@ discard block |
||
421 | 421 | * @access public |
422 | 422 | * @return void |
423 | 423 | */ |
424 | - function new_message_reply( $comment, $message ) { |
|
424 | + function new_message_reply($comment, $message) { |
|
425 | 425 | |
426 | 426 | |
427 | 427 | $send = false; |
428 | 428 | |
429 | - if( isset( Sensei()->settings->settings['email_global'] ) ) { |
|
430 | - if( in_array( 'new-message-reply', (array) Sensei()->settings->settings['email_global'] ) ) { |
|
429 | + if (isset(Sensei()->settings->settings['email_global'])) { |
|
430 | + if (in_array('new-message-reply', (array) Sensei()->settings->settings['email_global'])) { |
|
431 | 431 | $send = true; |
432 | 432 | } |
433 | 433 | } else { |
434 | 434 | $send = true; |
435 | 435 | } |
436 | 436 | |
437 | - if( $send ) { |
|
437 | + if ($send) { |
|
438 | 438 | $email = $this->emails['new-message-reply']; |
439 | - $email->trigger( $comment, $message ); |
|
439 | + $email->trigger($comment, $message); |
|
440 | 440 | } |
441 | 441 | } |
442 | 442 | |
@@ -447,4 +447,4 @@ discard block |
||
447 | 447 | * for backward compatibility |
448 | 448 | * @since 1.9.0 |
449 | 449 | */ |
450 | -class WooThemes_Sensei_Emails extends Sensei_Emails{} |
|
450 | +class WooThemes_Sensei_Emails extends Sensei_Emails {} |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
3 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
4 | 4 | |
5 | -if ( ! class_exists( 'WooThemes_Sensei_Email_Teacher_Completed_Lesson' ) ) : |
|
5 | +if ( ! class_exists('WooThemes_Sensei_Email_Teacher_Completed_Lesson')) : |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Teacher Completed Lesson |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function __construct() { |
33 | 33 | $this->template = 'teacher-completed-lesson'; |
34 | - $this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] Your student has completed a lesson', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template ); |
|
35 | - $this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has completed a lesson', 'woothemes-sensei' ), $this->template ); |
|
34 | + $this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] Your student has completed a lesson', 'woothemes-sensei'), get_bloginfo('name')), $this->template); |
|
35 | + $this->heading = apply_filters('sensei_email_heading', __('Your student has completed a lesson', 'woothemes-sensei'), $this->template); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -41,31 +41,31 @@ discard block |
||
41 | 41 | * @access public |
42 | 42 | * @return void |
43 | 43 | */ |
44 | - function trigger( $learner_id = 0, $lesson_id = 0 ) { |
|
44 | + function trigger($learner_id = 0, $lesson_id = 0) { |
|
45 | 45 | global $sensei_email_data; |
46 | 46 | |
47 | 47 | // Get learner user object |
48 | - $this->learner = new WP_User( $learner_id ); |
|
48 | + $this->learner = new WP_User($learner_id); |
|
49 | 49 | |
50 | 50 | // Get teacher ID and user object |
51 | - $teacher_id = get_post_field( 'post_author', $lesson_id, 'raw' ); |
|
52 | - $this->teacher = new WP_User( $teacher_id ); |
|
51 | + $teacher_id = get_post_field('post_author', $lesson_id, 'raw'); |
|
52 | + $this->teacher = new WP_User($teacher_id); |
|
53 | 53 | |
54 | 54 | // Construct data array |
55 | - $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
55 | + $sensei_email_data = apply_filters('sensei_email_data', array( |
|
56 | 56 | 'template' => $this->template, |
57 | 57 | 'heading' => $this->heading, |
58 | 58 | 'teacher_id' => $teacher_id, |
59 | 59 | 'learner_id' => $learner_id, |
60 | 60 | 'learner_name' => $this->learner->display_name, |
61 | 61 | 'lesson_id' => $lesson_id, |
62 | - ), $this->template ); |
|
62 | + ), $this->template); |
|
63 | 63 | |
64 | 64 | // Set recipient (teacher) |
65 | - $this->recipient = stripslashes( $this->teacher->user_email ); |
|
65 | + $this->recipient = stripslashes($this->teacher->user_email); |
|
66 | 66 | |
67 | 67 | // Send mail |
68 | - Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) ); |
|
68 | + Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template)); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
3 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
4 | 4 | |
5 | -if ( ! class_exists( 'WooThemes_Sensei_Email_Teacher_Quiz_Submitted' ) ) : |
|
5 | +if ( ! class_exists('WooThemes_Sensei_Email_Teacher_Quiz_Submitted')) : |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Teacher Quiz Submitted |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function __construct() { |
33 | 33 | $this->template = 'teacher-quiz-submitted'; |
34 | - $this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] Your student has submitted a quiz for grading', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template ); |
|
35 | - $this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has submitted a quiz for grading', 'woothemes-sensei' ), $this->template ); |
|
34 | + $this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] Your student has submitted a quiz for grading', 'woothemes-sensei'), get_bloginfo('name')), $this->template); |
|
35 | + $this->heading = apply_filters('sensei_email_heading', __('Your student has submitted a quiz for grading', 'woothemes-sensei'), $this->template); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | * @access public |
42 | 42 | * @return void |
43 | 43 | */ |
44 | - function trigger( $learner_id = 0, $quiz_id = 0 ) { |
|
44 | + function trigger($learner_id = 0, $quiz_id = 0) { |
|
45 | 45 | global $sensei_email_data; |
46 | 46 | |
47 | 47 | // Get learner user object |
48 | - $this->learner = new WP_User( $learner_id ); |
|
48 | + $this->learner = new WP_User($learner_id); |
|
49 | 49 | |
50 | 50 | // Get teacher ID and user object |
51 | - $lesson_id = get_post_meta( $quiz_id, '_quiz_lesson', true ); |
|
52 | - $course_id = get_post_meta( $lesson_id, '_lesson_course', true ); |
|
53 | - $teacher_id = get_post_field( 'post_author', $course_id, 'raw' ); |
|
54 | - $this->teacher = new WP_User( $teacher_id ); |
|
51 | + $lesson_id = get_post_meta($quiz_id, '_quiz_lesson', true); |
|
52 | + $course_id = get_post_meta($lesson_id, '_lesson_course', true); |
|
53 | + $teacher_id = get_post_field('post_author', $course_id, 'raw'); |
|
54 | + $this->teacher = new WP_User($teacher_id); |
|
55 | 55 | |
56 | 56 | // Construct data array |
57 | - $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
57 | + $sensei_email_data = apply_filters('sensei_email_data', array( |
|
58 | 58 | 'template' => $this->template, |
59 | 59 | 'heading' => $this->heading, |
60 | 60 | 'teacher_id' => $teacher_id, |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | 'learner_name' => $this->learner->display_name, |
63 | 63 | 'quiz_id' => $quiz_id, |
64 | 64 | 'lesson_id' => $lesson_id, |
65 | - ), $this->template ); |
|
65 | + ), $this->template); |
|
66 | 66 | |
67 | 67 | // Set recipient (teacher) |
68 | - $this->recipient = stripslashes( $this->teacher->user_email ); |
|
68 | + $this->recipient = stripslashes($this->teacher->user_email); |
|
69 | 69 | |
70 | 70 | // Send mail |
71 | - Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) ); |
|
71 | + Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template)); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
3 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
4 | 4 | |
5 | -if ( ! class_exists( 'WooThemes_Sensei_Email_Teacher_New_Message' ) ) : |
|
5 | +if ( ! class_exists('WooThemes_Sensei_Email_Teacher_New_Message')) : |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Teacher New Message |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | */ |
33 | 33 | function __construct() { |
34 | 34 | $this->template = 'teacher-new-message'; |
35 | - $this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] You have received a new private message', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template ); |
|
36 | - $this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has sent you a private message', 'woothemes-sensei' ), $this->template ); |
|
35 | + $this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] You have received a new private message', 'woothemes-sensei'), get_bloginfo('name')), $this->template); |
|
36 | + $this->heading = apply_filters('sensei_email_heading', __('Your student has sent you a private message', 'woothemes-sensei'), $this->template); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -42,29 +42,29 @@ discard block |
||
42 | 42 | * @access public |
43 | 43 | * @return void |
44 | 44 | */ |
45 | - function trigger( $message_id = 0 ) { |
|
45 | + function trigger($message_id = 0) { |
|
46 | 46 | global $sensei_email_data; |
47 | 47 | |
48 | - $this->message = get_post( $message_id ); |
|
48 | + $this->message = get_post($message_id); |
|
49 | 49 | |
50 | - $learner_username = get_post_meta( $message_id, '_sender', true ); |
|
51 | - $this->learner = get_user_by( 'login', $learner_username ); |
|
50 | + $learner_username = get_post_meta($message_id, '_sender', true); |
|
51 | + $this->learner = get_user_by('login', $learner_username); |
|
52 | 52 | |
53 | - $teacher_username = get_post_meta( $message_id, '_receiver', true ); |
|
54 | - $this->teacher = get_user_by( 'login', $teacher_username ); |
|
53 | + $teacher_username = get_post_meta($message_id, '_receiver', true); |
|
54 | + $this->teacher = get_user_by('login', $teacher_username); |
|
55 | 55 | |
56 | - $content_type = get_post_meta( $message_id, '_posttype', true ); |
|
57 | - $content_id = get_post_meta( $message_id, '_post', true ); |
|
58 | - $content_title = get_the_title( $content_id ); |
|
56 | + $content_type = get_post_meta($message_id, '_posttype', true); |
|
57 | + $content_id = get_post_meta($message_id, '_post', true); |
|
58 | + $content_title = get_the_title($content_id); |
|
59 | 59 | |
60 | 60 | // setup the post type parameter |
61 | - $content_type = get_post_type( $content_id ); |
|
62 | - if( !$content_type ){ |
|
63 | - $content_type =''; |
|
61 | + $content_type = get_post_type($content_id); |
|
62 | + if ( ! $content_type) { |
|
63 | + $content_type = ''; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | // Construct data array |
67 | - $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
67 | + $sensei_email_data = apply_filters('sensei_email_data', array( |
|
68 | 68 | 'template' => $this->template, |
69 | 69 | $content_type.'_id' => $content_id, |
70 | 70 | 'heading' => $this->heading, |
@@ -75,15 +75,15 @@ discard block |
||
75 | 75 | 'message' => $this->message->post_content, |
76 | 76 | 'content_title' => $content_title, |
77 | 77 | 'content_type' => $content_type, |
78 | - ), $this->template ); |
|
78 | + ), $this->template); |
|
79 | 79 | |
80 | 80 | // Set recipient (teacher) |
81 | - $this->recipient = stripslashes( $this->teacher->user_email ); |
|
81 | + $this->recipient = stripslashes($this->teacher->user_email); |
|
82 | 82 | |
83 | 83 | // Send mail |
84 | - Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) ); |
|
84 | + Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template)); |
|
85 | 85 | |
86 | - wp_safe_redirect( esc_url_raw( add_query_arg( array( 'send' => 'complete' ) ) ) ); |
|
86 | + wp_safe_redirect(esc_url_raw(add_query_arg(array('send' => 'complete')))); |
|
87 | 87 | exit; |
88 | 88 | } |
89 | 89 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
3 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
4 | 4 | |
5 | -if ( ! class_exists( 'WooThemes_Sensei_Email_Teacher_Started_Course' ) ) : |
|
5 | +if ( ! class_exists('WooThemes_Sensei_Email_Teacher_Started_Course')) : |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Teacher Started Course |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function __construct() { |
33 | 33 | $this->template = 'teacher-started-course'; |
34 | - $this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] Your student has started a course', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template ); |
|
35 | - $this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has started a course', 'woothemes-sensei' ), $this->template ); |
|
34 | + $this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] Your student has started a course', 'woothemes-sensei'), get_bloginfo('name')), $this->template); |
|
35 | + $this->heading = apply_filters('sensei_email_heading', __('Your student has started a course', 'woothemes-sensei'), $this->template); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -41,31 +41,31 @@ discard block |
||
41 | 41 | * @access public |
42 | 42 | * @return void |
43 | 43 | */ |
44 | - function trigger( $learner_id = 0, $course_id = 0 ) { |
|
44 | + function trigger($learner_id = 0, $course_id = 0) { |
|
45 | 45 | global $sensei_email_data; |
46 | 46 | |
47 | 47 | // Get learner user object |
48 | - $this->learner = new WP_User( $learner_id ); |
|
48 | + $this->learner = new WP_User($learner_id); |
|
49 | 49 | |
50 | 50 | // Get teacher ID and user object |
51 | - $teacher_id = get_post_field( 'post_author', $course_id, 'raw' ); |
|
52 | - $this->teacher = new WP_User( $teacher_id ); |
|
51 | + $teacher_id = get_post_field('post_author', $course_id, 'raw'); |
|
52 | + $this->teacher = new WP_User($teacher_id); |
|
53 | 53 | |
54 | 54 | // Construct data array |
55 | - $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
55 | + $sensei_email_data = apply_filters('sensei_email_data', array( |
|
56 | 56 | 'template' => $this->template, |
57 | 57 | 'heading' => $this->heading, |
58 | 58 | 'teacher_id' => $teacher_id, |
59 | 59 | 'learner_id' => $learner_id, |
60 | 60 | 'learner_name' => $this->learner->display_name, |
61 | 61 | 'course_id' => $course_id, |
62 | - ), $this->template ); |
|
62 | + ), $this->template); |
|
63 | 63 | |
64 | 64 | // Set recipient (learner) |
65 | - $this->recipient = stripslashes( $this->teacher->user_email ); |
|
65 | + $this->recipient = stripslashes($this->teacher->user_email); |
|
66 | 66 | |
67 | 67 | // Send mail |
68 | - Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) ); |
|
68 | + Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template)); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @version 1.8.0 |
13 | 13 | */ |
14 | 14 | |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; // Exit if accessed directly |
17 | 17 | } |
18 | 18 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function __construct() { |
31 | 31 | |
32 | - add_action( 'admin_menu', array( $this, 'admin_menus') ); |
|
33 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
32 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
33 | + add_action('admin_head', array($this, 'admin_head')); |
|
34 | 34 | |
35 | 35 | } |
36 | 36 | |
@@ -40,23 +40,23 @@ discard block |
||
40 | 40 | * Hooked into activated_plugin |
41 | 41 | * @since 1.8.0 |
42 | 42 | */ |
43 | - public static function redirect( $plugin ) { |
|
43 | + public static function redirect($plugin) { |
|
44 | 44 | |
45 | 45 | // Bail if activating from network, or bulk, or within an iFrame |
46 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) ) { |
|
46 | + if (is_network_admin() || isset($_GET['activate-multi']) || defined('IFRAME_REQUEST')) { |
|
47 | 47 | |
48 | 48 | return; |
49 | 49 | |
50 | 50 | } |
51 | 51 | // don't run for upgrades and for pages already on the welcome screen |
52 | - if ( ( isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action'] ) |
|
53 | - || ( ! empty( $_GET['page'] ) && $_GET['page'] === 'sensei-welcome' ) ) { |
|
52 | + if ((isset($_GET['action']) && 'upgrade-plugin' == $_GET['action']) |
|
53 | + || ( ! empty($_GET['page']) && $_GET['page'] === 'sensei-welcome')) { |
|
54 | 54 | |
55 | 55 | return; |
56 | 56 | |
57 | 57 | } |
58 | 58 | |
59 | - wp_redirect( admin_url( 'index.php?page=sensei-welcome' ) ); |
|
59 | + wp_redirect(admin_url('index.php?page=sensei-welcome')); |
|
60 | 60 | exit; |
61 | 61 | } |
62 | 62 | |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function admin_menus() { |
69 | 69 | |
70 | - if ( ! isset( $_GET['page'] ) || 'sensei-welcome' != $_GET[ 'page' ] ) { |
|
70 | + if ( ! isset($_GET['page']) || 'sensei-welcome' != $_GET['page']) { |
|
71 | 71 | return; |
72 | 72 | } |
73 | 73 | |
74 | - $welcome_page_name = __( 'Sensei Activation', 'woothemes-sensei' ); |
|
75 | - $welcome_page_title = __( 'Welcome to Sensei', 'woothemes-sensei' ); |
|
76 | - add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'sensei-welcome', array( $this, 'welcome_screen' ) ); |
|
74 | + $welcome_page_name = __('Sensei Activation', 'woothemes-sensei'); |
|
75 | + $welcome_page_title = __('Welcome to Sensei', 'woothemes-sensei'); |
|
76 | + add_dashboard_page($welcome_page_title, $welcome_page_name, 'manage_options', 'sensei-welcome', array($this, 'welcome_screen')); |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | <hr /> |
133 | 133 | |
134 | 134 | <div class="return-to-dashboard"> |
135 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'woothemes-sensei-settings' ), 'admin.php' ) ) ); ?>"><?php _e( 'Go to Sensei Settings', 'woothemes-sensei' ); ?></a> |
|
135 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'woothemes-sensei-settings'), 'admin.php'))); ?>"><?php _e('Go to Sensei Settings', 'woothemes-sensei'); ?></a> |
|
136 | 136 | </div> |
137 | 137 | </div> |
138 | 138 | <?php |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function admin_head() { |
145 | 145 | // remove the menu page so it is not visible in the admin side bar |
146 | - remove_submenu_page( 'index.php', 'sensei-welcome' ); |
|
146 | + remove_submenu_page('index.php', 'sensei-welcome'); |
|
147 | 147 | ?> |
148 | 148 | <style type="text/css"> |
149 | 149 | /*<![CDATA[*/ |
@@ -262,47 +262,47 @@ discard block |
||
262 | 262 | private function intro() { |
263 | 263 | |
264 | 264 | // Drop minor version if 0 |
265 | - $major_version = substr( Sensei()->version, 0, 3 ); |
|
265 | + $major_version = substr(Sensei()->version, 0, 3); |
|
266 | 266 | |
267 | 267 | // Random tweet - must be kept to 102 chars to "fit" |
268 | 268 | $tweets = array( |
269 | 269 | 'I\'ve just installed Sensei - A premium Learning Management plugin for #WordPress.' |
270 | 270 | ); |
271 | - shuffle( $tweets ); |
|
271 | + shuffle($tweets); |
|
272 | 272 | ?> |
273 | - <h1><?php printf( __( 'Welcome to Sensei %s', 'woothemes-sensei' ), $major_version ); ?></h1> |
|
273 | + <h1><?php printf(__('Welcome to Sensei %s', 'woothemes-sensei'), $major_version); ?></h1> |
|
274 | 274 | |
275 | 275 | <div class="about-text sensei-about-text"> |
276 | 276 | <?php |
277 | - if ( ! empty( $_GET['sensei-installed'] ) ) { |
|
278 | - $message = __( 'Thanks, all done!', 'woothemes-sensei' ); |
|
279 | - } elseif ( ! empty( $_GET['sensei-updated'] ) ) { |
|
280 | - $message = __( 'Thank you for updating to the latest version!', 'woothemes-sensei' ); |
|
277 | + if ( ! empty($_GET['sensei-installed'])) { |
|
278 | + $message = __('Thanks, all done!', 'woothemes-sensei'); |
|
279 | + } elseif ( ! empty($_GET['sensei-updated'])) { |
|
280 | + $message = __('Thank you for updating to the latest version!', 'woothemes-sensei'); |
|
281 | 281 | } else { |
282 | - $message = __( 'Thanks for installing!', 'woothemes-sensei' ); |
|
282 | + $message = __('Thanks for installing!', 'woothemes-sensei'); |
|
283 | 283 | } |
284 | 284 | |
285 | - printf( __( '%s We hope you enjoy using Sensei %s.', 'woothemes-sensei' ), $message, $major_version ); |
|
285 | + printf(__('%s We hope you enjoy using Sensei %s.', 'woothemes-sensei'), $message, $major_version); |
|
286 | 286 | ?> |
287 | 287 | </div> |
288 | 288 | |
289 | 289 | <div class="sensei-badge"> |
290 | 290 | <?php |
291 | - _e('Sensei by WooThemes','woothemes-sensei'); |
|
291 | + _e('Sensei by WooThemes', 'woothemes-sensei'); |
|
292 | 292 | echo '<br />'; |
293 | 293 | |
294 | - printf( __( 'Version %s', 'woothemes-sensei' ), Sensei()->version ); |
|
294 | + printf(__('Version %s', 'woothemes-sensei'), Sensei()->version); |
|
295 | 295 | ?> |
296 | 296 | </div> |
297 | 297 | |
298 | 298 | <p class="sensei-actions"> |
299 | - <a href="<?php echo admin_url('admin.php?page=woothemes-sensei-settings'); ?>" class="button button-primary"><?php _e( 'Settings', 'woothemes-sensei' ); ?></a> |
|
300 | - <a href="<?php echo esc_url( apply_filters( 'sensei_docs_url', 'http://docs.woothemes.com/documentation/plugins/sensei/', 'woothemes-sensei' ) ); ?>" class="docs button button-primary"><?php _e( 'Docs', 'woothemes-sensei' ); ?></a> |
|
301 | - <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/products/sensei" data-text="<?php echo esc_attr( $tweets[0] ); ?>" data-via="WooThemes" data-size="large">Tweet</a> |
|
299 | + <a href="<?php echo admin_url('admin.php?page=woothemes-sensei-settings'); ?>" class="button button-primary"><?php _e('Settings', 'woothemes-sensei'); ?></a> |
|
300 | + <a href="<?php echo esc_url(apply_filters('sensei_docs_url', 'http://docs.woothemes.com/documentation/plugins/sensei/', 'woothemes-sensei')); ?>" class="docs button button-primary"><?php _e('Docs', 'woothemes-sensei'); ?></a> |
|
301 | + <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/products/sensei" data-text="<?php echo esc_attr($tweets[0]); ?>" data-via="WooThemes" data-size="large">Tweet</a> |
|
302 | 302 | <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> |
303 | 303 | </p> |
304 | 304 | |
305 | - <h2 > <?php _e( "What's New", 'woothemes-sensei' ); ?> </h2> |
|
305 | + <h2 > <?php _e("What's New", 'woothemes-sensei'); ?> </h2> |
|
306 | 306 | |
307 | 307 | <?php |
308 | 308 | } |
@@ -1,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 Messages Class |
@@ -21,61 +21,61 @@ discard block |
||
21 | 21 | * Constructor. |
22 | 22 | * @since 1.6.0 |
23 | 23 | */ |
24 | - public function __construct () { |
|
24 | + public function __construct() { |
|
25 | 25 | $this->post_type = 'sensei_message'; |
26 | - $this->meta_fields = array( 'sender', 'receiver' ); |
|
26 | + $this->meta_fields = array('sender', 'receiver'); |
|
27 | 27 | |
28 | 28 | // Add Messages page to admin menu |
29 | - add_action( 'admin_menu', array( $this, 'add_menu_item' ), 40 ); |
|
30 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10, 2 ); |
|
31 | - add_action( 'admin_menu', array( $this, 'remove_meta_box' ) ); |
|
29 | + add_action('admin_menu', array($this, 'add_menu_item'), 40); |
|
30 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 10, 2); |
|
31 | + add_action('admin_menu', array($this, 'remove_meta_box')); |
|
32 | 32 | |
33 | 33 | // Save new private message |
34 | - add_action( 'init', array( $this, 'save_new_message' ), 1 ); |
|
34 | + add_action('init', array($this, 'save_new_message'), 1); |
|
35 | 35 | |
36 | 36 | // Monitor when new reply is posted |
37 | - add_action( 'comment_post', array( $this, 'message_reply_received' ), 10, 1 ); |
|
37 | + add_action('comment_post', array($this, 'message_reply_received'), 10, 1); |
|
38 | 38 | |
39 | 39 | // Block WordPress from sending comment update emails for the messages post type |
40 | - add_filter('comment_notification_recipients', array( $this, 'stop_wp_comment_emails' ), 20, 2 ); |
|
40 | + add_filter('comment_notification_recipients', array($this, 'stop_wp_comment_emails'), 20, 2); |
|
41 | 41 | |
42 | 42 | // Block WordPress from sending comment moderator emails on the sensei messages post types |
43 | - add_filter('comment_moderation_recipients', array( $this, 'stop_wp_comment_emails' ), 20, 2 ); |
|
43 | + add_filter('comment_moderation_recipients', array($this, 'stop_wp_comment_emails'), 20, 2); |
|
44 | 44 | |
45 | 45 | // Process saving of message posts |
46 | - add_action( 'save_post', array( $this, 'save_message' ) ); |
|
46 | + add_action('save_post', array($this, 'save_message')); |
|
47 | 47 | |
48 | 48 | // Add message links to courses & lessons |
49 | - add_action( 'sensei_single_course_content_inside_before', array( $this, 'send_message_link' ), 35 ); |
|
49 | + add_action('sensei_single_course_content_inside_before', array($this, 'send_message_link'), 35); |
|
50 | 50 | |
51 | 51 | // add message link to lesson |
52 | - add_action( 'sensei_single_lesson_content_inside_before', array( $this, 'send_message_link' ), 30, 2 ); |
|
52 | + add_action('sensei_single_lesson_content_inside_before', array($this, 'send_message_link'), 30, 2); |
|
53 | 53 | |
54 | 54 | // add message link to lesson |
55 | - add_action( 'sensei_single_quiz_questions_before', array( $this, 'send_message_link' ), 10, 2 ); |
|
55 | + add_action('sensei_single_quiz_questions_before', array($this, 'send_message_link'), 10, 2); |
|
56 | 56 | |
57 | 57 | // Hide messages and replies from users who do not have access |
58 | - add_action( 'template_redirect', array( $this, 'message_login' ), 10, 1 ); |
|
59 | - add_action( 'pre_get_posts', array( $this, 'message_list' ), 10, 1 ); |
|
60 | - add_filter( 'the_title', array( $this, 'message_title' ), 10, 2 ); |
|
61 | - add_filter( 'the_content', array( $this, 'message_content' ), 10, 1 ); |
|
62 | - add_filter( 'comments_array', array( $this, 'message_replies' ), 100, 1 ); |
|
63 | - add_filter( 'get_comments_number', array( $this, 'message_reply_count' ), 100, 2 ); |
|
64 | - add_filter( 'comments_open', array( $this, 'message_replies_open' ), 100, 2 ); |
|
58 | + add_action('template_redirect', array($this, 'message_login'), 10, 1); |
|
59 | + add_action('pre_get_posts', array($this, 'message_list'), 10, 1); |
|
60 | + add_filter('the_title', array($this, 'message_title'), 10, 2); |
|
61 | + add_filter('the_content', array($this, 'message_content'), 10, 1); |
|
62 | + add_filter('comments_array', array($this, 'message_replies'), 100, 1); |
|
63 | + add_filter('get_comments_number', array($this, 'message_reply_count'), 100, 2); |
|
64 | + add_filter('comments_open', array($this, 'message_replies_open'), 100, 2); |
|
65 | 65 | } // End __construct() |
66 | 66 | |
67 | 67 | public function add_menu_item() { |
68 | 68 | |
69 | - if( ! isset( Sensei()->settings->settings['messages_disable'] ) || ! Sensei()->settings->settings['messages_disable'] ) { |
|
70 | - add_submenu_page( 'sensei', __( 'Messages', 'woothemes-sensei'), __( 'Messages', 'woothemes-sensei') , 'edit_courses', 'edit.php?post_type=sensei_message' ); |
|
69 | + if ( ! isset(Sensei()->settings->settings['messages_disable']) || ! Sensei()->settings->settings['messages_disable']) { |
|
70 | + add_submenu_page('sensei', __('Messages', 'woothemes-sensei'), __('Messages', 'woothemes-sensei'), 'edit_courses', 'edit.php?post_type=sensei_message'); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | - public function add_meta_box( $post_type, $post ) { |
|
74 | + public function add_meta_box($post_type, $post) { |
|
75 | 75 | |
76 | - if( ! $post_type == $this->post_type ) return; |
|
76 | + if ( ! $post_type == $this->post_type) return; |
|
77 | 77 | |
78 | - add_meta_box( $this->post_type . '-data', __( 'Message Information', 'woothemes-sensei' ), array( $this, 'meta_box_content' ), $this->post_type, 'normal', 'default' ); |
|
78 | + add_meta_box($this->post_type.'-data', __('Message Information', 'woothemes-sensei'), array($this, 'meta_box_content'), $this->post_type, 'normal', 'default'); |
|
79 | 79 | |
80 | 80 | } |
81 | 81 | |
@@ -85,25 +85,25 @@ discard block |
||
85 | 85 | $settings = array( |
86 | 86 | array( |
87 | 87 | 'id' => 'sender', |
88 | - 'label' => __( 'Message sent by:', 'woothemes-sensei' ), |
|
89 | - 'description' => __( 'The username of the learner who sent this message.', 'woothemes-sensei' ), |
|
88 | + 'label' => __('Message sent by:', 'woothemes-sensei'), |
|
89 | + 'description' => __('The username of the learner who sent this message.', 'woothemes-sensei'), |
|
90 | 90 | 'type' => 'text', |
91 | 91 | 'default' => '', |
92 | - 'placeholder' => __( 'Learner username', 'woothemes-sensei' ), |
|
92 | + 'placeholder' => __('Learner username', 'woothemes-sensei'), |
|
93 | 93 | ), |
94 | 94 | array( |
95 | 95 | 'id' => 'receiver', |
96 | - 'label' => __( 'Message received by:', 'woothemes-sensei' ), |
|
97 | - 'description' => __( 'The username of the teacher who received this message.', 'woothemes-sensei' ), |
|
96 | + 'label' => __('Message received by:', 'woothemes-sensei'), |
|
97 | + 'description' => __('The username of the teacher who received this message.', 'woothemes-sensei'), |
|
98 | 98 | 'type' => 'text', |
99 | 99 | 'default' => '', |
100 | - 'placeholder' => __( 'Teacher username', 'woothemes-sensei' ), |
|
100 | + 'placeholder' => __('Teacher username', 'woothemes-sensei'), |
|
101 | 101 | ), |
102 | 102 | ); |
103 | 103 | |
104 | - $message_posttype = get_post_meta( $post->ID, '_posttype', true ); |
|
104 | + $message_posttype = get_post_meta($post->ID, '_posttype', true); |
|
105 | 105 | |
106 | - if( isset( $message_posttype ) && $message_posttype ) { |
|
106 | + if (isset($message_posttype) && $message_posttype) { |
|
107 | 107 | |
108 | 108 | $args = array( |
109 | 109 | 'post_type' => $message_posttype, |
@@ -113,58 +113,58 @@ discard block |
||
113 | 113 | 'post_status' => 'publish', |
114 | 114 | ); |
115 | 115 | |
116 | - $posts = get_posts( $args ); |
|
116 | + $posts = get_posts($args); |
|
117 | 117 | |
118 | - $post_options[0] = sprintf( __( 'Select %1$s', 'woothemes-sensei' ), $message_posttype ); |
|
119 | - foreach( $posts as $post_item ) { |
|
120 | - $post_options[ $post_item->ID ] = $post_item->post_title; |
|
118 | + $post_options[0] = sprintf(__('Select %1$s', 'woothemes-sensei'), $message_posttype); |
|
119 | + foreach ($posts as $post_item) { |
|
120 | + $post_options[$post_item->ID] = $post_item->post_title; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $settings[] = array( |
124 | 124 | 'id' => 'post', |
125 | - 'label' => sprintf( __( 'Message from %1$s:', 'woothemes-sensei' ), $message_posttype ), |
|
126 | - 'description' => sprintf( __( 'The %1$s to which this message relates.', 'woothemes-sensei' ), $message_posttype ), |
|
125 | + 'label' => sprintf(__('Message from %1$s:', 'woothemes-sensei'), $message_posttype), |
|
126 | + 'description' => sprintf(__('The %1$s to which this message relates.', 'woothemes-sensei'), $message_posttype), |
|
127 | 127 | 'type' => 'select', |
128 | 128 | 'default' => 0, |
129 | 129 | 'options' => $post_options, |
130 | 130 | ); |
131 | 131 | } |
132 | 132 | |
133 | - $html = Sensei()->admin->render_settings( $settings, $post->ID, 'message-info' ); |
|
133 | + $html = Sensei()->admin->render_settings($settings, $post->ID, 'message-info'); |
|
134 | 134 | |
135 | 135 | echo $html; |
136 | 136 | } |
137 | 137 | |
138 | - public function save_message( $post_id = 0 ) { |
|
138 | + public function save_message($post_id = 0) { |
|
139 | 139 | global $post; |
140 | 140 | |
141 | - if( $this->post_type != get_post_type() ) return; |
|
141 | + if ($this->post_type != get_post_type()) return; |
|
142 | 142 | |
143 | - if( isset( $_POST['sender'] ) && $_POST['sender'] ) { |
|
144 | - update_post_meta( $post_id, '_sender', $_POST['sender'] ); |
|
143 | + if (isset($_POST['sender']) && $_POST['sender']) { |
|
144 | + update_post_meta($post_id, '_sender', $_POST['sender']); |
|
145 | 145 | } |
146 | 146 | |
147 | - if( isset( $_POST['receiver'] ) && $_POST['receiver'] ) { |
|
148 | - update_post_meta( $post_id, '_receiver', $_POST['receiver'] ); |
|
147 | + if (isset($_POST['receiver']) && $_POST['receiver']) { |
|
148 | + update_post_meta($post_id, '_receiver', $_POST['receiver']); |
|
149 | 149 | } |
150 | 150 | |
151 | - if( isset( $_POST['post'] ) && $_POST['post'] ) { |
|
152 | - update_post_meta( $post_id, '_post', $_POST['post'] ); |
|
151 | + if (isset($_POST['post']) && $_POST['post']) { |
|
152 | + update_post_meta($post_id, '_post', $_POST['post']); |
|
153 | 153 | } |
154 | 154 | |
155 | - remove_action( 'save_post', array( $this, 'save_message' ) ); |
|
155 | + remove_action('save_post', array($this, 'save_message')); |
|
156 | 156 | |
157 | - wp_update_post( array( 'ID' => $post_id, 'comment_status' => 'open' ) ); |
|
157 | + wp_update_post(array('ID' => $post_id, 'comment_status' => 'open')); |
|
158 | 158 | |
159 | - add_action( 'save_post', array( $this, 'save_message' ) ); |
|
159 | + add_action('save_post', array($this, 'save_message')); |
|
160 | 160 | } |
161 | 161 | |
162 | - public function send_message_link( $post_id = 0, $user_id = 0 ) { |
|
162 | + public function send_message_link($post_id = 0, $user_id = 0) { |
|
163 | 163 | global $post; |
164 | 164 | |
165 | 165 | // only show the link for the allowed post types: |
166 | 166 | $allowed_post_types = array('lesson', 'course', 'quiz'); |
167 | - if ( ! in_array( get_post_type() , $allowed_post_types ) ) { |
|
167 | + if ( ! in_array(get_post_type(), $allowed_post_types)) { |
|
168 | 168 | |
169 | 169 | return; |
170 | 170 | |
@@ -172,28 +172,28 @@ discard block |
||
172 | 172 | |
173 | 173 | $html = ''; |
174 | 174 | |
175 | - if( ! isset( Sensei()->settings->settings['messages_disable'] ) || ! Sensei()->settings->settings['messages_disable'] ) { |
|
175 | + if ( ! isset(Sensei()->settings->settings['messages_disable']) || ! Sensei()->settings->settings['messages_disable']) { |
|
176 | 176 | |
177 | - if( ! is_user_logged_in() ) return; |
|
177 | + if ( ! is_user_logged_in()) return; |
|
178 | 178 | |
179 | - if( isset( $_GET['contact'] ) ) { |
|
180 | - $html .= $this->teacher_contact_form( $post ); |
|
179 | + if (isset($_GET['contact'])) { |
|
180 | + $html .= $this->teacher_contact_form($post); |
|
181 | 181 | } else { |
182 | - $href = add_query_arg( array( 'contact' => $post->post_type ) ); |
|
183 | - |
|
184 | - if( 'lesson' == $post->post_type ) { |
|
185 | - $contact_button_text = __( 'Contact Lesson Teacher', 'woothemes-sensei' ); |
|
186 | - } elseif( 'course' == $post->post_type ) { |
|
187 | - $contact_button_text = __( 'Contact Course Teacher', 'woothemes-sensei' ); |
|
188 | - }else{ |
|
189 | - $contact_button_text = __( 'Contact Teacher', 'woothemes-sensei' ); |
|
182 | + $href = add_query_arg(array('contact' => $post->post_type)); |
|
183 | + |
|
184 | + if ('lesson' == $post->post_type) { |
|
185 | + $contact_button_text = __('Contact Lesson Teacher', 'woothemes-sensei'); |
|
186 | + } elseif ('course' == $post->post_type) { |
|
187 | + $contact_button_text = __('Contact Course Teacher', 'woothemes-sensei'); |
|
188 | + } else { |
|
189 | + $contact_button_text = __('Contact Teacher', 'woothemes-sensei'); |
|
190 | 190 | } |
191 | 191 | |
192 | - $html .= '<p><a class="button send-message-button" href="' . esc_url($href) . '#private_message">' . $contact_button_text . '</a></p>'; |
|
192 | + $html .= '<p><a class="button send-message-button" href="'.esc_url($href).'#private_message">'.$contact_button_text.'</a></p>'; |
|
193 | 193 | } |
194 | 194 | |
195 | - if( isset( $this->message_notice ) && isset( $this->message_notice['type'] ) && isset( $this->message_notice['notice'] ) ) { |
|
196 | - $html .= '<div class="sensei-message ' . $this->message_notice['type'] . '">' . $this->message_notice['notice'] . '</div>'; |
|
195 | + if (isset($this->message_notice) && isset($this->message_notice['type']) && isset($this->message_notice['notice'])) { |
|
196 | + $html .= '<div class="sensei-message '.$this->message_notice['type'].'">'.$this->message_notice['notice'].'</div>'; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | } |
@@ -201,40 +201,40 @@ discard block |
||
201 | 201 | echo $html; |
202 | 202 | } |
203 | 203 | |
204 | - public function teacher_contact_form( $post ) { |
|
204 | + public function teacher_contact_form($post) { |
|
205 | 205 | |
206 | - if( ! is_user_logged_in() ) return; |
|
206 | + if ( ! is_user_logged_in()) return; |
|
207 | 207 | |
208 | 208 | global $current_user; |
209 | 209 | wp_get_current_user(); |
210 | 210 | |
211 | 211 | $html = ''; |
212 | 212 | |
213 | - if( ! isset( $post->ID ) ) return $html; |
|
213 | + if ( ! isset($post->ID)) return $html; |
|
214 | 214 | |
215 | 215 | //confirm private message |
216 | 216 | $confirmation = ''; |
217 | - if( isset( $_GET[ 'send' ] ) && 'complete' == $_GET[ 'send' ] ) { |
|
217 | + if (isset($_GET['send']) && 'complete' == $_GET['send']) { |
|
218 | 218 | |
219 | 219 | $confirmation_message = __('Your private message has been sent.', 'woothemes-sensei'); |
220 | - $confirmation = '<div class="sensei-message tick">' . $confirmation_message . '</div>'; |
|
220 | + $confirmation = '<div class="sensei-message tick">'.$confirmation_message.'</div>'; |
|
221 | 221 | |
222 | 222 | } |
223 | 223 | |
224 | - $html .= '<h3 id="private_message">' . __( 'Send Private Message', 'woothemes-sensei' ) . '</h3>'; |
|
224 | + $html .= '<h3 id="private_message">'.__('Send Private Message', 'woothemes-sensei').'</h3>'; |
|
225 | 225 | $html .= '<p>'; |
226 | - $html .= $confirmation; |
|
226 | + $html .= $confirmation; |
|
227 | 227 | $html .= '</p>'; |
228 | 228 | $html .= '<form name="contact-teacher" action="" method="post" class="contact-teacher">'; |
229 | 229 | $html .= '<p class="form-row form-row-wide">'; |
230 | - $html .= '<textarea name="contact_message" placeholder="' . __( 'Enter your private message.', 'woothemes-sensei' ) . '"></textarea>'; |
|
230 | + $html .= '<textarea name="contact_message" placeholder="'.__('Enter your private message.', 'woothemes-sensei').'"></textarea>'; |
|
231 | 231 | $html .= '</p>'; |
232 | 232 | $html .= '<p class="form-row">'; |
233 | - $html .= '<input type="hidden" name="post_id" value="' . $post->ID . '" />'; |
|
234 | - $html .= '<input type="hidden" name="sender_id" value="' . $current_user->ID . '" />'; |
|
235 | - $html .= '<input type="hidden" name="receiver_id" value="' . $post->post_author . '" />'; |
|
236 | - $html .= wp_nonce_field( 'message_teacher', 'sensei_message_teacher_nonce', true, false ); |
|
237 | - $html .= '<input type="submit" class="send_message" value="' . __( 'Send Message', 'woothemes-sensei' ) . '" />'; |
|
233 | + $html .= '<input type="hidden" name="post_id" value="'.$post->ID.'" />'; |
|
234 | + $html .= '<input type="hidden" name="sender_id" value="'.$current_user->ID.'" />'; |
|
235 | + $html .= '<input type="hidden" name="receiver_id" value="'.$post->post_author.'" />'; |
|
236 | + $html .= wp_nonce_field('message_teacher', 'sensei_message_teacher_nonce', true, false); |
|
237 | + $html .= '<input type="submit" class="send_message" value="'.__('Send Message', 'woothemes-sensei').'" />'; |
|
238 | 238 | $html .= '</p>'; |
239 | 239 | $html .= '<div class="fix"></div>'; |
240 | 240 | $html .= '</form>'; |
@@ -244,30 +244,30 @@ discard block |
||
244 | 244 | |
245 | 245 | public function save_new_message() { |
246 | 246 | |
247 | - if( ! isset( $_POST['sensei_message_teacher_nonce'] ) ) return; |
|
247 | + if ( ! isset($_POST['sensei_message_teacher_nonce'])) return; |
|
248 | 248 | |
249 | - if( ! wp_verify_nonce( $_POST['sensei_message_teacher_nonce'], 'message_teacher' ) ) return; |
|
249 | + if ( ! wp_verify_nonce($_POST['sensei_message_teacher_nonce'], 'message_teacher')) return; |
|
250 | 250 | |
251 | - $message_id = $this->save_new_message_post( $_POST['sender_id'], $_POST['receiver_id'], $_POST['contact_message'], $_POST['post_id'] ); |
|
251 | + $message_id = $this->save_new_message_post($_POST['sender_id'], $_POST['receiver_id'], $_POST['contact_message'], $_POST['post_id']); |
|
252 | 252 | |
253 | 253 | } |
254 | 254 | |
255 | - public function message_reply_received( $comment_id = 0 ) { |
|
255 | + public function message_reply_received($comment_id = 0) { |
|
256 | 256 | |
257 | 257 | // Get comment object |
258 | - $comment = get_comment( $comment_id ); |
|
258 | + $comment = get_comment($comment_id); |
|
259 | 259 | |
260 | - if( is_null( $comment ) ) return; |
|
260 | + if (is_null($comment)) return; |
|
261 | 261 | |
262 | 262 | // Get message post object |
263 | - $message = get_post( $comment->comment_post_ID ); |
|
263 | + $message = get_post($comment->comment_post_ID); |
|
264 | 264 | |
265 | - if( $message->post_type != $this->post_type ) return; |
|
265 | + if ($message->post_type != $this->post_type) return; |
|
266 | 266 | |
267 | 267 | // Force comment to be approved |
268 | - wp_set_comment_status( $comment_id, 'approve' ); |
|
268 | + wp_set_comment_status($comment_id, 'approve'); |
|
269 | 269 | |
270 | - do_action( 'sensei_private_message_reply', $comment, $message ); |
|
270 | + do_action('sensei_private_message_reply', $comment, $message); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | * @param int $comment_id |
281 | 281 | * @return array; |
282 | 282 | */ |
283 | - public function stop_wp_comment_emails( $emails , $comment_id ){ |
|
283 | + public function stop_wp_comment_emails($emails, $comment_id) { |
|
284 | 284 | |
285 | - $comment = get_comment( $comment_id ); |
|
286 | - if( isset( $comment->comment_post_ID ) && |
|
287 | - 'sensei_message' == get_post_type( $comment->comment_post_ID ) ){ |
|
285 | + $comment = get_comment($comment_id); |
|
286 | + if (isset($comment->comment_post_ID) && |
|
287 | + 'sensei_message' == get_post_type($comment->comment_post_ID)) { |
|
288 | 288 | |
289 | 289 | // empty the emails array to ensure no emails are sent for this comment |
290 | 290 | $emails = array(); |
@@ -302,45 +302,45 @@ discard block |
||
302 | 302 | * @param string $post_id ID of post related to message |
303 | 303 | * @return mixed Message ID on success, boolean false on failure |
304 | 304 | */ |
305 | - private function save_new_message_post( $sender_id = 0, $receiver_id = 0, $message = '', $post_id = 0 ) { |
|
305 | + private function save_new_message_post($sender_id = 0, $receiver_id = 0, $message = '', $post_id = 0) { |
|
306 | 306 | |
307 | 307 | $message_id = false; |
308 | 308 | |
309 | - if( $sender_id && $receiver_id && $message && $post_id ) { |
|
309 | + if ($sender_id && $receiver_id && $message && $post_id) { |
|
310 | 310 | |
311 | - $title = wp_trim_words( $message, 8, '...' ); |
|
311 | + $title = wp_trim_words($message, 8, '...'); |
|
312 | 312 | |
313 | 313 | // Set up post data for message |
314 | 314 | $message_data = array( |
315 | 315 | 'post_type' => $this->post_type, |
316 | - 'post_title' => esc_html( $title ), |
|
317 | - 'post_content' => esc_html( $message ), |
|
316 | + 'post_title' => esc_html($title), |
|
317 | + 'post_content' => esc_html($message), |
|
318 | 318 | 'post_status' => 'publish', |
319 | 319 | 'ping_status' => 'closed', |
320 | 320 | 'comment_status' => 'open', |
321 | 321 | 'post_excerpt' => '', |
322 | - 'post_author' => intval( $sender_id ) |
|
322 | + 'post_author' => intval($sender_id) |
|
323 | 323 | ); |
324 | 324 | |
325 | 325 | // Insert post |
326 | - $message_id = wp_insert_post( $message_data ); |
|
326 | + $message_id = wp_insert_post($message_data); |
|
327 | 327 | |
328 | - if( ! is_wp_error( $message_id ) ) { |
|
328 | + if ( ! is_wp_error($message_id)) { |
|
329 | 329 | |
330 | 330 | // Add sender to message meta |
331 | - $sender = get_userdata( $sender_id ); |
|
332 | - add_post_meta( $message_id, '_sender', $sender->user_login ); |
|
331 | + $sender = get_userdata($sender_id); |
|
332 | + add_post_meta($message_id, '_sender', $sender->user_login); |
|
333 | 333 | |
334 | 334 | // Add receiver to message meta |
335 | - $receiver = get_userdata( $receiver_id ); |
|
336 | - add_post_meta( $message_id, '_receiver', $receiver->user_login ); |
|
335 | + $receiver = get_userdata($receiver_id); |
|
336 | + add_post_meta($message_id, '_receiver', $receiver->user_login); |
|
337 | 337 | |
338 | 338 | // Add lesson/course ID to message meta |
339 | - $post = get_post( $post_id ); |
|
340 | - add_post_meta( $message_id, '_posttype', $post->post_type ); |
|
341 | - add_post_meta( $message_id, '_post', $post->ID ); |
|
339 | + $post = get_post($post_id); |
|
340 | + add_post_meta($message_id, '_posttype', $post->post_type); |
|
341 | + add_post_meta($message_id, '_post', $post->ID); |
|
342 | 342 | |
343 | - do_action( 'sensei_new_private_message', $message_id ); |
|
343 | + do_action('sensei_new_private_message', $message_id); |
|
344 | 344 | |
345 | 345 | } else { |
346 | 346 | |
@@ -358,22 +358,22 @@ discard block |
||
358 | 358 | * @param integer $user_id ID of user |
359 | 359 | * @return boolean True if user has access to this message |
360 | 360 | */ |
361 | - private function view_message( $message_id, $user_id = 0) { |
|
361 | + private function view_message($message_id, $user_id = 0) { |
|
362 | 362 | |
363 | - if( ! is_user_logged_in() ) return false; |
|
363 | + if ( ! is_user_logged_in()) return false; |
|
364 | 364 | |
365 | - if( $user_id == 0 ) { |
|
365 | + if ($user_id == 0) { |
|
366 | 366 | global $current_user; |
367 | 367 | wp_get_current_user(); |
368 | 368 | $user_login = $current_user->user_login; |
369 | 369 | } |
370 | 370 | |
371 | 371 | // Get allowed users |
372 | - $receiver = get_post_meta( $message_id, '_receiver', true ); |
|
373 | - $sender = get_post_meta( $message_id, '_sender', true ); |
|
372 | + $receiver = get_post_meta($message_id, '_receiver', true); |
|
373 | + $sender = get_post_meta($message_id, '_sender', true); |
|
374 | 374 | |
375 | 375 | // Check if user is allowed to view the message |
376 | - if( in_array( $user_login, array( $receiver, $sender ) ) ) { |
|
376 | + if (in_array($user_login, array($receiver, $sender))) { |
|
377 | 377 | return true; |
378 | 378 | } |
379 | 379 | |
@@ -400,27 +400,27 @@ discard block |
||
400 | 400 | * @return void |
401 | 401 | */ |
402 | 402 | |
403 | - public function message_login () { |
|
403 | + public function message_login() { |
|
404 | 404 | |
405 | - if ( is_user_logged_in() ) { |
|
405 | + if (is_user_logged_in()) { |
|
406 | 406 | |
407 | 407 | return; |
408 | 408 | } |
409 | 409 | |
410 | 410 | $settings = Sensei()->settings->get_settings(); |
411 | - if( isset( $settings[ 'my_course_page' ] ) |
|
412 | - && 0 < intval( $settings[ 'my_course_page' ] ) ){ |
|
411 | + if (isset($settings['my_course_page']) |
|
412 | + && 0 < intval($settings['my_course_page'])) { |
|
413 | 413 | |
414 | - $my_courses_page_id = $settings[ 'my_course_page' ]; |
|
414 | + $my_courses_page_id = $settings['my_course_page']; |
|
415 | 415 | |
416 | 416 | $my_courses_url = get_permalink($my_courses_page_id); |
417 | 417 | |
418 | 418 | } |
419 | 419 | |
420 | - if ( is_single() && is_singular( $this->post_type ) |
|
421 | - || is_post_type_archive( $this->post_type ) ) { |
|
420 | + if (is_single() && is_singular($this->post_type) |
|
421 | + || is_post_type_archive($this->post_type)) { |
|
422 | 422 | |
423 | - if ( isset($my_courses_url) ) { |
|
423 | + if (isset($my_courses_url)) { |
|
424 | 424 | |
425 | 425 | wp_redirect($my_courses_url, 303); |
426 | 426 | exit; |
@@ -439,12 +439,12 @@ discard block |
||
439 | 439 | * @param array $query Original query |
440 | 440 | * @return void |
441 | 441 | */ |
442 | - public function message_list( $query ) { |
|
442 | + public function message_list($query) { |
|
443 | 443 | global $current_user; |
444 | 444 | |
445 | - if( is_admin() ) return; |
|
445 | + if (is_admin()) return; |
|
446 | 446 | |
447 | - if( is_post_type_archive( $this->post_type ) && $query->is_main_query() ) { |
|
447 | + if (is_post_type_archive($this->post_type) && $query->is_main_query()) { |
|
448 | 448 | wp_get_current_user(); |
449 | 449 | $username = $current_user->user_login; |
450 | 450 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | 'compare' => '=' |
463 | 463 | ); |
464 | 464 | |
465 | - $query->set( 'meta_query', $meta_query ); |
|
465 | + $query->set('meta_query', $meta_query); |
|
466 | 466 | |
467 | 467 | return; |
468 | 468 | } |
@@ -474,11 +474,11 @@ discard block |
||
474 | 474 | * @param integer $post_id ID of post |
475 | 475 | * @return string Modified string if user does not have access to this message |
476 | 476 | */ |
477 | - public function message_title( $title = '', $post_id = null ) { |
|
477 | + public function message_title($title = '', $post_id = null) { |
|
478 | 478 | |
479 | - if( is_single() && is_singular( $this->post_type ) && in_the_loop() && get_post_type( $post_id ) == $this->post_type ) { |
|
480 | - if( ! is_user_logged_in() || ! $this->view_message( $post_id ) ) { |
|
481 | - $title = __( 'You are not allowed to view this message.', 'woothemes-sensei' ); |
|
479 | + if (is_single() && is_singular($this->post_type) && in_the_loop() && get_post_type($post_id) == $this->post_type) { |
|
480 | + if ( ! is_user_logged_in() || ! $this->view_message($post_id)) { |
|
481 | + $title = __('You are not allowed to view this message.', 'woothemes-sensei'); |
|
482 | 482 | } |
483 | 483 | } |
484 | 484 | |
@@ -490,12 +490,12 @@ discard block |
||
490 | 490 | * @param string $content Original message content |
491 | 491 | * @return string Empty string if user does not have access to this message |
492 | 492 | */ |
493 | - public function message_content( $content ) { |
|
493 | + public function message_content($content) { |
|
494 | 494 | global $post; |
495 | 495 | |
496 | - if( is_single() && is_singular( $this->post_type ) && in_the_loop() ) { |
|
497 | - if( ! is_user_logged_in() || ! $this->view_message( $post->ID ) ) { |
|
498 | - $content = __( 'Please log in to view your messages.', 'woothemes-sensei' ); |
|
496 | + if (is_single() && is_singular($this->post_type) && in_the_loop()) { |
|
497 | + if ( ! is_user_logged_in() || ! $this->view_message($post->ID)) { |
|
498 | + $content = __('Please log in to view your messages.', 'woothemes-sensei'); |
|
499 | 499 | } |
500 | 500 | } |
501 | 501 | |
@@ -507,11 +507,11 @@ discard block |
||
507 | 507 | * @param array $comments Array of replies |
508 | 508 | * @return array Empty array if user does not have access to this message |
509 | 509 | */ |
510 | - public function message_replies( $comments ) { |
|
510 | + public function message_replies($comments) { |
|
511 | 511 | global $post; |
512 | 512 | |
513 | - if( is_single() && is_singular( $this->post_type ) && in_the_loop() ) { |
|
514 | - if( ! is_user_logged_in() || ! $this->view_message( $post->ID ) ) { |
|
513 | + if (is_single() && is_singular($this->post_type) && in_the_loop()) { |
|
514 | + if ( ! is_user_logged_in() || ! $this->view_message($post->ID)) { |
|
515 | 515 | $comments = array(); |
516 | 516 | } |
517 | 517 | } |
@@ -525,11 +525,11 @@ discard block |
||
525 | 525 | * @param integer $post_id ID of post |
526 | 526 | * @return integer 0 if user does not have access to this message |
527 | 527 | */ |
528 | - public function message_reply_count( $count, $post_id ) { |
|
528 | + public function message_reply_count($count, $post_id) { |
|
529 | 529 | global $post; |
530 | 530 | |
531 | - if( is_single() && is_singular( $this->post_type ) && in_the_loop() ) { |
|
532 | - if( ! is_user_logged_in() || ! $this->view_message( $post->ID ) ) { |
|
531 | + if (is_single() && is_singular($this->post_type) && in_the_loop()) { |
|
532 | + if ( ! is_user_logged_in() || ! $this->view_message($post->ID)) { |
|
533 | 533 | $count = 0; |
534 | 534 | } |
535 | 535 | } |
@@ -543,11 +543,11 @@ discard block |
||
543 | 543 | * @param integer $post_id ID of post |
544 | 544 | * @return boolean False if user does not have access to this message |
545 | 545 | */ |
546 | - public function message_replies_open( $open, $post_id ) { |
|
546 | + public function message_replies_open($open, $post_id) { |
|
547 | 547 | global $post; |
548 | 548 | |
549 | - if( is_single() && is_singular( $this->post_type ) && in_the_loop() ) { |
|
550 | - if( ! is_user_logged_in() || ! $this->view_message( $post->ID ) ) { |
|
549 | + if (is_single() && is_singular($this->post_type) && in_the_loop()) { |
|
550 | + if ( ! is_user_logged_in() || ! $this->view_message($post->ID)) { |
|
551 | 551 | $open = false; |
552 | 552 | } |
553 | 553 | } |
@@ -560,17 +560,17 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @since 1.9.0 |
562 | 562 | */ |
563 | - public static function the_message_sent_by_title(){ |
|
563 | + public static function the_message_sent_by_title() { |
|
564 | 564 | |
565 | - $sender_username = get_post_meta( get_the_ID() , '_sender', true ); |
|
566 | - if( $sender_username ) { |
|
565 | + $sender_username = get_post_meta(get_the_ID(), '_sender', true); |
|
566 | + if ($sender_username) { |
|
567 | 567 | |
568 | - $sender = get_user_by( 'login', $sender_username ); ?> |
|
568 | + $sender = get_user_by('login', $sender_username); ?> |
|
569 | 569 | |
570 | 570 | <p class="message-meta"> |
571 | 571 | <small> |
572 | 572 | <em> |
573 | - <?php printf( __( 'Sent by %1$s on %2$s.', 'woothemes-sensei' ), $sender->display_name, get_the_date() ); ?> |
|
573 | + <?php printf(__('Sent by %1$s on %2$s.', 'woothemes-sensei'), $sender->display_name, get_the_date()); ?> |
|
574 | 574 | </em> |
575 | 575 | </small> |
576 | 576 | </p> |
@@ -589,11 +589,11 @@ discard block |
||
589 | 589 | |
590 | 590 | global $post; |
591 | 591 | |
592 | - $content_post_id = get_post_meta( $post->ID, '_post', true ); |
|
593 | - if( $content_post_id ) { |
|
594 | - $title = sprintf( __( 'Re: %1$s', 'woothemes-sensei' ), '<a href="' . get_permalink( $content_post_id ) . '">' . get_the_title( $content_post_id ) . '</a>' ); |
|
592 | + $content_post_id = get_post_meta($post->ID, '_post', true); |
|
593 | + if ($content_post_id) { |
|
594 | + $title = sprintf(__('Re: %1$s', 'woothemes-sensei'), '<a href="'.get_permalink($content_post_id).'">'.get_the_title($content_post_id).'</a>'); |
|
595 | 595 | } else { |
596 | - $title = get_the_title( $post->ID ); |
|
596 | + $title = get_the_title($post->ID); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | ?> |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | * @param string $template |
611 | 611 | * @param string $post_type |
612 | 612 | */ |
613 | - echo apply_filters( 'sensei_single_title', $title, $post->post_type ); |
|
613 | + echo apply_filters('sensei_single_title', $title, $post->post_type); |
|
614 | 614 | ?> |
615 | 615 | |
616 | 616 | </h1> |
@@ -629,18 +629,18 @@ discard block |
||
629 | 629 | * |
630 | 630 | * @return string |
631 | 631 | */ |
632 | - public static function the_archive_header( ){ |
|
632 | + public static function the_archive_header( ) { |
|
633 | 633 | |
634 | 634 | $html = ''; |
635 | 635 | $html .= '<header class="archive-header"><h1>'; |
636 | - $html .= __( 'My Messages', 'woothemes-sensei' ); |
|
636 | + $html .= __('My Messages', 'woothemes-sensei'); |
|
637 | 637 | $html .= '</h1></header>'; |
638 | 638 | |
639 | 639 | /** |
640 | 640 | * Filter the sensei messages archive title. |
641 | 641 | * @since 1.0.0 |
642 | 642 | */ |
643 | - echo apply_filters( 'sensei_message_archive_title', $html ); |
|
643 | + echo apply_filters('sensei_message_archive_title', $html); |
|
644 | 644 | |
645 | 645 | } // get_archive_header() |
646 | 646 | |
@@ -650,23 +650,23 @@ discard block |
||
650 | 650 | * @since 1.9.0 |
651 | 651 | * @param $post_id |
652 | 652 | */ |
653 | - public static function the_message_title( $message_post_id ){ |
|
653 | + public static function the_message_title($message_post_id) { |
|
654 | 654 | |
655 | - $content_post_id = get_post_meta( $message_post_id, '_post', true ); |
|
655 | + $content_post_id = get_post_meta($message_post_id, '_post', true); |
|
656 | 656 | |
657 | - if( $content_post_id ) { |
|
657 | + if ($content_post_id) { |
|
658 | 658 | |
659 | - $title = sprintf( __( 'Re: %1$s', 'woothemes-sensei' ), get_the_title( $content_post_id ) ); |
|
659 | + $title = sprintf(__('Re: %1$s', 'woothemes-sensei'), get_the_title($content_post_id)); |
|
660 | 660 | |
661 | 661 | } else { |
662 | 662 | |
663 | - $title = get_the_title( $message_post_id ); |
|
663 | + $title = get_the_title($message_post_id); |
|
664 | 664 | |
665 | 665 | } |
666 | 666 | |
667 | 667 | ?> |
668 | 668 | <h2> |
669 | - <a href="<?php esc_url( get_permalink( $message_post_id ) );?>"> |
|
669 | + <a href="<?php esc_url(get_permalink($message_post_id)); ?>"> |
|
670 | 670 | <?php echo $title; ?> |
671 | 671 | </a> |
672 | 672 | |
@@ -680,13 +680,13 @@ discard block |
||
680 | 680 | * |
681 | 681 | * @param $message_post_id |
682 | 682 | */ |
683 | - public static function the_message_sender( $message_post_id ){ |
|
683 | + public static function the_message_sender($message_post_id) { |
|
684 | 684 | |
685 | - $sender_username = get_post_meta( $message_post_id, '_sender', true ); |
|
686 | - $sender = get_user_by( 'login', $sender_username ); |
|
685 | + $sender_username = get_post_meta($message_post_id, '_sender', true); |
|
686 | + $sender = get_user_by('login', $sender_username); |
|
687 | 687 | |
688 | - if( $sender_username && $sender instanceof WP_User ) { |
|
689 | - $sender_display_name = sprintf( __( 'Sent by %1$s on %2$s.', 'woothemes-sensei' ), $sender->display_name, get_the_date() ); |
|
688 | + if ($sender_username && $sender instanceof WP_User) { |
|
689 | + $sender_display_name = sprintf(__('Sent by %1$s on %2$s.', 'woothemes-sensei'), $sender->display_name, get_the_date()); |
|
690 | 690 | ?> |
691 | 691 | <p class="message-meta"> |
692 | 692 | <small> |
@@ -704,13 +704,13 @@ discard block |
||
704 | 704 | * |
705 | 705 | * @since 1.9.0 |
706 | 706 | */ |
707 | - public static function the_my_messages_link(){ |
|
708 | - if( ! Sensei()->settings->get('messages_disable') ) { |
|
707 | + public static function the_my_messages_link() { |
|
708 | + if ( ! Sensei()->settings->get('messages_disable')) { |
|
709 | 709 | ?> |
710 | 710 | <p class="my-messages-link-container"> |
711 | - <a class="my-messages-link" href="<?php echo get_post_type_archive_link( 'sensei_message' ); ?>" |
|
712 | - title="<?php _e( 'View & reply to private messages sent to your course & lesson teachers.', 'woothemes-sensei' ); ?>"> |
|
713 | - <?php _e( 'My Messages', 'woothemes-sensei' ); ?> |
|
711 | + <a class="my-messages-link" href="<?php echo get_post_type_archive_link('sensei_message'); ?>" |
|
712 | + title="<?php _e('View & reply to private messages sent to your course & lesson teachers.', 'woothemes-sensei'); ?>"> |
|
713 | + <?php _e('My Messages', 'woothemes-sensei'); ?> |
|
714 | 714 | </a> |
715 | 715 | </p> |
716 | 716 | <?php |
@@ -724,4 +724,4 @@ discard block |
||
724 | 724 | * for backward compatibility |
725 | 725 | * @since 1.9.0 |
726 | 726 | */ |
727 | -class WooThemes_Sensei_Messages extends Sensei_Messages{} |
|
727 | +class WooThemes_Sensei_Messages extends Sensei_Messages {} |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +if ( ! defined('ABSPATH')) exit; |
|
3 | 3 | /** |
4 | 4 | * The Template for displaying Multi Line Questions. |
5 | 5 | * |
@@ -18,15 +18,15 @@ discard block |
||
18 | 18 | * Get the question data with the current quiz id |
19 | 19 | * All data is loaded in this array to keep the template clean. |
20 | 20 | */ |
21 | - $question_data = WooThemes_Sensei_Question::get_template_data( sensei_get_the_question_id(), get_the_ID() ); |
|
21 | + $question_data = WooThemes_Sensei_Question::get_template_data(sensei_get_the_question_id(), get_the_ID()); |
|
22 | 22 | |
23 | 23 | ?> |
24 | 24 | |
25 | 25 | <?php |
26 | 26 | |
27 | - Sensei_Utils::sensei_text_editor( $question_data[ 'user_answer_entry' ] , |
|
28 | - 'textquestion' . $question_data[ 'ID' ] , |
|
29 | - 'sensei_question[' . $question_data[ 'ID' ] . ']' ); |
|
27 | + Sensei_Utils::sensei_text_editor($question_data['user_answer_entry'], |
|
28 | + 'textquestion'.$question_data['ID'], |
|
29 | + 'sensei_question['.$question_data['ID'].']'); |
|
30 | 30 | |
31 | 31 | ?> |
32 | 32 |
@@ -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 |