Completed
Pull Request — master (#1282)
by Dwain
04:58
created
includes/template-functions.php 1 patch
Spacing   +198 added lines, -198 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
 	 * 	Output tags.
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
      * @param string $type (default: 'newcourses')
13 13
      * @return void
14 14
      */
15
-    function sensei_course_archive_next_link( $type = 'newcourses' ) {
15
+    function sensei_course_archive_next_link($type = 'newcourses') {
16 16
 
17
-        _deprecated_function('sensei_course_archive_next_link', '1.9.0','This is no longer used or required in Sensei.');
17
+        _deprecated_function('sensei_course_archive_next_link', '1.9.0', 'This is no longer used or required in Sensei.');
18 18
 
19 19
     } // End sensei_course_archive_next_link()
20 20
 
@@ -26,20 +26,20 @@  discard block
 block discarded – undo
26 26
 	  */
27 27
 	 function course_single_lessons() {
28 28
 
29
-		 if ( ! is_singular( 'course' )  ) {
29
+		 if ( ! is_singular('course')) {
30 30
 			 return;
31 31
 		 }
32 32
 
33 33
          // load backwards compatible template name if it exists in the users theme
34
-         $located_template= locate_template( Sensei()->template_url . 'single-course/course-lessons.php' );
35
-         if( $located_template ){
34
+         $located_template = locate_template(Sensei()->template_url.'single-course/course-lessons.php');
35
+         if ($located_template) {
36 36
 
37
-             Sensei_Templates::get_template( 'single-course/course-lessons.php' );
37
+             Sensei_Templates::get_template('single-course/course-lessons.php');
38 38
              return;
39 39
 
40 40
         }
41 41
 
42
-		Sensei_Templates::get_template( 'single-course/lessons.php' );
42
+		Sensei_Templates::get_template('single-course/lessons.php');
43 43
 
44 44
 	 } // End course_single_lessons()
45 45
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	  */
53 53
 	 function lesson_single_meta() {
54 54
 
55
-         _deprecated_function('lesson_single_meta','1.9;0', 'WooThemes_Sensei_Lesson::the_lesson_meta' );
55
+         _deprecated_function('lesson_single_meta', '1.9;0', 'WooThemes_Sensei_Lesson::the_lesson_meta');
56 56
          sensei_the_single_lesson_meta();
57 57
 
58 58
 	 } // End lesson_single_meta()
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	  * @return void
67 67
       * @deprecated since 1.9.0
68 68
 	  */
69
-	 function quiz_questions( $return = false ) {
69
+	 function quiz_questions($return = false) {
70 70
 
71
-	 	Sensei_Templates::get_template( 'single-quiz/quiz-questions.php' );
71
+	 	Sensei_Templates::get_template('single-quiz/quiz-questions.php');
72 72
 
73 73
 	 } // End quiz_questions()
74 74
 
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	  * @return void
81 81
       * @deprecated
82 82
 	  */
83
-	 function quiz_question_type( $question_type = 'multiple-choice' ) {
83
+	 function quiz_question_type($question_type = 'multiple-choice') {
84 84
 
85
-         Sensei_Templates::get_template( 'single-quiz/question_type-' . $question_type . '.php' );
85
+         Sensei_Templates::get_template('single-quiz/question_type-'.$question_type.'.php');
86 86
 
87 87
 	 } // End lesson_single_meta()
88 88
 
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 	 * @param mixed $course_id
99 99
 	 * @return bool
100 100
 	 */
101
-	function sensei_check_prerequisite_course( $course_id ) {
101
+	function sensei_check_prerequisite_course($course_id) {
102 102
 
103
-        return Sensei_Course::is_prerequisite_complete( $course_id );
103
+        return Sensei_Course::is_prerequisite_complete($course_id);
104 104
 
105 105
 	} // End sensei_check_prerequisite_course()
106 106
 
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
 	 * @param mixed $course_id
113 113
 	 * @return void
114 114
 	 */
115
-	function sensei_start_course_form( $course_id ) {
115
+	function sensei_start_course_form($course_id) {
116 116
 
117
-		$prerequisite_complete = sensei_check_prerequisite_course( $course_id );
117
+		$prerequisite_complete = sensei_check_prerequisite_course($course_id);
118 118
 
119
-		if ( $prerequisite_complete ) {
120
-		?><form method="POST" action="<?php echo esc_url( get_permalink() ); ?>">
119
+		if ($prerequisite_complete) {
120
+		?><form method="POST" action="<?php echo esc_url(get_permalink()); ?>">
121 121
 
122
-    			<input type="hidden" name="<?php echo esc_attr( 'woothemes_sensei_start_course_noonce' ); ?>" id="<?php echo esc_attr( 'woothemes_sensei_start_course_noonce' ); ?>" value="<?php echo esc_attr( wp_create_nonce( 'woothemes_sensei_start_course_noonce' ) ); ?>" />
122
+    			<input type="hidden" name="<?php echo esc_attr('woothemes_sensei_start_course_noonce'); ?>" id="<?php echo esc_attr('woothemes_sensei_start_course_noonce'); ?>" value="<?php echo esc_attr(wp_create_nonce('woothemes_sensei_start_course_noonce')); ?>" />
123 123
 
124
-    			<span><input name="course_start" type="submit" class="course-start" value="<?php _e( 'Start taking this Course', 'woothemes-sensei' ); ?>"/></span>
124
+    			<span><input name="course_start" type="submit" class="course-start" value="<?php _e('Start taking this Course', 'woothemes-sensei'); ?>"/></span>
125 125
 
126 126
     		</form><?php
127 127
     	} // End If Statement
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 	 * @param mixed $course_id
137 137
 	 * @return void
138 138
 	 */
139
-	function sensei_wc_add_to_cart( $course_id ) {
139
+	function sensei_wc_add_to_cart($course_id) {
140 140
 
141
-		Sensei_WC::the_add_to_cart_button_html( $course_id );
141
+		Sensei_WC::the_add_to_cart_button_html($course_id);
142 142
 
143 143
 	} // End sensei_wc_add_to_cart()
144 144
 
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	 * @param int $wc_post_id (default: 0)
151 151
 	 * @return bool
152 152
 	 */
153
-	function sensei_check_if_product_is_in_cart( $wc_product_id = 0 ) {
154
-        return Sensei_WC::is_product_in_cart( $wc_product_id );
153
+	function sensei_check_if_product_is_in_cart($wc_product_id = 0) {
154
+        return Sensei_WC::is_product_in_cart($wc_product_id);
155 155
 	} // End sensei_check_if_product_is_in_cart()
156 156
 
157 157
 	/**
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
 	 * @param mixed $post_id
162 162
 	 * @return void
163 163
 	 */
164
-	function sensei_simple_course_price( $post_id ) {
164
+	function sensei_simple_course_price($post_id) {
165 165
 
166 166
 		//WooCommerce Pricing
167
-        if ( Sensei_WC::is_woocommerce_active() ) {
168
-    	    $wc_post_id = get_post_meta( $post_id, '_course_woocommerce_product', true );
169
-    	    if ( 0 < $wc_post_id ) {
167
+        if (Sensei_WC::is_woocommerce_active()) {
168
+    	    $wc_post_id = get_post_meta($post_id, '_course_woocommerce_product', true);
169
+    	    if (0 < $wc_post_id) {
170 170
     	    	// Get the product
171
-    	    	$product = Sensei()->sensei_get_woocommerce_product_object( $wc_post_id );
171
+    	    	$product = Sensei()->sensei_get_woocommerce_product_object($wc_post_id);
172 172
 
173
-    	    	if ( isset( $product ) && !empty( $product )  &&  $product->is_purchasable() && $product->is_in_stock() && !sensei_check_if_product_is_in_cart( $wc_post_id ) ) { ?>
173
+    	    	if (isset($product) && ! empty($product) && $product->is_purchasable() && $product->is_in_stock() && ! sensei_check_if_product_is_in_cart($wc_post_id)) { ?>
174 174
     	    		<span class="course-price"><?php echo $product->get_price_html(); ?></span>
175 175
     	    	<?php } // End If Statement
176 176
     	    } // End If Statement
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 	 * @param array $widget_args (default: array())
185 185
 	 * @return array
186 186
 	 */
187
-	function sensei_recent_comments_widget_filter( $widget_args = array() ) {
188
-		if ( ! isset( $widget_args['post_type'] ) ) $widget_args['post_type'] = array( 'post', 'page' );
187
+	function sensei_recent_comments_widget_filter($widget_args = array()) {
188
+		if ( ! isset($widget_args['post_type'])) $widget_args['post_type'] = array('post', 'page');
189 189
 		return $widget_args;
190 190
 	} // End sensei_recent_comments_widget_filter()
191
-	add_filter( 'widget_comments_args', 'sensei_recent_comments_widget_filter', 10, 1 );
191
+	add_filter('widget_comments_args', 'sensei_recent_comments_widget_filter', 10, 1);
192 192
 
193 193
 	/**
194 194
 	 * sensei_course_archive_filter function.
@@ -197,26 +197,26 @@  discard block
 block discarded – undo
197 197
 	 * @param WP_Query $query ( default: array ( ) )
198 198
 	 * @return void
199 199
 	 */
200
-	function sensei_course_archive_filter( $query ) {
200
+	function sensei_course_archive_filter($query) {
201 201
 
202 202
 
203
-		if ( ! $query->is_main_query() )
203
+		if ( ! $query->is_main_query())
204 204
         	return;
205 205
 
206 206
 		// Apply Filter only if on frontend and when course archive is running
207
-		$course_page_id = intval( Sensei()->settings->settings[ 'course_page' ] );
207
+		$course_page_id = intval(Sensei()->settings->settings['course_page']);
208 208
 
209
-		if ( ! is_admin() && 0 < $course_page_id && 0 < intval( $query->get( 'page_id' ) ) && $query->get( 'page_id' ) == $course_page_id ) {
209
+		if ( ! is_admin() && 0 < $course_page_id && 0 < intval($query->get('page_id')) && $query->get('page_id') == $course_page_id) {
210 210
 			// Check for pagination settings
211
-   			if ( isset( Sensei()->settings->settings[ 'course_archive_amount' ] ) && ( 0 < absint( Sensei()->settings->settings[ 'course_archive_amount' ] ) ) ) {
212
-    			$amount = absint( Sensei()->settings->settings[ 'course_archive_amount' ] );
211
+   			if (isset(Sensei()->settings->settings['course_archive_amount']) && (0 < absint(Sensei()->settings->settings['course_archive_amount']))) {
212
+    			$amount = absint(Sensei()->settings->settings['course_archive_amount']);
213 213
     		} else {
214
-    			$amount = $query->get( 'posts_per_page' );
214
+    			$amount = $query->get('posts_per_page');
215 215
     		} // End If Statement
216
-    		$query->set( 'posts_per_page', $amount );
216
+    		$query->set('posts_per_page', $amount);
217 217
 		} // End If Statement
218 218
 	} // End sensei_course_archive_filter()
219
-	add_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 );
219
+	add_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
220 220
 
221 221
 	/**
222 222
 	 * sensei_complete_lesson_button description
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	 * @return html
225 225
 	 */
226 226
 	function sensei_complete_lesson_button() {
227
-		do_action( 'sensei_complete_lesson_button' );
227
+		do_action('sensei_complete_lesson_button');
228 228
 	} // End sensei_complete_lesson_button()
229 229
 
230 230
 	/**
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 * @return html
234 234
 	 */
235 235
 	function sensei_reset_lesson_button() {
236
-		do_action( 'sensei_reset_lesson_button' );
236
+		do_action('sensei_reset_lesson_button');
237 237
 	} // End sensei_reset_lesson_button()
238 238
 
239 239
 	/**
@@ -242,20 +242,20 @@  discard block
 block discarded – undo
242 242
 	 * @param  integer $lesson_id
243 243
 	 * @return array $return_values
244 244
 	 */
245
-	function sensei_get_prev_next_lessons( $lesson_id = 0 ) {
245
+	function sensei_get_prev_next_lessons($lesson_id = 0) {
246 246
 
247 247
 		$return_values = array();
248 248
 		$return_values['prev_lesson'] = 0;
249 249
 		$return_values['next_lesson'] = 0;
250
-		if ( 0 < $lesson_id ) {
250
+		if (0 < $lesson_id) {
251 251
 			// Get the List of Lessons in the Course
252
-			$lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true );
252
+			$lesson_course_id = get_post_meta($lesson_id, '_lesson_course', true);
253 253
 			$all_lessons = array();
254 254
 
255
-            $modules = Sensei()->modules->get_course_modules( intval( $lesson_course_id ) );
255
+            $modules = Sensei()->modules->get_course_modules(intval($lesson_course_id));
256 256
 
257
-            if( !empty( $modules )  ){
258
-                foreach( (array) $modules as $module ) {
257
+            if ( ! empty($modules)) {
258
+                foreach ((array) $modules as $module) {
259 259
 
260 260
                     $args = array(
261 261
                         'post_type' => 'lesson',
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
                         'meta_query' => array(
265 265
                             array(
266 266
                                 'key' => '_lesson_course',
267
-                                'value' => intval( $lesson_course_id ),
267
+                                'value' => intval($lesson_course_id),
268 268
                                 'compare' => '='
269 269
                             )
270 270
                         ),
@@ -272,18 +272,18 @@  discard block
 block discarded – undo
272 272
                             array(
273 273
                                 'taxonomy' => Sensei()->modules->taxonomy,
274 274
                                 'field' => 'id',
275
-                                'terms' => intval( $module->term_id )
275
+                                'terms' => intval($module->term_id)
276 276
                             )
277 277
                         ),
278
-                        'meta_key' => '_order_module_' . $module->term_id,
278
+                        'meta_key' => '_order_module_'.$module->term_id,
279 279
                         'orderby' => 'meta_value_num date',
280 280
                         'order' => 'ASC',
281 281
                         'suppress_filters' => 0
282 282
                     );
283 283
 
284
-                    $lessons = get_posts( $args );
285
-                    if ( 0 < count( $lessons ) ) {
286
-                        foreach ($lessons as $lesson_item){
284
+                    $lessons = get_posts($args);
285
+                    if (0 < count($lessons)) {
286
+                        foreach ($lessons as $lesson_item) {
287 287
                             $all_lessons[] = $lesson_item->ID;
288 288
                         } // End For Loop
289 289
                     } // End If Statement
@@ -296,36 +296,36 @@  discard block
 block discarded – undo
296 296
                 'post_type' => 'lesson',
297 297
                 'posts_per_page' => -1,
298 298
                 'suppress_filters' => 0,
299
-                'meta_key' => '_order_' . $lesson_course_id,
299
+                'meta_key' => '_order_'.$lesson_course_id,
300 300
                 'orderby' => 'meta_value_num date',
301 301
                 'order' => 'ASC',
302 302
                 'meta_query' => array(
303 303
                     array(
304 304
                         'key' => '_lesson_course',
305
-                        'value' => intval( $lesson_course_id ),
305
+                        'value' => intval($lesson_course_id),
306 306
                     ),
307 307
                 ),
308 308
                 'post__not_in' => $all_lessons,
309 309
             );
310 310
 
311
-            $other_lessons = get_posts( $args );
312
-            if ( 0 < count( $other_lessons ) ) {
313
-				foreach ($other_lessons as $lesson_item){
311
+            $other_lessons = get_posts($args);
312
+            if (0 < count($other_lessons)) {
313
+				foreach ($other_lessons as $lesson_item) {
314 314
 					$all_lessons[] = $lesson_item->ID;
315 315
 				} // End For Loop
316 316
 			} // End If Statement
317 317
 
318
-            if ( 0 < count( $all_lessons ) ) {
318
+            if (0 < count($all_lessons)) {
319 319
 				$found_index = false;
320
-				foreach ( $all_lessons as $lesson ){
321
-					if ( $found_index && $return_values['next_lesson'] == 0 ) {
320
+				foreach ($all_lessons as $lesson) {
321
+					if ($found_index && $return_values['next_lesson'] == 0) {
322 322
 						$return_values['next_lesson'] = $lesson;
323 323
 					} // End If Statement
324
-					if ( $lesson == $lesson_id ) {
324
+					if ($lesson == $lesson_id) {
325 325
 						// Is the current post
326 326
 						$found_index = true;
327 327
 					} // End If Statement
328
-					if ( !$found_index ) {
328
+					if ( ! $found_index) {
329 329
 						$return_values['prev_lesson'] = $lesson;
330 330
 					} // End If Statement
331 331
 				} // End For Loop
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
    * @param  int|WP_Post $post_id Optional. Defaults to current post
345 345
    * @return string $excerpt
346 346
    */
347
-  function sensei_get_excerpt( $post_id = '' ) {
347
+  function sensei_get_excerpt($post_id = '') {
348 348
 
349 349
       global $post;
350 350
       _deprecated_function('sensei_get_excerpt', 'use the wordpress excerpt functionality.');
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
 
353 353
   }
354 354
 
355
-	function sensei_has_user_started_course( $post_id = 0, $user_id = 0 ) {
356
-		_deprecated_function( __FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_started_course()" );
357
-		return Sensei_Utils::user_started_course( $post_id, $user_id );
355
+	function sensei_has_user_started_course($post_id = 0, $user_id = 0) {
356
+		_deprecated_function(__FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_started_course()");
357
+		return Sensei_Utils::user_started_course($post_id, $user_id);
358 358
 	} // End sensei_has_user_started_course()
359 359
 
360
-	function sensei_has_user_completed_lesson( $post_id = 0, $user_id = 0 ) {
361
-		_deprecated_function( __FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_completed_lesson()" );
362
-		return Sensei_Utils::user_completed_lesson( $post_id, $user_id );
360
+	function sensei_has_user_completed_lesson($post_id = 0, $user_id = 0) {
361
+		_deprecated_function(__FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_completed_lesson()");
362
+		return Sensei_Utils::user_completed_lesson($post_id, $user_id);
363 363
 	} // End sensei_has_user_completed_lesson()
364 364
 
365 365
 /**
@@ -371,9 +371,9 @@  discard block
 block discarded – undo
371 371
  * @param int $user_id
372 372
  * @return bool
373 373
 */
374
-function sensei_has_user_completed_prerequisite_lesson( $current_lesson_id, $user_id ) {
374
+function sensei_has_user_completed_prerequisite_lesson($current_lesson_id, $user_id) {
375 375
 
376
-    return WooThemes_Sensei_Lesson::is_pre_requisite_complete( $current_lesson_id, $user_id );
376
+    return WooThemes_Sensei_Lesson::is_pre_requisite_complete($current_lesson_id, $user_id);
377 377
 
378 378
 } // End sensei_has_user_completed_prerequisite_lesson()
379 379
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
  * @return bool
397 397
  *
398 398
  */
399
-function sensei_have_modules( $course_post_id = '' ){
399
+function sensei_have_modules($course_post_id = '') {
400 400
 
401 401
 	global $post, $wp_query, $sensei_modules_loop;
402 402
 
@@ -404,23 +404,23 @@  discard block
 block discarded – undo
404 404
 	wp_reset_query();
405 405
 	$post = $wp_query->post;
406 406
 
407
-	if( empty( $course_post_id ) ){
407
+	if (empty($course_post_id)) {
408 408
 
409 409
 		$course_id = $post->ID;
410 410
 
411 411
 	}
412 412
 
413 413
 	// doesn't apply to none course post types
414
-	if( ! sensei_is_a_course( $course_id )  ){
414
+	if ( ! sensei_is_a_course($course_id)) {
415 415
 		return false;
416 416
 	}
417 417
 
418 418
 	// check the current item compared to the total number of modules
419
-	if( $sensei_modules_loop[ 'current' ] + 1 > $sensei_modules_loop[ 'total' ]  ){
419
+	if ($sensei_modules_loop['current'] + 1 > $sensei_modules_loop['total']) {
420 420
 
421 421
 		return false;
422 422
 
423
-	}else{
423
+	} else {
424 424
 
425 425
 		return true;
426 426
 
@@ -434,27 +434,27 @@  discard block
 block discarded – undo
434 434
  *
435 435
  * @since 1.9.0
436 436
  */
437
-function sensei_setup_module(){
437
+function sensei_setup_module() {
438 438
 
439 439
 	global  $sensei_modules_loop, $wp_query;
440 440
 
441 441
 	// increment the index
442
-	$sensei_modules_loop[ 'current' ]++;
443
-	$index = $sensei_modules_loop[ 'current' ];
444
-	if( isset( $sensei_modules_loop['modules'][ $index ] ) ) {
442
+	$sensei_modules_loop['current']++;
443
+	$index = $sensei_modules_loop['current'];
444
+	if (isset($sensei_modules_loop['modules'][$index])) {
445 445
 
446 446
 		$sensei_modules_loop['current_module'] = $sensei_modules_loop['modules'][$index];
447 447
 		// setup the query for the module lessons
448 448
 		$course_id = $sensei_modules_loop['course_id'];
449 449
 		$module_term_id = $sensei_modules_loop['current_module']->term_id;
450
-		$modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id );
450
+		$modules_query = Sensei()->modules->get_lessons_query($course_id, $module_term_id);
451 451
 
452 452
 		// setup the global wp-query only if the lessons
453
-		if( $modules_query->have_posts() ){
453
+		if ($modules_query->have_posts()) {
454 454
 
455 455
 			$wp_query = $modules_query;
456 456
 
457
-		}else{
457
+		} else {
458 458
 
459 459
 			wp_reset_query();
460 460
 
@@ -478,30 +478,30 @@  discard block
 block discarded – undo
478 478
  *
479 479
  * @return bool
480 480
  */
481
-function sensei_module_has_lessons(){
481
+function sensei_module_has_lessons() {
482 482
 
483 483
 	global $wp_query, $sensei_modules_loop;
484 484
 
485
-	if( 'lesson' == $wp_query->get('post_type') ){
485
+	if ('lesson' == $wp_query->get('post_type')) {
486 486
 
487 487
 		return have_posts();
488 488
 
489
-	}else{
489
+	} else {
490 490
 
491 491
         // if the loop has not been initiated check the first module has lessons
492
-        if( -1 == $sensei_modules_loop[ 'current' ]  ){
492
+        if ( -1 == $sensei_modules_loop['current']  ) {
493 493
 
494 494
             $index = 0;
495 495
 
496
-            if( isset( $sensei_modules_loop['modules'][ $index ] ) ) {
496
+            if (isset($sensei_modules_loop['modules'][$index])) {
497 497
                 // setup the query for the module lessons
498 498
                 $course_id = $sensei_modules_loop['course_id'];
499 499
 
500
-                $module_term_id = $sensei_modules_loop['modules'][ $index ] ->term_id;
501
-                $modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id );
500
+                $module_term_id = $sensei_modules_loop['modules'][$index] ->term_id;
501
+                $modules_query = Sensei()->modules->get_lessons_query($course_id, $module_term_id);
502 502
 
503 503
                 // setup the global wp-query only if the lessons
504
-                if( $modules_query->have_posts() ){
504
+                if ($modules_query->have_posts()) {
505 505
 
506 506
                     return true;
507 507
 
@@ -525,9 +525,9 @@  discard block
 block discarded – undo
525 525
  * @uses sensei_the_module_title
526 526
  * @return string
527 527
  */
528
-function sensei_the_module_title_attribute(){
528
+function sensei_the_module_title_attribute() {
529 529
 
530
-	esc_attr_e( sensei_get_the_module_title() );
530
+	esc_attr_e(sensei_get_the_module_title());
531 531
 
532 532
 }
533 533
 
@@ -538,11 +538,11 @@  discard block
 block discarded – undo
538 538
  *
539 539
  * @return string
540 540
  */
541
-function sensei_the_module_permalink(){
541
+function sensei_the_module_permalink() {
542 542
 
543 543
 	global $sensei_modules_loop;
544 544
 	$course_id = $sensei_modules_loop['course_id'];
545
-	$module_url = add_query_arg('course_id', $course_id, get_term_link( $sensei_modules_loop['current_module'], 'module' ) );
545
+	$module_url = add_query_arg('course_id', $course_id, get_term_link($sensei_modules_loop['current_module'], 'module'));
546 546
 	$module_term_id = $sensei_modules_loop['current_module']->term_id;
547 547
 
548 548
 	/**
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 	 * @param int $module_term_id
555 555
 	 * @param string $course_id
556 556
 	 */
557
-	 echo esc_url_raw( apply_filters( 'sensei_the_module_permalink', $module_url, $module_term_id  ,$course_id ) );
557
+	 echo esc_url_raw(apply_filters('sensei_the_module_permalink', $module_url, $module_term_id, $course_id));
558 558
 
559 559
 }// end sensei_the_module_permalink
560 560
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
  *
567 567
  * @return string
568 568
  */
569
-function sensei_get_the_module_title(){
569
+function sensei_get_the_module_title() {
570 570
 
571 571
 	global $sensei_modules_loop;
572 572
 
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 	 * @param $module_term_id
586 586
 	 * @param $course_id
587 587
 	 */
588
-	return apply_filters( 'sensei_the_module_title',  $module_title , $module_term_id, $course_id );
588
+	return apply_filters('sensei_the_module_title', $module_title, $module_term_id, $course_id);
589 589
 
590 590
 }
591 591
 
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
  * @uses sensei_get_the_module_title
598 598
  * @return string
599 599
  */
600
-function sensei_the_module_title(){
600
+function sensei_the_module_title() {
601 601
 
602 602
 	echo sensei_get_the_module_title();
603 603
 
@@ -610,9 +610,9 @@  discard block
 block discarded – undo
610 610
  * @since 1.9.0
611 611
  * @return string
612 612
  */
613
-function sensei_get_the_module_status(){
613
+function sensei_get_the_module_status() {
614 614
 
615
-	if( ! is_user_logged_in() ){
615
+	if ( ! is_user_logged_in()) {
616 616
 		return '';
617 617
 	}
618 618
 
@@ -620,10 +620,10 @@  discard block
 block discarded – undo
620 620
     $module_title = $sensei_modules_loop['current_module']->name;
621 621
     $module_term_id = $sensei_modules_loop['current_module']->term_id;
622 622
     $course_id = $sensei_modules_loop['course_id'];
623
-    $module_progress = Sensei()->modules->get_user_module_progress( $module_term_id, $course_id, get_current_user_id() );
623
+    $module_progress = Sensei()->modules->get_user_module_progress($module_term_id, $course_id, get_current_user_id());
624 624
 
625
-    $module_status =  '';
626
-    if ( $module_progress && $module_progress > 0) {
625
+    $module_status = '';
626
+    if ($module_progress && $module_progress > 0) {
627 627
 
628 628
         $module_status = __('Completed', 'woothemes-sensei');
629 629
 
@@ -635,12 +635,12 @@  discard block
 block discarded – undo
635 635
 
636 636
     }
637 637
 
638
-	if ( empty( $module_status ) ){
638
+	if (empty($module_status)) {
639 639
 		return '';
640 640
 	}
641 641
 
642
-	$status_class = strtolower( str_replace( ' ', '-', $module_status  ) );
643
-    $module_status_html = '<p class="status module-status ' . $status_class . '">'
642
+	$status_class = strtolower(str_replace(' ', '-', $module_status));
643
+    $module_status_html = '<p class="status module-status '.$status_class.'">'
644 644
                             . $module_status
645 645
                             . '</p>';
646 646
 
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
      * @param $module_term_id
656 656
      * @param $course_id
657 657
      */
658
-    return apply_filters( 'sensei_the_module_status_html',  $module_status_html , $module_term_id, $course_id );
658
+    return apply_filters('sensei_the_module_status_html', $module_status_html, $module_term_id, $course_id);
659 659
 
660 660
 }
661 661
 
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
  * Print out the current module status
664 664
  * @since 1.9.0
665 665
  */
666
-function sensei_the_module_status(){
666
+function sensei_the_module_status() {
667 667
 
668 668
     echo sensei_get_the_module_status();
669 669
 
@@ -684,19 +684,19 @@  discard block
 block discarded – undo
684 684
  *
685 685
  * @return bool
686 686
  */
687
-function sensei_quiz_has_questions(){
687
+function sensei_quiz_has_questions() {
688 688
 
689 689
     global $sensei_question_loop;
690 690
 
691
-    if( !isset( $sensei_question_loop['total'] ) ){
691
+    if ( ! isset($sensei_question_loop['total'])) {
692 692
         return false;
693 693
     }
694 694
 
695
-    if( $sensei_question_loop['current'] + 1 < $sensei_question_loop['total']  ){
695
+    if ($sensei_question_loop['current'] + 1 < $sensei_question_loop['total']) {
696 696
 
697 697
         return true;
698 698
 
699
-    }else{
699
+    } else {
700 700
 
701 701
         return false;
702 702
 
@@ -713,13 +713,13 @@  discard block
 block discarded – undo
713 713
  * @since 1.9.0
714 714
 
715 715
  */
716
-function sensei_setup_the_question(){
716
+function sensei_setup_the_question() {
717 717
 
718 718
     global $sensei_question_loop;
719 719
 
720 720
     $sensei_question_loop['current']++;
721 721
     $index = $sensei_question_loop['current'];
722
-    $sensei_question_loop['current_question'] =  $sensei_question_loop['questions'][ $index ] ;
722
+    $sensei_question_loop['current_question'] = $sensei_question_loop['questions'][$index];
723 723
 
724 724
 
725 725
 }// end sensei_setup_the_question
@@ -730,14 +730,14 @@  discard block
 block discarded – undo
730 730
  * This function gets the type and loads the template that will handle it.
731 731
  *
732 732
  */
733
-function sensei_the_question_content(){
733
+function sensei_the_question_content() {
734 734
 
735 735
     global $sensei_question_loop;
736 736
 
737
-    $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID );
737
+    $question_type = Sensei()->question->get_question_type($sensei_question_loop['current_question']->ID);
738 738
 
739 739
     // load the template that displays the question information.
740
-    WooThemes_Sensei_Question::load_question_template( $question_type );
740
+    WooThemes_Sensei_Question::load_question_template($question_type);
741 741
 
742 742
 }// end sensei_the_question_content
743 743
 
@@ -746,11 +746,11 @@  discard block
 block discarded – undo
746 746
  *
747 747
  * @since 1.9.0
748 748
  */
749
-function sensei_the_question_class(){
749
+function sensei_the_question_class() {
750 750
 
751 751
     global $sensei_question_loop;
752 752
 
753
-    $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID );
753
+    $question_type = Sensei()->question->get_question_type($sensei_question_loop['current_question']->ID);
754 754
 
755 755
     /**
756 756
      * filter the sensei question class within
@@ -758,16 +758,16 @@  discard block
 block discarded – undo
758 758
      *
759 759
      * @since 1.9.0
760 760
      */
761
-     $classes = apply_filters( 'sensei_question_classes', array( $question_type ) );
761
+     $classes = apply_filters('sensei_question_classes', array($question_type));
762 762
 
763 763
     $html_classes = '';
764
-    foreach( $classes as $class ){
764
+    foreach ($classes as $class) {
765 765
 
766
-        $html_classes .= $class . ' ';
766
+        $html_classes .= $class.' ';
767 767
 
768 768
     }// end foreach
769 769
 
770
-    esc_attr_e( trim( $html_classes ) );
770
+    esc_attr_e(trim($html_classes));
771 771
 
772 772
 }
773 773
 
@@ -776,10 +776,10 @@  discard block
 block discarded – undo
776 776
  *
777 777
  * @since 1.9.0
778 778
  */
779
-function sensei_get_the_question_id( ){
779
+function sensei_get_the_question_id( ) {
780 780
 
781 781
     global $sensei_question_loop;
782
-    if( isset( $sensei_question_loop['current_question']->ID ) ){
782
+    if (isset($sensei_question_loop['current_question']->ID)) {
783 783
 
784 784
         return $sensei_question_loop['current_question']->ID;
785 785
 
@@ -808,27 +808,27 @@  discard block
 block discarded – undo
808 808
  * @param string $lesson_id
809 809
  * @return bool
810 810
  */
811
-function sensei_can_user_view_lesson( $lesson_id = '', $user_id = ''  ){
811
+function sensei_can_user_view_lesson($lesson_id = '', $user_id = '') {
812 812
 
813
-    if( empty( $lesson_id ) ){
813
+    if (empty($lesson_id)) {
814 814
 
815 815
         $lesson_id = get_the_ID();
816 816
 
817 817
     }
818 818
 
819
-    if( empty( $user_id ) ){
819
+    if (empty($user_id)) {
820 820
 
821 821
         $user_id = get_current_user_id();
822 822
 
823 823
     }
824 824
 
825 825
     // Check for prerequisite lesson completions
826
-    $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete( $lesson_id, $user_id );
827
-    $lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true );
828
-    $user_taking_course = Sensei_Utils::user_started_course( $lesson_course_id, $user_id );
826
+    $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete($lesson_id, $user_id);
827
+    $lesson_course_id = get_post_meta($lesson_id, '_lesson_course', true);
828
+    $user_taking_course = Sensei_Utils::user_started_course($lesson_course_id, $user_id);
829 829
 
830 830
     $is_preview = false;
831
-    if( Sensei_Utils::is_preview_lesson( $lesson_id ) ) {
831
+    if (Sensei_Utils::is_preview_lesson($lesson_id)) {
832 832
 
833 833
         $is_preview = true;
834 834
         $pre_requisite_complete = true;
@@ -836,24 +836,24 @@  discard block
 block discarded – undo
836 836
     };
837 837
 
838 838
 
839
-    $user_can_access_lesson =  false;
839
+    $user_can_access_lesson = false;
840 840
 
841
-    if( is_user_logged_in() && $user_taking_course ){
841
+    if (is_user_logged_in() && $user_taking_course) {
842 842
 
843
-        $user_can_access_lesson =  true;
843
+        $user_can_access_lesson = true;
844 844
 
845 845
     }
846 846
 
847 847
 
848 848
     $access_permission = false;
849 849
 
850
-    if ( ! Sensei()->settings->get('access_permission')  || sensei_all_access() ) {
850
+    if ( ! Sensei()->settings->get('access_permission') || sensei_all_access()) {
851 851
 
852 852
         $access_permission = true;
853 853
 
854 854
     }
855 855
 
856
-    $can_user_view_lesson = $access_permission || ( $user_can_access_lesson && $pre_requisite_complete ) || $is_preview;
856
+    $can_user_view_lesson = $access_permission || ($user_can_access_lesson && $pre_requisite_complete) || $is_preview;
857 857
 
858 858
     /**
859 859
      * Filter the can user view lesson function
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
      * @param string $lesson_id
867 867
      * @param string $user_id
868 868
      */
869
-    return apply_filters( 'sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id );
869
+    return apply_filters('sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id);
870 870
 
871 871
 } // end sensei_can_current_user_view_lesson
872 872
 
@@ -876,51 +876,51 @@  discard block
 block discarded – undo
876 876
  * The function should only be called on the single lesson
877 877
  *
878 878
  */
879
-function sensei_the_single_lesson_meta(){
879
+function sensei_the_single_lesson_meta() {
880 880
 
881 881
     // if the lesson meta is included within theme load that instead of the function content
882
-    $template = Sensei_Templates::locate_template( 'single-lesson/lesson-meta.php' );
883
-    if( ! empty( $template ) ){
882
+    $template = Sensei_Templates::locate_template('single-lesson/lesson-meta.php');
883
+    if ( ! empty($template)) {
884 884
 
885
-        Sensei_Templates::get_template( 'single-lesson/lesson-meta.php' );
885
+        Sensei_Templates::get_template('single-lesson/lesson-meta.php');
886 886
         return;
887 887
 
888 888
     }
889 889
 
890 890
     // Get the meta info
891
-    $lesson_course_id = absint( get_post_meta( get_the_ID(), '_lesson_course', true ) );
892
-    $is_preview = Sensei_Utils::is_preview_lesson( get_the_ID() );
891
+    $lesson_course_id = absint(get_post_meta(get_the_ID(), '_lesson_course', true));
892
+    $is_preview = Sensei_Utils::is_preview_lesson(get_the_ID());
893 893
 
894 894
     // Complete Lesson Logic
895
-    do_action( 'sensei_complete_lesson' );
895
+    do_action('sensei_complete_lesson');
896 896
     // Check that the course has been started
897
-    if ( Sensei()->access_settings()
898
-        || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id())
899
-        || $is_preview ) {
897
+    if (Sensei()->access_settings()
898
+        || Sensei_Utils::user_started_course($lesson_course_id, get_current_user_id())
899
+        || $is_preview) {
900 900
         ?>
901 901
         <section class="lesson-meta">
902 902
             <?php
903
-            if( apply_filters( 'sensei_video_position', 'top', get_the_ID() ) == 'bottom' ) {
903
+            if (apply_filters('sensei_video_position', 'top', get_the_ID()) == 'bottom') {
904 904
 
905
-                do_action( 'sensei_lesson_video', get_the_ID() );
905
+                do_action('sensei_lesson_video', get_the_ID());
906 906
 
907 907
             }
908 908
             ?>
909
-            <?php do_action( 'sensei_frontend_messages' ); ?>
909
+            <?php do_action('sensei_frontend_messages'); ?>
910 910
 
911 911
             <?php if ( ! $is_preview
912
-                || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) ) {
912
+                || Sensei_Utils::user_started_course($lesson_course_id, get_current_user_id())) {
913 913
 
914
-                sensei_do_deprecated_action( 'sensei_lesson_quiz_meta','1.9.0', 'sensei_single_lesson_content_inside_before' ,array( get_the_ID(), get_current_user_id() )  );
914
+                sensei_do_deprecated_action('sensei_lesson_quiz_meta', '1.9.0', 'sensei_single_lesson_content_inside_before', array(get_the_ID(), get_current_user_id()));
915 915
 
916 916
             } ?>
917 917
         </section>
918 918
 
919
-        <?php do_action( 'sensei_lesson_back_link', $lesson_course_id ); ?>
919
+        <?php do_action('sensei_lesson_back_link', $lesson_course_id); ?>
920 920
 
921 921
     <?php }
922 922
 
923
-    do_action( 'sensei_lesson_meta_extra', get_the_ID() );
923
+    do_action('sensei_lesson_meta_extra', get_the_ID());
924 924
 
925 925
 } // end the_single_lesson_meta
926 926
 
@@ -934,9 +934,9 @@  discard block
 block discarded – undo
934 934
  *
935 935
  * @since 1.9.0
936 936
  */
937
-function get_sensei_header(){
937
+function get_sensei_header() {
938 938
 
939
-    if ( ! defined( 'ABSPATH' ) ) exit;
939
+    if ( ! defined('ABSPATH')) exit;
940 940
 
941 941
     get_header();
942 942
 
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
      *
946 946
      * @hooked sensei_output_content_wrapper - 10 (outputs opening divs for the content)
947 947
      */
948
-    do_action( 'sensei_before_main_content' );
948
+    do_action('sensei_before_main_content');
949 949
 
950 950
 }// end get_sensei_header
951 951
 
@@ -959,28 +959,28 @@  discard block
 block discarded – undo
959 959
  *
960 960
  * @since 1.9.0
961 961
  */
962
-function get_sensei_footer(){
962
+function get_sensei_footer() {
963 963
 
964 964
     /**
965 965
      * sensei_pagination hook
966 966
      *
967 967
      * @hooked sensei_pagination - 10 (outputs pagination)
968 968
      */
969
-    do_action( 'sensei_pagination' );
969
+    do_action('sensei_pagination');
970 970
 
971 971
     /**
972 972
      * sensei_after_main_content hook
973 973
      *
974 974
      * @hooked sensei_output_content_wrapper_end - 10 (outputs closing divs for the content)
975 975
      */
976
-    do_action( 'sensei_after_main_content' );
976
+    do_action('sensei_after_main_content');
977 977
 
978 978
     /**
979 979
      * sensei_sidebar hook
980 980
      *
981 981
      * @hooked sensei_get_sidebar - 10
982 982
      */
983
-    do_action( 'sensei_sidebar' );
983
+    do_action('sensei_sidebar');
984 984
 
985 985
     get_footer();
986 986
 
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
  *
993 993
  * @since 1.9.0
994 994
  */
995
-function the_no_permissions_title(){
995
+function the_no_permissions_title() {
996 996
 
997 997
     /**
998 998
      * Filter the no permissions title just before it is echo'd on the
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
      * @since 1.9.0
1002 1002
      * @param $no_permissions_title
1003 1003
      */
1004
-    echo apply_filters( 'sensei_the_no_permissions_title', Sensei()->permissions_message['title'] );
1004
+    echo apply_filters('sensei_the_no_permissions_title', Sensei()->permissions_message['title']);
1005 1005
 
1006 1006
 }
1007 1007
 
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
  *
1011 1011
  * @since 1.9.0
1012 1012
  */
1013
-function the_no_permissions_message( $post_id ){
1013
+function the_no_permissions_message($post_id) {
1014 1014
 
1015 1015
     /**
1016 1016
      * Filter the no permissions message just before it is echo'd on the
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
      * @since 1.9.0
1020 1020
      * @param $no_permissions_message
1021 1021
      */
1022
-    echo apply_filters( 'sensei_the_no_permissions_message', Sensei()->permissions_message['message'] , $post_id );
1022
+    echo apply_filters('sensei_the_no_permissions_message', Sensei()->permissions_message['message'], $post_id);
1023 1023
 
1024 1024
 }
1025 1025
 
@@ -1028,10 +1028,10 @@  discard block
 block discarded – undo
1028 1028
  *
1029 1029
  * @since 1.9.0
1030 1030
  */
1031
-function sensei_the_excerpt( $post_id ){
1031
+function sensei_the_excerpt($post_id) {
1032 1032
 
1033 1033
     global $post;
1034
-    the_excerpt( $post );
1034
+    the_excerpt($post);
1035 1035
 
1036 1036
 }
1037 1037
 
@@ -1043,10 +1043,10 @@  discard block
 block discarded – undo
1043 1043
  * @global WP $wp
1044 1044
  * @return string $current_page_url
1045 1045
  */
1046
- function sensei_get_current_page_url(){
1046
+ function sensei_get_current_page_url() {
1047 1047
 
1048 1048
      global $wp;
1049
-     $current_page_url =  home_url( $wp->request );
1049
+     $current_page_url = home_url($wp->request);
1050 1050
      return $current_page_url;
1051 1051
 
1052 1052
  }
@@ -1057,9 +1057,9 @@  discard block
 block discarded – undo
1057 1057
  *
1058 1058
  * @since 1.9.0
1059 1059
  */
1060
-function sensei_the_my_courses_content(){
1060
+function sensei_the_my_courses_content() {
1061 1061
 
1062
-    echo Sensei()->course->load_user_courses_content( wp_get_current_user() );
1062
+    echo Sensei()->course->load_user_courses_content(wp_get_current_user());
1063 1063
 
1064 1064
 } // sensei_the_my_courses_content
1065 1065
 
@@ -1072,9 +1072,9 @@  discard block
 block discarded – undo
1072 1072
  *
1073 1073
  * @since 1.9.0
1074 1074
  */
1075
-function sensei_load_template( $template_name ){
1075
+function sensei_load_template($template_name) {
1076 1076
 
1077
-    Sensei_Templates::get_template( $template_name );
1077
+    Sensei_Templates::get_template($template_name);
1078 1078
 
1079 1079
 }
1080 1080
 
@@ -1086,9 +1086,9 @@  discard block
 block discarded – undo
1086 1086
  * @param string $name the name of the template.
1087 1087
  * @since 1.9.0
1088 1088
  */
1089
-function sensei_load_template_part( $slug, $name ){
1089
+function sensei_load_template_part($slug, $name) {
1090 1090
 
1091
-    Sensei_Templates::get_part( $slug, $name );
1091
+    Sensei_Templates::get_part($slug, $name);
1092 1092
 
1093 1093
 }
1094 1094
 
@@ -1105,19 +1105,19 @@  discard block
 block discarded – undo
1105 1105
  * @access public
1106 1106
  * @param string $lesson_id
1107 1107
  */
1108
-function sensei_the_lesson_excerpt( $lesson_id = '' ) {
1108
+function sensei_the_lesson_excerpt($lesson_id = '') {
1109 1109
 
1110
-    if( empty( $lesson_id )){
1110
+    if (empty($lesson_id)) {
1111 1111
 
1112 1112
         $lesson_id = get_the_ID();
1113 1113
 
1114 1114
     }
1115 1115
 
1116
-    if( 'lesson' != get_post_type( $lesson_id ) ){
1116
+    if ('lesson' != get_post_type($lesson_id)) {
1117 1117
         return;
1118 1118
     }
1119 1119
 
1120
-    echo Sensei_Lesson::lesson_excerpt( get_post( $lesson_id ), false );
1120
+    echo Sensei_Lesson::lesson_excerpt(get_post($lesson_id), false);
1121 1121
 
1122 1122
 }// End lesson_excerpt()
1123 1123
 
@@ -1126,17 +1126,17 @@  discard block
 block discarded – undo
1126 1126
  *
1127 1127
  * @since 1.9.0
1128 1128
  */
1129
-function sensei_the_course_results_lessons(){
1129
+function sensei_the_course_results_lessons() {
1130 1130
     // load backwards compatible template name if it exists in the users theme
1131
-    $located_template= locate_template( Sensei()->template_url . 'course-results/course-lessons.php' );
1132
-    if( $located_template ){
1131
+    $located_template = locate_template(Sensei()->template_url.'course-results/course-lessons.php');
1132
+    if ($located_template) {
1133 1133
 
1134
-        Sensei_Templates::get_template( 'course-results/course-lessons.php' );
1134
+        Sensei_Templates::get_template('course-results/course-lessons.php');
1135 1135
         return;
1136 1136
 
1137 1137
     }
1138 1138
 
1139
-    Sensei_Templates::get_template( 'course-results/lessons.php' );
1139
+    Sensei_Templates::get_template('course-results/lessons.php');
1140 1140
 }
1141 1141
 
1142 1142
 /**
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
  * @uses Sensei_Course::get_loop_number_of_columns
1147 1147
  * @since 1.9.0
1148 1148
  */
1149
-function sensei_courses_per_row(){
1149
+function sensei_courses_per_row() {
1150 1150
 
1151 1151
     echo Sensei_Course::get_loop_number_of_columns();
1152 1152
 
@@ -1160,9 +1160,9 @@  discard block
 block discarded – undo
1160 1160
  * @param $args
1161 1161
  * @param $path
1162 1162
  */
1163
-function sensei_get_template( $template_name, $args, $path ){
1163
+function sensei_get_template($template_name, $args, $path) {
1164 1164
 
1165
-    Sensei_Templates::get_template( $template_name, $args, $path );
1165
+    Sensei_Templates::get_template($template_name, $args, $path);
1166 1166
 
1167 1167
 }
1168 1168
 
@@ -1174,12 +1174,12 @@  discard block
 block discarded – undo
1174 1174
  *
1175 1175
  * @return string $status_class
1176 1176
  */
1177
-function get_the_lesson_status_class(){
1177
+function get_the_lesson_status_class() {
1178 1178
 
1179 1179
     $status_class = '';
1180
-    $lesson_completed = Sensei_Utils::user_completed_lesson( get_the_ID(), get_current_user_id() );
1180
+    $lesson_completed = Sensei_Utils::user_completed_lesson(get_the_ID(), get_current_user_id());
1181 1181
 
1182
-    if ( $lesson_completed ) {
1182
+    if ($lesson_completed) {
1183 1183
         $status_class = 'completed';
1184 1184
     }
1185 1185
 
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
  *
1194 1194
  * @since 1.9.0
1195 1195
  */
1196
-function sensei_the_lesson_status_class(){
1196
+function sensei_the_lesson_status_class() {
1197 1197
 
1198 1198
     echo get_the_lesson_status_class();
1199 1199
 }
Please login to merge, or discard this patch.
templates/single-quiz/question_type-boolean.php 1 patch
Spacing   +19 added lines, -19 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 True/False ( Boolean ) Question type.
5 5
  *
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
      * Get the question data with the current quiz id
17 17
      * All data is loaded in this array to keep the template clean.
18 18
      */
19
-    $question_data = WooThemes_Sensei_Question::get_template_data( sensei_get_the_question_id(), get_the_ID() );
20
-    $boolean_options = array( 'true', 'false' );
19
+    $question_data = WooThemes_Sensei_Question::get_template_data(sensei_get_the_question_id(), get_the_ID());
20
+    $boolean_options = array('true', 'false');
21 21
 
22 22
 ?>
23 23
 
@@ -27,20 +27,20 @@  discard block
 block discarded – undo
27 27
 
28 28
     // setup the options the right answer set by the admin/teacher
29 29
     // will be compared to.
30
-    $boolean_options = array( true, false );
30
+    $boolean_options = array(true, false);
31 31
 
32 32
     //loop through the 2 boolean options and compare them with
33 33
     // the selected right answer
34
-    foreach ( $boolean_options as $option ){
34
+    foreach ($boolean_options as $option) {
35 35
 
36 36
         $answer_class = '';
37 37
 
38 38
         // Add classes to indicate correctness, only if there is a grade
39
-        if( isset( $question_data[ 'user_correct' ] ) && 0 < $question_data['question_grade'] ) {
39
+        if (isset($question_data['user_correct']) && 0 < $question_data['question_grade']) {
40 40
 
41
-            if( $question_right_answer == $question_data[ 'question_right_answer' ] ) {
41
+            if ($question_right_answer == $question_data['question_right_answer']) {
42 42
 
43
-                if( $question_data[ 'user_correct' ] ) {
43
+                if ($question_data['user_correct']) {
44 44
 
45 45
                     $answer_class = 'user_right';
46 46
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
             } else {
52 52
 
53
-                if( ! $question_data[ 'user_correct' ] ) {
53
+                if ( ! $question_data['user_correct']) {
54 54
 
55 55
                     $answer_class = 'user_wrong';
56 56
 
@@ -64,25 +64,25 @@  discard block
 block discarded – undo
64 64
 
65 65
     ?>
66 66
 
67
-    <li class="<?php esc_attr_e( $answer_class ); ?>">
67
+    <li class="<?php esc_attr_e($answer_class); ?>">
68 68
 
69 69
         <input type="radio"
70
-               id="<?php echo esc_attr( 'question_' . $question_data[ 'ID' ]  ) . '-option-'. $option_value; ?>"
71
-               name="<?php echo esc_attr( 'sensei_question[' . $question_data[ 'ID' ]  . ']' ); ?>"
70
+               id="<?php echo esc_attr('question_'.$question_data['ID']).'-option-'.$option_value; ?>"
71
+               name="<?php echo esc_attr('sensei_question['.$question_data['ID'].']'); ?>"
72 72
                value="<?php echo $option_value; ?>"
73
-            <?php echo checked( $question_data[ 'user_answer_entry' ], $option, false ); ?>
74
-            <?php if ( !is_user_logged_in() ) { echo ' disabled'; } ?>
73
+            <?php echo checked($question_data['user_answer_entry'], $option, false); ?>
74
+            <?php if ( ! is_user_logged_in()) { echo ' disabled'; } ?>
75 75
 	    />
76
-        <label for="<?php echo esc_attr( 'question_' . $question_data[ 'ID' ]  ) . '-option-' . $option_value; ?>">
76
+        <label for="<?php echo esc_attr('question_'.$question_data['ID']).'-option-'.$option_value; ?>">
77 77
             <?php
78 78
 
79
-            if( 'true' == $option ){
79
+            if ('true' == $option) {
80 80
 
81
-                _e( 'True', 'woothemes-sensei' );
81
+                _e('True', 'woothemes-sensei');
82 82
 
83
-            }else{
83
+            } else {
84 84
 
85
-                _e( 'False', 'woothemes-sensei' );
85
+                _e('False', 'woothemes-sensei');
86 86
 
87 87
             }
88 88
 
Please login to merge, or discard this patch.
widgets/widget-woothemes-sensei-course-component.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 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,26 +172,26 @@  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
 		$course_ids = array();
179
-		if ( 'activecourses' == esc_attr( $instance['component'] ) ) {
180
-			$courses = Sensei_Utils::sensei_check_for_activity( array( 'user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'in-progress' ), true );
179
+		if ('activecourses' == esc_attr($instance['component'])) {
180
+			$courses = Sensei_Utils::sensei_check_for_activity(array('user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'in-progress'), true);
181 181
 			// Need to always return an array, even with only 1 item
182
-			if ( !is_array($courses) ) {
183
-				$courses = array( $courses );
182
+			if ( ! is_array($courses)) {
183
+				$courses = array($courses);
184 184
 			}
185
-			foreach( $courses AS $course ) {
185
+			foreach ($courses AS $course) {
186 186
 				$course_ids[] = $course->comment_post_ID;
187 187
 			}
188
-		} elseif( 'completedcourses' == esc_attr( $instance['component'] ) ) {
189
-			$courses = Sensei_Utils::sensei_check_for_activity( array( 'user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'complete' ), true );
188
+		} elseif ('completedcourses' == esc_attr($instance['component'])) {
189
+			$courses = Sensei_Utils::sensei_check_for_activity(array('user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'complete'), true);
190 190
 			// Need to always return an array, even with only 1 item
191
-			if ( !is_array($courses) ) {
192
-				$courses = array( $courses );
191
+			if ( ! is_array($courses)) {
192
+				$courses = array($courses);
193 193
 			}
194
-			foreach( $courses AS $course ) {
194
+			foreach ($courses AS $course) {
195 195
 				$course_ids[] = $course->comment_post_ID;
196 196
 			}
197 197
 		} // End If Statement
@@ -199,19 +199,19 @@  discard block
 block discarded – undo
199 199
 		$posts_array = array();
200 200
 
201 201
 		// course_query() is buggy, it doesn't honour the 1st arg if includes are provided, so instead slice the includes
202
-		if ( !empty($instance['limit']) && intval( $instance['limit'] ) >= 1 && intval( $instance['limit'] ) < count($course_ids) ) {
202
+		if ( ! empty($instance['limit']) && intval($instance['limit']) >= 1 && intval($instance['limit']) < count($course_ids)) {
203 203
 
204
-			$course_ids = array_slice( $course_ids, 0, intval( $instance['limit'] ) ); // This does mean the order by is effectively ignored
204
+			$course_ids = array_slice($course_ids, 0, intval($instance['limit'])); // This does mean the order by is effectively ignored
205 205
 
206 206
 		}
207 207
 
208
-        if ( ! empty( $course_ids ) ) {
208
+        if ( ! empty($course_ids)) {
209 209
 
210
-            $posts_array = Sensei()->course->course_query( intval( $instance['limit'] ), esc_attr( $instance['component'] ), $course_ids );
210
+            $posts_array = Sensei()->course->course_query(intval($instance['limit']), esc_attr($instance['component']), $course_ids);
211 211
 
212 212
 		} else {
213 213
 
214
-            if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
214
+            if ('activecourses' == esc_attr($instance['component']) || 'completedcourses' == esc_attr($instance['component'])) {
215 215
 				$posts_array = array();
216 216
 
217 217
             } else {
@@ -224,57 +224,57 @@  discard block
 block discarded – undo
224 224
                     'posts_per_page' => $instance['limit'],
225 225
                 );
226 226
 
227
-				$posts_array = get_posts( $course_args );
227
+				$posts_array = get_posts($course_args);
228 228
 			}
229 229
 
230 230
 		} // End If Statement
231 231
 
232
-		if ( count( $posts_array ) > 0 ) { ?>
232
+		if (count($posts_array) > 0) { ?>
233 233
 			<ul>
234
-			<?php foreach ($posts_array as $post_item){
235
-		    	$post_id = absint( $post_item->ID );
234
+			<?php foreach ($posts_array as $post_item) {
235
+		    	$post_id = absint($post_item->ID);
236 236
 		    	$post_title = $post_item->post_title;
237
-		    	$user_info = get_userdata( absint( $post_item->post_author ) );
238
-		    	$author_link = get_author_posts_url( absint( $post_item->post_author ) );
237
+		    	$user_info = get_userdata(absint($post_item->post_author));
238
+		    	$author_link = get_author_posts_url(absint($post_item->post_author));
239 239
 		    	$author_display_name = $user_info->display_name;
240 240
 		    	$author_id = $post_item->post_author;
241 241
 		    ?>
242 242
 		    	<li class="fix">
243
-		    		<?php do_action( 'sensei_course_image', $post_id ); ?>
244
-		    		<a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a>
243
+		    		<?php do_action('sensei_course_image', $post_id); ?>
244
+		    		<a href="<?php echo esc_url(get_permalink($post_id)); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a>
245 245
 		    		<br />
246
-		    		<?php if ( isset( Sensei()->settings->settings[ 'course_author' ] ) && ( Sensei()->settings->settings[ 'course_author' ] ) ) { ?>
247
-    					<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>
246
+		    		<?php if (isset(Sensei()->settings->settings['course_author']) && (Sensei()->settings->settings['course_author'])) { ?>
247
+    					<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 248
     					<br />
249 249
     				<?php } // End If Statement ?>
250
-    				<span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count( $post_id ) . '&nbsp;' . __( 'Lessons', 'woothemes-sensei' ); ?></span>
250
+    				<span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count($post_id).'&nbsp;'.__('Lessons', 'woothemes-sensei'); ?></span>
251 251
     				<br />
252
-    				<?php sensei_simple_course_price( $post_id ); ?>
252
+    				<?php sensei_simple_course_price($post_id); ?>
253 253
 		    	</li>
254 254
 		    <?php } // End For Loop ?>
255
-		    <?php if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
256
-		    	$my_account_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] );
257
-		    	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>';
255
+		    <?php if ('activecourses' == esc_attr($instance['component']) || 'completedcourses' == esc_attr($instance['component'])) {
256
+		    	$my_account_page_id = intval(Sensei()->settings->settings['my_course_page']);
257
+		    	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>';
258 258
 		    } // End If Statement ?>
259 259
 		</ul>
260 260
 		<?php } else {
261 261
 			// No posts returned. This means the user either has no active or no completed courses.
262
-			if( isset( $instance['component']  ) ) {
262
+			if (isset($instance['component'])) {
263 263
 
264
-				if ( 'featuredcourses' == $instance['component'] ) {
264
+				if ('featuredcourses' == $instance['component']) {
265 265
 
266
-					_e( 'You have no featured courses.', 'woothemes-sensei' );
266
+					_e('You have no featured courses.', 'woothemes-sensei');
267 267
 
268
-				} elseif ( 'activecourses' == $instance['component'] ) {
268
+				} elseif ('activecourses' == $instance['component']) {
269 269
 
270
-					_e( 'You have no active courses.', 'woothemes-sensei' );
270
+					_e('You have no active courses.', 'woothemes-sensei');
271 271
 
272
-				} elseif ( 'completedcourses' == $instance['component'] ) {
273
-					_e( 'You have no completed courses.', 'woothemes-sensei' );
272
+				} elseif ('completedcourses' == $instance['component']) {
273
+					_e('You have no completed courses.', 'woothemes-sensei');
274 274
 
275
-				}else{
275
+				} else {
276 276
 
277
-					_e( 'You have no courses.', 'woothemes-sensei' );
277
+					_e('You have no courses.', 'woothemes-sensei');
278 278
 
279 279
 				}
280 280
 
Please login to merge, or discard this patch.