Completed
Push — master ( b09b8b...45e17f )
by Dwain
07:46
created
includes/hooks/woocommerce.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,27 +7,27 @@  discard block
 block discarded – undo
7 7
  * show the WooCommerce course filter links above the courses
8 8
  * @since 1.9.0
9 9
  */
10
-add_filter( 'sensei_archive_course_filter_by_options', array( 'Sensei_WC', 'add_course_archive_wc_filter_links' ) );
10
+add_filter('sensei_archive_course_filter_by_options', array('Sensei_WC', 'add_course_archive_wc_filter_links'));
11 11
 
12 12
 /**
13 13
  * filter the queries for paid and free course based on the users selection.
14 14
  * @since 1.9.0
15 15
  */
16
-add_filter('pre_get_posts', array( 'Sensei_WC', 'course_archive_wc_filter_free'));
17
-add_filter('pre_get_posts', array( 'Sensei_WC', 'course_archive_wc_filter_paid'));
16
+add_filter('pre_get_posts', array('Sensei_WC', 'course_archive_wc_filter_free'));
17
+add_filter('pre_get_posts', array('Sensei_WC', 'course_archive_wc_filter_paid'));
18 18
 
19 19
 /**
20 20
  * Add woocommerce action above single course the action
21 21
  * @since 1.9.0
22 22
  */
23
-add_action('sensei_before_main_content', array('Sensei_WC', 'do_single_course_wc_single_product_action') ,50) ;
23
+add_action('sensei_before_main_content', array('Sensei_WC', 'do_single_course_wc_single_product_action'), 50);
24 24
 
25 25
 /******************************
26 26
  *
27 27
  * Single Lesson Hooks
28 28
  *
29 29
  ******************************/
30
-add_filter( 'sensei_can_user_view_lesson', array( 'Sensei_WC','alter_can_user_view_lesson' ), 20, 3 );
30
+add_filter('sensei_can_user_view_lesson', array('Sensei_WC', 'alter_can_user_view_lesson'), 20, 3);
31 31
 
32 32
 /******************************
33 33
  *
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
  *
36 36
  ******************************/
37 37
 // add a notice on the checkout page to tell users about the course they've purchase
38
-add_action( 'template_redirect', array( 'Sensei_WC','course_link_from_order' ) );
38
+add_action('template_redirect', array('Sensei_WC', 'course_link_from_order'));
39 39
 
40 40
 /******************************
41 41
  *
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
  ******************************/
45 45
 //@since 1.9.0
46 46
 //show a notice if the user has already added the current course to their cart
47
-add_action( 'sensei_single_course_content_inside_before', array( 'Sensei_WC', 'course_in_cart_message' ), 20 );
47
+add_action('sensei_single_course_content_inside_before', array('Sensei_WC', 'course_in_cart_message'), 20);
48 48
 
49 49
 /******************************
50 50
  *
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
  ******************************/
54 54
 //@since 1.9.0
55 55
 // alter the no permissions message to show the woocommerce message instead
56
-add_filter( 'sensei_the_no_permissions_message', array( 'Sensei_WC', 'alter_no_permissions_message' ), 20, 2 );
56
+add_filter('sensei_the_no_permissions_message', array('Sensei_WC', 'alter_no_permissions_message'), 20, 2);
57 57
 
58 58
 //@since 1.9.0
59 59
 // add the add to cart button for a valid purchasable course
60
-add_action( 'sensei_no_permissions_inside_before_content', array( 'Sensei_WC', 'the_add_to_cart_button_html' ), 20, 1);
60
+add_action('sensei_no_permissions_inside_before_content', array('Sensei_WC', 'the_add_to_cart_button_html'), 20, 1);
61 61
 
62 62
 // @since 1.9.0
63 63
 // add  woocommerce class to the the no permission body class to ensure WooCommerce elements are styled
64
-add_filter( 'body_class', array( 'Sensei_WC', 'add_woocommerce_body_class' ), 20, 1);
64
+add_filter('body_class', array('Sensei_WC', 'add_woocommerce_body_class'), 20, 1);
Please login to merge, or discard this patch.
templates/no-permissions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 ?>
13 13
 
14
-<?php  get_sensei_header();  ?>
14
+<?php  get_sensei_header(); ?>
15 15
 
16 16
 <?php
17 17
 /**
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
  * @since 1.9.0
22 22
  * @param $post_id
23 23
  */
24
-do_action('sensei_no_permissions_before_content', get_the_ID() );
24
+do_action('sensei_no_permissions_before_content', get_the_ID());
25 25
 ?>
26 26
 
27
-<article <?php post_class( 'no-permission' ) ?> >
27
+<article <?php post_class('no-permission') ?> >
28 28
 
29 29
     <header>
30 30
 
@@ -40,20 +40,20 @@  discard block
 block discarded – undo
40 40
      * @since 1.9.0
41 41
      * @param $post_id
42 42
      */
43
-    do_action('sensei_no_permissions_inside_before_content', get_the_ID() );
43
+    do_action('sensei_no_permissions_inside_before_content', get_the_ID());
44 44
     ?>
45 45
 
46 46
     <section class="entry fix">
47 47
 
48 48
         <div class="sensei-message alert">
49 49
 
50
-            <?php the_no_permissions_message( get_the_ID() ); ?>
50
+            <?php the_no_permissions_message(get_the_ID()); ?>
51 51
 
52 52
         </div>
53 53
 
54 54
         <p class="excerpt">
55 55
 
56
-            <?php sensei_the_excerpt( get_the_ID() ); ?>
56
+            <?php sensei_the_excerpt(get_the_ID()); ?>
57 57
 
58 58
         </p>
59 59
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      * @since 1.9.0
68 68
      * @param $post_id
69 69
      */
70
-    do_action('sensei_no_permissions_inside_after_content', get_the_ID() );
70
+    do_action('sensei_no_permissions_inside_after_content', get_the_ID());
71 71
     ?>
72 72
 
73 73
 </article><!-- .no-permissions -->
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
  * @since 1.9.0
81 81
  * @param $post_id
82 82
  */
83
-do_action('sensei_no_permissions_after_content', get_the_ID() );
83
+do_action('sensei_no_permissions_after_content', get_the_ID());
84 84
 ?>
85 85
 
86 86
 <?php get_sensei_footer(); ?>
87 87
\ No newline at end of file
Please login to merge, or discard this patch.
templates/course-results/lessons.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit;
2
+if ( ! defined('ABSPATH')) exit;
3 3
 /**
4 4
  * The Template for displaying all course lessons on the course results page.
5 5
  *
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 global $course;
15 15
 ?>
16 16
 
17
-<?php if ( is_user_logged_in() ): ?>
17
+<?php if (is_user_logged_in()): ?>
18 18
 
19 19
     <?php
20 20
     /**
@@ -22,53 +22,53 @@  discard block
 block discarded – undo
22 22
      * is uer logged check, just above the lessons header.
23 23
      * @since 1.4.0
24 24
      */
25
-    do_action( 'sensei_course_results_before_lessons', $course->ID );
25
+    do_action('sensei_course_results_before_lessons', $course->ID);
26 26
     ?>
27 27
 
28 28
     <header>
29 29
 
30
-        <h2>  <?php _e( 'Lessons', 'woothemes-sensei' );  ?> </h2>
30
+        <h2>  <?php _e('Lessons', 'woothemes-sensei'); ?> </h2>
31 31
 
32 32
     </header>
33 33
 
34
-    <article class="<?php  esc_attr_e( join( ' ', get_post_class( array( 'course', 'post' ), $course->ID ) ) ); ?> ">
34
+    <article class="<?php  esc_attr_e(join(' ', get_post_class(array('course', 'post'), $course->ID))); ?> ">
35 35
 
36 36
         <?php
37 37
 
38 38
 		$displayed_lessons = array();
39
-        $modules = Sensei()->modules->get_course_modules( intval( $course->ID ) );
39
+        $modules = Sensei()->modules->get_course_modules(intval($course->ID));
40 40
 
41 41
         // List modules with lessons
42
-        foreach( $modules as $module ) {
42
+        foreach ($modules as $module) {
43 43
 
44
-            $lessons_query = Sensei()->modules->get_lessons_query( $course->ID, $module->term_id );
44
+            $lessons_query = Sensei()->modules->get_lessons_query($course->ID, $module->term_id);
45 45
             $lessons = $lessons_query->get_posts();
46 46
 
47
-            if( count( $lessons ) > 0 ) { ?>
47
+            if (count($lessons) > 0) { ?>
48 48
 
49 49
                 <h3> <?php echo $module->name; ?></h3>
50 50
 
51 51
                 <?php
52 52
                 $count = 0;
53
-                foreach( $lessons as $lesson ) {
53
+                foreach ($lessons as $lesson) {
54 54
 
55 55
                     $lesson_grade = 'n/a';
56
-                    $has_questions = get_post_meta( $lesson->ID, '_quiz_has_questions', true );
57
-                    if ( $has_questions ) {
58
-                        $lesson_status = Sensei_Utils::user_lesson_status( $lesson->ID, get_current_user_id() );
56
+                    $has_questions = get_post_meta($lesson->ID, '_quiz_has_questions', true);
57
+                    if ($has_questions) {
58
+                        $lesson_status = Sensei_Utils::user_lesson_status($lesson->ID, get_current_user_id());
59 59
                         // Get user quiz grade
60
-                        $lesson_grade = get_comment_meta( $lesson_status->comment_ID, 'grade', true );
61
-                        if ( $lesson_grade ) {
60
+                        $lesson_grade = get_comment_meta($lesson_status->comment_ID, 'grade', true);
61
+                        if ($lesson_grade) {
62 62
                             $lesson_grade .= '%';
63 63
                         }
64 64
                     }
65 65
                     ?>
66 66
                     <h2>
67 67
 
68
-                        <a href="<?php esc_url_raw( get_permalink( $lesson->ID ) ); ?>"
69
-                           title="<?php esc_attr_e( sprintf( __( 'Start %s', 'woothemes-sensei' ), $lesson->post_title ) ); ?>">
68
+                        <a href="<?php esc_url_raw(get_permalink($lesson->ID)); ?>"
69
+                           title="<?php esc_attr_e(sprintf(__('Start %s', 'woothemes-sensei'), $lesson->post_title)); ?>">
70 70
 
71
-                            <?php esc_html_e( $lesson->post_title ); ?>
71
+                            <?php esc_html_e($lesson->post_title); ?>
72 72
 
73 73
                         </a>
74 74
 
@@ -89,25 +89,25 @@  discard block
 block discarded – undo
89 89
 
90 90
         <?php
91 91
 
92
-        $lessons = Sensei()->modules->get_none_module_lessons( $course->ID );
93
-        if( 0 < count( $lessons ) ): ?>
92
+        $lessons = Sensei()->modules->get_none_module_lessons($course->ID);
93
+        if (0 < count($lessons)): ?>
94 94
 
95 95
 			<h3>
96 96
 
97
-                <?php _e( 'Other Lessons', 'woothemes-sensei' ); ?>
97
+                <?php _e('Other Lessons', 'woothemes-sensei'); ?>
98 98
 
99 99
             </h3>
100 100
 
101
-            <?php foreach ( $lessons as $lesson ): ?>
101
+            <?php foreach ($lessons as $lesson): ?>
102 102
 
103 103
                 <?php
104 104
                 $lesson_grade = 'n/a';
105
-                $has_questions = get_post_meta( $lesson->ID, '_quiz_has_questions', true );
106
-                if ( $has_questions ) {
107
-                    $lesson_status = Sensei_Utils::user_lesson_status( $lesson->ID, get_current_user_id());
105
+                $has_questions = get_post_meta($lesson->ID, '_quiz_has_questions', true);
106
+                if ($has_questions) {
107
+                    $lesson_status = Sensei_Utils::user_lesson_status($lesson->ID, get_current_user_id());
108 108
                     // Get user quiz grade
109
-                    $lesson_grade = get_comment_meta( $lesson_status->comment_ID, 'grade', true );
110
-                    if ( $lesson_grade ) {
109
+                    $lesson_grade = get_comment_meta($lesson_status->comment_ID, 'grade', true);
110
+                    if ($lesson_grade) {
111 111
                         $lesson_grade .= '%';
112 112
                     }
113 113
                 }
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 
116 116
                 <h2>
117 117
 
118
-                    <a href="<?php esc_url_raw( get_permalink( $lesson->ID ) ) ?>" title="<?php esc_attr_e( sprintf( __( 'Start %s', 'woothemes-sensei' ), $lesson->post_title ) ) ?>" >
118
+                    <a href="<?php esc_url_raw(get_permalink($lesson->ID)) ?>" title="<?php esc_attr_e(sprintf(__('Start %s', 'woothemes-sensei'), $lesson->post_title)) ?>" >
119 119
 
120
-                        <?php esc_html_e( sprintf( __( '%s', 'woothemes-sensei' ), $lesson->post_title ) ); ?>
120
+                        <?php esc_html_e(sprintf(__('%s', 'woothemes-sensei'), $lesson->post_title)); ?>
121 121
 
122 122
                     </a>
123 123
 
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
 
133 133
         <h2 class="total-grade">
134 134
 
135
-            <?php _e( 'Total Grade', 'woothemes-sensei' ); ?>
135
+            <?php _e('Total Grade', 'woothemes-sensei'); ?>
136 136
             <span class="lesson-grade">
137 137
 
138 138
                 <?php
139 139
 
140
-                    $course_user_grade = Sensei_Utils::sensei_course_user_grade( $course->ID, get_current_user_id() );
141
-                    echo $course_user_grade . '%';
140
+                    $course_user_grade = Sensei_Utils::sensei_course_user_grade($course->ID, get_current_user_id());
141
+                    echo $course_user_grade.'%';
142 142
 
143 143
                 ?>
144 144
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      *
156 156
      * @since 1.4.0
157 157
      */
158
-	do_action( 'sensei_course_results_after_lessons', $course->ID );
158
+	do_action('sensei_course_results_after_lessons', $course->ID);
159 159
     ?>
160 160
 
161 161
 <?php endif; //user logged in ?>
162 162
\ No newline at end of file
Please login to merge, or discard this patch.
templates/single-quiz/question_type-multi-line.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
includes/emails/class-woothemes-sensei-email-teacher-completed-course.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
includes/emails/class-woothemes-sensei-email-learner-completed-course.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
includes/lib/woo-functions.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * Queue updates for the WooUpdater
5 5
  */
6
-if ( ! function_exists( 'woothemes_queue_update' ) ) {
7
-	function woothemes_queue_update( $file, $file_id, $product_id ) {
6
+if ( ! function_exists('woothemes_queue_update')) {
7
+	function woothemes_queue_update($file, $file_id, $product_id) {
8 8
 		global $woothemes_queued_updates;
9 9
 
10
-		if ( ! isset( $woothemes_queued_updates ) )
10
+		if ( ! isset($woothemes_queued_updates))
11 11
 			$woothemes_queued_updates = array();
12 12
 
13 13
 		$plugin             = new stdClass();
@@ -23,56 +23,56 @@  discard block
 block discarded – undo
23 23
  * Load installer for the WooThemes Updater.
24 24
  * @return $api Object
25 25
  */
26
-if ( ! class_exists( 'WooThemes_Updater' ) && ! function_exists( 'woothemes_updater_install' ) ) {
27
-	function woothemes_updater_install( $api, $action, $args ) {
26
+if ( ! class_exists('WooThemes_Updater') && ! function_exists('woothemes_updater_install')) {
27
+	function woothemes_updater_install($api, $action, $args) {
28 28
 		$download_url = 'http://woodojo.s3.amazonaws.com/downloads/woothemes-updater/woothemes-updater.zip';
29 29
 
30
-		if ( 'plugin_information' != $action ||
30
+		if ('plugin_information' != $action ||
31 31
 			false !== $api ||
32
-			! isset( $args->slug ) ||
32
+			! isset($args->slug) ||
33 33
 			'woothemes-updater' != $args->slug
34 34
 		) return $api;
35 35
 
36 36
 		$api = new stdClass();
37 37
 		$api->name = 'WooThemes Updater';
38 38
 		$api->version = '';
39
-		$api->download_link = esc_url( $download_url );
39
+		$api->download_link = esc_url($download_url);
40 40
 		return $api;
41 41
 	}
42 42
 
43
-	add_filter( 'plugins_api', 'woothemes_updater_install', 10, 3 );
43
+	add_filter('plugins_api', 'woothemes_updater_install', 10, 3);
44 44
 }
45 45
 
46 46
 /**
47 47
  * WooUpdater Installation Prompts
48 48
  */
49
-if ( ! class_exists( 'WooThemes_Updater' ) && ! function_exists( 'woothemes_updater_notice' ) ) {
49
+if ( ! class_exists('WooThemes_Updater') && ! function_exists('woothemes_updater_notice')) {
50 50
 
51 51
 	/**
52 52
 	 * Display a notice if the "WooThemes Updater" plugin hasn't been installed.
53 53
 	 * @return void
54 54
 	 */
55 55
 	function woothemes_updater_notice() {
56
-		$active_plugins = apply_filters( 'active_plugins', get_option('active_plugins' ) );
57
-		if ( in_array( 'woothemes-updater/woothemes-updater.php', $active_plugins ) ) return;
56
+		$active_plugins = apply_filters('active_plugins', get_option('active_plugins'));
57
+		if (in_array('woothemes-updater/woothemes-updater.php', $active_plugins)) return;
58 58
 
59 59
 		$slug = 'woothemes-updater';
60
-		$install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $slug ), 'install-plugin_' . $slug );
61
-		$activate_url = 'plugins.php?action=activate&plugin=' . urlencode( 'woothemes-updater/woothemes-updater.php' ) . '&plugin_status=all&paged=1&s&_wpnonce=' . urlencode( wp_create_nonce( 'activate-plugin_woothemes-updater/woothemes-updater.php' ) );
60
+		$install_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin='.$slug), 'install-plugin_'.$slug);
61
+		$activate_url = 'plugins.php?action=activate&plugin='.urlencode('woothemes-updater/woothemes-updater.php').'&plugin_status=all&paged=1&s&_wpnonce='.urlencode(wp_create_nonce('activate-plugin_woothemes-updater/woothemes-updater.php'));
62 62
 
63
-		$message = '<a href="' . esc_url( $install_url ) . '">Install the WooThemes Updater plugin</a> to get updates for your WooThemes plugins.';
63
+		$message = '<a href="'.esc_url($install_url).'">Install the WooThemes Updater plugin</a> to get updates for your WooThemes plugins.';
64 64
 		$is_downloaded = false;
65
-		$plugins = array_keys( get_plugins() );
66
-		foreach ( $plugins as $plugin ) {
67
-			if ( strpos( $plugin, 'woothemes-updater.php' ) !== false ) {
65
+		$plugins = array_keys(get_plugins());
66
+		foreach ($plugins as $plugin) {
67
+			if (strpos($plugin, 'woothemes-updater.php') !== false) {
68 68
 				$is_downloaded = true;
69
-				$message = '<a href="' . esc_url( admin_url( $activate_url ) ) . '">Activate the WooThemes Updater plugin</a> to get updates for your WooThemes plugins.';
69
+				$message = '<a href="'.esc_url(admin_url($activate_url)).'">Activate the WooThemes Updater plugin</a> to get updates for your WooThemes plugins.';
70 70
 			}
71 71
 		}
72
-		echo '<div class="updated fade"><p>' . $message . '</p></div>' . "\n";
72
+		echo '<div class="updated fade"><p>'.$message.'</p></div>'."\n";
73 73
 	}
74 74
 
75
-	add_action( 'admin_notices', 'woothemes_updater_notice' );
75
+	add_action('admin_notices', 'woothemes_updater_notice');
76 76
 }
77 77
 
78 78
 /**
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
  * @param  $version Version to check against
82 82
  * @return @boolean
83 83
  */
84
-if( ! function_exists( 'sensei_check_woocommerce_version' ) ) {
85
-	function sensei_check_woocommerce_version( $version = '2.1' ) {
86
-		if ( Sensei_WC::is_woocommerce_active() ) {
84
+if ( ! function_exists('sensei_check_woocommerce_version')) {
85
+	function sensei_check_woocommerce_version($version = '2.1') {
86
+		if (Sensei_WC::is_woocommerce_active()) {
87 87
 			global $woocommerce;
88
-			if( version_compare( $woocommerce->version, $version, ">=" ) ) {
88
+			if (version_compare($woocommerce->version, $version, ">=")) {
89 89
 			    return true;
90 90
 			}
91 91
 		}
Please login to merge, or discard this patch.
includes/class-sensei-grading-user-quiz.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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 Grading User Quiz Class
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 	 * @since  1.3.0
23 23
 	 * @return  void
24 24
 	 */
25
-	public function __construct ( $user_id = 0, $quiz_id = 0 ) {
26
-		$this->user_id = intval( $user_id );
27
-		$this->quiz_id = intval( $quiz_id );
28
-		$this->lesson_id = get_post_meta( $this->quiz_id, '_quiz_lesson', true );
25
+	public function __construct($user_id = 0, $quiz_id = 0) {
26
+		$this->user_id = intval($user_id);
27
+		$this->quiz_id = intval($quiz_id);
28
+		$this->lesson_id = get_post_meta($this->quiz_id, '_quiz_lesson', true);
29 29
 	} // End __construct()
30 30
 
31 31
 	/**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @return array
36 36
 	 */
37 37
 	public function build_data_array() {
38
-		$data_array = Sensei_Utils::sensei_get_quiz_questions( $this->quiz_id );
38
+		$data_array = Sensei_Utils::sensei_get_quiz_questions($this->quiz_id);
39 39
 		return $data_array;
40 40
 	} // End build_data_array()
41 41
 
@@ -60,94 +60,94 @@  discard block
 block discarded – undo
60 60
         $lesson_id = $this->lesson_id;
61 61
         $user_id = $this->user_id;
62 62
 
63
-		?><form name="<?php esc_attr_e( 'quiz_' . $this->quiz_id ); ?>" action="" method="post">
64
-			<?php wp_nonce_field( 'sensei_manual_grading', '_wp_sensei_manual_grading_nonce' ); ?>
65
-			<input type="hidden" name="sensei_manual_grade" value="<?php esc_attr_e( $this->quiz_id ); ?>" />
66
-			<input type="hidden" name="sensei_grade_next_learner" value="<?php esc_attr_e( $this->user_id ); ?>" />
63
+		?><form name="<?php esc_attr_e('quiz_'.$this->quiz_id); ?>" action="" method="post">
64
+			<?php wp_nonce_field('sensei_manual_grading', '_wp_sensei_manual_grading_nonce'); ?>
65
+			<input type="hidden" name="sensei_manual_grade" value="<?php esc_attr_e($this->quiz_id); ?>" />
66
+			<input type="hidden" name="sensei_grade_next_learner" value="<?php esc_attr_e($this->user_id); ?>" />
67 67
 			<div class="total_grade_display">
68
-				<span><?php esc_attr_e( __( 'Grade:', 'woothemes-sensei' ) ); ?></span>
68
+				<span><?php esc_attr_e(__('Grade:', 'woothemes-sensei')); ?></span>
69 69
 				<span class="total_grade_total"><?php echo $user_quiz_grade_total; ?></span> / <span class="quiz_grade_total"><?php echo $quiz_grade_total; ?></span> (<span class="total_grade_percent"><?php echo $quiz_grade; ?></span>%)
70 70
 			</div>
71 71
 			<div class="buttons">
72
-				<input type="submit" value="<?php esc_attr_e( __( 'Save', 'woothemes-sensei' ) ); ?>" class="grade-button button-primary" title="Saves grades as currently marked on this page" />
73
-				<input type="button" value="<?php esc_attr_e( __( 'Auto grade', 'woothemes-sensei' ) ); ?>" class="autograde-button button-secondary" title="Where possible, automatically grades questions that have not yet been graded" />
74
-				<input type="reset" value="<?php esc_attr_e( __( 'Reset', 'woothemes-sensei' ) ); ?>" class="reset-button button-secondary" title="Resets all questions to ungraded and total grade to 0" />
72
+				<input type="submit" value="<?php esc_attr_e(__('Save', 'woothemes-sensei')); ?>" class="grade-button button-primary" title="Saves grades as currently marked on this page" />
73
+				<input type="button" value="<?php esc_attr_e(__('Auto grade', 'woothemes-sensei')); ?>" class="autograde-button button-secondary" title="Where possible, automatically grades questions that have not yet been graded" />
74
+				<input type="reset" value="<?php esc_attr_e(__('Reset', 'woothemes-sensei')); ?>" class="reset-button button-secondary" title="Resets all questions to ungraded and total grade to 0" />
75 75
 			</div>
76 76
 			<div class="clear"></div><br/><?php
77 77
 
78
-		$lesson_status_id = Sensei_Utils::sensei_get_activity_value( array( 'post_id' => $this->lesson_id, 'user_id' => $this->user_id, 'type' => 'sensei_lesson_status', 'field' => 'comment_ID' ) );
79
-		$user_quiz_grade = get_comment_meta( $lesson_status_id, 'grade', true );
78
+		$lesson_status_id = Sensei_Utils::sensei_get_activity_value(array('post_id' => $this->lesson_id, 'user_id' => $this->user_id, 'type' => 'sensei_lesson_status', 'field' => 'comment_ID'));
79
+		$user_quiz_grade = get_comment_meta($lesson_status_id, 'grade', true);
80 80
 		$correct_answers = 0;
81 81
 
82
-		foreach( $questions as $question ) {
82
+		foreach ($questions as $question) {
83 83
 			$question_id = $question->ID;
84 84
 			++$count;
85 85
 
86 86
 			$type = false;
87 87
 			$type_name = '';
88 88
 
89
-			$type = Sensei()->question->get_question_type( $question_id );
89
+			$type = Sensei()->question->get_question_type($question_id);
90 90
 
91
-			$question_answer_notes = Sensei()->quiz->get_user_question_feedback( $lesson_id, $question_id, $user_id );
91
+			$question_answer_notes = Sensei()->quiz->get_user_question_feedback($lesson_id, $question_id, $user_id);
92 92
 
93 93
 
94
-			$question_grade_total = Sensei()->question->get_question_grade( $question_id );
94
+			$question_grade_total = Sensei()->question->get_question_grade($question_id);
95 95
 			$quiz_grade_total += $question_grade_total;
96 96
 
97
-			$right_answer = get_post_meta( $question_id, '_question_right_answer', true );
98
-			$user_answer_content = Sensei()->quiz->get_user_question_answer( $lesson_id, $question_id, $user_id );
99
-			$type_name = __( 'Multiple Choice', 'woothemes-sensei' );
97
+			$right_answer = get_post_meta($question_id, '_question_right_answer', true);
98
+			$user_answer_content = Sensei()->quiz->get_user_question_answer($lesson_id, $question_id, $user_id);
99
+			$type_name = __('Multiple Choice', 'woothemes-sensei');
100 100
 			$grade_type = 'manual-grade';
101 101
 
102
-			switch( $type ) {
102
+			switch ($type) {
103 103
 				case 'boolean':
104
-					$type_name = __( 'True/False', 'woothemes-sensei' );
105
-					$right_answer = ucfirst( $right_answer );
106
-					$user_answer_content = ucfirst( $user_answer_content );
104
+					$type_name = __('True/False', 'woothemes-sensei');
105
+					$right_answer = ucfirst($right_answer);
106
+					$user_answer_content = ucfirst($user_answer_content);
107 107
 					$grade_type = 'auto-grade';
108 108
 				break;
109 109
 				case 'multiple-choice':
110
-					$type_name = __( 'Multiple Choice', 'woothemes-sensei' );
110
+					$type_name = __('Multiple Choice', 'woothemes-sensei');
111 111
 					$grade_type = 'auto-grade';
112 112
 				break;
113 113
 				case 'gap-fill':
114
-					$type_name = __( 'Gap Fill', 'woothemes-sensei' );
114
+					$type_name = __('Gap Fill', 'woothemes-sensei');
115 115
 
116
-					$right_answer_array = explode( '||', $right_answer );
117
-					if ( isset( $right_answer_array[0] ) ) { $gapfill_pre = $right_answer_array[0]; } else { $gapfill_pre = ''; }
118
-					if ( isset( $right_answer_array[1] ) ) { $gapfill_gap = $right_answer_array[1]; } else { $gapfill_gap = ''; }
119
-					if ( isset( $right_answer_array[2] ) ) { $gapfill_post = $right_answer_array[2]; } else { $gapfill_post = ''; }
116
+					$right_answer_array = explode('||', $right_answer);
117
+					if (isset($right_answer_array[0])) { $gapfill_pre = $right_answer_array[0]; } else { $gapfill_pre = ''; }
118
+					if (isset($right_answer_array[1])) { $gapfill_gap = $right_answer_array[1]; } else { $gapfill_gap = ''; }
119
+					if (isset($right_answer_array[2])) { $gapfill_post = $right_answer_array[2]; } else { $gapfill_post = ''; }
120 120
 
121
-					if( ! $user_answer_content ) {
121
+					if ( ! $user_answer_content) {
122 122
 						$user_answer_content = '______';
123 123
 					}
124 124
 
125
-					$right_answer = $gapfill_pre . ' <span class="highlight">' . $gapfill_gap . '</span> ' . $gapfill_post;
126
-					$user_answer_content = $gapfill_pre . ' <span class="highlight">' . $user_answer_content . '</span> ' . $gapfill_post;
125
+					$right_answer = $gapfill_pre.' <span class="highlight">'.$gapfill_gap.'</span> '.$gapfill_post;
126
+					$user_answer_content = $gapfill_pre.' <span class="highlight">'.$user_answer_content.'</span> '.$gapfill_post;
127 127
 					$grade_type = 'auto-grade';
128 128
 
129 129
 				break;
130 130
 				case 'multi-line':
131
-					$type_name = __( 'Multi Line', 'woothemes-sensei' );
131
+					$type_name = __('Multi Line', 'woothemes-sensei');
132 132
 					$grade_type = 'manual-grade';
133 133
 				break;
134 134
 				case 'single-line':
135
-					$type_name = __( 'Single Line', 'woothemes-sensei' );
135
+					$type_name = __('Single Line', 'woothemes-sensei');
136 136
 					$grade_type = 'manual-grade';
137 137
 				break;
138 138
 				case 'file-upload':
139
-					$type_name = __( 'File Upload', 'woothemes-sensei' );
139
+					$type_name = __('File Upload', 'woothemes-sensei');
140 140
 					$grade_type = 'manual-grade';
141 141
 
142 142
 					// Get uploaded file
143
-					if( $user_answer_content ) {
143
+					if ($user_answer_content) {
144 144
 						$attachment_id = $user_answer_content;
145 145
 						$answer_media_url = $answer_media_filename = '';
146
-						if( 0 < intval( $attachment_id ) ) {
147
-							$answer_media_url = wp_get_attachment_url( $attachment_id );
148
-							$answer_media_filename = basename( $answer_media_url );
149
-							if( $answer_media_url && $answer_media_filename ) {
150
-								$user_answer_content = sprintf( __( 'Submitted file: %1$s', 'woothemes-sensei' ), '<a href="' . esc_url( $answer_media_url ) . '" target="_blank">' . esc_html( $answer_media_filename ) . '</a>' );
146
+						if (0 < intval($attachment_id)) {
147
+							$answer_media_url = wp_get_attachment_url($attachment_id);
148
+							$answer_media_filename = basename($answer_media_url);
149
+							if ($answer_media_url && $answer_media_filename) {
150
+								$user_answer_content = sprintf(__('Submitted file: %1$s', 'woothemes-sensei'), '<a href="'.esc_url($answer_media_url).'" target="_blank">'.esc_html($answer_media_filename).'</a>');
151 151
 							}
152 152
 						}
153 153
 					} else {
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
 			}
161 161
 			$user_answer_content = (array) $user_answer_content;
162 162
 			$right_answer = (array) $right_answer;
163
-			$question_title = sprintf( __( 'Question %d: ', 'woothemes-sensei' ), $count ) . $type_name;
163
+			$question_title = sprintf(__('Question %d: ', 'woothemes-sensei'), $count).$type_name;
164 164
 
165 165
 			$graded_class = '';
166
-			$user_question_grade = Sensei()->quiz->get_user_question_grade( $lesson_id, $question_id, $user_id );
166
+			$user_question_grade = Sensei()->quiz->get_user_question_grade($lesson_id, $question_id, $user_id);
167 167
 			$graded_class = 'ungraded';
168
-			if ( 0 == $question_grade_total && 0 == intval( $user_question_grade ) ) {
168
+			if (0 == $question_grade_total && 0 == intval($user_question_grade)) {
169 169
 				// Question skips grading
170 170
 				$grade_type = 'zero-graded';
171 171
 				$graded_class = '';
@@ -173,86 +173,86 @@  discard block
 block discarded – undo
173 173
 				++$graded_count;
174 174
 				$user_question_grade = 0;
175 175
 			}
176
-			elseif( intval( $user_question_grade ) > 0 ) {
176
+			elseif (intval($user_question_grade) > 0) {
177 177
 				$graded_class = 'user_right';
178 178
 				++$correct_answers;
179 179
 				$user_quiz_grade_total += $user_question_grade;
180 180
 				++$graded_count;
181 181
 			} else {
182
-				if( ! is_string( $user_question_grade ) && intval( $user_question_grade ) == 0 ) {
182
+				if ( ! is_string($user_question_grade) && intval($user_question_grade) == 0) {
183 183
 					$graded_class = 'user_wrong';
184 184
 					++$graded_count;
185 185
 				}
186 186
 				$user_question_grade = 0;
187 187
 			}
188 188
 
189
-			?><div class="postbox question_box <?php esc_attr_e( $type ); ?> <?php esc_attr_e( $grade_type ); ?> <?php esc_attr_e( $graded_class ); ?>" id="<?php esc_attr_e( 'question_' . $question_id . '_box' ); ?>">
189
+			?><div class="postbox question_box <?php esc_attr_e($type); ?> <?php esc_attr_e($grade_type); ?> <?php esc_attr_e($graded_class); ?>" id="<?php esc_attr_e('question_'.$question_id.'_box'); ?>">
190 190
 				<div class="handlediv" title="Click to toggle"><br></div>
191 191
 				<h3 class="hndle"><span><?php echo $question_title; ?></span></h3>
192 192
 				<div class="inside">
193 193
 					<div class="sensei-grading-actions">
194 194
 						<div class="actions">
195
-							<input type="hidden" class="question_id" value="<?php esc_attr_e( $question_id ); ?>" />
196
-							<input type="hidden" class="question_total_grade" name="question_total_grade" value="<?php echo esc_attr( $question_grade_total ); ?>" />
197
-							<span class="grading-mark icon_right"><input type="radio" class="<?php esc_attr_e( 'question_' . $question_id . '_right_option' ); ?>" name="<?php esc_attr_e( 'question_' . $question_id ); ?>" value="right" <?php checked( $graded_class, 'user_right', true ); ?> /></span>
198
-							<span class="grading-mark icon_wrong"><input type="radio" class="<?php esc_attr_e( 'question_' . $question_id . '_wrong_option' ); ?>" name="<?php esc_attr_e( 'question_' . $question_id ); ?>" value="wrong" <?php checked( $graded_class, 'user_wrong', true ); ?> /></span>
199
-							<input type="number" class="question-grade" name="<?php esc_attr_e( 'question_' . $question_id . '_grade' ); ?>" id="<?php esc_attr_e( 'question_' . $question_id . '_grade' ); ?>" value="<?php echo esc_attr( $user_question_grade ); ?>" min="0" max="<?php echo esc_attr( $question_grade_total ); ?>" />
195
+							<input type="hidden" class="question_id" value="<?php esc_attr_e($question_id); ?>" />
196
+							<input type="hidden" class="question_total_grade" name="question_total_grade" value="<?php echo esc_attr($question_grade_total); ?>" />
197
+							<span class="grading-mark icon_right"><input type="radio" class="<?php esc_attr_e('question_'.$question_id.'_right_option'); ?>" name="<?php esc_attr_e('question_'.$question_id); ?>" value="right" <?php checked($graded_class, 'user_right', true); ?> /></span>
198
+							<span class="grading-mark icon_wrong"><input type="radio" class="<?php esc_attr_e('question_'.$question_id.'_wrong_option'); ?>" name="<?php esc_attr_e('question_'.$question_id); ?>" value="wrong" <?php checked($graded_class, 'user_wrong', true); ?> /></span>
199
+							<input type="number" class="question-grade" name="<?php esc_attr_e('question_'.$question_id.'_grade'); ?>" id="<?php esc_attr_e('question_'.$question_id.'_grade'); ?>" value="<?php echo esc_attr($user_question_grade); ?>" min="0" max="<?php echo esc_attr($question_grade_total); ?>" />
200 200
 							<span class="question-grade-total"><?php echo $question_grade_total; ?></span>
201 201
 						</div>
202 202
 					</div>
203 203
 					<div class="sensei-grading-answer">
204
-						<h4><?php echo apply_filters( 'sensei_question_title', $question->post_title ); ?></h4>
205
-						<?php echo apply_filters( 'the_content', $question->post_content );?>
204
+						<h4><?php echo apply_filters('sensei_question_title', $question->post_title); ?></h4>
205
+						<?php echo apply_filters('the_content', $question->post_content); ?>
206 206
 						<p class="user-answer"><?php
207
-							foreach ( $user_answer_content as $_user_answer ) {
207
+							foreach ($user_answer_content as $_user_answer) {
208 208
 
209
-                                if( 'multi-line' == Sensei()->question->get_question_type( $question->ID ) ){
209
+                                if ('multi-line' == Sensei()->question->get_question_type($question->ID)) {
210 210
 
211
-                                    $_user_answer = htmlspecialchars_decode( nl2br( esc_html($_user_answer) ) );
211
+                                    $_user_answer = htmlspecialchars_decode(nl2br(esc_html($_user_answer)));
212 212
 
213 213
                                 }
214 214
 
215
-								echo apply_filters( 'sensei_answer_text', $_user_answer ) . "<br>";
215
+								echo apply_filters('sensei_answer_text', $_user_answer)."<br>";
216 216
 							}
217 217
 						?></p>
218 218
 						<div class="right-answer">
219
-							<h5><?php _e( 'Correct answer', 'woothemes-sensei' ) ?></h5>
219
+							<h5><?php _e('Correct answer', 'woothemes-sensei') ?></h5>
220 220
 							<span class="correct-answer"><?php
221
-								foreach ( $right_answer as $_right_answer ) {
221
+								foreach ($right_answer as $_right_answer) {
222 222
 
223
-									echo apply_filters( 'sensei_answer_text', $_right_answer ) . "<br>";
223
+									echo apply_filters('sensei_answer_text', $_right_answer)."<br>";
224 224
 
225 225
 								}
226 226
 							?></span>
227 227
 						</div>
228 228
 						<div class="answer-notes">
229
-							<h5><?php _e( 'Grading Notes', 'woothemes-sensei' ) ?></h5>
230
-							<textarea class="correct-answer" name="questions_feedback[<?php esc_attr_e( $question_id ); ?>]" placeholder="<?php _e( 'Add notes here...', 'woothemes-sensei' ) ?>"><?php echo $question_answer_notes; ?></textarea>
229
+							<h5><?php _e('Grading Notes', 'woothemes-sensei') ?></h5>
230
+							<textarea class="correct-answer" name="questions_feedback[<?php esc_attr_e($question_id); ?>]" placeholder="<?php _e('Add notes here...', 'woothemes-sensei') ?>"><?php echo $question_answer_notes; ?></textarea>
231 231
 						</div>
232 232
 					</div>
233 233
 				</div>
234 234
 			</div><?php
235 235
 		}
236 236
 
237
-		$quiz_grade = intval( $user_quiz_grade );
237
+		$quiz_grade = intval($user_quiz_grade);
238 238
 		$all_graded = 'no';
239
-		if( intval( $count ) == intval( $graded_count ) ) {
239
+		if (intval($count) == intval($graded_count)) {
240 240
 			$all_graded = 'yes';
241 241
 		}
242 242
 
243
-		?>  <input type="hidden" name="total_grade" id="total_grade" value="<?php esc_attr_e( $user_quiz_grade_total ); ?>" />
244
-			<input type="hidden" name="total_questions" id="total_questions" value="<?php esc_attr_e( $count ); ?>" />
245
-			<input type="hidden" name="quiz_grade_total" id="quiz_grade_total" value="<?php esc_attr_e( $quiz_grade_total ); ?>" />
246
-			<input type="hidden" name="total_graded_questions" id="total_graded_questions" value="<?php esc_attr_e( $graded_count ); ?>" />
247
-			<input type="hidden" name="all_questions_graded" id="all_questions_graded" value="<?php esc_attr_e( $all_graded ); ?>" />
243
+		?>  <input type="hidden" name="total_grade" id="total_grade" value="<?php esc_attr_e($user_quiz_grade_total); ?>" />
244
+			<input type="hidden" name="total_questions" id="total_questions" value="<?php esc_attr_e($count); ?>" />
245
+			<input type="hidden" name="quiz_grade_total" id="quiz_grade_total" value="<?php esc_attr_e($quiz_grade_total); ?>" />
246
+			<input type="hidden" name="total_graded_questions" id="total_graded_questions" value="<?php esc_attr_e($graded_count); ?>" />
247
+			<input type="hidden" name="all_questions_graded" id="all_questions_graded" value="<?php esc_attr_e($all_graded); ?>" />
248 248
 			<div class="total_grade_display">
249
-				<span><?php esc_attr_e( __( 'Grade:', 'woothemes-sensei' ) ); ?></span>
249
+				<span><?php esc_attr_e(__('Grade:', 'woothemes-sensei')); ?></span>
250 250
 				<span class="total_grade_total"><?php echo $user_quiz_grade_total; ?></span> / <span class="quiz_grade_total"><?php echo $quiz_grade_total; ?></span> (<span class="total_grade_percent"><?php echo $quiz_grade; ?></span>%)
251 251
 			</div>
252 252
 			<div class="buttons">
253
-				<input type="submit" value="<?php esc_attr_e( 'Save' ); ?>" class="grade-button button-primary" title="Saves grades as currently marked on this page" />
254
-				<input type="button" value="<?php esc_attr_e( __( 'Auto grade', 'woothemes-sensei' ) ); ?>" class="autograde-button button-secondary" title="Where possible, automatically grades questions that have not yet been graded" />
255
-				<input type="reset" value="<?php esc_attr_e( __( 'Reset', 'woothemes-sensei' ) ); ?>" class="reset-button button-secondary" title="Resets all questions to ungraded and total grade to 0" />
253
+				<input type="submit" value="<?php esc_attr_e('Save'); ?>" class="grade-button button-primary" title="Saves grades as currently marked on this page" />
254
+				<input type="button" value="<?php esc_attr_e(__('Auto grade', 'woothemes-sensei')); ?>" class="autograde-button button-secondary" title="Where possible, automatically grades questions that have not yet been graded" />
255
+				<input type="reset" value="<?php esc_attr_e(__('Reset', 'woothemes-sensei')); ?>" class="reset-button button-secondary" title="Resets all questions to ungraded and total grade to 0" />
256 256
 			</div>
257 257
 			<div class="clear"></div>
258 258
 			<script type="text/javascript">
@@ -271,4 +271,4 @@  discard block
 block discarded – undo
271 271
  * for backward compatibility
272 272
  * @since 1.9.0
273 273
  */
274
-class WooThemes_Sensei_Grading_User_Quiz extends Sensei_Grading_User_Quiz{}
274
+class WooThemes_Sensei_Grading_User_Quiz extends Sensei_Grading_User_Quiz {}
Please login to merge, or discard this patch.
widgets/widget-woothemes-sensei-course-component.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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 Course Component Widget
@@ -26,30 +26,30 @@  discard block
 block discarded – undo
26 26
 	public function __construct() {
27 27
 		/* Widget variable settings. */
28 28
 		$this->woo_widget_cssclass = 'widget_sensei_course_component';
29
-		$this->woo_widget_description = __( 'This widget will output a list of Courses - New, Featured, Free, Paid, Active, Completed.', 'woothemes-sensei' );
29
+		$this->woo_widget_description = __('This widget will output a list of Courses - New, Featured, Free, Paid, Active, Completed.', 'woothemes-sensei');
30 30
 		$this->woo_widget_idbase = 'sensei_course_component';
31
-		$this->woo_widget_title = __( 'Sensei - Course Component', 'woothemes-sensei' );
31
+		$this->woo_widget_title = __('Sensei - Course Component', 'woothemes-sensei');
32 32
 
33 33
 		$this->woo_widget_componentslist = array(
34
-												'usercourses' => __( 'New Courses', 'woothemes-sensei' ),
35
-												'featuredcourses' => __( 'Featured Courses', 'woothemes-sensei' ),
36
-												'activecourses' => __( 'My Active Courses', 'woothemes-sensei' ),
37
-												'completedcourses' => __( 'My Completed Courses', 'woothemes-sensei' ),
34
+												'usercourses' => __('New Courses', 'woothemes-sensei'),
35
+												'featuredcourses' => __('Featured Courses', 'woothemes-sensei'),
36
+												'activecourses' => __('My Active Courses', 'woothemes-sensei'),
37
+												'completedcourses' => __('My Completed Courses', 'woothemes-sensei'),
38 38
 												);
39 39
 
40 40
 		// Add support for the WooCommerce shelf.
41
-		if ( Sensei_WC::is_woocommerce_active() ) {
42
-			$this->woo_widget_componentslist['freecourses'] = __( 'Free Courses', 'woothemes-sensei' );
43
-			$this->woo_widget_componentslist['paidcourses'] = __( 'Paid Courses', 'woothemes-sensei' );
41
+		if (Sensei_WC::is_woocommerce_active()) {
42
+			$this->woo_widget_componentslist['freecourses'] = __('Free Courses', 'woothemes-sensei');
43
+			$this->woo_widget_componentslist['paidcourses'] = __('Paid Courses', 'woothemes-sensei');
44 44
 		}
45 45
 		/* Widget settings. */
46
-		$widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description );
46
+		$widget_ops = array('classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description);
47 47
 
48 48
 		/* Widget control settings. */
49
-		$control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase );
49
+		$control_ops = array('width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase);
50 50
 
51 51
 		/* Create the widget. */
52
-		parent::__construct( $this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops );
52
+		parent::__construct($this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops);
53 53
 	} // End __construct()
54 54
 
55 55
 	/**
@@ -59,44 +59,44 @@  discard block
 block discarded – undo
59 59
 	 * @param  array $instance Widget settings for this instance.
60 60
 	 * @return void
61 61
 	 */
62
-	public function widget( $args, $instance ) {
62
+	public function widget($args, $instance) {
63 63
 
64
-		remove_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 );
64
+		remove_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
65 65
 
66
-		if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) )
67
-            && ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] )
68
-            && !is_user_logged_in() ) {
66
+		if (in_array($instance['component'], array_keys($this->woo_widget_componentslist))
67
+            && ('activecourses' == $instance['component'] || 'completedcourses' == $instance['component'])
68
+            && ! is_user_logged_in()) {
69 69
 
70 70
 			// No Output
71 71
             return;
72 72
 
73 73
 		} else {
74 74
 			/* Our variables from the widget settings. */
75
-			$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
75
+			$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
76 76
 
77 77
 			/* Before widget (defined by themes). */
78 78
 			echo $args['before_widget'];
79 79
 
80 80
 			/* Display the widget title if one was input (before and after defined by themes). */
81
-			if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; }
81
+			if ($title) { echo $args['before_title'].$title.$args['after_title']; }
82 82
 
83 83
 			/* Widget content. */
84 84
 			// Add actions for plugins/themes to hook onto.
85
-			do_action( $this->woo_widget_cssclass . '_top' );
85
+			do_action($this->woo_widget_cssclass.'_top');
86 86
 
87
-			if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) ) {
88
-				$this->load_component( $instance );
87
+			if (in_array($instance['component'], array_keys($this->woo_widget_componentslist))) {
88
+				$this->load_component($instance);
89 89
 			}
90 90
 
91 91
 			// Add actions for plugins/themes to hook onto.
92
-			do_action( $this->woo_widget_cssclass . '_bottom' );
92
+			do_action($this->woo_widget_cssclass.'_bottom');
93 93
 
94 94
 			/* After widget (defined by themes). */
95 95
 			echo $args['after_widget'];
96 96
 
97 97
 		} // End If Statement
98 98
 
99
-		add_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 );
99
+		add_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
100 100
 
101 101
 	} // End widget()
102 102
 
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
 	 * @param  array $old_instance Previous settings.
108 108
 	 * @return array               Updated settings.
109 109
 	 */
110
-	public function update ( $new_instance, $old_instance ) {
110
+	public function update($new_instance, $old_instance) {
111 111
 		$instance = $old_instance;
112 112
 
113 113
 		/* Strip tags for title and name to remove HTML (important for text inputs). */
114
-		$instance['title'] = strip_tags( $new_instance['title'] );
114
+		$instance['title'] = strip_tags($new_instance['title']);
115 115
 
116 116
 		/* The select box is returning a text value, so we escape it. */
117
-		$instance['component'] = esc_attr( $new_instance['component'] );
117
+		$instance['component'] = esc_attr($new_instance['component']);
118 118
 
119 119
 		/* The select box is returning a text value, so we escape it. */
120
-		$instance['limit'] = esc_attr( $new_instance['limit'] );
120
+		$instance['limit'] = esc_attr($new_instance['limit']);
121 121
 
122 122
 
123 123
 		return $instance;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @param  array $instance The settings for this instance.
131 131
 	 * @return void
132 132
 	 */
133
-    public function form( $instance ) {
133
+    public function form($instance) {
134 134
 
135 135
 		/* Set up some default widget settings. */
136 136
 		/* Make sure all keys are added here, even with empty string values. */
@@ -140,26 +140,26 @@  discard block
 block discarded – undo
140 140
 						'limit' => 3
141 141
 					);
142 142
 
143
-		$instance = wp_parse_args( (array) $instance, $defaults );
143
+		$instance = wp_parse_args((array) $instance, $defaults);
144 144
 ?>
145 145
 		<!-- Widget Title: Text Input -->
146 146
 		<p>
147
-			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label>
148
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"  value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" />
147
+			<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
148
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('title')); ?>"  value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" />
149 149
 		</p>
150 150
 		<!-- Widget Component: Select Input -->
151 151
 		<p>
152
-			<label for="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"><?php _e( 'Component:', 'woothemes-sensei' ); ?></label>
153
-			<select name="<?php echo esc_attr( $this->get_field_name( 'component' ) ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>">
154
-			<?php foreach ( $this->woo_widget_componentslist as $k => $v ) { ?>
155
-				<option value="<?php echo esc_attr( $k ); ?>"<?php selected( $instance['component'], $k ); ?>><?php echo $v; ?></option>
152
+			<label for="<?php echo esc_attr($this->get_field_id('component')); ?>"><?php _e('Component:', 'woothemes-sensei'); ?></label>
153
+			<select name="<?php echo esc_attr($this->get_field_name('component')); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('component')); ?>">
154
+			<?php foreach ($this->woo_widget_componentslist as $k => $v) { ?>
155
+				<option value="<?php echo esc_attr($k); ?>"<?php selected($instance['component'], $k); ?>><?php echo $v; ?></option>
156 156
 			<?php } ?>
157 157
 			</select>
158 158
 		</p>
159 159
 		<!-- Widget Limit: Text Input -->
160 160
 		<p>
161
-			<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Courses (optional):', 'woothemes-sensei' ); ?></label>
162
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>"  value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" />
161
+			<label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Courses (optional):', 'woothemes-sensei'); ?></label>
162
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('limit')); ?>"  value="<?php echo esc_attr($instance['limit']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" />
163 163
 		</p>
164 164
 
165 165
 <?php
@@ -172,28 +172,28 @@  discard block
 block discarded – undo
172 172
 	 * @since  1.0.0
173 173
 	 * @return void
174 174
 	 */
175
-	protected function load_component ( $instance ) {
175
+	protected function load_component($instance) {
176 176
 		global  $current_user;
177 177
 
178 178
 		get_currentuserinfo();
179 179
 
180 180
 		$course_ids = array();
181
-		if ( 'activecourses' == esc_attr( $instance['component'] ) ) {
182
-			$courses = Sensei_Utils::sensei_check_for_activity( array( 'user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'in-progress' ), true );
181
+		if ('activecourses' == esc_attr($instance['component'])) {
182
+			$courses = Sensei_Utils::sensei_check_for_activity(array('user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'in-progress'), true);
183 183
 			// Need to always return an array, even with only 1 item
184
-			if ( !is_array($courses) ) {
185
-				$courses = array( $courses );
184
+			if ( ! is_array($courses)) {
185
+				$courses = array($courses);
186 186
 			}
187
-			foreach( $courses AS $course ) {
187
+			foreach ($courses AS $course) {
188 188
 				$course_ids[] = $course->comment_post_ID;
189 189
 			}
190
-		} elseif( 'completedcourses' == esc_attr( $instance['component'] ) ) {
191
-			$courses = Sensei_Utils::sensei_check_for_activity( array( 'user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'complete' ), true );
190
+		} elseif ('completedcourses' == esc_attr($instance['component'])) {
191
+			$courses = Sensei_Utils::sensei_check_for_activity(array('user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'complete'), true);
192 192
 			// Need to always return an array, even with only 1 item
193
-			if ( !is_array($courses) ) {
194
-				$courses = array( $courses );
193
+			if ( ! is_array($courses)) {
194
+				$courses = array($courses);
195 195
 			}
196
-			foreach( $courses AS $course ) {
196
+			foreach ($courses AS $course) {
197 197
 				$course_ids[] = $course->comment_post_ID;
198 198
 			}
199 199
 		} // End If Statement
@@ -201,19 +201,19 @@  discard block
 block discarded – undo
201 201
 		$posts_array = array();
202 202
 
203 203
 		// course_query() is buggy, it doesn't honour the 1st arg if includes are provided, so instead slice the includes
204
-		if ( !empty($instance['limit']) && intval( $instance['limit'] ) >= 1 && intval( $instance['limit'] ) < count($course_ids) ) {
204
+		if ( ! empty($instance['limit']) && intval($instance['limit']) >= 1 && intval($instance['limit']) < count($course_ids)) {
205 205
 
206
-			$course_ids = array_slice( $course_ids, 0, intval( $instance['limit'] ) ); // This does mean the order by is effectively ignored
206
+			$course_ids = array_slice($course_ids, 0, intval($instance['limit'])); // This does mean the order by is effectively ignored
207 207
 
208 208
 		}
209 209
 
210
-        if ( ! empty( $course_ids ) ) {
210
+        if ( ! empty($course_ids)) {
211 211
 
212
-            $posts_array = Sensei()->course->course_query( intval( $instance['limit'] ), esc_attr( $instance['component'] ), $course_ids );
212
+            $posts_array = Sensei()->course->course_query(intval($instance['limit']), esc_attr($instance['component']), $course_ids);
213 213
 
214 214
 		} else {
215 215
 
216
-            if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
216
+            if ('activecourses' == esc_attr($instance['component']) || 'completedcourses' == esc_attr($instance['component'])) {
217 217
 				$posts_array = array();
218 218
 
219 219
             } else {
@@ -226,43 +226,43 @@  discard block
 block discarded – undo
226 226
                     'posts_per_page' => $instance['limit'],
227 227
                 );
228 228
 
229
-				$posts_array = get_posts( $course_args );
229
+				$posts_array = get_posts($course_args);
230 230
 			}
231 231
 
232 232
 		} // End If Statement
233 233
 
234
-		if ( count( $posts_array ) > 0 ) { ?>
234
+		if (count($posts_array) > 0) { ?>
235 235
 			<ul>
236
-			<?php foreach ($posts_array as $post_item){
237
-		    	$post_id = absint( $post_item->ID );
236
+			<?php foreach ($posts_array as $post_item) {
237
+		    	$post_id = absint($post_item->ID);
238 238
 		    	$post_title = $post_item->post_title;
239
-		    	$user_info = get_userdata( absint( $post_item->post_author ) );
240
-		    	$author_link = get_author_posts_url( absint( $post_item->post_author ) );
239
+		    	$user_info = get_userdata(absint($post_item->post_author));
240
+		    	$author_link = get_author_posts_url(absint($post_item->post_author));
241 241
 		    	$author_display_name = $user_info->display_name;
242 242
 		    	$author_id = $post_item->post_author;
243 243
 		    ?>
244 244
 		    	<li class="fix">
245
-		    		<?php do_action( 'sensei_course_image', $post_id ); ?>
246
-		    		<a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a>
245
+		    		<?php do_action('sensei_course_image', $post_id); ?>
246
+		    		<a href="<?php echo esc_url(get_permalink($post_id)); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a>
247 247
 		    		<br />
248
-		    		<?php if ( isset( Sensei()->settings->settings[ 'course_author' ] ) && ( Sensei()->settings->settings[ 'course_author' ] ) ) { ?>
249
-    					<span class="course-author"><?php _e( 'by ', 'woothemes-sensei' ); ?><a href="<?php echo esc_url( $author_link ); ?>" title="<?php echo esc_attr( $author_display_name ); ?>"><?php echo esc_html( $author_display_name ); ?></a></span>
248
+		    		<?php if (isset(Sensei()->settings->settings['course_author']) && (Sensei()->settings->settings['course_author'])) { ?>
249
+    					<span class="course-author"><?php _e('by ', 'woothemes-sensei'); ?><a href="<?php echo esc_url($author_link); ?>" title="<?php echo esc_attr($author_display_name); ?>"><?php echo esc_html($author_display_name); ?></a></span>
250 250
     					<br />
251 251
     				<?php } // End If Statement ?>
252
-    				<span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count( $post_id ) . '&nbsp;' . __( 'Lessons', 'woothemes-sensei' ); ?></span>
252
+    				<span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count($post_id).'&nbsp;'.__('Lessons', 'woothemes-sensei'); ?></span>
253 253
     				<br />
254
-    				<?php sensei_simple_course_price( $post_id ); ?>
254
+    				<?php sensei_simple_course_price($post_id); ?>
255 255
 		    	</li>
256 256
 		    <?php } // End For Loop ?>
257
-		    <?php if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
258
-		    	$my_account_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] );
259
-		    	echo '<li class="my-account fix"><a href="'. esc_url( get_permalink( $my_account_page_id ) ) .'">'.__('My Courses', 'woothemes-sensei').' <span class="meta-nav"></span></a></li>';
257
+		    <?php if ('activecourses' == esc_attr($instance['component']) || 'completedcourses' == esc_attr($instance['component'])) {
258
+		    	$my_account_page_id = intval(Sensei()->settings->settings['my_course_page']);
259
+		    	echo '<li class="my-account fix"><a href="'.esc_url(get_permalink($my_account_page_id)).'">'.__('My Courses', 'woothemes-sensei').' <span class="meta-nav"></span></a></li>';
260 260
 		    } // End If Statement ?>
261 261
 		</ul>
262 262
 		<?php } else {
263 263
 			// No posts returned. This means the user either has no active or no completed courses.
264
-			$course_status = substr( esc_attr( $instance['component'] ) , 0, -7);
265
-			echo sprintf( __( 'You have no %1s courses.', 'woothemes-sensei' ), $course_status );
264
+			$course_status = substr(esc_attr($instance['component']), 0, -7);
265
+			echo sprintf(__('You have no %1s courses.', 'woothemes-sensei'), $course_status);
266 266
 		} // End If Statement
267 267
 	} // End load_component()
268 268
 } // End Class
269 269
\ No newline at end of file
Please login to merge, or discard this patch.