Completed
Push — master ( 201c1b...d51ce1 )
by Dwain
04:57
created
includes/template-functions.php 4 patches
Braces   +13 added lines, -8 removed lines patch added patch discarded remove patch
@@ -181,7 +181,9 @@  discard block
 block discarded – undo
181 181
 	 * @return void
182 182
 	 */
183 183
 	function sensei_recent_comments_widget_filter( $widget_args = array() ) {
184
-		if ( ! isset( $widget_args['post_type'] ) ) $widget_args['post_type'] = array( 'post', 'page' );
184
+		if ( ! isset( $widget_args['post_type'] ) ) {
185
+			$widget_args['post_type'] = array( 'post', 'page' );
186
+		}
185 187
 		return $widget_args;
186 188
 	} // End sensei_recent_comments_widget_filter()
187 189
 	add_filter( 'widget_comments_args', 'sensei_recent_comments_widget_filter', 10, 1 );
@@ -196,8 +198,9 @@  discard block
 block discarded – undo
196 198
 	function sensei_course_archive_filter( $query ) {
197 199
 
198 200
 
199
-		if ( ! $query->is_main_query() )
200
-        	return;
201
+		if ( ! $query->is_main_query() ) {
202
+		        	return;
203
+		}
201 204
 
202 205
 		// Apply Filter only if on frontend and when course archive is running
203 206
 		$course_page_id = intval( Sensei()->settings->settings[ 'course_page' ] );
@@ -412,7 +415,7 @@  discard block
 block discarded – undo
412 415
 
413 416
 		return false;
414 417
 
415
-	}else{
418
+	} else{
416 419
 
417 420
 		return true;
418 421
 
@@ -446,7 +449,7 @@  discard block
 block discarded – undo
446 449
 
447 450
 			$wp_query = $modules_query;
448 451
 
449
-		}else{
452
+		} else{
450 453
 
451 454
 			wp_reset_query();
452 455
 
@@ -478,7 +481,7 @@  discard block
 block discarded – undo
478 481
 
479 482
 		return have_posts();
480 483
 
481
-	}else{
484
+	} else{
482 485
 
483 486
         // if the loop has not been initiated check the first module has lessons
484 487
         if( -1 == $sensei_modules_loop[ 'current' ]  ){
@@ -622,7 +625,7 @@  discard block
 block discarded – undo
622 625
 
623 626
         return true;
624 627
 
625
-    }else{
628
+    } else{
626 629
 
627 630
         return false;
628 631
 
@@ -865,7 +868,9 @@  discard block
 block discarded – undo
865 868
  */
866 869
 function get_sensei_header(){
867 870
 
868
-    if ( ! defined( 'ABSPATH' ) ) exit;
871
+    if ( ! defined( 'ABSPATH' ) ) {
872
+    	exit;
873
+    }
869 874
 
870 875
     get_header();
871 876
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
 	 * sensei_check_if_product_is_in_cart function.
144 144
 	 *
145 145
 	 * @deprecated since 1.9.0
146
-	 * @param int $wc_post_id (default: 0)
146
+	 * @param int $wc_product_id (default: 0)
147 147
 	 * @return bool
148 148
 	 */
149 149
 	function sensei_check_if_product_is_in_cart( $wc_product_id = 0 ) {
Please login to merge, or discard this patch.
Indentation   +280 added lines, -281 removed lines patch added patch discarded remove patch
@@ -5,18 +5,18 @@  discard block
 block discarded – undo
5 5
 	 * 	Output tags.
6 6
 	 ***************************************************************************************************/
7 7
 
8
-    /**
9
-     * sensei_course_archive_next_link function.
10
-     *
11
-     * @access public
12
-     * @param string $type (default: 'newcourses')
13
-     * @return void
14
-     */
15
-    function sensei_course_archive_next_link( $type = 'newcourses' ) {
8
+	/**
9
+	 * sensei_course_archive_next_link function.
10
+	 *
11
+	 * @access public
12
+	 * @param string $type (default: 'newcourses')
13
+	 * @return void
14
+	 */
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
-    } // End sensei_course_archive_next_link()
19
+	} // End sensei_course_archive_next_link()
20 20
 
21 21
 	 /**
22 22
 	  * course_single_lessons function.
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
 	  */
27 27
 	 function course_single_lessons() {
28 28
 
29
-         // load backwards compatible template name if it exists in the users theme
30
-         $located_template= locate_template( Sensei()->template_url . 'single-course/course-lessons.php' );
31
-         if( $located_template ){
29
+		 // load backwards compatible template name if it exists in the users theme
30
+		 $located_template= locate_template( Sensei()->template_url . 'single-course/course-lessons.php' );
31
+		 if( $located_template ){
32 32
 
33
-             Sensei_Templates::get_template( 'single-course/course-lessons.php' );
34
-             return;
33
+			 Sensei_Templates::get_template( 'single-course/course-lessons.php' );
34
+			 return;
35 35
 
36
-        }
36
+		}
37 37
 
38 38
 		Sensei_Templates::get_template( 'single-course/lessons.php' );
39 39
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	  */
49 49
 	 function lesson_single_meta() {
50 50
 
51
-         _deprecated_function('lesson_single_meta','1.9;0', 'WooThemes_Sensei_Lesson::the_lesson_meta' );
52
-         sensei_the_single_lesson_meta();
51
+		 _deprecated_function('lesson_single_meta','1.9;0', 'WooThemes_Sensei_Lesson::the_lesson_meta' );
52
+		 sensei_the_single_lesson_meta();
53 53
 
54 54
 	 } // End lesson_single_meta()
55 55
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	  * @access public
61 61
 	  * @param bool $return (default: false)
62 62
 	  * @return void
63
-      * @deprecated since 1.9.0
63
+	  * @deprecated since 1.9.0
64 64
 	  */
65 65
 	 function quiz_questions( $return = false ) {
66 66
 
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 	  * @access public
75 75
 	  * @since  1.3.0
76 76
 	  * @return void
77
-      * @deprecated
77
+	  * @deprecated
78 78
 	  */
79 79
 	 function quiz_question_type( $question_type = 'multiple-choice' ) {
80 80
 
81
-         Sensei_Templates::get_template( 'single-quiz/question_type-' . $question_type . '.php' );
81
+		 Sensei_Templates::get_template( 'single-quiz/question_type-' . $question_type . '.php' );
82 82
 
83 83
 	 } // End lesson_single_meta()
84 84
 
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
 	/**
90 90
 	 * sensei_check_prerequisite_course function.
91 91
 	 *
92
-     * @deprecated since 1.9.0 use Sensei_Course::is_prerequisite_complete( $course_id );
92
+	 * @deprecated since 1.9.0 use Sensei_Course::is_prerequisite_complete( $course_id );
93 93
 	 * @access public
94 94
 	 * @param mixed $course_id
95 95
 	 * @return bool
96 96
 	 */
97 97
 	function sensei_check_prerequisite_course( $course_id ) {
98 98
 
99
-        return Sensei_Course::is_prerequisite_complete( $course_id );
99
+		return Sensei_Course::is_prerequisite_complete( $course_id );
100 100
 
101 101
 	} // End sensei_check_prerequisite_course()
102 102
 
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
     			<span><input name="course_start" type="submit" class="course-start" value="<?php _e( 'Start taking this Course', 'woothemes-sensei' ); ?>"/></span>
121 121
 
122 122
     		</form><?php
123
-    	} // End If Statement
123
+		} // End If Statement
124 124
 	} // End sensei_start_course_form()
125 125
 
126 126
 
127 127
 	/**
128 128
 	 * sensei_wc_add_to_cart function.
129 129
 	 *
130
-     * @deprecated since Sensei_WC::the_add_to_cart_button_html( $course_id );
130
+	 * @deprecated since Sensei_WC::the_add_to_cart_button_html( $course_id );
131 131
 	 * @access public
132 132
 	 * @param mixed $course_id
133 133
 	 * @return void
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 * @return bool
148 148
 	 */
149 149
 	function sensei_check_if_product_is_in_cart( $wc_product_id = 0 ) {
150
-        return Sensei_WC::is_product_in_cart( $wc_product_id );
150
+		return Sensei_WC::is_product_in_cart( $wc_product_id );
151 151
 	} // End sensei_check_if_product_is_in_cart()
152 152
 
153 153
 	/**
@@ -160,17 +160,17 @@  discard block
 block discarded – undo
160 160
 	function sensei_simple_course_price( $post_id ) {
161 161
 
162 162
 		//WooCommerce Pricing
163
-        if ( Sensei_WC::is_woocommerce_active() ) {
164
-    	    $wc_post_id = get_post_meta( $post_id, '_course_woocommerce_product', true );
165
-    	    if ( 0 < $wc_post_id ) {
166
-    	    	// Get the product
167
-    	    	$product = Sensei()->sensei_get_woocommerce_product_object( $wc_post_id );
163
+		if ( Sensei_WC::is_woocommerce_active() ) {
164
+			$wc_post_id = get_post_meta( $post_id, '_course_woocommerce_product', true );
165
+			if ( 0 < $wc_post_id ) {
166
+				// Get the product
167
+				$product = Sensei()->sensei_get_woocommerce_product_object( $wc_post_id );
168 168
 
169
-    	    	if ( isset( $product ) && !empty( $product )  &&  $product->is_purchasable() && $product->is_in_stock() && !sensei_check_if_product_is_in_cart( $wc_post_id ) ) { ?>
169
+				if ( isset( $product ) && !empty( $product )  &&  $product->is_purchasable() && $product->is_in_stock() && !sensei_check_if_product_is_in_cart( $wc_post_id ) ) { ?>
170 170
     	    		<span class="course-price"><?php echo $product->get_price_html(); ?></span>
171 171
     	    	<?php } // End If Statement
172
-    	    } // End If Statement
173
-    	} // End If Statement
172
+			} // End If Statement
173
+		} // End If Statement
174 174
 	} // End sensei_simple_course_price()
175 175
 
176 176
 	/**
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
 
199 199
 		if ( ! $query->is_main_query() )
200
-        	return;
200
+			return;
201 201
 
202 202
 		// Apply Filter only if on frontend and when course archive is running
203 203
 		$course_page_id = intval( Sensei()->settings->settings[ 'course_page' ] );
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 		if ( ! is_admin() && 0 < $course_page_id && 0 < intval( $query->get( 'page_id' ) ) && $query->get( 'page_id' ) == $course_page_id ) {
206 206
 			// Check for pagination settings
207 207
    			if ( isset( Sensei()->settings->settings[ 'course_archive_amount' ] ) && ( 0 < absint( Sensei()->settings->settings[ 'course_archive_amount' ] ) ) ) {
208
-    			$amount = absint( Sensei()->settings->settings[ 'course_archive_amount' ] );
209
-    		} else {
210
-    			$amount = $query->get( 'posts_per_page' );
211
-    		} // End If Statement
212
-    		$query->set( 'posts_per_page', $amount );
208
+				$amount = absint( Sensei()->settings->settings[ 'course_archive_amount' ] );
209
+			} else {
210
+				$amount = $query->get( 'posts_per_page' );
211
+			} // End If Statement
212
+			$query->set( 'posts_per_page', $amount );
213 213
 		} // End If Statement
214 214
 	} // End sensei_course_archive_filter()
215 215
 	add_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 );
@@ -248,66 +248,66 @@  discard block
 block discarded – undo
248 248
 			$lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true );
249 249
 			$all_lessons = array();
250 250
 
251
-            $modules = Sensei()->modules->get_course_modules( intval( $lesson_course_id ) );
252
-
253
-            foreach( (array) $modules as $module ) {
254
-
255
-                $args = array(
256
-                    'post_type' => 'lesson',
257
-                    'post_status' => 'publish',
258
-                    'posts_per_page' => -1,
259
-                    'meta_query' => array(
260
-                        array(
261
-                            'key' => '_lesson_course',
262
-                            'value' => intval( $lesson_course_id ),
263
-                            'compare' => '='
264
-                        )
265
-                    ),
266
-                    'tax_query' => array(
267
-                        array(
268
-                            'taxonomy' => Sensei()->modules->taxonomy,
269
-                            'field' => 'id',
270
-                            'terms' => intval( $module->term_id )
271
-                        )
272
-                    ),
273
-                    'meta_key' => '_order_module_' . $module->term_id,
274
-                    'orderby' => 'meta_value_num date',
275
-                    'order' => 'ASC',
276
-                    'suppress_filters' => 0
277
-                );
278
-
279
-                $lessons = get_posts( $args );
280
-                if ( 0 < count( $lessons ) ) {
281
-                    foreach ($lessons as $lesson_item){
282
-                        $all_lessons[] = $lesson_item->ID;
283
-                    } // End For Loop
284
-                } // End If Statement
285
-            }
286
-
287
-            $args = array(
288
-                'post_type' => 'lesson',
289
-                'posts_per_page' => -1,
290
-                'suppress_filters' => 0,
291
-                'meta_key' => '_order_' . $lesson_course_id,
292
-                'orderby' => 'meta_value_num date',
293
-                'order' => 'ASC',
294
-                'meta_query' => array(
295
-                    array(
296
-                        'key' => '_lesson_course',
297
-                        'value' => intval( $lesson_course_id ),
298
-                    ),
299
-                ),
300
-                'post__not_in' => $all_lessons,
301
-            );
302
-
303
-            $other_lessons = get_posts( $args );
304
-            if ( 0 < count( $other_lessons ) ) {
251
+			$modules = Sensei()->modules->get_course_modules( intval( $lesson_course_id ) );
252
+
253
+			foreach( (array) $modules as $module ) {
254
+
255
+				$args = array(
256
+					'post_type' => 'lesson',
257
+					'post_status' => 'publish',
258
+					'posts_per_page' => -1,
259
+					'meta_query' => array(
260
+						array(
261
+							'key' => '_lesson_course',
262
+							'value' => intval( $lesson_course_id ),
263
+							'compare' => '='
264
+						)
265
+					),
266
+					'tax_query' => array(
267
+						array(
268
+							'taxonomy' => Sensei()->modules->taxonomy,
269
+							'field' => 'id',
270
+							'terms' => intval( $module->term_id )
271
+						)
272
+					),
273
+					'meta_key' => '_order_module_' . $module->term_id,
274
+					'orderby' => 'meta_value_num date',
275
+					'order' => 'ASC',
276
+					'suppress_filters' => 0
277
+				);
278
+
279
+				$lessons = get_posts( $args );
280
+				if ( 0 < count( $lessons ) ) {
281
+					foreach ($lessons as $lesson_item){
282
+						$all_lessons[] = $lesson_item->ID;
283
+					} // End For Loop
284
+				} // End If Statement
285
+			}
286
+
287
+			$args = array(
288
+				'post_type' => 'lesson',
289
+				'posts_per_page' => -1,
290
+				'suppress_filters' => 0,
291
+				'meta_key' => '_order_' . $lesson_course_id,
292
+				'orderby' => 'meta_value_num date',
293
+				'order' => 'ASC',
294
+				'meta_query' => array(
295
+					array(
296
+						'key' => '_lesson_course',
297
+						'value' => intval( $lesson_course_id ),
298
+					),
299
+				),
300
+				'post__not_in' => $all_lessons,
301
+			);
302
+
303
+			$other_lessons = get_posts( $args );
304
+			if ( 0 < count( $other_lessons ) ) {
305 305
 				foreach ($other_lessons as $lesson_item){
306 306
 					$all_lessons[] = $lesson_item->ID;
307 307
 				} // End For Loop
308 308
 			} // End If Statement
309 309
 
310
-            if ( 0 < count( $all_lessons ) ) {
310
+			if ( 0 < count( $all_lessons ) ) {
311 311
 				$found_index = false;
312 312
 				foreach ( $all_lessons as $lesson ){
313 313
 					if ( $found_index && $return_values['next_lesson'] == 0 ) {
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
    */
339 339
   function sensei_get_excerpt( $post_id = '' ) {
340 340
 
341
-      global $post;
342
-      _deprecated_function('sensei_get_excerpt', 'use the wordpress excerpt functionality.');
343
-      return get_the_excerpt();
341
+	  global $post;
342
+	  _deprecated_function('sensei_get_excerpt', 'use the wordpress excerpt functionality.');
343
+	  return get_the_excerpt();
344 344
 
345 345
   }
346 346
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 */
366 366
 function sensei_has_user_completed_prerequisite_lesson( $current_lesson_id, $user_id ) {
367 367
 
368
-    return WooThemes_Sensei_Lesson::is_pre_requisite_complete( $current_lesson_id, $user_id );
368
+	return WooThemes_Sensei_Lesson::is_pre_requisite_complete( $current_lesson_id, $user_id );
369 369
 
370 370
 } // End sensei_has_user_completed_prerequisite_lesson()
371 371
 
@@ -480,27 +480,27 @@  discard block
 block discarded – undo
480 480
 
481 481
 	}else{
482 482
 
483
-        // if the loop has not been initiated check the first module has lessons
484
-        if( -1 == $sensei_modules_loop[ 'current' ]  ){
483
+		// if the loop has not been initiated check the first module has lessons
484
+		if( -1 == $sensei_modules_loop[ 'current' ]  ){
485 485
 
486
-            $index = 0;
486
+			$index = 0;
487 487
 
488
-            if( isset( $sensei_modules_loop['modules'][ $index ] ) ) {
489
-                // setup the query for the module lessons
490
-                $course_id = $sensei_modules_loop['course_id'];
488
+			if( isset( $sensei_modules_loop['modules'][ $index ] ) ) {
489
+				// setup the query for the module lessons
490
+				$course_id = $sensei_modules_loop['course_id'];
491 491
 
492
-                $module_term_id = $sensei_modules_loop['modules'][ $index ] ->term_id;
493
-                $modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id );
492
+				$module_term_id = $sensei_modules_loop['modules'][ $index ] ->term_id;
493
+				$modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id );
494 494
 
495
-                // setup the global wp-query only if the lessons
496
-                if( $modules_query->have_posts() ){
495
+				// setup the global wp-query only if the lessons
496
+				if( $modules_query->have_posts() ){
497 497
 
498
-                    return true;
498
+					return true;
499 499
 
500
-                }
501
-            }
502
-        }
503
-        // default to false if the first module doesn't have posts
500
+				}
501
+			}
502
+		}
503
+		// default to false if the first module doesn't have posts
504 504
 		return false;
505 505
 
506 506
 	}
@@ -612,21 +612,21 @@  discard block
 block discarded – undo
612 612
  */
613 613
 function sensei_quiz_has_questions(){
614 614
 
615
-    global $sensei_question_loop;
615
+	global $sensei_question_loop;
616 616
 
617
-    if( !isset( $sensei_question_loop['total'] ) ){
618
-        return false;
619
-    }
617
+	if( !isset( $sensei_question_loop['total'] ) ){
618
+		return false;
619
+	}
620 620
 
621
-    if( $sensei_question_loop['current'] + 1 < $sensei_question_loop['total']  ){
621
+	if( $sensei_question_loop['current'] + 1 < $sensei_question_loop['total']  ){
622 622
 
623
-        return true;
623
+		return true;
624 624
 
625
-    }else{
625
+	}else{
626 626
 
627
-        return false;
627
+		return false;
628 628
 
629
-    }
629
+	}
630 630
 
631 631
 }// end sensei_quiz_has_questions
632 632
 
@@ -637,15 +637,14 @@  discard block
 block discarded – undo
637 637
  * execution.
638 638
  *
639 639
  * @since 1.9.0
640
-
641 640
  */
642 641
 function sensei_setup_the_question(){
643 642
 
644
-    global $sensei_question_loop;
643
+	global $sensei_question_loop;
645 644
 
646
-    $sensei_question_loop['current']++;
647
-    $index = $sensei_question_loop['current'];
648
-    $sensei_question_loop['current_question'] =  $sensei_question_loop['questions'][ $index ] ;
645
+	$sensei_question_loop['current']++;
646
+	$index = $sensei_question_loop['current'];
647
+	$sensei_question_loop['current_question'] =  $sensei_question_loop['questions'][ $index ] ;
649 648
 
650 649
 
651 650
 }// end sensei_setup_the_question
@@ -658,12 +657,12 @@  discard block
 block discarded – undo
658 657
  */
659 658
 function sensei_the_question_content(){
660 659
 
661
-    global $sensei_question_loop;
660
+	global $sensei_question_loop;
662 661
 
663
-    $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID );
662
+	$question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID );
664 663
 
665
-    // load the template that displays the question information.
666
-    WooThemes_Sensei_Question::load_question_template( $question_type );
664
+	// load the template that displays the question information.
665
+	WooThemes_Sensei_Question::load_question_template( $question_type );
667 666
 
668 667
 }// end sensei_the_question_content
669 668
 
@@ -674,26 +673,26 @@  discard block
 block discarded – undo
674 673
  */
675 674
 function sensei_the_question_class(){
676 675
 
677
-    global $sensei_question_loop;
676
+	global $sensei_question_loop;
678 677
 
679
-    $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID );
678
+	$question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID );
680 679
 
681
-    /**
682
-     * filter the sensei question class within
683
-     * the quiz question loop.
684
-     *
685
-     * @since 1.9.0
686
-     */
687
-     $classes = apply_filters( 'sensei_question_classes', array( $question_type ) );
680
+	/**
681
+	 * filter the sensei question class within
682
+	 * the quiz question loop.
683
+	 *
684
+	 * @since 1.9.0
685
+	 */
686
+	 $classes = apply_filters( 'sensei_question_classes', array( $question_type ) );
688 687
 
689
-    $html_classes = '';
690
-    foreach( $classes as $class ){
688
+	$html_classes = '';
689
+	foreach( $classes as $class ){
691 690
 
692
-        $html_classes .= $class . ' ';
691
+		$html_classes .= $class . ' ';
693 692
 
694
-    }// end foreach
693
+	}// end foreach
695 694
 
696
-    esc_attr_e( trim( $html_classes ) );
695
+	esc_attr_e( trim( $html_classes ) );
697 696
 
698 697
 }
699 698
 
@@ -704,12 +703,12 @@  discard block
 block discarded – undo
704 703
  */
705 704
 function sensei_get_the_question_id( ){
706 705
 
707
-    global $sensei_question_loop;
708
-    if( isset( $sensei_question_loop['current_question']->ID ) ){
706
+	global $sensei_question_loop;
707
+	if( isset( $sensei_question_loop['current_question']->ID ) ){
709 708
 
710
-        return $sensei_question_loop['current_question']->ID;
709
+		return $sensei_question_loop['current_question']->ID;
711 710
 
712
-    }
711
+	}
713 712
 
714 713
 }// end sensei_the_question_id
715 714
 
@@ -736,63 +735,63 @@  discard block
 block discarded – undo
736 735
  */
737 736
 function sensei_can_user_view_lesson( $lesson_id = '', $user_id = ''  ){
738 737
 
739
-    if( empty( $lesson_id ) ){
738
+	if( empty( $lesson_id ) ){
740 739
 
741
-        $lesson_id = get_the_ID();
740
+		$lesson_id = get_the_ID();
742 741
 
743
-    }
742
+	}
744 743
 
745
-    if( empty( $user_id ) ){
744
+	if( empty( $user_id ) ){
746 745
 
747
-        $user_id = get_current_user_id();
746
+		$user_id = get_current_user_id();
748 747
 
749
-    }
748
+	}
750 749
 
751
-    // Check for prerequisite lesson completions
752
-    $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete( $lesson_id, $user_id );
753
-    $lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true );
754
-    $user_taking_course = Sensei_Utils::user_started_course( $lesson_course_id, $user_id );
750
+	// Check for prerequisite lesson completions
751
+	$pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete( $lesson_id, $user_id );
752
+	$lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true );
753
+	$user_taking_course = Sensei_Utils::user_started_course( $lesson_course_id, $user_id );
755 754
 
756
-    $is_preview = false;
757
-    if( Sensei_Utils::is_preview_lesson( $lesson_id ) ) {
755
+	$is_preview = false;
756
+	if( Sensei_Utils::is_preview_lesson( $lesson_id ) ) {
758 757
 
759
-        $is_preview = true;
760
-        $pre_requisite_complete = true;
758
+		$is_preview = true;
759
+		$pre_requisite_complete = true;
761 760
 
762
-    };
761
+	};
763 762
 
764 763
 
765
-    $user_can_access_lesson =  false;
764
+	$user_can_access_lesson =  false;
766 765
 
767
-    if( is_user_logged_in() && $user_taking_course ){
766
+	if( is_user_logged_in() && $user_taking_course ){
768 767
 
769
-        $user_can_access_lesson =  true;
768
+		$user_can_access_lesson =  true;
770 769
 
771
-    }
770
+	}
772 771
 
773 772
 
774
-    $access_permission = false;
773
+	$access_permission = false;
775 774
 
776
-    if ( ! Sensei()->settings->get('access_permission')  || sensei_all_access() ) {
775
+	if ( ! Sensei()->settings->get('access_permission')  || sensei_all_access() ) {
777 776
 
778
-        $access_permission = true;
777
+		$access_permission = true;
779 778
 
780
-    }
779
+	}
781 780
 
782
-    $can_user_view_lesson = $access_permission || ( $user_can_access_lesson && $pre_requisite_complete ) || $is_preview;
781
+	$can_user_view_lesson = $access_permission || ( $user_can_access_lesson && $pre_requisite_complete ) || $is_preview;
783 782
 
784
-    /**
785
-     * Filter the can user view lesson function
786
-     *
787
-     * @since 1.9.0
788
-     *
789
-     * @hooked Sensei_WC::alter_can_user_view_lesson
790
-     *
791
-     * @param bool $can_user_view_lesson
792
-     * @param string $lesson_id
793
-     * @param string $user_id
794
-     */
795
-    return apply_filters( 'sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id );
783
+	/**
784
+	 * Filter the can user view lesson function
785
+	 *
786
+	 * @since 1.9.0
787
+	 *
788
+	 * @hooked Sensei_WC::alter_can_user_view_lesson
789
+	 *
790
+	 * @param bool $can_user_view_lesson
791
+	 * @param string $lesson_id
792
+	 * @param string $user_id
793
+	 */
794
+	return apply_filters( 'sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id );
796 795
 
797 796
 } // end sensei_can_current_user_view_lesson
798 797
 
@@ -804,52 +803,52 @@  discard block
 block discarded – undo
804 803
  */
805 804
 function sensei_the_single_lesson_meta(){
806 805
 
807
-    // if the lesson meta is included within theme load that instead of the function content
808
-    $template = Sensei_Templates::locate_template( 'single-lesson/lesson-meta.php' );
809
-    if( ! empty( $template ) ){
806
+	// if the lesson meta is included within theme load that instead of the function content
807
+	$template = Sensei_Templates::locate_template( 'single-lesson/lesson-meta.php' );
808
+	if( ! empty( $template ) ){
810 809
 
811
-        Sensei_Templates::get_template( 'single-lesson/lesson-meta.php' );
812
-        return;
810
+		Sensei_Templates::get_template( 'single-lesson/lesson-meta.php' );
811
+		return;
813 812
 
814
-    }
813
+	}
815 814
 
816
-    // Get the meta info
817
-    $lesson_course_id = absint( get_post_meta( get_the_ID(), '_lesson_course', true ) );
818
-    $is_preview = Sensei_Utils::is_preview_lesson( get_the_ID() );
815
+	// Get the meta info
816
+	$lesson_course_id = absint( get_post_meta( get_the_ID(), '_lesson_course', true ) );
817
+	$is_preview = Sensei_Utils::is_preview_lesson( get_the_ID() );
819 818
 
820
-    // Get User Meta
821
-    get_currentuserinfo();
819
+	// Get User Meta
820
+	get_currentuserinfo();
822 821
 
823
-    // Complete Lesson Logic
824
-    do_action( 'sensei_complete_lesson' );
825
-    // Check that the course has been started
826
-    if ( Sensei()->access_settings()
827
-        || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id())
828
-        || $is_preview ) {
829
-        ?>
822
+	// Complete Lesson Logic
823
+	do_action( 'sensei_complete_lesson' );
824
+	// Check that the course has been started
825
+	if ( Sensei()->access_settings()
826
+		|| Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id())
827
+		|| $is_preview ) {
828
+		?>
830 829
         <section class="lesson-meta">
831 830
             <?php
832
-            if( apply_filters( 'sensei_video_position', 'top', get_the_ID() ) == 'bottom' ) {
831
+			if( apply_filters( 'sensei_video_position', 'top', get_the_ID() ) == 'bottom' ) {
833 832
 
834
-                do_action( 'sensei_lesson_video', get_the_ID() );
833
+				do_action( 'sensei_lesson_video', get_the_ID() );
835 834
 
836
-            }
837
-            ?>
835
+			}
836
+			?>
838 837
             <?php do_action( 'sensei_frontend_messages' ); ?>
839 838
 
840 839
             <?php if ( ! $is_preview
841
-                || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) ) {
840
+				|| Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) ) {
842 841
 
843
-                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() )  );
842
+				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() )  );
844 843
 
845
-            } ?>
844
+			} ?>
846 845
         </section>
847 846
 
848 847
         <?php do_action( 'sensei_lesson_back_link', $lesson_course_id ); ?>
849 848
 
850 849
     <?php }
851 850
 
852
-    do_action( 'sensei_lesson_meta_extra', get_the_ID() );
851
+	do_action( 'sensei_lesson_meta_extra', get_the_ID() );
853 852
 
854 853
 } // end the_single_lesson_meta
855 854
 
@@ -865,16 +864,16 @@  discard block
 block discarded – undo
865 864
  */
866 865
 function get_sensei_header(){
867 866
 
868
-    if ( ! defined( 'ABSPATH' ) ) exit;
867
+	if ( ! defined( 'ABSPATH' ) ) exit;
869 868
 
870
-    get_header();
869
+	get_header();
871 870
 
872
-    /**
873
-     * sensei_before_main_content hook
874
-     *
875
-     * @hooked sensei_output_content_wrapper - 10 (outputs opening divs for the content)
876
-     */
877
-    do_action( 'sensei_before_main_content' );
871
+	/**
872
+	 * sensei_before_main_content hook
873
+	 *
874
+	 * @hooked sensei_output_content_wrapper - 10 (outputs opening divs for the content)
875
+	 */
876
+	do_action( 'sensei_before_main_content' );
878 877
 
879 878
 }// end get_sensei_header
880 879
 
@@ -890,28 +889,28 @@  discard block
 block discarded – undo
890 889
  */
891 890
 function get_sensei_footer(){
892 891
 
893
-    /**
894
-     * sensei_pagination hook
895
-     *
896
-     * @hooked sensei_pagination - 10 (outputs pagination)
897
-     */
898
-    do_action( 'sensei_pagination' );
899
-
900
-    /**
901
-     * sensei_after_main_content hook
902
-     *
903
-     * @hooked sensei_output_content_wrapper_end - 10 (outputs closing divs for the content)
904
-     */
905
-    do_action( 'sensei_after_main_content' );
906
-
907
-    /**
908
-     * sensei_sidebar hook
909
-     *
910
-     * @hooked sensei_get_sidebar - 10
911
-     */
912
-    do_action( 'sensei_sidebar' );
913
-
914
-    get_footer();
892
+	/**
893
+	 * sensei_pagination hook
894
+	 *
895
+	 * @hooked sensei_pagination - 10 (outputs pagination)
896
+	 */
897
+	do_action( 'sensei_pagination' );
898
+
899
+	/**
900
+	 * sensei_after_main_content hook
901
+	 *
902
+	 * @hooked sensei_output_content_wrapper_end - 10 (outputs closing divs for the content)
903
+	 */
904
+	do_action( 'sensei_after_main_content' );
905
+
906
+	/**
907
+	 * sensei_sidebar hook
908
+	 *
909
+	 * @hooked sensei_get_sidebar - 10
910
+	 */
911
+	do_action( 'sensei_sidebar' );
912
+
913
+	get_footer();
915 914
 
916 915
 }// end get_sensei_header
917 916
 
@@ -923,14 +922,14 @@  discard block
 block discarded – undo
923 922
  */
924 923
 function the_no_permissions_title(){
925 924
 
926
-    /**
927
-     * Filter the no permissions title just before it is echo'd on the
928
-     * no-permissions.php file.
929
-     *
930
-     * @since 1.9.0
931
-     * @param $no_permissions_title
932
-     */
933
-    echo apply_filters( 'sensei_the_no_permissions_title', Sensei()->permissions_message['title'] );
925
+	/**
926
+	 * Filter the no permissions title just before it is echo'd on the
927
+	 * no-permissions.php file.
928
+	 *
929
+	 * @since 1.9.0
930
+	 * @param $no_permissions_title
931
+	 */
932
+	echo apply_filters( 'sensei_the_no_permissions_title', Sensei()->permissions_message['title'] );
934 933
 
935 934
 }
936 935
 
@@ -941,14 +940,14 @@  discard block
 block discarded – undo
941 940
  */
942 941
 function the_no_permissions_message( $post_id ){
943 942
 
944
-    /**
945
-     * Filter the no permissions message just before it is echo'd on the
946
-     * no-permissions.php file.
947
-     *
948
-     * @since 1.9.0
949
-     * @param $no_permissions_message
950
-     */
951
-    echo apply_filters( 'sensei_the_no_permissions_message', Sensei()->permissions_message['message'] , $post_id );
943
+	/**
944
+	 * Filter the no permissions message just before it is echo'd on the
945
+	 * no-permissions.php file.
946
+	 *
947
+	 * @since 1.9.0
948
+	 * @param $no_permissions_message
949
+	 */
950
+	echo apply_filters( 'sensei_the_no_permissions_message', Sensei()->permissions_message['message'] , $post_id );
952 951
 
953 952
 }
954 953
 
@@ -959,8 +958,8 @@  discard block
 block discarded – undo
959 958
  */
960 959
 function sensei_the_excerpt( $post_id ){
961 960
 
962
-    global $post;
963
-    the_excerpt( $post );
961
+	global $post;
962
+	the_excerpt( $post );
964 963
 
965 964
 }
966 965
 
@@ -974,9 +973,9 @@  discard block
 block discarded – undo
974 973
  */
975 974
  function sensei_get_current_page_url(){
976 975
 
977
-     global $wp;
978
-     $current_page_url =  home_url( $wp->request );
979
-     return $current_page_url;
976
+	 global $wp;
977
+	 $current_page_url =  home_url( $wp->request );
978
+	 return $current_page_url;
980 979
 
981 980
  }
982 981
 
@@ -988,7 +987,7 @@  discard block
 block discarded – undo
988 987
  */
989 988
 function sensei_the_my_courses_content(){
990 989
 
991
-    echo Sensei()->course->load_user_courses_content( wp_get_current_user() );
990
+	echo Sensei()->course->load_user_courses_content( wp_get_current_user() );
992 991
 
993 992
 } // sensei_the_my_courses_content
994 993
 
@@ -1003,7 +1002,7 @@  discard block
 block discarded – undo
1003 1002
  */
1004 1003
 function sensei_load_template( $template_name ){
1005 1004
 
1006
-    Sensei_Templates::get_template( $template_name );
1005
+	Sensei_Templates::get_template( $template_name );
1007 1006
 
1008 1007
 }
1009 1008
 
@@ -1017,7 +1016,7 @@  discard block
 block discarded – undo
1017 1016
  */
1018 1017
 function sensei_load_template_part( $slug, $name ){
1019 1018
 
1020
-    Sensei_Templates::get_part( $slug, $name );
1019
+	Sensei_Templates::get_part( $slug, $name );
1021 1020
 
1022 1021
 }
1023 1022
 
@@ -1036,17 +1035,17 @@  discard block
 block discarded – undo
1036 1035
  */
1037 1036
 function sensei_the_lesson_excerpt( $lesson_id = '' ) {
1038 1037
 
1039
-    if( empty( $lesson_id )){
1038
+	if( empty( $lesson_id )){
1040 1039
 
1041
-        $lesson_id = get_the_ID();
1040
+		$lesson_id = get_the_ID();
1042 1041
 
1043
-    }
1042
+	}
1044 1043
 
1045
-    if( 'lesson' != get_post_type( $lesson_id ) ){
1046
-        return;
1047
-    }
1044
+	if( 'lesson' != get_post_type( $lesson_id ) ){
1045
+		return;
1046
+	}
1048 1047
 
1049
-    echo Sensei_Lesson::lesson_excerpt( get_post( $lesson_id ), false );
1048
+	echo Sensei_Lesson::lesson_excerpt( get_post( $lesson_id ), false );
1050 1049
 
1051 1050
 }// End lesson_excerpt()
1052 1051
 
@@ -1056,16 +1055,16 @@  discard block
 block discarded – undo
1056 1055
  * @since 1.9.0
1057 1056
  */
1058 1057
 function sensei_the_course_results_lessons(){
1059
-    // load backwards compatible template name if it exists in the users theme
1060
-    $located_template= locate_template( Sensei()->template_url . 'course-results/course-lessons.php' );
1061
-    if( $located_template ){
1058
+	// load backwards compatible template name if it exists in the users theme
1059
+	$located_template= locate_template( Sensei()->template_url . 'course-results/course-lessons.php' );
1060
+	if( $located_template ){
1062 1061
 
1063
-        Sensei_Templates::get_template( 'course-results/course-lessons.php' );
1064
-        return;
1062
+		Sensei_Templates::get_template( 'course-results/course-lessons.php' );
1063
+		return;
1065 1064
 
1066
-    }
1065
+	}
1067 1066
 
1068
-    Sensei_Templates::get_template( 'course-results/lessons.php' );
1067
+	Sensei_Templates::get_template( 'course-results/lessons.php' );
1069 1068
 }
1070 1069
 
1071 1070
 /**
@@ -1077,6 +1076,6 @@  discard block
 block discarded – undo
1077 1076
  */
1078 1077
 function sensei_courses_per_row(){
1079 1078
 
1080
-    echo Sensei_Course::get_loop_number_of_columns();
1079
+	echo Sensei_Course::get_loop_number_of_columns();
1081 1080
 
1082 1081
 }
Please login to merge, or discard this patch.
Spacing   +180 added lines, -180 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
 
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 	 function course_single_lessons() {
28 28
 
29 29
          // load backwards compatible template name if it exists in the users theme
30
-         $located_template= locate_template( Sensei()->template_url . 'single-course/course-lessons.php' );
31
-         if( $located_template ){
30
+         $located_template = locate_template(Sensei()->template_url.'single-course/course-lessons.php');
31
+         if ($located_template) {
32 32
 
33
-             Sensei_Templates::get_template( 'single-course/course-lessons.php' );
33
+             Sensei_Templates::get_template('single-course/course-lessons.php');
34 34
              return;
35 35
 
36 36
         }
37 37
 
38
-		Sensei_Templates::get_template( 'single-course/lessons.php' );
38
+		Sensei_Templates::get_template('single-course/lessons.php');
39 39
 
40 40
 	 } // End course_single_lessons()
41 41
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	  */
49 49
 	 function lesson_single_meta() {
50 50
 
51
-         _deprecated_function('lesson_single_meta','1.9;0', 'WooThemes_Sensei_Lesson::the_lesson_meta' );
51
+         _deprecated_function('lesson_single_meta', '1.9;0', 'WooThemes_Sensei_Lesson::the_lesson_meta');
52 52
          sensei_the_single_lesson_meta();
53 53
 
54 54
 	 } // End lesson_single_meta()
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	  * @return void
63 63
       * @deprecated since 1.9.0
64 64
 	  */
65
-	 function quiz_questions( $return = false ) {
65
+	 function quiz_questions($return = false) {
66 66
 
67
-	 	Sensei_Templates::get_template( 'single-quiz/quiz-questions.php' );
67
+	 	Sensei_Templates::get_template('single-quiz/quiz-questions.php');
68 68
 
69 69
 	 } // End quiz_questions()
70 70
 
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	  * @return void
77 77
       * @deprecated
78 78
 	  */
79
-	 function quiz_question_type( $question_type = 'multiple-choice' ) {
79
+	 function quiz_question_type($question_type = 'multiple-choice') {
80 80
 
81
-         Sensei_Templates::get_template( 'single-quiz/question_type-' . $question_type . '.php' );
81
+         Sensei_Templates::get_template('single-quiz/question_type-'.$question_type.'.php');
82 82
 
83 83
 	 } // End lesson_single_meta()
84 84
 
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 	 * @param mixed $course_id
95 95
 	 * @return bool
96 96
 	 */
97
-	function sensei_check_prerequisite_course( $course_id ) {
97
+	function sensei_check_prerequisite_course($course_id) {
98 98
 
99
-        return Sensei_Course::is_prerequisite_complete( $course_id );
99
+        return Sensei_Course::is_prerequisite_complete($course_id);
100 100
 
101 101
 	} // End sensei_check_prerequisite_course()
102 102
 
@@ -108,16 +108,16 @@  discard block
 block discarded – undo
108 108
 	 * @param mixed $course_id
109 109
 	 * @return void
110 110
 	 */
111
-	function sensei_start_course_form( $course_id ) {
111
+	function sensei_start_course_form($course_id) {
112 112
 
113
-		$prerequisite_complete = sensei_check_prerequisite_course( $course_id );
113
+		$prerequisite_complete = sensei_check_prerequisite_course($course_id);
114 114
 
115
-		if ( $prerequisite_complete ) {
116
-		?><form method="POST" action="<?php echo esc_url( get_permalink() ); ?>">
115
+		if ($prerequisite_complete) {
116
+		?><form method="POST" action="<?php echo esc_url(get_permalink()); ?>">
117 117
 
118
-    			<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' ) ); ?>" />
118
+    			<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')); ?>" />
119 119
 
120
-    			<span><input name="course_start" type="submit" class="course-start" value="<?php _e( 'Start taking this Course', 'woothemes-sensei' ); ?>"/></span>
120
+    			<span><input name="course_start" type="submit" class="course-start" value="<?php _e('Start taking this Course', 'woothemes-sensei'); ?>"/></span>
121 121
 
122 122
     		</form><?php
123 123
     	} // End If Statement
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 	 * @param mixed $course_id
133 133
 	 * @return void
134 134
 	 */
135
-	function sensei_wc_add_to_cart( $course_id ) {
135
+	function sensei_wc_add_to_cart($course_id) {
136 136
 
137
-		Sensei_WC::the_add_to_cart_button_html( $course_id );
137
+		Sensei_WC::the_add_to_cart_button_html($course_id);
138 138
 
139 139
 	} // End sensei_wc_add_to_cart()
140 140
 
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
 	 * @param int $wc_post_id (default: 0)
147 147
 	 * @return bool
148 148
 	 */
149
-	function sensei_check_if_product_is_in_cart( $wc_product_id = 0 ) {
150
-        return Sensei_WC::is_product_in_cart( $wc_product_id );
149
+	function sensei_check_if_product_is_in_cart($wc_product_id = 0) {
150
+        return Sensei_WC::is_product_in_cart($wc_product_id);
151 151
 	} // End sensei_check_if_product_is_in_cart()
152 152
 
153 153
 	/**
@@ -157,16 +157,16 @@  discard block
 block discarded – undo
157 157
 	 * @param mixed $post_id
158 158
 	 * @return void
159 159
 	 */
160
-	function sensei_simple_course_price( $post_id ) {
160
+	function sensei_simple_course_price($post_id) {
161 161
 
162 162
 		//WooCommerce Pricing
163
-        if ( Sensei_WC::is_woocommerce_active() ) {
164
-    	    $wc_post_id = get_post_meta( $post_id, '_course_woocommerce_product', true );
165
-    	    if ( 0 < $wc_post_id ) {
163
+        if (Sensei_WC::is_woocommerce_active()) {
164
+    	    $wc_post_id = get_post_meta($post_id, '_course_woocommerce_product', true);
165
+    	    if (0 < $wc_post_id) {
166 166
     	    	// Get the product
167
-    	    	$product = Sensei()->sensei_get_woocommerce_product_object( $wc_post_id );
167
+    	    	$product = Sensei()->sensei_get_woocommerce_product_object($wc_post_id);
168 168
 
169
-    	    	if ( isset( $product ) && !empty( $product )  &&  $product->is_purchasable() && $product->is_in_stock() && !sensei_check_if_product_is_in_cart( $wc_post_id ) ) { ?>
169
+    	    	if (isset($product) && ! empty($product) && $product->is_purchasable() && $product->is_in_stock() && ! sensei_check_if_product_is_in_cart($wc_post_id)) { ?>
170 170
     	    		<span class="course-price"><?php echo $product->get_price_html(); ?></span>
171 171
     	    	<?php } // End If Statement
172 172
     	    } // End If Statement
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 	 * @param array $widget_args (default: array())
181 181
 	 * @return void
182 182
 	 */
183
-	function sensei_recent_comments_widget_filter( $widget_args = array() ) {
184
-		if ( ! isset( $widget_args['post_type'] ) ) $widget_args['post_type'] = array( 'post', 'page' );
183
+	function sensei_recent_comments_widget_filter($widget_args = array()) {
184
+		if ( ! isset($widget_args['post_type'])) $widget_args['post_type'] = array('post', 'page');
185 185
 		return $widget_args;
186 186
 	} // End sensei_recent_comments_widget_filter()
187
-	add_filter( 'widget_comments_args', 'sensei_recent_comments_widget_filter', 10, 1 );
187
+	add_filter('widget_comments_args', 'sensei_recent_comments_widget_filter', 10, 1);
188 188
 
189 189
 	/**
190 190
 	 * sensei_course_archive_filter function.
@@ -193,26 +193,26 @@  discard block
 block discarded – undo
193 193
 	 * @param array $query ( default: array ( ) )
194 194
 	 * @return void
195 195
 	 */
196
-	function sensei_course_archive_filter( $query ) {
196
+	function sensei_course_archive_filter($query) {
197 197
 
198 198
 
199
-		if ( ! $query->is_main_query() )
199
+		if ( ! $query->is_main_query())
200 200
         	return;
201 201
 
202 202
 		// Apply Filter only if on frontend and when course archive is running
203
-		$course_page_id = intval( Sensei()->settings->settings[ 'course_page' ] );
203
+		$course_page_id = intval(Sensei()->settings->settings['course_page']);
204 204
 
205
-		if ( ! is_admin() && 0 < $course_page_id && 0 < intval( $query->get( 'page_id' ) ) && $query->get( 'page_id' ) == $course_page_id ) {
205
+		if ( ! is_admin() && 0 < $course_page_id && 0 < intval($query->get('page_id')) && $query->get('page_id') == $course_page_id) {
206 206
 			// Check for pagination settings
207
-   			if ( isset( Sensei()->settings->settings[ 'course_archive_amount' ] ) && ( 0 < absint( Sensei()->settings->settings[ 'course_archive_amount' ] ) ) ) {
208
-    			$amount = absint( Sensei()->settings->settings[ 'course_archive_amount' ] );
207
+   			if (isset(Sensei()->settings->settings['course_archive_amount']) && (0 < absint(Sensei()->settings->settings['course_archive_amount']))) {
208
+    			$amount = absint(Sensei()->settings->settings['course_archive_amount']);
209 209
     		} else {
210
-    			$amount = $query->get( 'posts_per_page' );
210
+    			$amount = $query->get('posts_per_page');
211 211
     		} // End If Statement
212
-    		$query->set( 'posts_per_page', $amount );
212
+    		$query->set('posts_per_page', $amount);
213 213
 		} // End If Statement
214 214
 	} // End sensei_course_archive_filter()
215
-	add_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 );
215
+	add_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
216 216
 
217 217
 	/**
218 218
 	 * sensei_complete_lesson_button description
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 * @return html
221 221
 	 */
222 222
 	function sensei_complete_lesson_button() {
223
-		do_action( 'sensei_complete_lesson_button' );
223
+		do_action('sensei_complete_lesson_button');
224 224
 	} // End sensei_complete_lesson_button()
225 225
 
226 226
 	/**
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 * @return html
230 230
 	 */
231 231
 	function sensei_reset_lesson_button() {
232
-		do_action( 'sensei_reset_lesson_button' );
232
+		do_action('sensei_reset_lesson_button');
233 233
 	} // End sensei_reset_lesson_button()
234 234
 
235 235
 	/**
@@ -238,19 +238,19 @@  discard block
 block discarded – undo
238 238
 	 * @param  integer $lesson_id
239 239
 	 * @return array $return_values
240 240
 	 */
241
-	function sensei_get_prev_next_lessons( $lesson_id = 0 ) {
241
+	function sensei_get_prev_next_lessons($lesson_id = 0) {
242 242
 
243 243
 		$return_values = array();
244 244
 		$return_values['prev_lesson'] = 0;
245 245
 		$return_values['next_lesson'] = 0;
246
-		if ( 0 < $lesson_id ) {
246
+		if (0 < $lesson_id) {
247 247
 			// Get the List of Lessons in the Course
248
-			$lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true );
248
+			$lesson_course_id = get_post_meta($lesson_id, '_lesson_course', true);
249 249
 			$all_lessons = array();
250 250
 
251
-            $modules = Sensei()->modules->get_course_modules( intval( $lesson_course_id ) );
251
+            $modules = Sensei()->modules->get_course_modules(intval($lesson_course_id));
252 252
 
253
-            foreach( (array) $modules as $module ) {
253
+            foreach ((array) $modules as $module) {
254 254
 
255 255
                 $args = array(
256 256
                     'post_type' => 'lesson',
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
                     'meta_query' => array(
260 260
                         array(
261 261
                             'key' => '_lesson_course',
262
-                            'value' => intval( $lesson_course_id ),
262
+                            'value' => intval($lesson_course_id),
263 263
                             'compare' => '='
264 264
                         )
265 265
                     ),
@@ -267,18 +267,18 @@  discard block
 block discarded – undo
267 267
                         array(
268 268
                             'taxonomy' => Sensei()->modules->taxonomy,
269 269
                             'field' => 'id',
270
-                            'terms' => intval( $module->term_id )
270
+                            'terms' => intval($module->term_id)
271 271
                         )
272 272
                     ),
273
-                    'meta_key' => '_order_module_' . $module->term_id,
273
+                    'meta_key' => '_order_module_'.$module->term_id,
274 274
                     'orderby' => 'meta_value_num date',
275 275
                     'order' => 'ASC',
276 276
                     'suppress_filters' => 0
277 277
                 );
278 278
 
279
-                $lessons = get_posts( $args );
280
-                if ( 0 < count( $lessons ) ) {
281
-                    foreach ($lessons as $lesson_item){
279
+                $lessons = get_posts($args);
280
+                if (0 < count($lessons)) {
281
+                    foreach ($lessons as $lesson_item) {
282 282
                         $all_lessons[] = $lesson_item->ID;
283 283
                     } // End For Loop
284 284
                 } // End If Statement
@@ -288,36 +288,36 @@  discard block
 block discarded – undo
288 288
                 'post_type' => 'lesson',
289 289
                 'posts_per_page' => -1,
290 290
                 'suppress_filters' => 0,
291
-                'meta_key' => '_order_' . $lesson_course_id,
291
+                'meta_key' => '_order_'.$lesson_course_id,
292 292
                 'orderby' => 'meta_value_num date',
293 293
                 'order' => 'ASC',
294 294
                 'meta_query' => array(
295 295
                     array(
296 296
                         'key' => '_lesson_course',
297
-                        'value' => intval( $lesson_course_id ),
297
+                        'value' => intval($lesson_course_id),
298 298
                     ),
299 299
                 ),
300 300
                 'post__not_in' => $all_lessons,
301 301
             );
302 302
 
303
-            $other_lessons = get_posts( $args );
304
-            if ( 0 < count( $other_lessons ) ) {
305
-				foreach ($other_lessons as $lesson_item){
303
+            $other_lessons = get_posts($args);
304
+            if (0 < count($other_lessons)) {
305
+				foreach ($other_lessons as $lesson_item) {
306 306
 					$all_lessons[] = $lesson_item->ID;
307 307
 				} // End For Loop
308 308
 			} // End If Statement
309 309
 
310
-            if ( 0 < count( $all_lessons ) ) {
310
+            if (0 < count($all_lessons)) {
311 311
 				$found_index = false;
312
-				foreach ( $all_lessons as $lesson ){
313
-					if ( $found_index && $return_values['next_lesson'] == 0 ) {
312
+				foreach ($all_lessons as $lesson) {
313
+					if ($found_index && $return_values['next_lesson'] == 0) {
314 314
 						$return_values['next_lesson'] = $lesson;
315 315
 					} // End If Statement
316
-					if ( $lesson == $lesson_id ) {
316
+					if ($lesson == $lesson_id) {
317 317
 						// Is the current post
318 318
 						$found_index = true;
319 319
 					} // End If Statement
320
-					if ( !$found_index ) {
320
+					if ( ! $found_index) {
321 321
 						$return_values['prev_lesson'] = $lesson;
322 322
 					} // End If Statement
323 323
 				} // End For Loop
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
    * @param  int|WP_Post $post_id Optional. Defaults to current post
337 337
    * @return string $excerpt
338 338
    */
339
-  function sensei_get_excerpt( $post_id = '' ) {
339
+  function sensei_get_excerpt($post_id = '') {
340 340
 
341 341
       global $post;
342 342
       _deprecated_function('sensei_get_excerpt', 'use the wordpress excerpt functionality.');
@@ -344,14 +344,14 @@  discard block
 block discarded – undo
344 344
 
345 345
   }
346 346
 
347
-	function sensei_has_user_started_course( $post_id = 0, $user_id = 0 ) {
348
-		_deprecated_function( __FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_started_course()" );
349
-		return Sensei_Utils::user_started_course( $post_id, $user_id );
347
+	function sensei_has_user_started_course($post_id = 0, $user_id = 0) {
348
+		_deprecated_function(__FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_started_course()");
349
+		return Sensei_Utils::user_started_course($post_id, $user_id);
350 350
 	} // End sensei_has_user_started_course()
351 351
 
352
-	function sensei_has_user_completed_lesson( $post_id = 0, $user_id = 0 ) {
353
-		_deprecated_function( __FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_completed_lesson()" );
354
-		return Sensei_Utils::user_completed_lesson( $post_id, $user_id );
352
+	function sensei_has_user_completed_lesson($post_id = 0, $user_id = 0) {
353
+		_deprecated_function(__FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_completed_lesson()");
354
+		return Sensei_Utils::user_completed_lesson($post_id, $user_id);
355 355
 	} // End sensei_has_user_completed_lesson()
356 356
 
357 357
 /**
@@ -363,9 +363,9 @@  discard block
 block discarded – undo
363 363
  * @param int $user_id
364 364
  * @return bool
365 365
 */
366
-function sensei_has_user_completed_prerequisite_lesson( $current_lesson_id, $user_id ) {
366
+function sensei_has_user_completed_prerequisite_lesson($current_lesson_id, $user_id) {
367 367
 
368
-    return WooThemes_Sensei_Lesson::is_pre_requisite_complete( $current_lesson_id, $user_id );
368
+    return WooThemes_Sensei_Lesson::is_pre_requisite_complete($current_lesson_id, $user_id);
369 369
 
370 370
 } // End sensei_has_user_completed_prerequisite_lesson()
371 371
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
  * @return bool
389 389
  *
390 390
  */
391
-function sensei_have_modules( $course_post_id = '' ){
391
+function sensei_have_modules($course_post_id = '') {
392 392
 
393 393
 	global $post, $wp_query, $sensei_modules_loop;
394 394
 
@@ -396,23 +396,23 @@  discard block
 block discarded – undo
396 396
 	wp_reset_query();
397 397
 	$post = $wp_query->post;
398 398
 
399
-	if( empty( $course_post_id ) ){
399
+	if (empty($course_post_id)) {
400 400
 
401 401
 		$course_id = $post->ID;
402 402
 
403 403
 	}
404 404
 
405 405
 	// doesn't apply to none course post types
406
-	if( ! sensei_is_a_course( $course_id )  ){
406
+	if ( ! sensei_is_a_course($course_id)) {
407 407
 		return false;
408 408
 	}
409 409
 
410 410
 	// check the current item compared to the total number of modules
411
-	if( $sensei_modules_loop[ 'current' ] + 1 > $sensei_modules_loop[ 'total' ]  ){
411
+	if ($sensei_modules_loop['current'] + 1 > $sensei_modules_loop['total']) {
412 412
 
413 413
 		return false;
414 414
 
415
-	}else{
415
+	} else {
416 416
 
417 417
 		return true;
418 418
 
@@ -426,27 +426,27 @@  discard block
 block discarded – undo
426 426
  *
427 427
  * @since 1.9.0
428 428
  */
429
-function sensei_setup_module(){
429
+function sensei_setup_module() {
430 430
 
431 431
 	global  $sensei_modules_loop, $wp_query;
432 432
 
433 433
 	// increment the index
434
-	$sensei_modules_loop[ 'current' ]++;
435
-	$index = $sensei_modules_loop[ 'current' ];
436
-	if( isset( $sensei_modules_loop['modules'][ $index ] ) ) {
434
+	$sensei_modules_loop['current']++;
435
+	$index = $sensei_modules_loop['current'];
436
+	if (isset($sensei_modules_loop['modules'][$index])) {
437 437
 
438 438
 		$sensei_modules_loop['current_module'] = $sensei_modules_loop['modules'][$index];
439 439
 		// setup the query for the module lessons
440 440
 		$course_id = $sensei_modules_loop['course_id'];
441 441
 		$module_term_id = $sensei_modules_loop['current_module']->term_id;
442
-		$modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id );
442
+		$modules_query = Sensei()->modules->get_lessons_query($course_id, $module_term_id);
443 443
 
444 444
 		// setup the global wp-query only if the lessons
445
-		if( $modules_query->have_posts() ){
445
+		if ($modules_query->have_posts()) {
446 446
 
447 447
 			$wp_query = $modules_query;
448 448
 
449
-		}else{
449
+		} else {
450 450
 
451 451
 			wp_reset_query();
452 452
 
@@ -470,30 +470,30 @@  discard block
 block discarded – undo
470 470
  *
471 471
  * @return bool
472 472
  */
473
-function sensei_module_has_lessons(){
473
+function sensei_module_has_lessons() {
474 474
 
475 475
 	global $wp_query, $sensei_modules_loop;
476 476
 
477
-	if( 'lesson' == $wp_query->get('post_type') ){
477
+	if ('lesson' == $wp_query->get('post_type')) {
478 478
 
479 479
 		return have_posts();
480 480
 
481
-	}else{
481
+	} else {
482 482
 
483 483
         // if the loop has not been initiated check the first module has lessons
484
-        if( -1 == $sensei_modules_loop[ 'current' ]  ){
484
+        if ( -1 == $sensei_modules_loop['current']  ) {
485 485
 
486 486
             $index = 0;
487 487
 
488
-            if( isset( $sensei_modules_loop['modules'][ $index ] ) ) {
488
+            if (isset($sensei_modules_loop['modules'][$index])) {
489 489
                 // setup the query for the module lessons
490 490
                 $course_id = $sensei_modules_loop['course_id'];
491 491
 
492
-                $module_term_id = $sensei_modules_loop['modules'][ $index ] ->term_id;
493
-                $modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id );
492
+                $module_term_id = $sensei_modules_loop['modules'][$index] ->term_id;
493
+                $modules_query = Sensei()->modules->get_lessons_query($course_id, $module_term_id);
494 494
 
495 495
                 // setup the global wp-query only if the lessons
496
-                if( $modules_query->have_posts() ){
496
+                if ($modules_query->have_posts()) {
497 497
 
498 498
                     return true;
499 499
 
@@ -517,9 +517,9 @@  discard block
 block discarded – undo
517 517
  * @uses sensei_the_module_title
518 518
  * @return string
519 519
  */
520
-function sensei_the_module_title_attribute(){
520
+function sensei_the_module_title_attribute() {
521 521
 
522
-	esc_attr_e( sensei_get_the_module_title() );
522
+	esc_attr_e(sensei_get_the_module_title());
523 523
 
524 524
 }
525 525
 
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
  *
531 531
  * @return string
532 532
  */
533
-function sensei_the_module_permalink(){
533
+function sensei_the_module_permalink() {
534 534
 
535 535
 	global $sensei_modules_loop;
536 536
 	$course_id = $sensei_modules_loop['course_id'];
537
-	$module_url = add_query_arg('course_id', $course_id, get_term_link( $sensei_modules_loop['current_module'], 'module' ) );
537
+	$module_url = add_query_arg('course_id', $course_id, get_term_link($sensei_modules_loop['current_module'], 'module'));
538 538
 	$module_term_id = $sensei_modules_loop['current_module']->term_id;
539 539
 
540 540
 	/**
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 	 * @param int $module_term_id
547 547
 	 * @param string $course_id
548 548
 	 */
549
-	 echo esc_url_raw( apply_filters( 'sensei_the_module_permalink', $module_url, $module_term_id  ,$course_id ) );
549
+	 echo esc_url_raw(apply_filters('sensei_the_module_permalink', $module_url, $module_term_id, $course_id));
550 550
 
551 551
 }// end sensei_the_module_permalink
552 552
 
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
  *
559 559
  * @return string
560 560
  */
561
-function sensei_get_the_module_title(){
561
+function sensei_get_the_module_title() {
562 562
 
563 563
 	global $sensei_modules_loop;
564 564
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	 * @param $module_term_id
578 578
 	 * @param $course_id
579 579
 	 */
580
-	return apply_filters( 'sensei_the_module_title',  $module_title , $module_term_id, $course_id );
580
+	return apply_filters('sensei_the_module_title', $module_title, $module_term_id, $course_id);
581 581
 
582 582
 }
583 583
 
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
  * @uses sensei_get_the_module_title
590 590
  * @return string
591 591
  */
592
-function sensei_the_module_title(){
592
+function sensei_the_module_title() {
593 593
 
594 594
 	echo sensei_get_the_module_title();
595 595
 
@@ -610,19 +610,19 @@  discard block
 block discarded – undo
610 610
  *
611 611
  * @return bool
612 612
  */
613
-function sensei_quiz_has_questions(){
613
+function sensei_quiz_has_questions() {
614 614
 
615 615
     global $sensei_question_loop;
616 616
 
617
-    if( !isset( $sensei_question_loop['total'] ) ){
617
+    if ( ! isset($sensei_question_loop['total'])) {
618 618
         return false;
619 619
     }
620 620
 
621
-    if( $sensei_question_loop['current'] + 1 < $sensei_question_loop['total']  ){
621
+    if ($sensei_question_loop['current'] + 1 < $sensei_question_loop['total']) {
622 622
 
623 623
         return true;
624 624
 
625
-    }else{
625
+    } else {
626 626
 
627 627
         return false;
628 628
 
@@ -639,13 +639,13 @@  discard block
 block discarded – undo
639 639
  * @since 1.9.0
640 640
 
641 641
  */
642
-function sensei_setup_the_question(){
642
+function sensei_setup_the_question() {
643 643
 
644 644
     global $sensei_question_loop;
645 645
 
646 646
     $sensei_question_loop['current']++;
647 647
     $index = $sensei_question_loop['current'];
648
-    $sensei_question_loop['current_question'] =  $sensei_question_loop['questions'][ $index ] ;
648
+    $sensei_question_loop['current_question'] = $sensei_question_loop['questions'][$index];
649 649
 
650 650
 
651 651
 }// end sensei_setup_the_question
@@ -656,14 +656,14 @@  discard block
 block discarded – undo
656 656
  * This function gets the type and loads the template that will handle it.
657 657
  *
658 658
  */
659
-function sensei_the_question_content(){
659
+function sensei_the_question_content() {
660 660
 
661 661
     global $sensei_question_loop;
662 662
 
663
-    $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID );
663
+    $question_type = Sensei()->question->get_question_type($sensei_question_loop['current_question']->ID);
664 664
 
665 665
     // load the template that displays the question information.
666
-    WooThemes_Sensei_Question::load_question_template( $question_type );
666
+    WooThemes_Sensei_Question::load_question_template($question_type);
667 667
 
668 668
 }// end sensei_the_question_content
669 669
 
@@ -672,11 +672,11 @@  discard block
 block discarded – undo
672 672
  *
673 673
  * @since 1.9.0
674 674
  */
675
-function sensei_the_question_class(){
675
+function sensei_the_question_class() {
676 676
 
677 677
     global $sensei_question_loop;
678 678
 
679
-    $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID );
679
+    $question_type = Sensei()->question->get_question_type($sensei_question_loop['current_question']->ID);
680 680
 
681 681
     /**
682 682
      * filter the sensei question class within
@@ -684,16 +684,16 @@  discard block
 block discarded – undo
684 684
      *
685 685
      * @since 1.9.0
686 686
      */
687
-     $classes = apply_filters( 'sensei_question_classes', array( $question_type ) );
687
+     $classes = apply_filters('sensei_question_classes', array($question_type));
688 688
 
689 689
     $html_classes = '';
690
-    foreach( $classes as $class ){
690
+    foreach ($classes as $class) {
691 691
 
692
-        $html_classes .= $class . ' ';
692
+        $html_classes .= $class.' ';
693 693
 
694 694
     }// end foreach
695 695
 
696
-    esc_attr_e( trim( $html_classes ) );
696
+    esc_attr_e(trim($html_classes));
697 697
 
698 698
 }
699 699
 
@@ -702,10 +702,10 @@  discard block
 block discarded – undo
702 702
  *
703 703
  * @since 1.9.0
704 704
  */
705
-function sensei_get_the_question_id( ){
705
+function sensei_get_the_question_id( ) {
706 706
 
707 707
     global $sensei_question_loop;
708
-    if( isset( $sensei_question_loop['current_question']->ID ) ){
708
+    if (isset($sensei_question_loop['current_question']->ID)) {
709 709
 
710 710
         return $sensei_question_loop['current_question']->ID;
711 711
 
@@ -734,27 +734,27 @@  discard block
 block discarded – undo
734 734
  * @param string $lesson_id
735 735
  * @return bool
736 736
  */
737
-function sensei_can_user_view_lesson( $lesson_id = '', $user_id = ''  ){
737
+function sensei_can_user_view_lesson($lesson_id = '', $user_id = '') {
738 738
 
739
-    if( empty( $lesson_id ) ){
739
+    if (empty($lesson_id)) {
740 740
 
741 741
         $lesson_id = get_the_ID();
742 742
 
743 743
     }
744 744
 
745
-    if( empty( $user_id ) ){
745
+    if (empty($user_id)) {
746 746
 
747 747
         $user_id = get_current_user_id();
748 748
 
749 749
     }
750 750
 
751 751
     // Check for prerequisite lesson completions
752
-    $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete( $lesson_id, $user_id );
753
-    $lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true );
754
-    $user_taking_course = Sensei_Utils::user_started_course( $lesson_course_id, $user_id );
752
+    $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete($lesson_id, $user_id);
753
+    $lesson_course_id = get_post_meta($lesson_id, '_lesson_course', true);
754
+    $user_taking_course = Sensei_Utils::user_started_course($lesson_course_id, $user_id);
755 755
 
756 756
     $is_preview = false;
757
-    if( Sensei_Utils::is_preview_lesson( $lesson_id ) ) {
757
+    if (Sensei_Utils::is_preview_lesson($lesson_id)) {
758 758
 
759 759
         $is_preview = true;
760 760
         $pre_requisite_complete = true;
@@ -762,24 +762,24 @@  discard block
 block discarded – undo
762 762
     };
763 763
 
764 764
 
765
-    $user_can_access_lesson =  false;
765
+    $user_can_access_lesson = false;
766 766
 
767
-    if( is_user_logged_in() && $user_taking_course ){
767
+    if (is_user_logged_in() && $user_taking_course) {
768 768
 
769
-        $user_can_access_lesson =  true;
769
+        $user_can_access_lesson = true;
770 770
 
771 771
     }
772 772
 
773 773
 
774 774
     $access_permission = false;
775 775
 
776
-    if ( ! Sensei()->settings->get('access_permission')  || sensei_all_access() ) {
776
+    if ( ! Sensei()->settings->get('access_permission') || sensei_all_access()) {
777 777
 
778 778
         $access_permission = true;
779 779
 
780 780
     }
781 781
 
782
-    $can_user_view_lesson = $access_permission || ( $user_can_access_lesson && $pre_requisite_complete ) || $is_preview;
782
+    $can_user_view_lesson = $access_permission || ($user_can_access_lesson && $pre_requisite_complete) || $is_preview;
783 783
 
784 784
     /**
785 785
      * Filter the can user view lesson function
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
      * @param string $lesson_id
793 793
      * @param string $user_id
794 794
      */
795
-    return apply_filters( 'sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id );
795
+    return apply_filters('sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id);
796 796
 
797 797
 } // end sensei_can_current_user_view_lesson
798 798
 
@@ -802,54 +802,54 @@  discard block
 block discarded – undo
802 802
  * The function should only be called on the single lesson
803 803
  *
804 804
  */
805
-function sensei_the_single_lesson_meta(){
805
+function sensei_the_single_lesson_meta() {
806 806
 
807 807
     // if the lesson meta is included within theme load that instead of the function content
808
-    $template = Sensei_Templates::locate_template( 'single-lesson/lesson-meta.php' );
809
-    if( ! empty( $template ) ){
808
+    $template = Sensei_Templates::locate_template('single-lesson/lesson-meta.php');
809
+    if ( ! empty($template)) {
810 810
 
811
-        Sensei_Templates::get_template( 'single-lesson/lesson-meta.php' );
811
+        Sensei_Templates::get_template('single-lesson/lesson-meta.php');
812 812
         return;
813 813
 
814 814
     }
815 815
 
816 816
     // Get the meta info
817
-    $lesson_course_id = absint( get_post_meta( get_the_ID(), '_lesson_course', true ) );
818
-    $is_preview = Sensei_Utils::is_preview_lesson( get_the_ID() );
817
+    $lesson_course_id = absint(get_post_meta(get_the_ID(), '_lesson_course', true));
818
+    $is_preview = Sensei_Utils::is_preview_lesson(get_the_ID());
819 819
 
820 820
     // Get User Meta
821 821
     get_currentuserinfo();
822 822
 
823 823
     // Complete Lesson Logic
824
-    do_action( 'sensei_complete_lesson' );
824
+    do_action('sensei_complete_lesson');
825 825
     // Check that the course has been started
826
-    if ( Sensei()->access_settings()
827
-        || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id())
828
-        || $is_preview ) {
826
+    if (Sensei()->access_settings()
827
+        || Sensei_Utils::user_started_course($lesson_course_id, get_current_user_id())
828
+        || $is_preview) {
829 829
         ?>
830 830
         <section class="lesson-meta">
831 831
             <?php
832
-            if( apply_filters( 'sensei_video_position', 'top', get_the_ID() ) == 'bottom' ) {
832
+            if (apply_filters('sensei_video_position', 'top', get_the_ID()) == 'bottom') {
833 833
 
834
-                do_action( 'sensei_lesson_video', get_the_ID() );
834
+                do_action('sensei_lesson_video', get_the_ID());
835 835
 
836 836
             }
837 837
             ?>
838
-            <?php do_action( 'sensei_frontend_messages' ); ?>
838
+            <?php do_action('sensei_frontend_messages'); ?>
839 839
 
840 840
             <?php if ( ! $is_preview
841
-                || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) ) {
841
+                || Sensei_Utils::user_started_course($lesson_course_id, get_current_user_id())) {
842 842
 
843
-                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() )  );
843
+                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()));
844 844
 
845 845
             } ?>
846 846
         </section>
847 847
 
848
-        <?php do_action( 'sensei_lesson_back_link', $lesson_course_id ); ?>
848
+        <?php do_action('sensei_lesson_back_link', $lesson_course_id); ?>
849 849
 
850 850
     <?php }
851 851
 
852
-    do_action( 'sensei_lesson_meta_extra', get_the_ID() );
852
+    do_action('sensei_lesson_meta_extra', get_the_ID());
853 853
 
854 854
 } // end the_single_lesson_meta
855 855
 
@@ -863,9 +863,9 @@  discard block
 block discarded – undo
863 863
  *
864 864
  * @since 1.9.0
865 865
  */
866
-function get_sensei_header(){
866
+function get_sensei_header() {
867 867
 
868
-    if ( ! defined( 'ABSPATH' ) ) exit;
868
+    if ( ! defined('ABSPATH')) exit;
869 869
 
870 870
     get_header();
871 871
 
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
      *
875 875
      * @hooked sensei_output_content_wrapper - 10 (outputs opening divs for the content)
876 876
      */
877
-    do_action( 'sensei_before_main_content' );
877
+    do_action('sensei_before_main_content');
878 878
 
879 879
 }// end get_sensei_header
880 880
 
@@ -888,28 +888,28 @@  discard block
 block discarded – undo
888 888
  *
889 889
  * @since 1.9.0
890 890
  */
891
-function get_sensei_footer(){
891
+function get_sensei_footer() {
892 892
 
893 893
     /**
894 894
      * sensei_pagination hook
895 895
      *
896 896
      * @hooked sensei_pagination - 10 (outputs pagination)
897 897
      */
898
-    do_action( 'sensei_pagination' );
898
+    do_action('sensei_pagination');
899 899
 
900 900
     /**
901 901
      * sensei_after_main_content hook
902 902
      *
903 903
      * @hooked sensei_output_content_wrapper_end - 10 (outputs closing divs for the content)
904 904
      */
905
-    do_action( 'sensei_after_main_content' );
905
+    do_action('sensei_after_main_content');
906 906
 
907 907
     /**
908 908
      * sensei_sidebar hook
909 909
      *
910 910
      * @hooked sensei_get_sidebar - 10
911 911
      */
912
-    do_action( 'sensei_sidebar' );
912
+    do_action('sensei_sidebar');
913 913
 
914 914
     get_footer();
915 915
 
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
  *
922 922
  * @since 1.9.0
923 923
  */
924
-function the_no_permissions_title(){
924
+function the_no_permissions_title() {
925 925
 
926 926
     /**
927 927
      * Filter the no permissions title just before it is echo'd on the
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
      * @since 1.9.0
931 931
      * @param $no_permissions_title
932 932
      */
933
-    echo apply_filters( 'sensei_the_no_permissions_title', Sensei()->permissions_message['title'] );
933
+    echo apply_filters('sensei_the_no_permissions_title', Sensei()->permissions_message['title']);
934 934
 
935 935
 }
936 936
 
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
  *
940 940
  * @since 1.9.0
941 941
  */
942
-function the_no_permissions_message( $post_id ){
942
+function the_no_permissions_message($post_id) {
943 943
 
944 944
     /**
945 945
      * Filter the no permissions message just before it is echo'd on the
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
      * @since 1.9.0
949 949
      * @param $no_permissions_message
950 950
      */
951
-    echo apply_filters( 'sensei_the_no_permissions_message', Sensei()->permissions_message['message'] , $post_id );
951
+    echo apply_filters('sensei_the_no_permissions_message', Sensei()->permissions_message['message'], $post_id);
952 952
 
953 953
 }
954 954
 
@@ -957,10 +957,10 @@  discard block
 block discarded – undo
957 957
  *
958 958
  * @since 1.9.0
959 959
  */
960
-function sensei_the_excerpt( $post_id ){
960
+function sensei_the_excerpt($post_id) {
961 961
 
962 962
     global $post;
963
-    the_excerpt( $post );
963
+    the_excerpt($post);
964 964
 
965 965
 }
966 966
 
@@ -972,10 +972,10 @@  discard block
 block discarded – undo
972 972
  * @global WP $wp
973 973
  * @return string $current_page_url
974 974
  */
975
- function sensei_get_current_page_url(){
975
+ function sensei_get_current_page_url() {
976 976
 
977 977
      global $wp;
978
-     $current_page_url =  home_url( $wp->request );
978
+     $current_page_url = home_url($wp->request);
979 979
      return $current_page_url;
980 980
 
981 981
  }
@@ -986,9 +986,9 @@  discard block
 block discarded – undo
986 986
  *
987 987
  * @since 1.9.0
988 988
  */
989
-function sensei_the_my_courses_content(){
989
+function sensei_the_my_courses_content() {
990 990
 
991
-    echo Sensei()->course->load_user_courses_content( wp_get_current_user() );
991
+    echo Sensei()->course->load_user_courses_content(wp_get_current_user());
992 992
 
993 993
 } // sensei_the_my_courses_content
994 994
 
@@ -1001,9 +1001,9 @@  discard block
 block discarded – undo
1001 1001
  *
1002 1002
  * @since 1.9.0
1003 1003
  */
1004
-function sensei_load_template( $template_name ){
1004
+function sensei_load_template($template_name) {
1005 1005
 
1006
-    Sensei_Templates::get_template( $template_name );
1006
+    Sensei_Templates::get_template($template_name);
1007 1007
 
1008 1008
 }
1009 1009
 
@@ -1015,9 +1015,9 @@  discard block
 block discarded – undo
1015 1015
  * @param string $name the name of the template.
1016 1016
  * @since 1.9.0
1017 1017
  */
1018
-function sensei_load_template_part( $slug, $name ){
1018
+function sensei_load_template_part($slug, $name) {
1019 1019
 
1020
-    Sensei_Templates::get_part( $slug, $name );
1020
+    Sensei_Templates::get_part($slug, $name);
1021 1021
 
1022 1022
 }
1023 1023
 
@@ -1034,19 +1034,19 @@  discard block
 block discarded – undo
1034 1034
  * @access public
1035 1035
  * @param string $lesson_id
1036 1036
  */
1037
-function sensei_the_lesson_excerpt( $lesson_id = '' ) {
1037
+function sensei_the_lesson_excerpt($lesson_id = '') {
1038 1038
 
1039
-    if( empty( $lesson_id )){
1039
+    if (empty($lesson_id)) {
1040 1040
 
1041 1041
         $lesson_id = get_the_ID();
1042 1042
 
1043 1043
     }
1044 1044
 
1045
-    if( 'lesson' != get_post_type( $lesson_id ) ){
1045
+    if ('lesson' != get_post_type($lesson_id)) {
1046 1046
         return;
1047 1047
     }
1048 1048
 
1049
-    echo Sensei_Lesson::lesson_excerpt( get_post( $lesson_id ), false );
1049
+    echo Sensei_Lesson::lesson_excerpt(get_post($lesson_id), false);
1050 1050
 
1051 1051
 }// End lesson_excerpt()
1052 1052
 
@@ -1055,17 +1055,17 @@  discard block
 block discarded – undo
1055 1055
  *
1056 1056
  * @since 1.9.0
1057 1057
  */
1058
-function sensei_the_course_results_lessons(){
1058
+function sensei_the_course_results_lessons() {
1059 1059
     // load backwards compatible template name if it exists in the users theme
1060
-    $located_template= locate_template( Sensei()->template_url . 'course-results/course-lessons.php' );
1061
-    if( $located_template ){
1060
+    $located_template = locate_template(Sensei()->template_url.'course-results/course-lessons.php');
1061
+    if ($located_template) {
1062 1062
 
1063
-        Sensei_Templates::get_template( 'course-results/course-lessons.php' );
1063
+        Sensei_Templates::get_template('course-results/course-lessons.php');
1064 1064
         return;
1065 1065
 
1066 1066
     }
1067 1067
 
1068
-    Sensei_Templates::get_template( 'course-results/lessons.php' );
1068
+    Sensei_Templates::get_template('course-results/lessons.php');
1069 1069
 }
1070 1070
 
1071 1071
 /**
@@ -1075,7 +1075,7 @@  discard block
 block discarded – undo
1075 1075
  * @uses Sensei_Course::get_loop_number_of_columns
1076 1076
  * @since 1.9.0
1077 1077
  */
1078
-function sensei_courses_per_row(){
1078
+function sensei_courses_per_row() {
1079 1079
 
1080 1080
     echo Sensei_Course::get_loop_number_of_columns();
1081 1081
 
Please login to merge, or discard this patch.
templates/no-permissions.php 2 patches
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.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,15 +33,15 @@  discard block
 block discarded – undo
33 33
     </header>
34 34
 
35 35
     <?php
36
-    /**
37
-     * This action fires inside the no-permissions.php file. It
38
-     * is place just before the content.
39
-     *
40
-     * @since 1.9.0
41
-     * @param $post_id
42
-     */
43
-    do_action('sensei_no_permissions_inside_before_content', get_the_ID() );
44
-    ?>
36
+	/**
37
+	 * This action fires inside the no-permissions.php file. It
38
+	 * is place just before the content.
39
+	 *
40
+	 * @since 1.9.0
41
+	 * @param $post_id
42
+	 */
43
+	do_action('sensei_no_permissions_inside_before_content', get_the_ID() );
44
+	?>
45 45
 
46 46
     <section class="entry fix">
47 47
 
@@ -60,26 +60,26 @@  discard block
 block discarded – undo
60 60
     </section>
61 61
 
62 62
     <?php
63
-    /**
64
-     * This action fires inside the no-permissions.php file. It
65
-     * is place just after the content.
66
-     *
67
-     * @since 1.9.0
68
-     * @param $post_id
69
-     */
70
-    do_action('sensei_no_permissions_inside_after_content', get_the_ID() );
71
-    ?>
63
+	/**
64
+	 * This action fires inside the no-permissions.php file. It
65
+	 * is place just after the content.
66
+	 *
67
+	 * @since 1.9.0
68
+	 * @param $post_id
69
+	 */
70
+	do_action('sensei_no_permissions_inside_after_content', get_the_ID() );
71
+	?>
72 72
 
73 73
 </article><!-- .no-permissions -->
74 74
 
75 75
 <?php
76 76
 /**
77
- * This action fires inside the no-permissions.php file. It
78
- * is placed outside after the content.
79
- *
80
- * @since 1.9.0
81
- * @param $post_id
82
- */
77
+	 * This action fires inside the no-permissions.php file. It
78
+	 * is placed outside after the content.
79
+	 *
80
+	 * @since 1.9.0
81
+	 * @param $post_id
82
+	 */
83 83
 do_action('sensei_no_permissions_after_content', get_the_ID() );
84 84
 ?>
85 85
 
Please login to merge, or discard this patch.
templates/course-results.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * The Template for displaying course archives, including the course page template.
4
- *
5
- * Override this template by copying it to yourtheme/sensei/archive-course.php
6
- *
7
- * @author 		Automattic
8
- * @package 	Sensei
9
- * @category    Templates
10
- * @version     1.9.0
11
- */
3
+	 * The Template for displaying course archives, including the course page template.
4
+	 *
5
+	 * Override this template by copying it to yourtheme/sensei/archive-course.php
6
+	 *
7
+	 * @author 		Automattic
8
+	 * @package 	Sensei
9
+	 * @category    Templates
10
+	 * @version     1.9.0
11
+	 */
12 12
 ?>
13 13
 
14 14
 <?php  get_sensei_header();  ?>
15 15
 
16 16
 <?php
17 17
 /**
18
- * This hook fire inside learner-profile.php before the content
19
- *
20
- * @since 1.9.0
21
- *
22
- * @hooked Sensei_Course_Results::deprecate_sensei_course_results_content_hook() - 20
23
- */
18
+	 * This hook fire inside learner-profile.php before the content
19
+	 *
20
+	 * @since 1.9.0
21
+	 *
22
+	 * @hooked Sensei_Course_Results::deprecate_sensei_course_results_content_hook() - 20
23
+	 */
24 24
 do_action( 'sensei_course_results_content_before' );
25 25
 ?>
26 26
 
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
     <section class="entry fix">
35 35
 
36 36
         <?php
37
-        /**
38
-         * This hook fire inside learner-profile.php inside directly before the content
39
-         *
40
-         * @since 1.9.0
41
-         *
42
-         * @hooked Sensei_Course_Results::fire_sensei_message_hook() - 20
43
-         */
44
-        do_action( 'sensei_course_results_content_inside_before' );
45
-        ?>
37
+		/**
38
+		 * This hook fire inside learner-profile.php inside directly before the content
39
+		 *
40
+		 * @since 1.9.0
41
+		 *
42
+		 * @hooked Sensei_Course_Results::fire_sensei_message_hook() - 20
43
+		 */
44
+		do_action( 'sensei_course_results_content_inside_before' );
45
+		?>
46 46
 
47 47
         <header>
48 48
 
@@ -56,27 +56,27 @@  discard block
 block discarded – undo
56 56
 
57 57
             <section class="course-results-lessons">
58 58
                 <?php
59
-                $started_course = Sensei_Utils::user_started_course( $course->ID, get_current_user_id() );
60
-                if( $started_course ) {
59
+				$started_course = Sensei_Utils::user_started_course( $course->ID, get_current_user_id() );
60
+				if( $started_course ) {
61 61
 
62
-                    sensei_the_course_results_lessons();
62
+					sensei_the_course_results_lessons();
63 63
 
64
-                }
65
-                ?>
64
+				}
65
+				?>
66 66
             </section>
67 67
 
68 68
         <?php endif; ?>
69 69
 
70 70
         <?php
71
-        /**
72
-         * This hook fire inside learner-profile.php inside directly after the content
73
-         *
74
-         * @since 1.9.0
75
-         *
76
-         * @hooked Sensei()->course_results->course_info - 20
77
-         */
78
-        do_action( 'sensei_course_results_content_inside_after' );
79
-        ?>
71
+		/**
72
+		 * This hook fire inside learner-profile.php inside directly after the content
73
+		 *
74
+		 * @since 1.9.0
75
+		 *
76
+		 * @hooked Sensei()->course_results->course_info - 20
77
+		 */
78
+		do_action( 'sensei_course_results_content_inside_after' );
79
+		?>
80 80
 
81 81
     </section>
82 82
 
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 
85 85
 <?php
86 86
 /**
87
- * This hook fire inside course-results.php before the content
88
- *
89
- * @since 1.9.0
90
- *
91
- */
87
+		 * This hook fire inside course-results.php before the content
88
+		 *
89
+		 * @since 1.9.0
90
+		 *
91
+		 */
92 92
 do_action( 'sensei_course_results_content_after' );
93 93
 ?>
94 94
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 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,15 +21,15 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @hooked Sensei_Course_Results::deprecate_sensei_course_results_content_hook() - 20
23 23
  */
24
-do_action( 'sensei_course_results_content_before' );
24
+do_action('sensei_course_results_content_before');
25 25
 ?>
26 26
 
27 27
 <?php
28 28
 global $course;
29
-$course = get_page_by_path( $wp_query->query_vars['course_results'], OBJECT, 'course' );
29
+$course = get_page_by_path($wp_query->query_vars['course_results'], OBJECT, 'course');
30 30
 ?>
31 31
 
32
-<article <?php post_class( array( 'course', 'post','course-results' ) ); ?> >
32
+<article <?php post_class(array('course', 'post', 'course-results')); ?> >
33 33
 
34 34
     <section class="entry fix">
35 35
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
          *
42 42
          * @hooked Sensei_Course_Results::fire_sensei_message_hook() - 20
43 43
          */
44
-        do_action( 'sensei_course_results_content_inside_before' );
44
+        do_action('sensei_course_results_content_inside_before');
45 45
         ?>
46 46
 
47 47
         <header>
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 
53 53
         </header>
54 54
 
55
-        <?php if ( is_user_logged_in() ):?>
55
+        <?php if (is_user_logged_in()):?>
56 56
 
57 57
             <section class="course-results-lessons">
58 58
                 <?php
59
-                $started_course = Sensei_Utils::user_started_course( $course->ID, get_current_user_id() );
60
-                if( $started_course ) {
59
+                $started_course = Sensei_Utils::user_started_course($course->ID, get_current_user_id());
60
+                if ($started_course) {
61 61
 
62 62
                     sensei_the_course_results_lessons();
63 63
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
          *
76 76
          * @hooked Sensei()->course_results->course_info - 20
77 77
          */
78
-        do_action( 'sensei_course_results_content_inside_after' );
78
+        do_action('sensei_course_results_content_inside_after');
79 79
         ?>
80 80
 
81 81
     </section>
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
  * @since 1.9.0
90 90
  *
91 91
  */
92
-do_action( 'sensei_course_results_content_after' );
92
+do_action('sensei_course_results_content_after');
93 93
 ?>
94 94
 
95 95
 
Please login to merge, or discard this patch.
includes/class-sensei-frontend.php 3 patches
Indentation   +311 added lines, -311 removed lines patch added patch discarded remove patch
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 		// Only show course & lesson excerpts in search results
72 72
 		add_filter( 'the_content', array( $this, 'sensei_search_results_excerpt' ) );
73 73
 
74
-        //Use WooCommerce filter to show admin bar to Teachers.
75
-        add_action( 'init', array( $this, 'sensei_show_admin_bar') );
74
+		//Use WooCommerce filter to show admin bar to Teachers.
75
+		add_action( 'init', array( $this, 'sensei_show_admin_bar') );
76 76
 
77
-        // Remove course from active courses if an order is cancelled or refunded
77
+		// Remove course from active courses if an order is cancelled or refunded
78 78
 		add_action( 'woocommerce_order_status_processing_to_cancelled', array( $this, 'remove_active_course' ), 10, 1 );
79 79
 		add_action( 'woocommerce_order_status_completed_to_cancelled', array( $this, 'remove_active_course' ), 10, 1 );
80 80
 		add_action( 'woocommerce_order_status_on-hold_to_cancelled', array( $this, 'remove_active_course' ), 10, 1 );
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 			wp_enqueue_script( $this->token . '-user-dashboard' );
146 146
 
147 147
 
148
-            // Course Archive javascript
149
-            if( is_post_type_archive( 'course' ) ){
148
+			// Course Archive javascript
149
+			if( is_post_type_archive( 'course' ) ){
150 150
 
151
-                wp_register_script( 'sensei-course-archive-js', esc_url( Sensei()->plugin_url . 'assets/js/frontend/course-archive' . $suffix . '.js' ), array( 'jquery' ), '1', true );
152
-                wp_enqueue_script( 'sensei-course-archive-js' );
151
+				wp_register_script( 'sensei-course-archive-js', esc_url( Sensei()->plugin_url . 'assets/js/frontend/course-archive' . $suffix . '.js' ), array( 'jquery' ), '1', true );
152
+				wp_enqueue_script( 'sensei-course-archive-js' );
153 153
 
154
-            }
154
+			}
155 155
 
156 156
 
157 157
 			// Allow additional scripts to be loaded
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	/**
194 194
 	 * sensei_get_template_part function.
195 195
 	 *
196
-     * @deprecated sine 1.9.0
196
+	 * @deprecated sine 1.9.0
197 197
 	 * @access public
198 198
 	 * @param mixed $slug
199 199
 	 * @param string $name (default: '')
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
 	 */
202 202
 	function sensei_get_template_part( $slug, $name = '' ) {
203 203
 
204
-        _deprecated_function( 'class-woothemes-sensei-frontend.php', '1.9.0', 'Sensei_Templates::get_part' );
205
-        Sensei_Templates::get_part( $slug, $name );
204
+		_deprecated_function( 'class-woothemes-sensei-frontend.php', '1.9.0', 'Sensei_Templates::get_part' );
205
+		Sensei_Templates::get_part( $slug, $name );
206 206
 
207 207
 	} // End sensei_get_template_part()
208 208
 
209 209
 	/**
210 210
 	 * sensei_get_template function.
211 211
 	 *
212
-     * @deprecated since 1.9.0
212
+	 * @deprecated since 1.9.0
213 213
 	 * @access public
214 214
 	 * @param mixed $template_name
215 215
 	 * @param array $args (default: array())
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	function sensei_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
221 221
 
222
-        _deprecated_function( 'sensei_get_template', '1.9.0', 'Sensei_Templates::get_template' );
223
-        Sensei_Templates::get_template($template_name, $args, $template_path, $default_path  );
222
+		_deprecated_function( 'sensei_get_template', '1.9.0', 'Sensei_Templates::get_template' );
223
+		Sensei_Templates::get_template($template_name, $args, $template_path, $default_path  );
224 224
 
225 225
 	} // End sensei_get_template()
226 226
 
@@ -236,33 +236,33 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	function sensei_locate_template( $template_name, $template_path = '', $default_path = '' ) {
238 238
 
239
-        _deprecated_function( 'sensei_locate_template', '1.9.0', 'Sensei_Templates::locate_template' );
240
-        Sensei_Templates::locate_template( $template_name, $template_path, $default_path );
239
+		_deprecated_function( 'sensei_locate_template', '1.9.0', 'Sensei_Templates::locate_template' );
240
+		Sensei_Templates::locate_template( $template_name, $template_path, $default_path );
241 241
 
242 242
 	} // End sensei_locate_template()
243 243
 
244 244
 
245 245
 	/**
246 246
 	 * sensei_output_content_wrapper function.
247
-     *
247
+	 *
248 248
 	 * @access public
249 249
 	 * @return void
250 250
 	 */
251 251
 	function sensei_output_content_wrapper() {
252 252
 
253
-	    // backwards compatibility check for old location under the wrappers directory of the active theme
254
-        $backwards_compatible_wrapper_location =   array(
255
-            Sensei()->template_url . 'wrappers/wrapper-start.php',
256
-            'wrappers/wrapper-start.php'
257
-        );
253
+		// backwards compatibility check for old location under the wrappers directory of the active theme
254
+		$backwards_compatible_wrapper_location =   array(
255
+			Sensei()->template_url . 'wrappers/wrapper-start.php',
256
+			'wrappers/wrapper-start.php'
257
+		);
258 258
 
259
-        $template = locate_template( $backwards_compatible_wrapper_location );
260
-        if( !empty( $template ) ){
259
+		$template = locate_template( $backwards_compatible_wrapper_location );
260
+		if( !empty( $template ) ){
261 261
 
262
-            Sensei_Templates::get_template( 'wrappers/wrapper-start.php' );
263
-            return;
262
+			Sensei_Templates::get_template( 'wrappers/wrapper-start.php' );
263
+			return;
264 264
 
265
-        }
265
+		}
266 266
 
267 267
 		Sensei_Templates::get_template( 'globals/wrapper-start.php' );
268 268
 
@@ -271,25 +271,25 @@  discard block
 block discarded – undo
271 271
 
272 272
 	/**
273 273
 	 * sensei_output_content_wrapper_end function.
274
-     *
274
+	 *
275 275
 	 * @access public
276 276
 	 * @return void
277 277
 	 */
278 278
 	function sensei_output_content_wrapper_end() {
279 279
 
280
-	    // backwards compatibility check for old location under the wrappers directory of the active theme
281
-        $backwards_compatible_wrapper_location =   array(
282
-            Sensei()->template_url . 'wrappers/wrapper-end.php',
283
-            'wrappers/wrapper-end.php'
284
-        );
280
+		// backwards compatibility check for old location under the wrappers directory of the active theme
281
+		$backwards_compatible_wrapper_location =   array(
282
+			Sensei()->template_url . 'wrappers/wrapper-end.php',
283
+			'wrappers/wrapper-end.php'
284
+		);
285 285
 
286
-        $backwards_compatible_template = locate_template( $backwards_compatible_wrapper_location );
287
-        if( !empty( $backwards_compatible_template ) ){
286
+		$backwards_compatible_template = locate_template( $backwards_compatible_wrapper_location );
287
+		if( !empty( $backwards_compatible_template ) ){
288 288
 
289
-            Sensei_Templates::get_template( 'wrappers/wrapper-end.php' );
290
-            return;
289
+			Sensei_Templates::get_template( 'wrappers/wrapper-end.php' );
290
+			return;
291 291
 
292
-        }
292
+		}
293 293
 
294 294
 
295 295
 		Sensei_Templates::get_template( 'globals/wrapper-end.php' );
@@ -305,55 +305,55 @@  discard block
 block discarded – undo
305 305
 	 */
306 306
 	public static function load_content_pagination() {
307 307
 
308
-        if( is_singular('course') ) {
308
+		if( is_singular('course') ) {
309 309
 
310
-            // backwards compatibility check for old location under the wrappers directory of the active theme
311
-            $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-posts.php' ) );
312
-            if( !empty( $template ) ){
310
+			// backwards compatibility check for old location under the wrappers directory of the active theme
311
+			$template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-posts.php' ) );
312
+			if( !empty( $template ) ){
313 313
 
314
-                Sensei_Templates::get_template( 'wrappers/pagination-posts.php' );
315
-                return;
314
+				Sensei_Templates::get_template( 'wrappers/pagination-posts.php' );
315
+				return;
316 316
 
317
-            }
317
+			}
318 318
 
319 319
 			Sensei_Templates::get_template( 'globals/pagination-posts.php' );
320 320
 
321 321
 		} elseif( is_singular('lesson') ) {
322 322
 
323
-		    // backwards compatibility check for old location under the wrappers directory of the active theme
324
-		    $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-lesson.php' ) );
325
-            if( !empty( $template ) ){
323
+			// backwards compatibility check for old location under the wrappers directory of the active theme
324
+			$template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-lesson.php' ) );
325
+			if( !empty( $template ) ){
326 326
 
327
-                Sensei_Templates::get_template( 'wrappers/pagination-lesson.php' );
328
-                return;
327
+				Sensei_Templates::get_template( 'wrappers/pagination-lesson.php' );
328
+				return;
329 329
 
330
-            }
330
+			}
331 331
 
332 332
 			Sensei_Templates::get_template( 'globals/pagination-lesson.php' );
333 333
 
334 334
 		} elseif( is_singular('quiz') ) {
335 335
 
336
-		    // backwards compatibility check for old location under the wrappers directory of the active theme
337
-		    $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-quiz.php' ) );
338
-            if( !empty( $template ) ){
336
+			// backwards compatibility check for old location under the wrappers directory of the active theme
337
+			$template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-quiz.php' ) );
338
+			if( !empty( $template ) ){
339 339
 
340
-                Sensei_Templates::get_template( 'wrappers/pagination-quiz.php' );
341
-                return;
340
+				Sensei_Templates::get_template( 'wrappers/pagination-quiz.php' );
341
+				return;
342 342
 
343
-            }
343
+			}
344 344
 
345 345
 			Sensei_Templates::get_template( 'globals/pagination-quiz.php' );
346 346
 
347 347
 		} else {
348 348
 
349
-            // backwards compatibility check for old location under the wrappers directory of the active theme
350
-            $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination.php' ) );
351
-            if( !empty( $template ) ){
349
+			// backwards compatibility check for old location under the wrappers directory of the active theme
350
+			$template = locate_template( array( Sensei()->template_url . 'wrappers/pagination.php' ) );
351
+			if( !empty( $template ) ){
352 352
 
353
-                Sensei_Templates::get_template( 'wrappers/pagination.php' );
354
-                return;
353
+				Sensei_Templates::get_template( 'wrappers/pagination.php' );
354
+				return;
355 355
 
356
-            }
356
+			}
357 357
 
358 358
 			Sensei_Templates::get_template( 'globals/pagination.php' );
359 359
 
@@ -410,13 +410,13 @@  discard block
 block discarded – undo
410 410
 
411 411
 				case '#senseimymessages':
412 412
 					$item->url = $my_messages_url;
413
-                    // if no archive link exist for sensei_message
414
-                    // set it back to the place holder
415
-                    if( ! $item->url ){
413
+					// if no archive link exist for sensei_message
414
+					// set it back to the place holder
415
+					if( ! $item->url ){
416 416
 
417
-                        $item->url = '#senseimymessages';
417
+						$item->url = '#senseimymessages';
418 418
 
419
-                    }
419
+					}
420 420
 					break;
421 421
 
422 422
 				case '#senseilearnerprofile':
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 
483 483
 			// Remove the My Messages link for logged out users or if Private Messages are disabled
484 484
 			if( ! get_post_type_archive_link( 'sensei_message' )
485
-                && '#senseimymessages' == $item->url ) {
485
+				&& '#senseimymessages' == $item->url ) {
486 486
 
487 487
 				if ( !is_user_logged_in() || ( isset( Sensei()->settings->settings['messages_disable'] ) && Sensei()->settings->settings['messages_disable'] ) ) {
488 488
 
@@ -505,44 +505,44 @@  discard block
 block discarded – undo
505 505
 
506 506
 	// add category nicenames in body and post class
507 507
 	function sensei_search_results_classes($classes) {
508
-	    global $post;
509
-	    // Handle Search Classes for Courses, Lessons, and WC Products
510
-	    if ( isset( $post->post_type ) && ( ( 'course' == $post->post_type ) || ( 'lesson' == $post->post_type ) || ( 'product' == $post->post_type ) ) ) {
511
-	    	$classes[] = 'post';
508
+		global $post;
509
+		// Handle Search Classes for Courses, Lessons, and WC Products
510
+		if ( isset( $post->post_type ) && ( ( 'course' == $post->post_type ) || ( 'lesson' == $post->post_type ) || ( 'product' == $post->post_type ) ) ) {
511
+			$classes[] = 'post';
512 512
 		} // End If Statement
513
-	    return $classes;
513
+		return $classes;
514 514
 	} // End sensei_search_results_classes()
515 515
 
516
-    /**
517
-     * sensei_single_title output for single page title
518
-     * @since  1.1.0
519
-     * @return void
520
-     * @deprecate
521
-     */
522
-    function the_single_title() {
516
+	/**
517
+	 * sensei_single_title output for single page title
518
+	 * @since  1.1.0
519
+	 * @return void
520
+	 * @deprecate
521
+	 */
522
+	function the_single_title() {
523 523
 
524
-        _deprecated_function(' WooThemes_Sensei_Frontend::the_single_title', '1.9.0');
524
+		_deprecated_function(' WooThemes_Sensei_Frontend::the_single_title', '1.9.0');
525 525
 
526
-    } // End sensei_single_title()
526
+	} // End sensei_single_title()
527 527
 
528 528
 	/**
529 529
 	 * sensei_course_image output for course image Please use Sensei()->course->course_image instead.
530
-     *
531
-     * @deprecated since 1.9.0
532
-     * @param $course_id
533
-     * @param string $width
534
-     * @param string $height
535
-     * @param bool|false $return
536
-     * @return string|void
530
+	 *
531
+	 * @deprecated since 1.9.0
532
+	 * @param $course_id
533
+	 * @param string $width
534
+	 * @param string $height
535
+	 * @param bool|false $return
536
+	 * @return string|void
537 537
 	 */
538 538
 	function sensei_course_image( $course_id, $width = '100', $height = '100', $return = false ) {
539 539
 
540
-        trigger_error( 'Sensei Deprecated function: sensei_course_image since 1.9.0 . Please use Sensei()->course->course_image instead.');
540
+		trigger_error( 'Sensei Deprecated function: sensei_course_image since 1.9.0 . Please use Sensei()->course->course_image instead.');
541 541
 
542
-    	if ( ! $return ) {
542
+		if ( ! $return ) {
543 543
 
544 544
 			echo Sensei()->course->course_image( $course_id, $width, $height );
545
-            return '';
545
+			return '';
546 546
 
547 547
 		} // End If Statement
548 548
 
@@ -553,31 +553,31 @@  discard block
 block discarded – undo
553 553
 	/**
554 554
 	 * sensei_lesson_image output for lesson image
555 555
 	 * @since  1.2.0
556
-     * @deprecated since 1.9.0
557
-     * @param $lesson_id
558
-     * @param string $width
559
-     * @param string $height
560
-     * @param bool|false $return
561
-     * @param bool|false $widget
562
-     * @return string
556
+	 * @deprecated since 1.9.0
557
+	 * @param $lesson_id
558
+	 * @param string $width
559
+	 * @param string $height
560
+	 * @param bool|false $return
561
+	 * @param bool|false $widget
562
+	 * @return string
563 563
 	 */
564 564
 	function sensei_lesson_image( $lesson_id, $width = '100', $height = '100', $return = false, $widget = false ) {
565 565
 
566
-        if( ! $return ){
566
+		if( ! $return ){
567 567
 
568
-            echo Sensei()->lesson->lesson_image( $lesson_id, $width, $height, $widget );
569
-            return '';
570
-        }
568
+			echo Sensei()->lesson->lesson_image( $lesson_id, $width, $height, $widget );
569
+			return '';
570
+		}
571 571
 
572
-        return Sensei()->lesson->lesson_image( $lesson_id, $width, $height, $widget );
572
+		return Sensei()->lesson->lesson_image( $lesson_id, $width, $height, $widget );
573 573
 
574 574
 	} // End sensei_lesson_image()
575 575
 
576
-    /**
577
-     * @since 1.0.0
578
-     * @param WP_Query $query
579
-     */
580
-    function sensei_course_archive_pagination( $query ) {
576
+	/**
577
+	 * @since 1.0.0
578
+	 * @param WP_Query $query
579
+	 */
580
+	function sensei_course_archive_pagination( $query ) {
581 581
 
582 582
 		if( ! is_admin() && $query->is_main_query() && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'newcourses', 'featuredcourses', 'freecourses', 'paidcourses' ) ) ) {
583 583
 
@@ -600,50 +600,50 @@  discard block
 block discarded – undo
600 600
 	 *
601 601
 	 * @access public
602 602
 	 * @since  1.2.0
603
-     * @deprecated since 1.9.0 use WooThemes_Sensei_Course::archive_header
603
+	 * @deprecated since 1.9.0 use WooThemes_Sensei_Course::archive_header
604 604
 	 * @return void
605 605
 	 */
606 606
 	function sensei_course_archive_header(  ) {
607 607
 
608
-        trigger_error('This function sensei_course_archive_header has been depricated. Please use: WooThemes_Sensei_Course::course_archive_header ');
609
-        WooThemes_Sensei_Course::archive_header( '', '<header class="archive-header"><h1>', '</h1></header>' );
608
+		trigger_error('This function sensei_course_archive_header has been depricated. Please use: WooThemes_Sensei_Course::course_archive_header ');
609
+		WooThemes_Sensei_Course::archive_header( '', '<header class="archive-header"><h1>', '</h1></header>' );
610 610
 
611 611
 	} // sensei_course_archive_header()
612 612
 
613 613
 	/**
614 614
 	 * sensei_lesson_archive_header function.
615 615
 	 *
616
-     * @deprecated since 1.9.0
616
+	 * @deprecated since 1.9.0
617 617
 	 * @access public
618 618
 	 * @since  1.2.1
619 619
 	 * @return void
620 620
 	 */
621 621
 	public function sensei_lesson_archive_header( ) {
622
-        _deprecated_function( 'WooThemes_Sensei_Frontend::sensei_lesson_archive_header', '1.9.0', 'WooThemes_Sensei_Lesson::the_archive_header' );
623
-        Sensei()->lesson->the_archive_header();
622
+		_deprecated_function( 'WooThemes_Sensei_Frontend::sensei_lesson_archive_header', '1.9.0', 'WooThemes_Sensei_Lesson::the_archive_header' );
623
+		Sensei()->lesson->the_archive_header();
624 624
 	} // sensei_course_archive_header()
625 625
 
626
-    /**
627
-     * @deprecated since 1.9.0
628
-     */
626
+	/**
627
+	 * @deprecated since 1.9.0
628
+	 */
629 629
 	public function sensei_message_archive_header( ){
630
-        _deprecated_function('Sensei_Frontend::sensei_message_archive_header','Please use: Sense');
631
-        Sensei_Messages::the_archive_header();
630
+		_deprecated_function('Sensei_Frontend::sensei_message_archive_header','Please use: Sense');
631
+		Sensei_Messages::the_archive_header();
632 632
 	} // sensei_message_archive_header()
633 633
 
634 634
 	/**
635 635
 	 * sensei_course_archive_course_title output for course archive page individual course title
636 636
 	 * @since  1.2.0
637
-     * @param WP_Post $post_item
637
+	 * @param WP_Post $post_item
638 638
 	 * @return void
639 639
 	 */
640 640
 	function sensei_course_archive_course_title( $post_item ) {
641 641
 		if ( isset( $post_item->ID ) && ( 0 < $post_item->ID ) ) {
642 642
 			$post_id = absint( $post_item->ID );
643
-    		$post_title = $post_item->post_title;
643
+			$post_title = $post_item->post_title;
644 644
 		} else {
645 645
 			$post_id = get_the_ID();
646
-    		$post_title = get_the_title();
646
+			$post_title = get_the_title();
647 647
 		} // End If Statement
648 648
 		?><header><h2><a href="<?php echo get_permalink( $post_id ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a></h2></header><?php
649 649
 	} // End sensei_course_archive_course_title()
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 	 */
656 656
 	public function sensei_lesson_archive_lesson_title() {
657 657
 		$post_id = get_the_ID();
658
-    	$post_title = get_the_title();
658
+		$post_title = get_the_title();
659 659
 		?><header><h2><a href="<?php echo get_permalink( $post_id ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a></h2></header><?php
660 660
 	} // End sensei_lesson_archive_lesson_title()
661 661
 
@@ -672,9 +672,9 @@  discard block
 block discarded – undo
672 672
 
673 673
 		if( empty( $id )  ){
674 674
 
675
-            $id = get_the_ID();
675
+			$id = get_the_ID();
676 676
 
677
-        }
677
+		}
678 678
 
679 679
 		$sensei_breadcrumb_prefix = __( 'Back to: ', 'woothemes-sensei' );
680 680
 		$separator = apply_filters( 'sensei_breadcrumb_separator', '&gt;' );
@@ -687,31 +687,31 @@  discard block
 block discarded – undo
687 687
 				return;
688 688
 			}
689 689
 			$html .= '<a href="' . esc_url( get_permalink( $course_id ) ) . '" title="' . __( 'Back to the course', 'woothemes-sensei' ) . '">' . get_the_title( $course_id ) . '</a>';
690
-    	} // End If Statement
691
-    	// Quiz
690
+		} // End If Statement
691
+		// Quiz
692 692
 		if ( is_singular( 'quiz' ) && 0 < intval( $id ) ) {
693 693
 			$lesson_id = intval( get_post_meta( $id, '_quiz_lesson', true ) );
694 694
 			if( ! $lesson_id ) {
695 695
 				return;
696 696
 			}
697 697
 			 $html .= '<a href="' . esc_url( get_permalink( $lesson_id ) ) . '" title="' .  __( 'Back to the lesson', 'woothemes-sensei' ) . '">' . get_the_title( $lesson_id ) . '</a>';
698
-    	} // End If Statement
698
+		} // End If Statement
699 699
 
700
-    	// Allow other plugins to filter html
701
-    	$html = apply_filters ( 'sensei_breadcrumb_output', $html, $separator );
702
-    	$html .= '</section>';
700
+		// Allow other plugins to filter html
701
+		$html = apply_filters ( 'sensei_breadcrumb_output', $html, $separator );
702
+		$html .= '</section>';
703 703
 
704
-    	echo $html;
704
+		echo $html;
705 705
 	} // End sensei_breadcrumb()
706 706
 
707 707
 
708
-    /**
709
-     * @deprecated since 1.9.0 use WooThemes_Sensei_Lesson::course_signup_link instead
710
-     */
708
+	/**
709
+	 * @deprecated since 1.9.0 use WooThemes_Sensei_Lesson::course_signup_link instead
710
+	 */
711 711
 	public function sensei_lesson_course_signup_link( ) {
712 712
 
713
-        _deprecated_function('sensei_lesson_course_signup_link', '1.9.0', 'WooThemes_Sensei_Lesson::course_signup_link' );
714
-        WooThemes_Sensei_Lesson::course_signup_link();
713
+		_deprecated_function('sensei_lesson_course_signup_link', '1.9.0', 'WooThemes_Sensei_Lesson::course_signup_link' );
714
+		WooThemes_Sensei_Lesson::course_signup_link();
715 715
 	}
716 716
 
717 717
 	public function lesson_tags_display( $lesson_id = 0 ) {
@@ -730,27 +730,27 @@  discard block
 block discarded – undo
730 730
 					?><section class="lesson-tags">
731 731
 		    			<?php printf( __( 'Lesson tags: %1$s', 'woothemes-sensei' ), $tag_list ); ?>
732 732
 		    		</section><?php
733
-		    	}
734
-	    	}
733
+				}
734
+			}
735 735
 		}
736 736
 	}
737 737
 
738
-    /**
739
-     * @param WP_Query $query
740
-     */
738
+	/**
739
+	 * @param WP_Query $query
740
+	 */
741 741
 	public function lesson_tag_archive_filter( $query ) {
742
-    	if( is_tax( 'lesson-tag' ) && $query->is_main_query() ) {
743
-    		// Limit to lessons only
744
-    		$query->set( 'post_type', 'lesson' );
742
+		if( is_tax( 'lesson-tag' ) && $query->is_main_query() ) {
743
+			// Limit to lessons only
744
+			$query->set( 'post_type', 'lesson' );
745 745
 
746
-    		// Set order of lessons
747
-    		$query->set( 'orderby', 'menu_order' );
748
-    		$query->set( 'order', 'ASC' );
746
+			// Set order of lessons
747
+			$query->set( 'orderby', 'menu_order' );
748
+			$query->set( 'order', 'ASC' );
749 749
 
750
-    	}
751
-    }
750
+		}
751
+	}
752 752
 
753
-    public function lesson_tag_archive_header( $title ) {
753
+	public function lesson_tag_archive_header( $title ) {
754 754
 		if( is_tax( 'lesson-tag' ) ) {
755 755
 			$title = sprintf( __( 'Lesson tag: %1$s', 'woothemes-sensei' ), apply_filters( 'sensei_lesson_tag_archive_title', get_queried_object()->name ) );
756 756
 		}
@@ -772,13 +772,13 @@  discard block
 block discarded – undo
772 772
 			$sanitized_submit = esc_html( $_POST['quiz_action'] );
773 773
 
774 774
 			switch ($sanitized_submit) {
775
-                case 'lesson-complete':
775
+				case 'lesson-complete':
776 776
 
777 777
 					Sensei_Utils::sensei_start_lesson( $post->ID, $current_user->ID, $complete = true );
778 778
 
779 779
 					break;
780 780
 
781
-                case 'lesson-reset':
781
+				case 'lesson-reset':
782 782
 
783 783
 					Sensei_Utils::sensei_remove_user_from_lesson( $post->ID, $current_user->ID );
784 784
 
@@ -890,13 +890,13 @@  discard block
 block discarded – undo
890 890
 		if ( 0 < intval( $post_id ) ) {
891 891
 			$lesson_video_embed = get_post_meta( $post_id, '_lesson_video_embed', true );
892 892
 			if ( 'http' == substr( $lesson_video_embed, 0, 4) ) {
893
-        		// V2 - make width and height a setting for video embed
894
-        		$lesson_video_embed = wp_oembed_get( esc_url( $lesson_video_embed )/*, array( 'width' => 100 , 'height' => 100)*/ );
895
-        	} // End If Statement
896
-        	if ( '' != $lesson_video_embed ) {
897
-        	?><div class="video"><?php echo html_entity_decode($lesson_video_embed); ?></div><?php
898
-        	} // End If Statement
899
-        } // End If Statement
893
+				// V2 - make width and height a setting for video embed
894
+				$lesson_video_embed = wp_oembed_get( esc_url( $lesson_video_embed )/*, array( 'width' => 100 , 'height' => 100)*/ );
895
+			} // End If Statement
896
+			if ( '' != $lesson_video_embed ) {
897
+			?><div class="video"><?php echo html_entity_decode($lesson_video_embed); ?></div><?php
898
+			} // End If Statement
899
+		} // End If Statement
900 900
 	} // End sensei_lesson_video()
901 901
 
902 902
 	public function sensei_complete_lesson_button() {
@@ -909,8 +909,8 @@  discard block
 block discarded – undo
909 909
 		$pass_required = true;
910 910
 		if( $quiz_id ) {
911 911
 			// Get quiz pass setting
912
-	    	$pass_required = get_post_meta( $quiz_id, '_pass_required', true );
913
-	    }
912
+			$pass_required = get_post_meta( $quiz_id, '_pass_required', true );
913
+		}
914 914
 		if( ! $quiz_id || ( $quiz_id && ! $pass_required ) ) {
915 915
 			?>
916 916
 			<form class="lesson_button_form" method="POST" action="<?php echo esc_url( get_permalink() ); ?>">
@@ -963,12 +963,12 @@  discard block
 block discarded – undo
963 963
 		} // End If Statement
964 964
 	} // End sensei_reset_lesson_button()
965 965
 
966
-    /**
967
-     * @deprecated since 1.9.0
968
-     */
969
-    public function sensei_lesson_quiz_meta( ) {
966
+	/**
967
+	 * @deprecated since 1.9.0
968
+	 */
969
+	public function sensei_lesson_quiz_meta( ) {
970 970
 
971
-        Sensei_Lesson::footer_quiz_call_to_action();
971
+		Sensei_Lesson::footer_quiz_call_to_action();
972 972
 
973 973
 	} // End sensei_lesson_quiz_meta()
974 974
 
@@ -994,38 +994,38 @@  discard block
 block discarded – undo
994 994
         	</p>
995 995
         	<p class="course-excerpt"><?php the_excerpt(); ?></p>
996 996
         	<?php if ( 0 < $free_lesson_count ) {
997
-                $free_lessons = sprintf( __( 'You can access %d of this course\'s lessons for free', 'woothemes-sensei' ), $free_lesson_count ); ?>
997
+				$free_lessons = sprintf( __( 'You can access %d of this course\'s lessons for free', 'woothemes-sensei' ), $free_lesson_count ); ?>
998 998
                 <p class="sensei-free-lessons"><a href="<?php echo get_permalink( $post_id ); ?>"><?php _e( 'Preview this course', 'woothemes-sensei' ) ?></a> - <?php echo $free_lessons; ?></p>
999 999
             <?php } ?>
1000 1000
 		</section><?php
1001 1001
 	} // End sensei_course_archive_meta()
1002 1002
 
1003
-    /**
1004
-     * @deprecated since 1.9.0
1005
-     */
1003
+	/**
1004
+	 * @deprecated since 1.9.0
1005
+	 */
1006 1006
 	public function sensei_single_main_content() {
1007
-	    _deprecated_function('Woothemes_Sensei_Frontend::sensei_single_main_content', '1.9.0');
1007
+		_deprecated_function('Woothemes_Sensei_Frontend::sensei_single_main_content', '1.9.0');
1008 1008
 	} // End sensei_single_main_content()
1009 1009
 
1010
-    /**
1011
-    * @deprecated since 1.9.0
1012
-    */
1010
+	/**
1011
+	 * @deprecated since 1.9.0
1012
+	 */
1013 1013
 	public function sensei_lesson_archive_main_content() {
1014
-        _deprecated_function('Sensei_Frontend::sensei_lesson_archive_main_content', '1.9.0', 'Please include loop-lesson.php directly');
1014
+		_deprecated_function('Sensei_Frontend::sensei_lesson_archive_main_content', '1.9.0', 'Please include loop-lesson.php directly');
1015 1015
 	} // End sensei_lesson_archive_main_content()
1016 1016
 
1017
-    /**
1018
-    * @deprecated since 1.9.0
1019
-    */
1017
+	/**
1018
+	 * @deprecated since 1.9.0
1019
+	 */
1020 1020
 	public function sensei_message_archive_main_content() {
1021 1021
 		_deprecated_function( 'Sensei_Frontend::sensei_message_archive_main_content', 'This method is no longer needed' );
1022 1022
 	} // End sensei_lesson_archive_main_content()
1023 1023
 
1024
-    /**
1025
-    * @deprecated since 1.9.0
1026
-    */
1024
+	/**
1025
+	 * @deprecated since 1.9.0
1026
+	 */
1027 1027
 	public function sensei_no_permissions_main_content() {
1028
-        _deprecated_function( 'Sensei_Frontend::sensei_no_permissions_main_content', 'This method is no longer needed' );
1028
+		_deprecated_function( 'Sensei_Frontend::sensei_no_permissions_main_content', 'This method is no longer needed' );
1029 1029
 	} // End sensei_no_permissions_main_content()
1030 1030
 
1031 1031
 	public function sensei_course_category_main_content() {
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 				<div class="col-1">
1074 1074
 					<?php
1075 1075
 					// output the actual form markup
1076
-                    Sensei_Templates::get_template( 'user/login-form.php');
1076
+					Sensei_Templates::get_template( 'user/login-form.php');
1077 1077
 					?>
1078 1078
 				</div>
1079 1079
 
@@ -1154,12 +1154,12 @@  discard block
 block discarded – undo
1154 1154
 
1155 1155
 		//if this is a paid course
1156 1156
 		if ( Sensei_WC::is_woocommerce_active() ) {
1157
-    	    $wc_post_id = get_post_meta( $course_id, '_course_woocommerce_product', true );
1158
-    	    if ( 0 < $wc_post_id ) {
1159
-    	    	$preview_text = __( ' (Free Preview)', 'woothemes-sensei' );
1160
-    	    } // End If Statement
1161
-    	}
1162
-    	return $preview_text;
1157
+			$wc_post_id = get_post_meta( $course_id, '_course_woocommerce_product', true );
1158
+			if ( 0 < $wc_post_id ) {
1159
+				$preview_text = __( ' (Free Preview)', 'woothemes-sensei' );
1160
+			} // End If Statement
1161
+		}
1162
+		return $preview_text;
1163 1163
 	}
1164 1164
 
1165 1165
 	public function sensei_lesson_preview_title( $title = '', $id = 0 ) {
@@ -1191,8 +1191,8 @@  discard block
 block discarded – undo
1191 1191
 		$is_user_taking_course = Sensei_Utils::user_started_course( $post->ID, $current_user->ID );
1192 1192
 		// Handle user starting the course
1193 1193
 		if ( isset( $_POST['course_start'] )
1194
-		    && wp_verify_nonce( $_POST[ 'woothemes_sensei_start_course_noonce' ], 'woothemes_sensei_start_course_noonce' )
1195
-		    && !$is_user_taking_course ) {
1194
+			&& wp_verify_nonce( $_POST[ 'woothemes_sensei_start_course_noonce' ], 'woothemes_sensei_start_course_noonce' )
1195
+			&& !$is_user_taking_course ) {
1196 1196
 
1197 1197
 			// Start the course
1198 1198
 			$activity_logged = Sensei_Utils::user_start_course( $current_user->ID, $post->ID );
@@ -1211,35 +1211,35 @@  discard block
 block discarded – undo
1211 1211
 		} // End If Statement
1212 1212
 	} // End sensei_course_start()
1213 1213
 
1214
-    /**
1215
-     * @deprecated since 1.9.0
1216
-     */
1214
+	/**
1215
+	 * @deprecated since 1.9.0
1216
+	 */
1217 1217
 	public function sensei_course_meta() {
1218
-        _deprecated_function( 'Sensei_Frontend::sensei_course_meta', '1.9.0' , 'Sensei_Course::the_course_meta()' );
1219
-        Sensei()->course->the_course_meta( get_post() );
1218
+		_deprecated_function( 'Sensei_Frontend::sensei_course_meta', '1.9.0' , 'Sensei_Course::the_course_meta()' );
1219
+		Sensei()->course->the_course_meta( get_post() );
1220 1220
 	} // End sensei_course_meta()
1221 1221
 
1222
-    /**
1223
-     * @deprecated since 1.9.0
1224
-     */
1222
+	/**
1223
+	 * @deprecated since 1.9.0
1224
+	 */
1225 1225
 	public function sensei_course_meta_video() {
1226
-        _deprecated_function( 'Sensei_Frontend::sensei_course_meta_video', '1.9.0' , 'Sensei_Course::the_course_video()' );
1227
-        Sensei_Course::the_course_video();
1226
+		_deprecated_function( 'Sensei_Frontend::sensei_course_meta_video', '1.9.0' , 'Sensei_Course::the_course_video()' );
1227
+		Sensei_Course::the_course_video();
1228 1228
 	} // End sensei_course_meta_video()
1229 1229
 
1230
-    /**
1231
-     * This function shows the WooCommerce cart notice if the user has
1232
-     * added the current course to cart. It does not show if the user is already taking
1233
-     * the course.
1234
-     *
1235
-     * @since 1.0.2
1236
-     * @return void;
1237
-     */
1238
-    public function sensei_woocommerce_in_cart_message() {
1230
+	/**
1231
+	 * This function shows the WooCommerce cart notice if the user has
1232
+	 * added the current course to cart. It does not show if the user is already taking
1233
+	 * the course.
1234
+	 *
1235
+	 * @since 1.0.2
1236
+	 * @return void;
1237
+	 */
1238
+	public function sensei_woocommerce_in_cart_message() {
1239 1239
 		global $post, $woocommerce;
1240 1240
 
1241 1241
 		$wc_post_id = absint( get_post_meta( $post->ID, '_course_woocommerce_product', true ) );
1242
-        $user_course_status_id = Sensei_Utils::user_started_course($post->ID , get_current_user_id() );
1242
+		$user_course_status_id = Sensei_Utils::user_started_course($post->ID , get_current_user_id() );
1243 1243
 		if ( 0 < intval( $wc_post_id ) && ! $user_course_status_id ) {
1244 1244
 
1245 1245
 			if ( Sensei_WC::is_product_in_cart( $wc_post_id ) ) {
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
 				$item_id = $item['product_id'];
1288 1288
 			} 
1289 1289
 
1290
-            if ( $item_id > 0 ) {
1290
+			if ( $item_id > 0 ) {
1291 1291
 
1292 1292
 				$user_id = get_post_meta( $order_id, '_customer_user', true );
1293 1293
 
@@ -1367,15 +1367,15 @@  discard block
 block discarded – undo
1367 1367
 
1368 1368
 					$items = $order->get_items();
1369 1369
 					foreach( $items as $item ) {
1370
-                                            if (isset($item['variation_id']) && $item['variation_id'] > 0) {
1371
-                                                $item_id = $item['variation_id'];
1372
-                                                $product_type = 'variation';
1373
-                                            } else {
1374
-                                                $item_id = $item['product_id'];
1375
-                                            }
1370
+											if (isset($item['variation_id']) && $item['variation_id'] > 0) {
1371
+												$item_id = $item['variation_id'];
1372
+												$product_type = 'variation';
1373
+											} else {
1374
+												$item_id = $item['product_id'];
1375
+											}
1376 1376
 
1377
-                                            $product_ids[] = $item_id;
1378
-                                            }
1377
+											$product_ids[] = $item_id;
1378
+											}
1379 1379
 
1380 1380
 					$order_ids[] = $post_id;
1381 1381
 				}
@@ -1482,32 +1482,32 @@  discard block
 block discarded – undo
1482 1482
 
1483 1483
 				$items = $order->get_items();
1484 1484
 				foreach( $items as $item ) {
1485
-                    $product = wc_get_product( $item['product_id'] );
1485
+					$product = wc_get_product( $item['product_id'] );
1486 1486
 
1487
-                    // handle product bundles
1488
-                    if( $product->is_type('bundle') ){
1487
+					// handle product bundles
1488
+					if( $product->is_type('bundle') ){
1489 1489
 
1490
-                        $bundled_product = new WC_Product_Bundle( $product->id );
1491
-                        $bundled_items = $bundled_product->get_bundled_items();
1490
+						$bundled_product = new WC_Product_Bundle( $product->id );
1491
+						$bundled_items = $bundled_product->get_bundled_items();
1492 1492
 
1493
-                        foreach( $bundled_items as $bundled_item ){
1493
+						foreach( $bundled_items as $bundled_item ){
1494 1494
 
1495
-                            if( $bundled_item->product_id == $course_product_id ) {
1496
-                                Sensei_Utils::user_start_course( $user_id, $course_id );
1497
-                                return;
1498
-                            }
1495
+							if( $bundled_item->product_id == $course_product_id ) {
1496
+								Sensei_Utils::user_start_course( $user_id, $course_id );
1497
+								return;
1498
+							}
1499 1499
 
1500
-                        }
1500
+						}
1501 1501
 
1502
-                    } else {
1502
+					} else {
1503 1503
 
1504
-                    // handle regular products
1505
-                        if( $item['product_id'] == $course_product_id ) {
1506
-                            Sensei_Utils::user_start_course( $user_id, $course_id );
1507
-                            return;
1508
-                        }
1504
+					// handle regular products
1505
+						if( $item['product_id'] == $course_product_id ) {
1506
+							Sensei_Utils::user_start_course( $user_id, $course_id );
1507
+							return;
1508
+						}
1509 1509
 
1510
-                    }
1510
+					}
1511 1511
 				}
1512 1512
 			}
1513 1513
 
@@ -1538,21 +1538,21 @@  discard block
 block discarded – undo
1538 1538
 
1539 1539
 		//if not posted from the sensei login form let
1540 1540
 		// WordPress or any other party handle the failed request
1541
-	    if( ! isset( $_REQUEST['form'] ) || 'sensei-login' != $_REQUEST['form']  ){
1541
+		if( ! isset( $_REQUEST['form'] ) || 'sensei-login' != $_REQUEST['form']  ){
1542 1542
 
1543
-	    	return ;
1543
+			return ;
1544 1544
 
1545
-	    }
1545
+		}
1546 1546
 
1547
-    	// Get the reffering page, where did the post submission come from?
1548
-    	$referrer = add_query_arg('login', false, $_SERVER['HTTP_REFERER']);
1547
+		// Get the reffering page, where did the post submission come from?
1548
+		$referrer = add_query_arg('login', false, $_SERVER['HTTP_REFERER']);
1549 1549
 
1550 1550
    		 // if there's a valid referrer, and it's not the default log-in screen
1551
-	    if(!empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin')){
1552
-	        // let's append some information (login=failed) to the URL for the theme to use
1553
-	        wp_redirect( esc_url_raw( add_query_arg('login', 'failed',  $referrer) ) );
1554
-	    	exit;
1555
-    	}
1551
+		if(!empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin')){
1552
+			// let's append some information (login=failed) to the URL for the theme to use
1553
+			wp_redirect( esc_url_raw( add_query_arg('login', 'failed',  $referrer) ) );
1554
+			exit;
1555
+		}
1556 1556
 	}// End sensei_login_fail_redirect_to_front_end_login
1557 1557
 
1558 1558
 	/**
@@ -1564,47 +1564,47 @@  discard block
 block discarded – undo
1564 1564
 
1565 1565
 
1566 1566
 		// Check that it is a sensei login request and if it has a valid nonce
1567
-	    if(  isset( $_REQUEST['form'] ) && 'sensei-login' == $_REQUEST['form'] ) {
1567
+		if(  isset( $_REQUEST['form'] ) && 'sensei-login' == $_REQUEST['form'] ) {
1568 1568
 
1569
-	    	// Validate the login request nonce
1570
-		    if( !wp_verify_nonce( $_REQUEST['_wpnonce'], 'sensei-login' ) ){
1571
-		    	return;
1572
-		    }
1569
+			// Validate the login request nonce
1570
+			if( !wp_verify_nonce( $_REQUEST['_wpnonce'], 'sensei-login' ) ){
1571
+				return;
1572
+			}
1573 1573
 
1574 1574
 
1575
-		    //get the page where the sensei log form is located
1576
-		    $referrer = $_REQUEST['_wp_http_referer'];
1577
-		    //$redirect = $_REQUEST['_sensei_redirect'];
1575
+			//get the page where the sensei log form is located
1576
+			$referrer = $_REQUEST['_wp_http_referer'];
1577
+			//$redirect = $_REQUEST['_sensei_redirect'];
1578 1578
 
1579
-		    if ( ( isset( $_REQUEST['log'] ) && !empty( $_REQUEST['log'] ) )
1580
-		    	 && ( isset( $_REQUEST['pwd'] ) && !empty( $_REQUEST['pwd'] ) ) ){
1579
+			if ( ( isset( $_REQUEST['log'] ) && !empty( $_REQUEST['log'] ) )
1580
+				 && ( isset( $_REQUEST['pwd'] ) && !empty( $_REQUEST['pwd'] ) ) ){
1581 1581
 
1582
-		    	// when the user has entered a password or username do the sensei login
1583
-		    	$creds = array();
1582
+				// when the user has entered a password or username do the sensei login
1583
+				$creds = array();
1584 1584
 
1585
-		    	// check if the requests login is an email address
1586
-		    	if( is_email(  trim( $_REQUEST['log'] ) )  ){
1587
-		    		// query wordpress for the users details
1588
-		    		$user =	get_user_by( 'email', sanitize_email( $_REQUEST['log'] )  );
1585
+				// check if the requests login is an email address
1586
+				if( is_email(  trim( $_REQUEST['log'] ) )  ){
1587
+					// query wordpress for the users details
1588
+					$user =	get_user_by( 'email', sanitize_email( $_REQUEST['log'] )  );
1589 1589
 
1590
-		    		// validate the user object
1591
-		    		if( !$user ){
1590
+					// validate the user object
1591
+					if( !$user ){
1592 1592
 
1593
-		    			// the email doesnt exist
1594
-                        wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) );
1595
-		        		exit;
1593
+						// the email doesnt exist
1594
+						wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) );
1595
+						exit;
1596 1596
 
1597
-		    		}
1597
+					}
1598 1598
 
1599
-		    		//assigne the username to the creds array for further processing
1600
-		    		$creds['user_login'] =  $user->user_login ;
1599
+					//assigne the username to the creds array for further processing
1600
+					$creds['user_login'] =  $user->user_login ;
1601 1601
 
1602
-		    	}else{
1602
+				}else{
1603 1603
 
1604
-		    		// process this as a default username login
1605
-		    		$creds['user_login'] = sanitize_text_field( $_REQUEST['log'] ) ;
1604
+					// process this as a default username login
1605
+					$creds['user_login'] = sanitize_text_field( $_REQUEST['log'] ) ;
1606 1606
 
1607
-		    	}
1607
+				}
1608 1608
 
1609 1609
 				// get setup the rest of the creds array
1610 1610
 				$creds['user_password'] = sanitize_text_field( $_REQUEST['pwd'] );
@@ -1614,42 +1614,42 @@  discard block
 block discarded – undo
1614 1614
 				$user = wp_signon( $creds, false );
1615 1615
 
1616 1616
 				if ( is_wp_error($user) ){ // on login failure
1617
-                    wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) );
1618
-                    exit;
1617
+					wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) );
1618
+					exit;
1619 1619
 				}else{ // on login success
1620 1620
 
1621 1621
 					/**
1622
-					* change the redirect url programatically
1623
-					*
1624
-					* @since 1.6.1
1625
-					*
1626
-					* @param string $referrer the page where the current url wheresensei login form was posted from
1627
-					*/
1622
+					 * change the redirect url programatically
1623
+					 *
1624
+					 * @since 1.6.1
1625
+					 *
1626
+					 * @param string $referrer the page where the current url wheresensei login form was posted from
1627
+					 */
1628 1628
 
1629 1629
 					$success_redirect_url = apply_filters('sesei_login_success_redirect_url', remove_query_arg( 'login', $referrer ) );
1630 1630
 
1631 1631
 					wp_redirect( esc_url_raw( $success_redirect_url ) );
1632
-		        	exit;
1632
+					exit;
1633 1633
 
1634 1634
 				}	// end is_wp_error($user)
1635 1635
 
1636
-		    }else{ // if username or password is empty
1636
+			}else{ // if username or password is empty
1637 1637
 
1638
-                wp_redirect( esc_url_raw( add_query_arg('login', 'emptyfields', $referrer) ) );
1639
-		        exit;
1638
+				wp_redirect( esc_url_raw( add_query_arg('login', 'emptyfields', $referrer) ) );
1639
+				exit;
1640 1640
 
1641
-		    } // end if username $_REQUEST['log']  and password $_REQUEST['pwd'] is empty
1641
+			} // end if username $_REQUEST['log']  and password $_REQUEST['pwd'] is empty
1642 1642
 
1643
-	    }elseif( ( isset( $_GET['login'] ) ) ) {
1644
-	    	// else if this request is a redircect from a previously faile login request
1645
-	    	$this->login_message_process();
1643
+		}elseif( ( isset( $_GET['login'] ) ) ) {
1644
+			// else if this request is a redircect from a previously faile login request
1645
+			$this->login_message_process();
1646 1646
 
1647 1647
 			//exit the handle login request function
1648 1648
 			return;
1649
-	    }
1649
+		}
1650 1650
 
1651
-	    // if none of the above
1652
-	    return;
1651
+		// if none of the above
1652
+		return;
1653 1653
 
1654 1654
 	} // End  sensei_login_fail_redirect_to_front_end_login
1655 1655
 
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
 	public function login_message_process(){
1754 1754
 
1755 1755
 
1756
-		    // setup the message variables
1756
+			// setup the message variables
1757 1757
 			$message = '';
1758 1758
 
1759 1759
 			//only output message if the url contains login=failed and login=emptyfields
@@ -1772,22 +1772,22 @@  discard block
 block discarded – undo
1772 1772
 	}// end login_message_process
1773 1773
 
1774 1774
 
1775
-    /**
1776
-     * sensei_show_admin_bar(). Use WooCommerce filter
1777
-     * to show admin bar to Teachers as well.
1778
-     *
1779
-     * @return void redirect
1780
-     *
1781
-     */
1782
-    public function sensei_show_admin_bar () {
1775
+	/**
1776
+	 * sensei_show_admin_bar(). Use WooCommerce filter
1777
+	 * to show admin bar to Teachers as well.
1778
+	 *
1779
+	 * @return void redirect
1780
+	 *
1781
+	 */
1782
+	public function sensei_show_admin_bar () {
1783 1783
 
1784
-        if (current_user_can('edit_courses')) {
1784
+		if (current_user_can('edit_courses')) {
1785 1785
 
1786
-            add_filter( 'woocommerce_disable_admin_bar', '__return_false', 10, 1);
1786
+			add_filter( 'woocommerce_disable_admin_bar', '__return_false', 10, 1);
1787 1787
 
1788
-        }
1788
+		}
1789 1789
 
1790
-    }
1790
+	}
1791 1791
 
1792 1792
 } // End Class
1793 1793
 
Please login to merge, or discard this patch.
Spacing   +452 added lines, -452 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 Frontend Class
@@ -22,78 +22,78 @@  discard block
 block discarded – undo
22 22
 	 * Constructor.
23 23
 	 * @since  1.0.0
24 24
 	 */
25
-	public function __construct () {
25
+	public function __construct() {
26 26
 
27 27
 		// Template output actions
28
-		add_action( 'sensei_before_main_content', array( $this, 'sensei_output_content_wrapper' ), 10 );
29
-		add_action( 'sensei_after_main_content', array( $this, 'sensei_output_content_wrapper_end' ), 10 );
30
-		add_action( 'sensei_lesson_archive_lesson_title', array( $this, 'sensei_lesson_archive_lesson_title' ), 10 );
28
+		add_action('sensei_before_main_content', array($this, 'sensei_output_content_wrapper'), 10);
29
+		add_action('sensei_after_main_content', array($this, 'sensei_output_content_wrapper_end'), 10);
30
+		add_action('sensei_lesson_archive_lesson_title', array($this, 'sensei_lesson_archive_lesson_title'), 10);
31 31
 
32 32
 		// 1.2.1
33
-		add_action( 'sensei_complete_lesson', array( $this, 'sensei_complete_lesson' ) );
34
-		add_action( 'init', array( $this, 'sensei_complete_course' ), 5 );
35
-		add_action( 'sensei_frontend_messages', array( $this, 'sensei_frontend_messages' ) );
36
-		add_action( 'sensei_lesson_video', array( $this, 'sensei_lesson_video' ), 10, 1 );
37
-		add_action( 'sensei_complete_lesson_button', array( $this, 'sensei_complete_lesson_button' ) );
38
-		add_action( 'sensei_reset_lesson_button', array( $this, 'sensei_reset_lesson_button' ) );
33
+		add_action('sensei_complete_lesson', array($this, 'sensei_complete_lesson'));
34
+		add_action('init', array($this, 'sensei_complete_course'), 5);
35
+		add_action('sensei_frontend_messages', array($this, 'sensei_frontend_messages'));
36
+		add_action('sensei_lesson_video', array($this, 'sensei_lesson_video'), 10, 1);
37
+		add_action('sensei_complete_lesson_button', array($this, 'sensei_complete_lesson_button'));
38
+		add_action('sensei_reset_lesson_button', array($this, 'sensei_reset_lesson_button'));
39 39
 
40
-		add_action( 'sensei_course_archive_meta', array( $this, 'sensei_course_archive_meta' ) );
40
+		add_action('sensei_course_archive_meta', array($this, 'sensei_course_archive_meta'));
41 41
 
42
-		add_action( 'sensei_lesson_tag_main_content', array( $this, 'sensei_lesson_archive_main_content' ), 10 );
43
-		add_action( 'sensei_no_permissions_main_content', array( $this, 'sensei_no_permissions_main_content' ), 10 );
42
+		add_action('sensei_lesson_tag_main_content', array($this, 'sensei_lesson_archive_main_content'), 10);
43
+		add_action('sensei_no_permissions_main_content', array($this, 'sensei_no_permissions_main_content'), 10);
44 44
 
45
-		add_action( 'sensei_lesson_meta', array( $this, 'sensei_lesson_meta' ), 10 );
46
-		add_action( 'sensei_single_course_content_inside_before', array( $this, 'sensei_course_start' ), 10 );
45
+		add_action('sensei_lesson_meta', array($this, 'sensei_lesson_meta'), 10);
46
+		add_action('sensei_single_course_content_inside_before', array($this, 'sensei_course_start'), 10);
47 47
 
48 48
 		// add_filter( 'get_comments_number', array( $this, 'sensei_lesson_comment_count' ), 1 );
49
-		add_filter( 'the_title', array( $this, 'sensei_lesson_preview_title' ), 10, 2 );
49
+		add_filter('the_title', array($this, 'sensei_lesson_preview_title'), 10, 2);
50 50
 
51 51
 		//1.6.2
52
-		add_filter( 'wp_login_failed', array( $this, 'sensei_login_fail_redirect' ), 10 );
53
-		add_filter( 'init', array( $this, 'sensei_handle_login_request' ), 10 );
52
+		add_filter('wp_login_failed', array($this, 'sensei_login_fail_redirect'), 10);
53
+		add_filter('init', array($this, 'sensei_handle_login_request'), 10);
54 54
 		//1.6.3
55
-		add_action( 'init', array( $this, 'sensei_process_registration' ), 2 );
55
+		add_action('init', array($this, 'sensei_process_registration'), 2);
56 56
 		//1.7.0
57
-		add_action( 'sensei_pagination', array( $this, 'sensei_breadcrumb' ), 80, 1 );
57
+		add_action('sensei_pagination', array($this, 'sensei_breadcrumb'), 80, 1);
58 58
 
59 59
 		// Fix pagination for course archive pages when filtering by course type
60
-		add_filter( 'pre_get_posts', array( $this, 'sensei_course_archive_pagination' ) );
60
+		add_filter('pre_get_posts', array($this, 'sensei_course_archive_pagination'));
61 61
 
62 62
 		// Scripts and Styles
63
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
64
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
63
+		add_action('wp_enqueue_scripts', array($this, 'enqueue_styles'));
64
+		add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
65 65
 
66 66
 		// Custom Menu Item filters
67
-		add_filter( 'wp_setup_nav_menu_item', array( $this, 'sensei_setup_nav_menu_item' ) );
68
-		add_filter( 'wp_nav_menu_objects', array( $this, 'sensei_wp_nav_menu_objects' ) );
67
+		add_filter('wp_setup_nav_menu_item', array($this, 'sensei_setup_nav_menu_item'));
68
+		add_filter('wp_nav_menu_objects', array($this, 'sensei_wp_nav_menu_objects'));
69 69
 		// Search Results filters
70
-		add_filter( 'post_class', array( $this, 'sensei_search_results_classes' ), 10 );
70
+		add_filter('post_class', array($this, 'sensei_search_results_classes'), 10);
71 71
 		// Only show course & lesson excerpts in search results
72
-		add_filter( 'the_content', array( $this, 'sensei_search_results_excerpt' ) );
72
+		add_filter('the_content', array($this, 'sensei_search_results_excerpt'));
73 73
 
74 74
         //Use WooCommerce filter to show admin bar to Teachers.
75
-        add_action( 'init', array( $this, 'sensei_show_admin_bar') );
75
+        add_action('init', array($this, 'sensei_show_admin_bar'));
76 76
 
77 77
         // Remove course from active courses if an order is cancelled or refunded
78
-		add_action( 'woocommerce_order_status_processing_to_cancelled', array( $this, 'remove_active_course' ), 10, 1 );
79
-		add_action( 'woocommerce_order_status_completed_to_cancelled', array( $this, 'remove_active_course' ), 10, 1 );
80
-		add_action( 'woocommerce_order_status_on-hold_to_cancelled', array( $this, 'remove_active_course' ), 10, 1 );
81
-		add_action( 'woocommerce_order_status_processing_to_refunded', array( $this, 'remove_active_course' ), 10, 1 );
82
-		add_action( 'woocommerce_order_status_completed_to_refunded', array( $this, 'remove_active_course' ), 10, 1 );
83
-		add_action( 'woocommerce_order_status_on-hold_to_refunded', array( $this, 'remove_active_course' ), 10, 1 );
78
+		add_action('woocommerce_order_status_processing_to_cancelled', array($this, 'remove_active_course'), 10, 1);
79
+		add_action('woocommerce_order_status_completed_to_cancelled', array($this, 'remove_active_course'), 10, 1);
80
+		add_action('woocommerce_order_status_on-hold_to_cancelled', array($this, 'remove_active_course'), 10, 1);
81
+		add_action('woocommerce_order_status_processing_to_refunded', array($this, 'remove_active_course'), 10, 1);
82
+		add_action('woocommerce_order_status_completed_to_refunded', array($this, 'remove_active_course'), 10, 1);
83
+		add_action('woocommerce_order_status_on-hold_to_refunded', array($this, 'remove_active_course'), 10, 1);
84 84
 
85 85
 		// Make sure correct courses are marked as active for users
86
-		add_action( 'sensei_before_my_courses', array( $this, 'activate_purchased_courses' ), 10, 1 );
87
-		add_action( 'sensei_single_course_content_inside_before', array( $this, 'activate_purchased_single_course' ), 10 );
86
+		add_action('sensei_before_my_courses', array($this, 'activate_purchased_courses'), 10, 1);
87
+		add_action('sensei_single_course_content_inside_before', array($this, 'activate_purchased_single_course'), 10);
88 88
 
89 89
 		// Lesson tags
90
-		add_action( 'sensei_lesson_meta_extra', array( $this, 'lesson_tags_display' ), 10, 1 );
91
-		add_action( 'pre_get_posts', array( $this, 'lesson_tag_archive_filter' ), 10, 1 );
92
-		add_filter( 'sensei_lessons_archive_text', array( $this, 'lesson_tag_archive_header' ) );
93
-		add_action( 'sensei_loop_lesson_inside_before', array( $this, 'lesson_tag_archive_description' ), 11 );
90
+		add_action('sensei_lesson_meta_extra', array($this, 'lesson_tags_display'), 10, 1);
91
+		add_action('pre_get_posts', array($this, 'lesson_tag_archive_filter'), 10, 1);
92
+		add_filter('sensei_lessons_archive_text', array($this, 'lesson_tag_archive_header'));
93
+		add_action('sensei_loop_lesson_inside_before', array($this, 'lesson_tag_archive_description'), 11);
94 94
 
95 95
 		// Hide Sensei activity comments from lesson and course pages
96
-		add_filter( 'wp_list_comments_args', array( $this, 'hide_sensei_activity' ) );
96
+		add_filter('wp_list_comments_args', array($this, 'hide_sensei_activity'));
97 97
 	} // End __construct()
98 98
 
99 99
 	/**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @since  1.0.0
102 102
 	 * @return void
103 103
 	 */
104
-	public function init () {
104
+	public function init() {
105 105
 
106 106
 	} // End init()
107 107
 
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
 	 * @since  1.7.3
113 113
 	 * @return array|mixed
114 114
 	 */
115
-	public function __get( $key ) {
115
+	public function __get($key) {
116 116
 
117 117
 
118
-		if ( 'lesson' == $key || 'course' == $key ) {
119
-			if ( WP_DEBUG ) {
120
-				trigger_error( sprintf( 'Sensei()->frontend->%1$s has been <strong>deprecated</strong> since version %2$s! Please use Sensei()->%1$s to access the instance.', $key, '1.7.3' ) );
118
+		if ('lesson' == $key || 'course' == $key) {
119
+			if (WP_DEBUG) {
120
+				trigger_error(sprintf('Sensei()->frontend->%1$s has been <strong>deprecated</strong> since version %2$s! Please use Sensei()->%1$s to access the instance.', $key, '1.7.3'));
121 121
 			}
122 122
 			return Sensei()->$key;
123 123
 		}
@@ -130,32 +130,32 @@  discard block
 block discarded – undo
130 130
 	 * @since  1.0.0
131 131
 	 * @return void
132 132
 	 */
133
-	public function enqueue_scripts () {
133
+	public function enqueue_scripts() {
134 134
 
135 135
 		$disable_js = false;
136
-		if ( isset( Sensei()->settings->settings[ 'js_disable' ] ) ) {
137
-			$disable_js = Sensei()->settings->settings[ 'js_disable' ];
136
+		if (isset(Sensei()->settings->settings['js_disable'])) {
137
+			$disable_js = Sensei()->settings->settings['js_disable'];
138 138
 		} // End If Statement
139
-		if ( ! $disable_js ) {
139
+		if ( ! $disable_js) {
140 140
 
141
-			$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
141
+			$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
142 142
 
143 143
 			// My Courses tabs script
144
-			wp_register_script( $this->token . '-user-dashboard', esc_url( Sensei()->plugin_url . 'assets/js/user-dashboard' . $suffix . '.js' ), array( 'jquery-ui-tabs' ), Sensei()->version, true );
145
-			wp_enqueue_script( $this->token . '-user-dashboard' );
144
+			wp_register_script($this->token.'-user-dashboard', esc_url(Sensei()->plugin_url.'assets/js/user-dashboard'.$suffix.'.js'), array('jquery-ui-tabs'), Sensei()->version, true);
145
+			wp_enqueue_script($this->token.'-user-dashboard');
146 146
 
147 147
 
148 148
             // Course Archive javascript
149
-            if( is_post_type_archive( 'course' ) ){
149
+            if (is_post_type_archive('course')) {
150 150
 
151
-                wp_register_script( 'sensei-course-archive-js', esc_url( Sensei()->plugin_url . 'assets/js/frontend/course-archive' . $suffix . '.js' ), array( 'jquery' ), '1', true );
152
-                wp_enqueue_script( 'sensei-course-archive-js' );
151
+                wp_register_script('sensei-course-archive-js', esc_url(Sensei()->plugin_url.'assets/js/frontend/course-archive'.$suffix.'.js'), array('jquery'), '1', true);
152
+                wp_enqueue_script('sensei-course-archive-js');
153 153
 
154 154
             }
155 155
 
156 156
 
157 157
 			// Allow additional scripts to be loaded
158
-			do_action( 'sensei_additional_scripts' );
158
+			do_action('sensei_additional_scripts');
159 159
 
160 160
 		} // End If Statement
161 161
 
@@ -166,24 +166,24 @@  discard block
 block discarded – undo
166 166
 	 * @since  1.0.0
167 167
 	 * @return void
168 168
 	 */
169
-	public function enqueue_styles () {
169
+	public function enqueue_styles() {
170 170
 
171 171
 
172 172
 		$disable_styles = false;
173
-		if ( isset( Sensei()->settings->settings[ 'styles_disable' ] ) ) {
174
-			$disable_styles = Sensei()->settings->settings[ 'styles_disable' ];
173
+		if (isset(Sensei()->settings->settings['styles_disable'])) {
174
+			$disable_styles = Sensei()->settings->settings['styles_disable'];
175 175
 		} // End If Statement
176 176
 
177 177
 		// Add filter for theme overrides
178
-		$disable_styles = apply_filters( 'sensei_disable_styles', $disable_styles );
178
+		$disable_styles = apply_filters('sensei_disable_styles', $disable_styles);
179 179
 
180
-		if ( ! $disable_styles ) {
180
+		if ( ! $disable_styles) {
181 181
 
182
-			wp_register_style( Sensei()->token . '-frontend', Sensei()->plugin_url . 'assets/css/frontend/sensei.css', '', Sensei()->version, 'screen' );
183
-			wp_enqueue_style( Sensei()->token . '-frontend' );
182
+			wp_register_style(Sensei()->token.'-frontend', Sensei()->plugin_url.'assets/css/frontend/sensei.css', '', Sensei()->version, 'screen');
183
+			wp_enqueue_style(Sensei()->token.'-frontend');
184 184
 
185 185
 			// Allow additional stylesheets to be loaded
186
-			do_action( 'sensei_additional_styles' );
186
+			do_action('sensei_additional_styles');
187 187
 
188 188
 		} // End If Statement
189 189
 
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 	 * @param string $name (default: '')
200 200
 	 * @return void
201 201
 	 */
202
-	function sensei_get_template_part( $slug, $name = '' ) {
202
+	function sensei_get_template_part($slug, $name = '') {
203 203
 
204
-        _deprecated_function( 'class-woothemes-sensei-frontend.php', '1.9.0', 'Sensei_Templates::get_part' );
205
-        Sensei_Templates::get_part( $slug, $name );
204
+        _deprecated_function('class-woothemes-sensei-frontend.php', '1.9.0', 'Sensei_Templates::get_part');
205
+        Sensei_Templates::get_part($slug, $name);
206 206
 
207 207
 	} // End sensei_get_template_part()
208 208
 
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 	 * @param string $default_path (default: '')
218 218
 	 * @return void
219 219
 	 */
220
-	function sensei_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
220
+	function sensei_get_template($template_name, $args = array(), $template_path = '', $default_path = '') {
221 221
 
222
-        _deprecated_function( 'sensei_get_template', '1.9.0', 'Sensei_Templates::get_template' );
223
-        Sensei_Templates::get_template($template_name, $args, $template_path, $default_path  );
222
+        _deprecated_function('sensei_get_template', '1.9.0', 'Sensei_Templates::get_template');
223
+        Sensei_Templates::get_template($template_name, $args, $template_path, $default_path);
224 224
 
225 225
 	} // End sensei_get_template()
226 226
 
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
 	 * @param string $default_path (default: '')
235 235
 	 * @return void
236 236
 	 */
237
-	function sensei_locate_template( $template_name, $template_path = '', $default_path = '' ) {
237
+	function sensei_locate_template($template_name, $template_path = '', $default_path = '') {
238 238
 
239
-        _deprecated_function( 'sensei_locate_template', '1.9.0', 'Sensei_Templates::locate_template' );
240
-        Sensei_Templates::locate_template( $template_name, $template_path, $default_path );
239
+        _deprecated_function('sensei_locate_template', '1.9.0', 'Sensei_Templates::locate_template');
240
+        Sensei_Templates::locate_template($template_name, $template_path, $default_path);
241 241
 
242 242
 	} // End sensei_locate_template()
243 243
 
@@ -251,20 +251,20 @@  discard block
 block discarded – undo
251 251
 	function sensei_output_content_wrapper() {
252 252
 
253 253
 	    // backwards compatibility check for old location under the wrappers directory of the active theme
254
-        $backwards_compatible_wrapper_location =   array(
255
-            Sensei()->template_url . 'wrappers/wrapper-start.php',
254
+        $backwards_compatible_wrapper_location = array(
255
+            Sensei()->template_url.'wrappers/wrapper-start.php',
256 256
             'wrappers/wrapper-start.php'
257 257
         );
258 258
 
259
-        $template = locate_template( $backwards_compatible_wrapper_location );
260
-        if( !empty( $template ) ){
259
+        $template = locate_template($backwards_compatible_wrapper_location);
260
+        if ( ! empty($template)) {
261 261
 
262
-            Sensei_Templates::get_template( 'wrappers/wrapper-start.php' );
262
+            Sensei_Templates::get_template('wrappers/wrapper-start.php');
263 263
             return;
264 264
 
265 265
         }
266 266
 
267
-		Sensei_Templates::get_template( 'globals/wrapper-start.php' );
267
+		Sensei_Templates::get_template('globals/wrapper-start.php');
268 268
 
269 269
 	} // End sensei_output_content_wrapper()
270 270
 
@@ -278,21 +278,21 @@  discard block
 block discarded – undo
278 278
 	function sensei_output_content_wrapper_end() {
279 279
 
280 280
 	    // backwards compatibility check for old location under the wrappers directory of the active theme
281
-        $backwards_compatible_wrapper_location =   array(
282
-            Sensei()->template_url . 'wrappers/wrapper-end.php',
281
+        $backwards_compatible_wrapper_location = array(
282
+            Sensei()->template_url.'wrappers/wrapper-end.php',
283 283
             'wrappers/wrapper-end.php'
284 284
         );
285 285
 
286
-        $backwards_compatible_template = locate_template( $backwards_compatible_wrapper_location );
287
-        if( !empty( $backwards_compatible_template ) ){
286
+        $backwards_compatible_template = locate_template($backwards_compatible_wrapper_location);
287
+        if ( ! empty($backwards_compatible_template)) {
288 288
 
289
-            Sensei_Templates::get_template( 'wrappers/wrapper-end.php' );
289
+            Sensei_Templates::get_template('wrappers/wrapper-end.php');
290 290
             return;
291 291
 
292 292
         }
293 293
 
294 294
 
295
-		Sensei_Templates::get_template( 'globals/wrapper-end.php' );
295
+		Sensei_Templates::get_template('globals/wrapper-end.php');
296 296
 
297 297
 	} // End sensei_output_content_wrapper_end()
298 298
 
@@ -305,57 +305,57 @@  discard block
 block discarded – undo
305 305
 	 */
306 306
 	public static function load_content_pagination() {
307 307
 
308
-        if( is_singular('course') ) {
308
+        if (is_singular('course')) {
309 309
 
310 310
             // backwards compatibility check for old location under the wrappers directory of the active theme
311
-            $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-posts.php' ) );
312
-            if( !empty( $template ) ){
311
+            $template = locate_template(array(Sensei()->template_url.'wrappers/pagination-posts.php'));
312
+            if ( ! empty($template)) {
313 313
 
314
-                Sensei_Templates::get_template( 'wrappers/pagination-posts.php' );
314
+                Sensei_Templates::get_template('wrappers/pagination-posts.php');
315 315
                 return;
316 316
 
317 317
             }
318 318
 
319
-			Sensei_Templates::get_template( 'globals/pagination-posts.php' );
319
+			Sensei_Templates::get_template('globals/pagination-posts.php');
320 320
 
321
-		} elseif( is_singular('lesson') ) {
321
+		} elseif (is_singular('lesson')) {
322 322
 
323 323
 		    // backwards compatibility check for old location under the wrappers directory of the active theme
324
-		    $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-lesson.php' ) );
325
-            if( !empty( $template ) ){
324
+		    $template = locate_template(array(Sensei()->template_url.'wrappers/pagination-lesson.php'));
325
+            if ( ! empty($template)) {
326 326
 
327
-                Sensei_Templates::get_template( 'wrappers/pagination-lesson.php' );
327
+                Sensei_Templates::get_template('wrappers/pagination-lesson.php');
328 328
                 return;
329 329
 
330 330
             }
331 331
 
332
-			Sensei_Templates::get_template( 'globals/pagination-lesson.php' );
332
+			Sensei_Templates::get_template('globals/pagination-lesson.php');
333 333
 
334
-		} elseif( is_singular('quiz') ) {
334
+		} elseif (is_singular('quiz')) {
335 335
 
336 336
 		    // backwards compatibility check for old location under the wrappers directory of the active theme
337
-		    $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-quiz.php' ) );
338
-            if( !empty( $template ) ){
337
+		    $template = locate_template(array(Sensei()->template_url.'wrappers/pagination-quiz.php'));
338
+            if ( ! empty($template)) {
339 339
 
340
-                Sensei_Templates::get_template( 'wrappers/pagination-quiz.php' );
340
+                Sensei_Templates::get_template('wrappers/pagination-quiz.php');
341 341
                 return;
342 342
 
343 343
             }
344 344
 
345
-			Sensei_Templates::get_template( 'globals/pagination-quiz.php' );
345
+			Sensei_Templates::get_template('globals/pagination-quiz.php');
346 346
 
347 347
 		} else {
348 348
 
349 349
             // backwards compatibility check for old location under the wrappers directory of the active theme
350
-            $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination.php' ) );
351
-            if( !empty( $template ) ){
350
+            $template = locate_template(array(Sensei()->template_url.'wrappers/pagination.php'));
351
+            if ( ! empty($template)) {
352 352
 
353
-                Sensei_Templates::get_template( 'wrappers/pagination.php' );
353
+                Sensei_Templates::get_template('wrappers/pagination.php');
354 354
                 return;
355 355
 
356 356
             }
357 357
 
358
-			Sensei_Templates::get_template( 'globals/pagination.php' );
358
+			Sensei_Templates::get_template('globals/pagination.php');
359 359
 
360 360
 		} // End If Statement
361 361
 
@@ -381,21 +381,21 @@  discard block
 block discarded – undo
381 381
 	 * @param object $item
382 382
 	 * @return object $item
383 383
 	 */
384
-	public function sensei_setup_nav_menu_item( $item ) {
384
+	public function sensei_setup_nav_menu_item($item) {
385 385
 		global $pagenow, $wp_rewrite;
386 386
 
387
-		if( 'nav-menus.php' != $pagenow && !defined('DOING_AJAX') && isset( $item->url ) && 'custom' == $item->type ) {
387
+		if ('nav-menus.php' != $pagenow && ! defined('DOING_AJAX') && isset($item->url) && 'custom' == $item->type) {
388 388
 
389 389
 			// Set up Sensei menu links
390
-			$course_page_id = intval( Sensei()->settings->settings[ 'course_page' ] );
391
-			$my_account_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] );
390
+			$course_page_id = intval(Sensei()->settings->settings['course_page']);
391
+			$my_account_page_id = intval(Sensei()->settings->settings['my_course_page']);
392 392
 
393 393
 			$course_page_url = Sensei_Course::get_courses_page_url();
394
-			$lesson_archive_url = get_post_type_archive_link( 'lesson' );
395
-			$my_courses_url = get_permalink( $my_account_page_id );
396
-			$my_messages_url = get_post_type_archive_link( 'sensei_message' );
394
+			$lesson_archive_url = get_post_type_archive_link('lesson');
395
+			$my_courses_url = get_permalink($my_account_page_id);
396
+			$my_messages_url = get_post_type_archive_link('sensei_message');
397 397
 
398
-			switch ( $item->url ) {
398
+			switch ($item->url) {
399 399
 				case '#senseicourses':
400 400
 					$item->url = $course_page_url;
401 401
 					break;
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 					$item->url = $my_messages_url;
413 413
                     // if no archive link exist for sensei_message
414 414
                     // set it back to the place holder
415
-                    if( ! $item->url ){
415
+                    if ( ! $item->url) {
416 416
 
417 417
                         $item->url = '#senseimymessages';
418 418
 
@@ -420,21 +420,21 @@  discard block
 block discarded – undo
420 420
 					break;
421 421
 
422 422
 				case '#senseilearnerprofile':
423
-					$item->url = esc_url( Sensei()->learner_profiles->get_permalink() );
423
+					$item->url = esc_url(Sensei()->learner_profiles->get_permalink());
424 424
 					break;
425 425
 
426 426
 				case '#senseiloginlogout':
427
-						$logout_url = wp_logout_url( home_url() );
427
+						$logout_url = wp_logout_url(home_url());
428 428
 						// Login link links to the My Courses page, to avoid the WP dashboard.
429 429
 						$login_url = $my_courses_url;
430 430
 
431
-						$item->url = ( is_user_logged_in() ? $logout_url : $login_url );
431
+						$item->url = (is_user_logged_in() ? $logout_url : $login_url);
432 432
 
433 433
 						// determine the menu title login or logout
434
-						if ( is_user_logged_in() ) {
435
-							$menu_title =  __( 'Logout'  ,'woothemes-sensei');
434
+						if (is_user_logged_in()) {
435
+							$menu_title = __('Logout', 'woothemes-sensei');
436 436
 						} else {
437
-							$menu_title =  __( 'Login'  ,'woothemes-sensei');
437
+							$menu_title = __('Login', 'woothemes-sensei');
438 438
 						}
439 439
 
440 440
 						/**
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 						 *
445 445
 						 * @param $menu_title
446 446
 						 */
447
-						$item->title = apply_filters( 'sensei_login_logout_menu_title', $menu_title );
447
+						$item->title = apply_filters('sensei_login_logout_menu_title', $menu_title);
448 448
 
449 449
 					break;
450 450
 
@@ -452,12 +452,12 @@  discard block
 block discarded – undo
452 452
 					break;
453 453
 			}
454 454
 
455
-			$_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] );
456
-			$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current );
457
-			$item_url = untrailingslashit( $item->url );
458
-			$_indexless_current = untrailingslashit( preg_replace( '/' . preg_quote( $wp_rewrite->index, '/' ) . '$/', '', $current_url ) );
455
+			$_root_relative_current = untrailingslashit($_SERVER['REQUEST_URI']);
456
+			$current_url = set_url_scheme('http://'.$_SERVER['HTTP_HOST'].$_root_relative_current);
457
+			$item_url = untrailingslashit($item->url);
458
+			$_indexless_current = untrailingslashit(preg_replace('/'.preg_quote($wp_rewrite->index, '/').'$/', '', $current_url));
459 459
 			// Highlight current menu item
460
-			if ( $item_url && in_array( $item_url, array( $current_url, $_indexless_current, $_root_relative_current ) ) ) {
460
+			if ($item_url && in_array($item_url, array($current_url, $_indexless_current, $_root_relative_current))) {
461 461
 				$item->classes[] = 'current-menu-item current_page_item';
462 462
 			}
463 463
 
@@ -476,26 +476,26 @@  discard block
 block discarded – undo
476 476
 	 * @param object $sorted_menu_items
477 477
 	 * @return object $sorted_menu_items
478 478
 	 */
479
-	public function sensei_wp_nav_menu_objects( $sorted_menu_items ) {
479
+	public function sensei_wp_nav_menu_objects($sorted_menu_items) {
480 480
 
481
-		foreach( $sorted_menu_items as $k=>$item ) {
481
+		foreach ($sorted_menu_items as $k=>$item) {
482 482
 
483 483
 			// Remove the My Messages link for logged out users or if Private Messages are disabled
484
-			if( ! get_post_type_archive_link( 'sensei_message' )
485
-                && '#senseimymessages' == $item->url ) {
484
+			if ( ! get_post_type_archive_link('sensei_message')
485
+                && '#senseimymessages' == $item->url) {
486 486
 
487
-				if ( !is_user_logged_in() || ( isset( Sensei()->settings->settings['messages_disable'] ) && Sensei()->settings->settings['messages_disable'] ) ) {
487
+				if ( ! is_user_logged_in() || (isset(Sensei()->settings->settings['messages_disable']) && Sensei()->settings->settings['messages_disable'])) {
488 488
 
489
-					unset( $sorted_menu_items[$k] );
489
+					unset($sorted_menu_items[$k]);
490 490
 
491 491
 				}
492 492
 			}
493 493
 			// Remove the My Profile link for logged out users.
494
-			if( Sensei()->learner_profiles->get_permalink() == $item->url ) {
494
+			if (Sensei()->learner_profiles->get_permalink() == $item->url) {
495 495
 
496
-				if ( !is_user_logged_in() || ! ( isset( Sensei()->settings->settings[ 'learner_profile_enable' ] ) && Sensei()->settings->settings[ 'learner_profile_enable' ] ) ) {
496
+				if ( ! is_user_logged_in() || ! (isset(Sensei()->settings->settings['learner_profile_enable']) && Sensei()->settings->settings['learner_profile_enable'])) {
497 497
 
498
-					unset( $sorted_menu_items[$k] );
498
+					unset($sorted_menu_items[$k]);
499 499
 
500 500
 				}
501 501
 			}
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 	function sensei_search_results_classes($classes) {
508 508
 	    global $post;
509 509
 	    // Handle Search Classes for Courses, Lessons, and WC Products
510
-	    if ( isset( $post->post_type ) && ( ( 'course' == $post->post_type ) || ( 'lesson' == $post->post_type ) || ( 'product' == $post->post_type ) ) ) {
510
+	    if (isset($post->post_type) && (('course' == $post->post_type) || ('lesson' == $post->post_type) || ('product' == $post->post_type))) {
511 511
 	    	$classes[] = 'post';
512 512
 		} // End If Statement
513 513
 	    return $classes;
@@ -535,18 +535,18 @@  discard block
 block discarded – undo
535 535
      * @param bool|false $return
536 536
      * @return string|void
537 537
 	 */
538
-	function sensei_course_image( $course_id, $width = '100', $height = '100', $return = false ) {
538
+	function sensei_course_image($course_id, $width = '100', $height = '100', $return = false) {
539 539
 
540
-        trigger_error( 'Sensei Deprecated function: sensei_course_image since 1.9.0 . Please use Sensei()->course->course_image instead.');
540
+        trigger_error('Sensei Deprecated function: sensei_course_image since 1.9.0 . Please use Sensei()->course->course_image instead.');
541 541
 
542
-    	if ( ! $return ) {
542
+    	if ( ! $return) {
543 543
 
544
-			echo Sensei()->course->course_image( $course_id, $width, $height );
544
+			echo Sensei()->course->course_image($course_id, $width, $height);
545 545
             return '';
546 546
 
547 547
 		} // End If Statement
548 548
 
549
-		return Sensei()->course->course_image( $course_id, $width, $height );
549
+		return Sensei()->course->course_image($course_id, $width, $height);
550 550
 
551 551
 	} // End sensei_course_image()
552 552
 
@@ -561,15 +561,15 @@  discard block
 block discarded – undo
561 561
      * @param bool|false $widget
562 562
      * @return string
563 563
 	 */
564
-	function sensei_lesson_image( $lesson_id, $width = '100', $height = '100', $return = false, $widget = false ) {
564
+	function sensei_lesson_image($lesson_id, $width = '100', $height = '100', $return = false, $widget = false) {
565 565
 
566
-        if( ! $return ){
566
+        if ( ! $return) {
567 567
 
568
-            echo Sensei()->lesson->lesson_image( $lesson_id, $width, $height, $widget );
568
+            echo Sensei()->lesson->lesson_image($lesson_id, $width, $height, $widget);
569 569
             return '';
570 570
         }
571 571
 
572
-        return Sensei()->lesson->lesson_image( $lesson_id, $width, $height, $widget );
572
+        return Sensei()->lesson->lesson_image($lesson_id, $width, $height, $widget);
573 573
 
574 574
 	} // End sensei_lesson_image()
575 575
 
@@ -577,20 +577,20 @@  discard block
 block discarded – undo
577 577
      * @since 1.0.0
578 578
      * @param WP_Query $query
579 579
      */
580
-    function sensei_course_archive_pagination( $query ) {
580
+    function sensei_course_archive_pagination($query) {
581 581
 
582
-		if( ! is_admin() && $query->is_main_query() && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'newcourses', 'featuredcourses', 'freecourses', 'paidcourses' ) ) ) {
582
+		if ( ! is_admin() && $query->is_main_query() && isset($_GET['action']) && in_array($_GET['action'], array('newcourses', 'featuredcourses', 'freecourses', 'paidcourses'))) {
583 583
 
584 584
 			$amount = 0;
585
-			if ( isset( Sensei()->settings->settings[ 'course_archive_amount' ] ) && ( 0 < absint( Sensei()->settings->settings[ 'course_archive_amount' ] ) ) ) {
586
-				$amount = absint( Sensei()->settings->settings[ 'course_archive_amount' ] );
585
+			if (isset(Sensei()->settings->settings['course_archive_amount']) && (0 < absint(Sensei()->settings->settings['course_archive_amount']))) {
586
+				$amount = absint(Sensei()->settings->settings['course_archive_amount']);
587 587
 			}
588 588
 
589
-			if( $amount ) {
590
-				$query->set( 'posts_per_page', $amount );
589
+			if ($amount) {
590
+				$query->set('posts_per_page', $amount);
591 591
 			}
592 592
 
593
-			$query->set( 'orderby', 'menu_order date' );
593
+			$query->set('orderby', 'menu_order date');
594 594
 
595 595
 		}
596 596
 	}
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 	function sensei_course_archive_header(  ) {
607 607
 
608 608
         trigger_error('This function sensei_course_archive_header has been depricated. Please use: WooThemes_Sensei_Course::course_archive_header ');
609
-        WooThemes_Sensei_Course::archive_header( '', '<header class="archive-header"><h1>', '</h1></header>' );
609
+        WooThemes_Sensei_Course::archive_header('', '<header class="archive-header"><h1>', '</h1></header>');
610 610
 
611 611
 	} // sensei_course_archive_header()
612 612
 
@@ -619,15 +619,15 @@  discard block
 block discarded – undo
619 619
 	 * @return void
620 620
 	 */
621 621
 	public function sensei_lesson_archive_header( ) {
622
-        _deprecated_function( 'WooThemes_Sensei_Frontend::sensei_lesson_archive_header', '1.9.0', 'WooThemes_Sensei_Lesson::the_archive_header' );
622
+        _deprecated_function('WooThemes_Sensei_Frontend::sensei_lesson_archive_header', '1.9.0', 'WooThemes_Sensei_Lesson::the_archive_header');
623 623
         Sensei()->lesson->the_archive_header();
624 624
 	} // sensei_course_archive_header()
625 625
 
626 626
     /**
627 627
      * @deprecated since 1.9.0
628 628
      */
629
-	public function sensei_message_archive_header( ){
630
-        _deprecated_function('Sensei_Frontend::sensei_message_archive_header','Please use: Sense');
629
+	public function sensei_message_archive_header( ) {
630
+        _deprecated_function('Sensei_Frontend::sensei_message_archive_header', 'Please use: Sense');
631 631
         Sensei_Messages::the_archive_header();
632 632
 	} // sensei_message_archive_header()
633 633
 
@@ -637,15 +637,15 @@  discard block
 block discarded – undo
637 637
      * @param WP_Post $post_item
638 638
 	 * @return void
639 639
 	 */
640
-	function sensei_course_archive_course_title( $post_item ) {
641
-		if ( isset( $post_item->ID ) && ( 0 < $post_item->ID ) ) {
642
-			$post_id = absint( $post_item->ID );
640
+	function sensei_course_archive_course_title($post_item) {
641
+		if (isset($post_item->ID) && (0 < $post_item->ID)) {
642
+			$post_id = absint($post_item->ID);
643 643
     		$post_title = $post_item->post_title;
644 644
 		} else {
645 645
 			$post_id = get_the_ID();
646 646
     		$post_title = get_the_title();
647 647
 		} // End If Statement
648
-		?><header><h2><a href="<?php echo get_permalink( $post_id ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a></h2></header><?php
648
+		?><header><h2><a href="<?php echo get_permalink($post_id); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a></h2></header><?php
649 649
 	} // End sensei_course_archive_course_title()
650 650
 
651 651
 	/**
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 	public function sensei_lesson_archive_lesson_title() {
657 657
 		$post_id = get_the_ID();
658 658
     	$post_title = get_the_title();
659
-		?><header><h2><a href="<?php echo get_permalink( $post_id ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a></h2></header><?php
659
+		?><header><h2><a href="<?php echo get_permalink($post_id); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a></h2></header><?php
660 660
 	} // End sensei_lesson_archive_lesson_title()
661 661
 
662 662
 	/**
@@ -665,40 +665,40 @@  discard block
 block discarded – undo
665 665
 	 * @param  integer $id course, lesson or quiz id
666 666
 	 * @return void
667 667
 	 */
668
-	public function sensei_breadcrumb( $id = 0 ) {
668
+	public function sensei_breadcrumb($id = 0) {
669 669
 
670 670
 		// Only output on lesson, quiz and taxonomy (module) pages
671
-		if( ! ( is_tax( 'module' ) || is_singular( 'lesson' ) || is_singular( 'quiz' ) ) ) return;
671
+		if ( ! (is_tax('module') || is_singular('lesson') || is_singular('quiz'))) return;
672 672
 
673
-		if( empty( $id )  ){
673
+		if (empty($id)) {
674 674
 
675 675
             $id = get_the_ID();
676 676
 
677 677
         }
678 678
 
679
-		$sensei_breadcrumb_prefix = __( 'Back to: ', 'woothemes-sensei' );
680
-		$separator = apply_filters( 'sensei_breadcrumb_separator', '&gt;' );
679
+		$sensei_breadcrumb_prefix = __('Back to: ', 'woothemes-sensei');
680
+		$separator = apply_filters('sensei_breadcrumb_separator', '&gt;');
681 681
 
682
-		$html = '<section class="sensei-breadcrumb">' . $sensei_breadcrumb_prefix;
682
+		$html = '<section class="sensei-breadcrumb">'.$sensei_breadcrumb_prefix;
683 683
 		// Lesson
684
-		if ( is_singular( 'lesson' ) && 0 < intval( $id ) ) {
685
-			$course_id = intval( get_post_meta( $id, '_lesson_course', true ) );
686
-			if( ! $course_id ) {
684
+		if (is_singular('lesson') && 0 < intval($id)) {
685
+			$course_id = intval(get_post_meta($id, '_lesson_course', true));
686
+			if ( ! $course_id) {
687 687
 				return;
688 688
 			}
689
-			$html .= '<a href="' . esc_url( get_permalink( $course_id ) ) . '" title="' . __( 'Back to the course', 'woothemes-sensei' ) . '">' . get_the_title( $course_id ) . '</a>';
689
+			$html .= '<a href="'.esc_url(get_permalink($course_id)).'" title="'.__('Back to the course', 'woothemes-sensei').'">'.get_the_title($course_id).'</a>';
690 690
     	} // End If Statement
691 691
     	// Quiz
692
-		if ( is_singular( 'quiz' ) && 0 < intval( $id ) ) {
693
-			$lesson_id = intval( get_post_meta( $id, '_quiz_lesson', true ) );
694
-			if( ! $lesson_id ) {
692
+		if (is_singular('quiz') && 0 < intval($id)) {
693
+			$lesson_id = intval(get_post_meta($id, '_quiz_lesson', true));
694
+			if ( ! $lesson_id) {
695 695
 				return;
696 696
 			}
697
-			 $html .= '<a href="' . esc_url( get_permalink( $lesson_id ) ) . '" title="' .  __( 'Back to the lesson', 'woothemes-sensei' ) . '">' . get_the_title( $lesson_id ) . '</a>';
697
+			 $html .= '<a href="'.esc_url(get_permalink($lesson_id)).'" title="'.__('Back to the lesson', 'woothemes-sensei').'">'.get_the_title($lesson_id).'</a>';
698 698
     	} // End If Statement
699 699
 
700 700
     	// Allow other plugins to filter html
701
-    	$html = apply_filters ( 'sensei_breadcrumb_output', $html, $separator );
701
+    	$html = apply_filters('sensei_breadcrumb_output', $html, $separator);
702 702
     	$html .= '</section>';
703 703
 
704 704
     	echo $html;
@@ -710,25 +710,25 @@  discard block
 block discarded – undo
710 710
      */
711 711
 	public function sensei_lesson_course_signup_link( ) {
712 712
 
713
-        _deprecated_function('sensei_lesson_course_signup_link', '1.9.0', 'WooThemes_Sensei_Lesson::course_signup_link' );
713
+        _deprecated_function('sensei_lesson_course_signup_link', '1.9.0', 'WooThemes_Sensei_Lesson::course_signup_link');
714 714
         WooThemes_Sensei_Lesson::course_signup_link();
715 715
 	}
716 716
 
717
-	public function lesson_tags_display( $lesson_id = 0 ) {
718
-		if( $lesson_id ) {
719
-			$tags = wp_get_post_terms( $lesson_id, 'lesson-tag' );
720
-			if( $tags && count( $tags ) > 0 ) {
717
+	public function lesson_tags_display($lesson_id = 0) {
718
+		if ($lesson_id) {
719
+			$tags = wp_get_post_terms($lesson_id, 'lesson-tag');
720
+			if ($tags && count($tags) > 0) {
721 721
 				$tag_list = '';
722
-				foreach( $tags as $tag ) {
723
-					$tag_link = get_term_link( $tag, 'lesson-tag' );
724
-					if( ! is_wp_error( $tag_link ) ) {
725
-						if( $tag_list ) { $tag_list .= ', '; }
726
-						$tag_list .= '<a href="' . $tag_link . '">' . $tag->name . '</a>';
722
+				foreach ($tags as $tag) {
723
+					$tag_link = get_term_link($tag, 'lesson-tag');
724
+					if ( ! is_wp_error($tag_link)) {
725
+						if ($tag_list) { $tag_list .= ', '; }
726
+						$tag_list .= '<a href="'.$tag_link.'">'.$tag->name.'</a>';
727 727
 					}
728 728
 				}
729
-				if( $tag_list ) {
729
+				if ($tag_list) {
730 730
 					?><section class="lesson-tags">
731
-		    			<?php printf( __( 'Lesson tags: %1$s', 'woothemes-sensei' ), $tag_list ); ?>
731
+		    			<?php printf(__('Lesson tags: %1$s', 'woothemes-sensei'), $tag_list); ?>
732 732
 		    		</section><?php
733 733
 		    	}
734 734
 	    	}
@@ -738,51 +738,51 @@  discard block
 block discarded – undo
738 738
     /**
739 739
      * @param WP_Query $query
740 740
      */
741
-	public function lesson_tag_archive_filter( $query ) {
742
-    	if( is_tax( 'lesson-tag' ) && $query->is_main_query() ) {
741
+	public function lesson_tag_archive_filter($query) {
742
+    	if (is_tax('lesson-tag') && $query->is_main_query()) {
743 743
     		// Limit to lessons only
744
-    		$query->set( 'post_type', 'lesson' );
744
+    		$query->set('post_type', 'lesson');
745 745
 
746 746
     		// Set order of lessons
747
-    		$query->set( 'orderby', 'menu_order' );
748
-    		$query->set( 'order', 'ASC' );
747
+    		$query->set('orderby', 'menu_order');
748
+    		$query->set('order', 'ASC');
749 749
 
750 750
     	}
751 751
     }
752 752
 
753
-    public function lesson_tag_archive_header( $title ) {
754
-		if( is_tax( 'lesson-tag' ) ) {
755
-			$title = sprintf( __( 'Lesson tag: %1$s', 'woothemes-sensei' ), apply_filters( 'sensei_lesson_tag_archive_title', get_queried_object()->name ) );
753
+    public function lesson_tag_archive_header($title) {
754
+		if (is_tax('lesson-tag')) {
755
+			$title = sprintf(__('Lesson tag: %1$s', 'woothemes-sensei'), apply_filters('sensei_lesson_tag_archive_title', get_queried_object()->name));
756 756
 		}
757 757
 		return $title;
758 758
 	}
759 759
 
760 760
 	public function lesson_tag_archive_description() {
761
-		if( is_tax( 'lesson-tag' ) ) {
761
+		if (is_tax('lesson-tag')) {
762 762
 			$tag = get_queried_object();
763
-			echo '<p class="archive-description lesson-description">' . apply_filters( 'sensei_lesson_tag_archive_description', nl2br( $tag->description ), $tag->term_id ) . '</p>';
763
+			echo '<p class="archive-description lesson-description">'.apply_filters('sensei_lesson_tag_archive_description', nl2br($tag->description), $tag->term_id).'</p>';
764 764
 		}
765 765
 	}
766 766
 
767 767
 	public function sensei_complete_lesson() {
768
-		global $post,  $current_user;
768
+		global $post, $current_user;
769 769
 		// Handle Quiz Completion
770
-		if ( isset( $_POST['quiz_action'] ) && wp_verify_nonce( $_POST[ 'woothemes_sensei_complete_lesson_noonce' ], 'woothemes_sensei_complete_lesson_noonce' ) ) {
770
+		if (isset($_POST['quiz_action']) && wp_verify_nonce($_POST['woothemes_sensei_complete_lesson_noonce'], 'woothemes_sensei_complete_lesson_noonce')) {
771 771
 
772
-			$sanitized_submit = esc_html( $_POST['quiz_action'] );
772
+			$sanitized_submit = esc_html($_POST['quiz_action']);
773 773
 
774 774
 			switch ($sanitized_submit) {
775 775
                 case 'lesson-complete':
776 776
 
777
-					Sensei_Utils::sensei_start_lesson( $post->ID, $current_user->ID, $complete = true );
777
+					Sensei_Utils::sensei_start_lesson($post->ID, $current_user->ID, $complete = true);
778 778
 
779 779
 					break;
780 780
 
781 781
                 case 'lesson-reset':
782 782
 
783
-					Sensei_Utils::sensei_remove_user_from_lesson( $post->ID, $current_user->ID );
783
+					Sensei_Utils::sensei_remove_user_from_lesson($post->ID, $current_user->ID);
784 784
 
785
-					$this->messages = '<div class="sensei-message note">' .  __( 'Lesson Reset Successfully.', 'woothemes-sensei' ) . '</div>';
785
+					$this->messages = '<div class="sensei-message note">'.__('Lesson Reset Successfully.', 'woothemes-sensei').'</div>';
786 786
 					break;
787 787
 
788 788
 				default:
@@ -796,14 +796,14 @@  discard block
 block discarded – undo
796 796
 	} // End sensei_complete_lesson()
797 797
 
798 798
 	public function sensei_complete_course() {
799
-		global $post,  $current_user, $wp_query;
800
-		if ( isset( $_POST['course_complete'] ) && wp_verify_nonce( $_POST[ 'woothemes_sensei_complete_course_noonce' ], 'woothemes_sensei_complete_course_noonce' ) ) {
799
+		global $post, $current_user, $wp_query;
800
+		if (isset($_POST['course_complete']) && wp_verify_nonce($_POST['woothemes_sensei_complete_course_noonce'], 'woothemes_sensei_complete_course_noonce')) {
801 801
 
802
-			$sanitized_submit = esc_html( $_POST['course_complete'] );
803
-			$sanitized_course_id = absint( esc_html( $_POST['course_complete_id'] ) );
802
+			$sanitized_submit = esc_html($_POST['course_complete']);
803
+			$sanitized_course_id = absint(esc_html($_POST['course_complete_id']));
804 804
 			// Handle submit data
805 805
 			switch ($sanitized_submit) {
806
-				case __( 'Mark as Complete', 'woothemes-sensei' ):
806
+				case __('Mark as Complete', 'woothemes-sensei'):
807 807
 
808 808
 					// Add user to course
809 809
 					$course_metadata = array(
@@ -811,15 +811,15 @@  discard block
 block discarded – undo
811 811
 						'percent' => 0, // No completed lessons yet
812 812
 						'complete' => 0,
813 813
 					);
814
-					$activity_logged = Sensei_Utils::update_course_status( $current_user->ID, $sanitized_course_id, 'in-progress', $course_metadata );
814
+					$activity_logged = Sensei_Utils::update_course_status($current_user->ID, $sanitized_course_id, 'in-progress', $course_metadata);
815 815
 
816
-					if ( $activity_logged ) {
816
+					if ($activity_logged) {
817 817
 						// Get all course lessons
818
-						$course_lesson_ids = Sensei()->course->course_lessons( $sanitized_course_id, 'any', 'ids' );
818
+						$course_lesson_ids = Sensei()->course->course_lessons($sanitized_course_id, 'any', 'ids');
819 819
 						// Mark all quiz user meta lessons as complete
820
-						foreach ( $course_lesson_ids as $lesson_item_id ){
820
+						foreach ($course_lesson_ids as $lesson_item_id) {
821 821
 							// Mark lesson as complete
822
-							$activity_logged = Sensei_Utils::sensei_start_lesson( $lesson_item_id, $current_user->ID, $complete = true );
822
+							$activity_logged = Sensei_Utils::sensei_start_lesson($lesson_item_id, $current_user->ID, $complete = true);
823 823
 						} // End For Loop
824 824
 
825 825
 						// Update with final stats
@@ -827,22 +827,22 @@  discard block
 block discarded – undo
827 827
 							'percent' => 100,
828 828
 							'complete' => count($course_lesson_ids),
829 829
 						);
830
-						$activity_logged = Sensei_Utils::update_course_status( $current_user->ID, $sanitized_course_id, 'complete', $course_metadata );
830
+						$activity_logged = Sensei_Utils::update_course_status($current_user->ID, $sanitized_course_id, 'complete', $course_metadata);
831 831
 
832
-						do_action( 'sensei_user_course_end', $current_user->ID, $sanitized_course_id );
832
+						do_action('sensei_user_course_end', $current_user->ID, $sanitized_course_id);
833 833
 
834 834
 						// Success message
835
-						$this->messages = '<header class="archive-header"><div class="sensei-message tick">' . sprintf( __( '%1$s marked as complete.', 'woothemes-sensei' ), get_the_title( $sanitized_course_id ) ) . '</div></header>';
835
+						$this->messages = '<header class="archive-header"><div class="sensei-message tick">'.sprintf(__('%1$s marked as complete.', 'woothemes-sensei'), get_the_title($sanitized_course_id)).'</div></header>';
836 836
 					} // End If Statement
837 837
 
838 838
 					break;
839 839
 
840
-				case __( 'Delete Course', 'woothemes-sensei' ):
840
+				case __('Delete Course', 'woothemes-sensei'):
841 841
 
842
-					Sensei_Utils::sensei_remove_user_from_course( $sanitized_course_id, $current_user->ID );
842
+					Sensei_Utils::sensei_remove_user_from_course($sanitized_course_id, $current_user->ID);
843 843
 
844 844
 					// Success message
845
-					$this->messages = '<header class="archive-header"><div class="sensei-message tick">' . sprintf( __( '%1$s deleted.', 'woothemes-sensei' ), get_the_title( $sanitized_course_id ) ) . '</div></header>';
845
+					$this->messages = '<header class="archive-header"><div class="sensei-message tick">'.sprintf(__('%1$s deleted.', 'woothemes-sensei'), get_the_title($sanitized_course_id)).'</div></header>';
846 846
 					break;
847 847
 
848 848
 				default:
@@ -858,25 +858,25 @@  discard block
 block discarded – undo
858 858
 	 * @param int $lesson_id
859 859
 	 * @return array
860 860
 	 */
861
-	public function sensei_get_user_quiz_answers( $lesson_id = 0 ) {
861
+	public function sensei_get_user_quiz_answers($lesson_id = 0) {
862 862
 		global $current_user;
863 863
 
864 864
 		$user_answers = array();
865 865
 
866
-		if ( 0 < intval( $lesson_id ) ) {
867
-			$lesson_quiz_questions = Sensei()->lesson->lesson_quiz_questions( $lesson_id );
868
-			foreach( $lesson_quiz_questions as $question ) {
869
-				$answer = maybe_unserialize( base64_decode( Sensei_Utils::sensei_get_activity_value( array( 'post_id' => $question->ID, 'user_id' => $current_user->ID, 'type' => 'sensei_user_answer', 'field' => 'comment_content' ) ) ) );
870
-				$user_answers[ $question->ID ] = $answer;
866
+		if (0 < intval($lesson_id)) {
867
+			$lesson_quiz_questions = Sensei()->lesson->lesson_quiz_questions($lesson_id);
868
+			foreach ($lesson_quiz_questions as $question) {
869
+				$answer = maybe_unserialize(base64_decode(Sensei_Utils::sensei_get_activity_value(array('post_id' => $question->ID, 'user_id' => $current_user->ID, 'type' => 'sensei_user_answer', 'field' => 'comment_content'))));
870
+				$user_answers[$question->ID] = $answer;
871 871
 			}
872 872
 		}
873 873
 
874 874
 		return $user_answers;
875 875
 	} // End sensei_get_user_quiz_answers()
876 876
 
877
-	public function sensei_has_user_completed_lesson( $post_id = 0, $user_id = 0 ) {
878
-		_deprecated_function( __FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_completed_lesson()" );
879
-		return Sensei_Utils::user_completed_lesson( $post_id, $user_id );
877
+	public function sensei_has_user_completed_lesson($post_id = 0, $user_id = 0) {
878
+		_deprecated_function(__FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_completed_lesson()");
879
+		return Sensei_Utils::user_completed_lesson($post_id, $user_id);
880 880
 	} // End sensei_has_user_completed_lesson()
881 881
 
882 882
 /**
@@ -886,14 +886,14 @@  discard block
 block discarded – undo
886 886
 		Sensei()->notices->print_notices();
887 887
 	} // End sensei_frontend_messages()
888 888
 
889
-	public function sensei_lesson_video( $post_id = 0 ) {
890
-		if ( 0 < intval( $post_id ) ) {
891
-			$lesson_video_embed = get_post_meta( $post_id, '_lesson_video_embed', true );
892
-			if ( 'http' == substr( $lesson_video_embed, 0, 4) ) {
889
+	public function sensei_lesson_video($post_id = 0) {
890
+		if (0 < intval($post_id)) {
891
+			$lesson_video_embed = get_post_meta($post_id, '_lesson_video_embed', true);
892
+			if ('http' == substr($lesson_video_embed, 0, 4)) {
893 893
         		// V2 - make width and height a setting for video embed
894
-        		$lesson_video_embed = wp_oembed_get( esc_url( $lesson_video_embed )/*, array( 'width' => 100 , 'height' => 100)*/ );
894
+        		$lesson_video_embed = wp_oembed_get(esc_url($lesson_video_embed)/*, array( 'width' => 100 , 'height' => 100)*/);
895 895
         	} // End If Statement
896
-        	if ( '' != $lesson_video_embed ) {
896
+        	if ('' != $lesson_video_embed) {
897 897
         	?><div class="video"><?php echo html_entity_decode($lesson_video_embed); ?></div><?php
898 898
         	} // End If Statement
899 899
         } // End If Statement
@@ -905,19 +905,19 @@  discard block
 block discarded – undo
905 905
 		$quiz_id = 0;
906 906
 
907 907
 		// Lesson quizzes
908
-		$quiz_id = Sensei()->lesson->lesson_quizzes( $post->ID );
908
+		$quiz_id = Sensei()->lesson->lesson_quizzes($post->ID);
909 909
 		$pass_required = true;
910
-		if( $quiz_id ) {
910
+		if ($quiz_id) {
911 911
 			// Get quiz pass setting
912
-	    	$pass_required = get_post_meta( $quiz_id, '_pass_required', true );
912
+	    	$pass_required = get_post_meta($quiz_id, '_pass_required', true);
913 913
 	    }
914
-		if( ! $quiz_id || ( $quiz_id && ! $pass_required ) ) {
914
+		if ( ! $quiz_id || ($quiz_id && ! $pass_required)) {
915 915
 			?>
916
-			<form class="lesson_button_form" method="POST" action="<?php echo esc_url( get_permalink() ); ?>">
916
+			<form class="lesson_button_form" method="POST" action="<?php echo esc_url(get_permalink()); ?>">
917 917
 	            <input type="hidden"
918 918
                        name="woothemes_sensei_complete_lesson_noonce"
919 919
                        id="woothemes_sensei_complete_lesson_noonce"
920
-                       value="<?php echo esc_attr( wp_create_nonce( 'woothemes_sensei_complete_lesson_noonce' ) ); ?>"
920
+                       value="<?php echo esc_attr(wp_create_nonce('woothemes_sensei_complete_lesson_noonce')); ?>"
921 921
                 />
922 922
 
923 923
 	            <input type="hidden" name="quiz_action" value="lesson-complete" />
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
                 <input type="submit"
926 926
                        name="quiz_complete"
927 927
                        class="quiz-submit complete"
928
-                       value="<?php _e( 'Complete Lesson', 'woothemes-sensei' ); ?>"/>
928
+                       value="<?php _e('Complete Lesson', 'woothemes-sensei'); ?>"/>
929 929
 
930 930
 	        </form>
931 931
 			<?php
@@ -938,25 +938,25 @@  discard block
 block discarded – undo
938 938
 		$quiz_id = 0;
939 939
 
940 940
 		// Lesson quizzes
941
-		$quiz_id = Sensei()->lesson->lesson_quizzes( $post->ID );
941
+		$quiz_id = Sensei()->lesson->lesson_quizzes($post->ID);
942 942
 		$reset_allowed = true;
943
-		if( $quiz_id ) {
943
+		if ($quiz_id) {
944 944
 			// Get quiz pass setting
945
-			$reset_allowed = get_post_meta( $quiz_id, '_enable_quiz_reset', true );
945
+			$reset_allowed = get_post_meta($quiz_id, '_enable_quiz_reset', true);
946 946
 		}
947
-		if ( ! $quiz_id || !empty($reset_allowed) ) {
947
+		if ( ! $quiz_id || ! empty($reset_allowed)) {
948 948
 		?>
949
-		<form method="POST" action="<?php echo esc_url( get_permalink() ); ?>">
949
+		<form method="POST" action="<?php echo esc_url(get_permalink()); ?>">
950 950
 
951 951
             <input
952 952
             type="hidden"
953
-            name="<?php echo esc_attr( 'woothemes_sensei_complete_lesson_noonce' ); ?>"
954
-            id="<?php echo esc_attr( 'woothemes_sensei_complete_lesson_noonce' ); ?>"
955
-            value="<?php echo esc_attr( wp_create_nonce( 'woothemes_sensei_complete_lesson_noonce' ) ); ?>" />
953
+            name="<?php echo esc_attr('woothemes_sensei_complete_lesson_noonce'); ?>"
954
+            id="<?php echo esc_attr('woothemes_sensei_complete_lesson_noonce'); ?>"
955
+            value="<?php echo esc_attr(wp_create_nonce('woothemes_sensei_complete_lesson_noonce')); ?>" />
956 956
 
957 957
             <input type="hidden" name="quiz_action" value="lesson-reset" />
958 958
 
959
-            <input type="submit" name="quiz_complete" class="quiz-submit reset" value="<?php _e( 'Reset Lesson', 'woothemes-sensei' ); ?>"/>
959
+            <input type="submit" name="quiz_complete" class="quiz-submit reset" value="<?php _e('Reset Lesson', 'woothemes-sensei'); ?>"/>
960 960
 
961 961
         </form>
962 962
 		<?php
@@ -979,23 +979,23 @@  discard block
 block discarded – undo
979 979
 		$post_title = get_the_title();
980 980
 		$author_display_name = get_the_author();
981 981
 		$author_id = get_the_author_meta('ID');
982
-		$category_output = get_the_term_list( $post_id, 'course-category', '', ', ', '' );
983
-		$free_lesson_count = intval( Sensei()->course->course_lesson_preview_count( $post_id ) );
982
+		$category_output = get_the_term_list($post_id, 'course-category', '', ', ', '');
983
+		$free_lesson_count = intval(Sensei()->course->course_lesson_preview_count($post_id));
984 984
 		?><section class="entry">
985 985
         	<p class="sensei-course-meta">
986
-           	<?php if ( isset( Sensei()->settings->settings[ 'course_author' ] ) && ( Sensei()->settings->settings[ 'course_author' ] ) ) { ?>
987
-		   	<span class="course-author"><?php _e( 'by ', 'woothemes-sensei' ); ?><?php the_author_link(); ?></span>
986
+           	<?php if (isset(Sensei()->settings->settings['course_author']) && (Sensei()->settings->settings['course_author'])) { ?>
987
+		   	<span class="course-author"><?php _e('by ', 'woothemes-sensei'); ?><?php the_author_link(); ?></span>
988 988
 		   	<?php } // End If Statement ?>
989
-		   	<span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count( $post_id ) . '&nbsp;' . __( 'Lessons', 'woothemes-sensei' ); ?></span>
990
-		   	<?php if ( '' != $category_output ) { ?>
991
-		   	<span class="course-category"><?php echo sprintf( __( 'in %s', 'woothemes-sensei' ), $category_output ); ?></span>
989
+		   	<span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count($post_id).'&nbsp;'.__('Lessons', 'woothemes-sensei'); ?></span>
990
+		   	<?php if ('' != $category_output) { ?>
991
+		   	<span class="course-category"><?php echo sprintf(__('in %s', 'woothemes-sensei'), $category_output); ?></span>
992 992
 		   	<?php } // End If Statement ?>
993
-		   	<?php sensei_simple_course_price( $post_id ); ?>
993
+		   	<?php sensei_simple_course_price($post_id); ?>
994 994
         	</p>
995 995
         	<p class="course-excerpt"><?php the_excerpt(); ?></p>
996
-        	<?php if ( 0 < $free_lesson_count ) {
997
-                $free_lessons = sprintf( __( 'You can access %d of this course\'s lessons for free', 'woothemes-sensei' ), $free_lesson_count ); ?>
998
-                <p class="sensei-free-lessons"><a href="<?php echo get_permalink( $post_id ); ?>"><?php _e( 'Preview this course', 'woothemes-sensei' ) ?></a> - <?php echo $free_lessons; ?></p>
996
+        	<?php if (0 < $free_lesson_count) {
997
+                $free_lessons = sprintf(__('You can access %d of this course\'s lessons for free', 'woothemes-sensei'), $free_lesson_count); ?>
998
+                <p class="sensei-free-lessons"><a href="<?php echo get_permalink($post_id); ?>"><?php _e('Preview this course', 'woothemes-sensei') ?></a> - <?php echo $free_lessons; ?></p>
999 999
             <?php } ?>
1000 1000
 		</section><?php
1001 1001
 	} // End sensei_course_archive_meta()
@@ -1018,33 +1018,33 @@  discard block
 block discarded – undo
1018 1018
     * @deprecated since 1.9.0
1019 1019
     */
1020 1020
 	public function sensei_message_archive_main_content() {
1021
-		_deprecated_function( 'Sensei_Frontend::sensei_message_archive_main_content', 'This method is no longer needed' );
1021
+		_deprecated_function('Sensei_Frontend::sensei_message_archive_main_content', 'This method is no longer needed');
1022 1022
 	} // End sensei_lesson_archive_main_content()
1023 1023
 
1024 1024
     /**
1025 1025
     * @deprecated since 1.9.0
1026 1026
     */
1027 1027
 	public function sensei_no_permissions_main_content() {
1028
-        _deprecated_function( 'Sensei_Frontend::sensei_no_permissions_main_content', 'This method is no longer needed' );
1028
+        _deprecated_function('Sensei_Frontend::sensei_no_permissions_main_content', 'This method is no longer needed');
1029 1029
 	} // End sensei_no_permissions_main_content()
1030 1030
 
1031 1031
 	public function sensei_course_category_main_content() {
1032 1032
 		global $post;
1033
-		if ( have_posts() ) { ?>
1033
+		if (have_posts()) { ?>
1034 1034
 
1035 1035
 			<section id="main-course" class="course-container">
1036 1036
 
1037
-                <?php do_action( 'sensei_course_archive_header' ); ?>
1037
+                <?php do_action('sensei_course_archive_header'); ?>
1038 1038
 
1039
-                <?php while ( have_posts() ) { the_post(); ?>
1039
+                <?php while (have_posts()) { the_post(); ?>
1040 1040
 
1041
-                    <article class="<?php echo join( ' ', get_post_class( array( 'course', 'post' ), get_the_ID() ) ); ?>">
1041
+                    <article class="<?php echo join(' ', get_post_class(array('course', 'post'), get_the_ID())); ?>">
1042 1042
 
1043
-	    			    <?php do_action( 'sensei_course_image', get_the_ID() ); ?>
1043
+	    			    <?php do_action('sensei_course_image', get_the_ID()); ?>
1044 1044
 
1045
-	    			    <?php do_action( 'sensei_course_archive_course_title', $post ); ?>
1045
+	    			    <?php do_action('sensei_course_archive_course_title', $post); ?>
1046 1046
 
1047
-	    			    <?php do_action( 'sensei_course_archive_meta' ); ?>
1047
+	    			    <?php do_action('sensei_course_archive_meta'); ?>
1048 1048
 
1049 1049
 	    		    </article>
1050 1050
 
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 
1057 1057
 			<p>
1058 1058
 
1059
-                <?php _e( 'No courses found that match your selection.', 'woothemes-sensei' ); ?>
1059
+                <?php _e('No courses found that match your selection.', 'woothemes-sensei'); ?>
1060 1060
 
1061 1061
             </p>
1062 1062
 
@@ -1073,12 +1073,12 @@  discard block
 block discarded – undo
1073 1073
 				<div class="col-1">
1074 1074
 					<?php
1075 1075
 					// output the actual form markup
1076
-                    Sensei_Templates::get_template( 'user/login-form.php');
1076
+                    Sensei_Templates::get_template('user/login-form.php');
1077 1077
 					?>
1078 1078
 				</div>
1079 1079
 
1080 1080
 			<?php
1081
-			if ( get_option('users_can_register') ) {
1081
+			if (get_option('users_can_register')) {
1082 1082
 
1083 1083
 				// get current url
1084 1084
 				$action_url = get_permalink();
@@ -1086,38 +1086,38 @@  discard block
 block discarded – undo
1086 1086
 				?>
1087 1087
 
1088 1088
 				<div class="col-2">
1089
-					<h2><?php _e( 'Register', 'woothemes-sensei' ); ?></h2>
1089
+					<h2><?php _e('Register', 'woothemes-sensei'); ?></h2>
1090 1090
 
1091
-					<form method="post" class="register"  action="<?php echo esc_url( $action_url ); ?>" >
1091
+					<form method="post" class="register"  action="<?php echo esc_url($action_url); ?>" >
1092 1092
 
1093
-						<?php do_action( 'sensei_register_form_start' ); ?>
1093
+						<?php do_action('sensei_register_form_start'); ?>
1094 1094
 
1095 1095
 						<p class="form-row form-row-wide">
1096
-							<label for="sensei_reg_username"><?php _e( 'Username', 'woothemes-sensei' ); ?> <span class="required">*</span></label>
1097
-							<input type="text" class="input-text" name="sensei_reg_username" id="sensei_reg_username" value="<?php if ( ! empty( $_POST['sensei_reg_username'] ) ) esc_attr_e( $_POST['sensei_reg_username'] ); ?>" />
1096
+							<label for="sensei_reg_username"><?php _e('Username', 'woothemes-sensei'); ?> <span class="required">*</span></label>
1097
+							<input type="text" class="input-text" name="sensei_reg_username" id="sensei_reg_username" value="<?php if ( ! empty($_POST['sensei_reg_username'])) esc_attr_e($_POST['sensei_reg_username']); ?>" />
1098 1098
 						</p>
1099 1099
 
1100 1100
 						<p class="form-row form-row-wide">
1101
-							<label for="sensei_reg_email"><?php _e( 'Email address', 'woothemes-sensei' ); ?> <span class="required">*</span></label>
1102
-							<input type="email" class="input-text" name="sensei_reg_email" id="sensei_reg_email" value="<?php if ( ! empty( $_POST['sensei_reg_email'] ) ) esc_attr_e( $_POST['sensei_reg_email'] ); ?>" />
1101
+							<label for="sensei_reg_email"><?php _e('Email address', 'woothemes-sensei'); ?> <span class="required">*</span></label>
1102
+							<input type="email" class="input-text" name="sensei_reg_email" id="sensei_reg_email" value="<?php if ( ! empty($_POST['sensei_reg_email'])) esc_attr_e($_POST['sensei_reg_email']); ?>" />
1103 1103
 						</p>
1104 1104
 
1105 1105
 						<p class="form-row form-row-wide">
1106
-							<label for="sensei_reg_password"><?php _e( 'Password', 'woothemes-sensei' ); ?> <span class="required">*</span></label>
1107
-							<input type="password" class="input-text" name="sensei_reg_password" id="sensei_reg_password" value="<?php if ( ! empty( $_POST['sensei_reg_password'] ) ) esc_attr_e( $_POST['sensei_reg_password'] ); ?>" />
1106
+							<label for="sensei_reg_password"><?php _e('Password', 'woothemes-sensei'); ?> <span class="required">*</span></label>
1107
+							<input type="password" class="input-text" name="sensei_reg_password" id="sensei_reg_password" value="<?php if ( ! empty($_POST['sensei_reg_password'])) esc_attr_e($_POST['sensei_reg_password']); ?>" />
1108 1108
 						</p>
1109 1109
 
1110 1110
 						<!-- Spam Trap -->
1111
-						<div style="left:-999em; position:absolute;"><label for="trap"><?php _e( 'Anti-spam', 'woothemes-sensei' ); ?></label><input type="text" name="email_2" id="trap" tabindex="-1" /></div>
1111
+						<div style="left:-999em; position:absolute;"><label for="trap"><?php _e('Anti-spam', 'woothemes-sensei'); ?></label><input type="text" name="email_2" id="trap" tabindex="-1" /></div>
1112 1112
 
1113
-						<?php do_action( 'sensei_register_form_fields' ); ?>
1114
-						<?php do_action( 'register_form' ); ?>
1113
+						<?php do_action('sensei_register_form_fields'); ?>
1114
+						<?php do_action('register_form'); ?>
1115 1115
 
1116 1116
 						<p class="form-row">
1117
-							<input type="submit" class="button" name="register" value="<?php _e( 'Register', 'woothemes-sensei' ); ?>" />
1117
+							<input type="submit" class="button" name="register" value="<?php _e('Register', 'woothemes-sensei'); ?>" />
1118 1118
 						</p>
1119 1119
 
1120
-						<?php do_action( 'sensei_register_form_end' ); ?>
1120
+						<?php do_action('sensei_register_form_end'); ?>
1121 1121
 
1122 1122
 					</form>
1123 1123
 				</div>
@@ -1130,17 +1130,17 @@  discard block
 block discarded – undo
1130 1130
 		<?php
1131 1131
 	} // End sensei_login_form()
1132 1132
 
1133
-	public function sensei_lesson_meta( $post_id = 0 ) {
1133
+	public function sensei_lesson_meta($post_id = 0) {
1134 1134
 		global $post;
1135
-		if ( 0 < intval( $post_id ) ) {
1136
-		$lesson_course_id = absint( get_post_meta( $post_id, '_lesson_course', true ) );
1135
+		if (0 < intval($post_id)) {
1136
+		$lesson_course_id = absint(get_post_meta($post_id, '_lesson_course', true));
1137 1137
 		?><section class="entry">
1138 1138
             <p class="sensei-course-meta">
1139
-			    <?php if ( isset( Sensei()->settings->settings[ 'lesson_author' ] ) && ( Sensei()->settings->settings[ 'lesson_author' ] ) ) { ?>
1140
-			    <span class="course-author"><?php _e( 'by ', 'woothemes-sensei' ); ?><?php the_author_link(); ?></span>
1139
+			    <?php if (isset(Sensei()->settings->settings['lesson_author']) && (Sensei()->settings->settings['lesson_author'])) { ?>
1140
+			    <span class="course-author"><?php _e('by ', 'woothemes-sensei'); ?><?php the_author_link(); ?></span>
1141 1141
 			    <?php } ?>
1142
-                <?php if ( 0 < intval( $lesson_course_id ) ) { ?>
1143
-                <span class="lesson-course"><?php echo '&nbsp;' . sprintf( __( 'Part of: %s', 'woothemes-sensei' ), '<a href="' . esc_url( get_permalink( $lesson_course_id ) ) . '" title="' . __( 'View course', 'woothemes-sensei' ) . '"><em>' . get_the_title( $lesson_course_id ) . '</em></a>' ); ?></span>
1142
+                <?php if (0 < intval($lesson_course_id)) { ?>
1143
+                <span class="lesson-course"><?php echo '&nbsp;'.sprintf(__('Part of: %s', 'woothemes-sensei'), '<a href="'.esc_url(get_permalink($lesson_course_id)).'" title="'.__('View course', 'woothemes-sensei').'"><em>'.get_the_title($lesson_course_id).'</em></a>'); ?></span>
1144 1144
                 <?php } ?>
1145 1145
             </p>
1146 1146
             <p class="lesson-excerpt"><?php the_excerpt( ); ?></p>
@@ -1148,36 +1148,36 @@  discard block
 block discarded – undo
1148 1148
 		} // End If Statement
1149 1149
 	} // sensei_lesson_meta()
1150 1150
 
1151
-	public function sensei_lesson_preview_title_text( $course_id ) {
1151
+	public function sensei_lesson_preview_title_text($course_id) {
1152 1152
 
1153
-		$preview_text = __( ' (Preview)', 'woothemes-sensei' );
1153
+		$preview_text = __(' (Preview)', 'woothemes-sensei');
1154 1154
 
1155 1155
 		//if this is a paid course
1156
-		if ( Sensei_WC::is_woocommerce_active() ) {
1157
-    	    $wc_post_id = get_post_meta( $course_id, '_course_woocommerce_product', true );
1158
-    	    if ( 0 < $wc_post_id ) {
1159
-    	    	$preview_text = __( ' (Free Preview)', 'woothemes-sensei' );
1156
+		if (Sensei_WC::is_woocommerce_active()) {
1157
+    	    $wc_post_id = get_post_meta($course_id, '_course_woocommerce_product', true);
1158
+    	    if (0 < $wc_post_id) {
1159
+    	    	$preview_text = __(' (Free Preview)', 'woothemes-sensei');
1160 1160
     	    } // End If Statement
1161 1161
     	}
1162 1162
     	return $preview_text;
1163 1163
 	}
1164 1164
 
1165
-	public function sensei_lesson_preview_title( $title = '', $id = 0 ) {
1165
+	public function sensei_lesson_preview_title($title = '', $id = 0) {
1166 1166
 		global $post, $current_user;
1167 1167
 
1168 1168
 		// Limit to lessons and check if lesson ID matches filtered post ID
1169 1169
 		// @see https://github.com/woothemes/sensei/issues/574
1170
-		if( isset( $post->ID ) && $id == $post->ID && 'lesson' == get_post_type( $post ) ) {
1170
+		if (isset($post->ID) && $id == $post->ID && 'lesson' == get_post_type($post)) {
1171 1171
 
1172 1172
 			// Limit to main query only
1173
-			if( is_main_query() ) {
1173
+			if (is_main_query()) {
1174 1174
 
1175 1175
 				// Get the course ID
1176
-				$course_id = get_post_meta( $post->ID, '_lesson_course', true );
1176
+				$course_id = get_post_meta($post->ID, '_lesson_course', true);
1177 1177
 
1178 1178
 				// Check if the user is taking the course
1179
-				if( is_singular( 'lesson' ) && Sensei_Utils::is_preview_lesson( $post->ID ) && ! Sensei_Utils::user_started_course( $course_id, $current_user->ID ) && $post->ID == $id ) {
1180
-					$title .= ' ' . $this->sensei_lesson_preview_title_text( $course_id );
1179
+				if (is_singular('lesson') && Sensei_Utils::is_preview_lesson($post->ID) && ! Sensei_Utils::user_started_course($course_id, $current_user->ID) && $post->ID == $id) {
1180
+					$title .= ' '.$this->sensei_lesson_preview_title_text($course_id);
1181 1181
 				}
1182 1182
 			}
1183 1183
 		}
@@ -1188,23 +1188,23 @@  discard block
 block discarded – undo
1188 1188
 		global $post, $current_user;
1189 1189
 
1190 1190
 		// Check if the user is taking the course
1191
-		$is_user_taking_course = Sensei_Utils::user_started_course( $post->ID, $current_user->ID );
1191
+		$is_user_taking_course = Sensei_Utils::user_started_course($post->ID, $current_user->ID);
1192 1192
 		// Handle user starting the course
1193
-		if ( isset( $_POST['course_start'] )
1194
-		    && wp_verify_nonce( $_POST[ 'woothemes_sensei_start_course_noonce' ], 'woothemes_sensei_start_course_noonce' )
1195
-		    && !$is_user_taking_course ) {
1193
+		if (isset($_POST['course_start'])
1194
+		    && wp_verify_nonce($_POST['woothemes_sensei_start_course_noonce'], 'woothemes_sensei_start_course_noonce')
1195
+		    && ! $is_user_taking_course) {
1196 1196
 
1197 1197
 			// Start the course
1198
-			$activity_logged = Sensei_Utils::user_start_course( $current_user->ID, $post->ID );
1198
+			$activity_logged = Sensei_Utils::user_start_course($current_user->ID, $post->ID);
1199 1199
 			$this->data = new stdClass();
1200 1200
 			$this->data->is_user_taking_course = false;
1201
-			if ( $activity_logged ) {
1201
+			if ($activity_logged) {
1202 1202
 				$this->data->is_user_taking_course = true;
1203 1203
 
1204 1204
 				// Refresh page to avoid re-posting
1205 1205
 				?>
1206 1206
 
1207
-			    <script type="text/javascript"> window.location = '<?php echo get_permalink( $post->ID ); ?>'; </script>
1207
+			    <script type="text/javascript"> window.location = '<?php echo get_permalink($post->ID); ?>'; </script>
1208 1208
 
1209 1209
 			    <?php
1210 1210
 			} // End If Statement
@@ -1215,15 +1215,15 @@  discard block
 block discarded – undo
1215 1215
      * @deprecated since 1.9.0
1216 1216
      */
1217 1217
 	public function sensei_course_meta() {
1218
-        _deprecated_function( 'Sensei_Frontend::sensei_course_meta', '1.9.0' , 'Sensei_Course::the_course_meta()' );
1219
-        Sensei()->course->the_course_meta( get_post() );
1218
+        _deprecated_function('Sensei_Frontend::sensei_course_meta', '1.9.0', 'Sensei_Course::the_course_meta()');
1219
+        Sensei()->course->the_course_meta(get_post());
1220 1220
 	} // End sensei_course_meta()
1221 1221
 
1222 1222
     /**
1223 1223
      * @deprecated since 1.9.0
1224 1224
      */
1225 1225
 	public function sensei_course_meta_video() {
1226
-        _deprecated_function( 'Sensei_Frontend::sensei_course_meta_video', '1.9.0' , 'Sensei_Course::the_course_video()' );
1226
+        _deprecated_function('Sensei_Frontend::sensei_course_meta_video', '1.9.0', 'Sensei_Course::the_course_video()');
1227 1227
         Sensei_Course::the_course_video();
1228 1228
 	} // End sensei_course_meta_video()
1229 1229
 
@@ -1238,12 +1238,12 @@  discard block
 block discarded – undo
1238 1238
     public function sensei_woocommerce_in_cart_message() {
1239 1239
 		global $post, $woocommerce;
1240 1240
 
1241
-		$wc_post_id = absint( get_post_meta( $post->ID, '_course_woocommerce_product', true ) );
1242
-        $user_course_status_id = Sensei_Utils::user_started_course($post->ID , get_current_user_id() );
1243
-		if ( 0 < intval( $wc_post_id ) && ! $user_course_status_id ) {
1241
+		$wc_post_id = absint(get_post_meta($post->ID, '_course_woocommerce_product', true));
1242
+        $user_course_status_id = Sensei_Utils::user_started_course($post->ID, get_current_user_id());
1243
+		if (0 < intval($wc_post_id) && ! $user_course_status_id) {
1244 1244
 
1245
-			if ( Sensei_WC::is_product_in_cart( $wc_post_id ) ) {
1246
-				echo '<div class="sensei-message info">' . sprintf(  __('You have already added this Course to your cart. Please %1$s to access the course.', 'woothemes-sensei') . '</div>', '<a class="cart-complete" href="' . $woocommerce->cart->get_checkout_url() . '" title="' . __('complete the purchase', 'woothemes-sensei') . '">' . __('complete the purchase', 'woothemes-sensei') . '</a>' );
1245
+			if (Sensei_WC::is_product_in_cart($wc_post_id)) {
1246
+				echo '<div class="sensei-message info">'.sprintf(__('You have already added this Course to your cart. Please %1$s to access the course.', 'woothemes-sensei').'</div>', '<a class="cart-complete" href="'.$woocommerce->cart->get_checkout_url().'" title="'.__('complete the purchase', 'woothemes-sensei').'">'.__('complete the purchase', 'woothemes-sensei').'</a>');
1247 1247
 			} // End If Statement
1248 1248
 
1249 1249
 		} // End If Statement
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
 	} // End sensei_woocommerce_in_cart_message()
1252 1252
 
1253 1253
 	// Deprecated
1254
-	public function sensei_lesson_comment_count( $count ) {
1254
+	public function sensei_lesson_comment_count($count) {
1255 1255
 		return $count;
1256 1256
 	} // End sensei_lesson_comment_count()
1257 1257
 
@@ -1260,11 +1260,11 @@  discard block
 block discarded – undo
1260 1260
 	 * @param  string $content Original content
1261 1261
 	 * @return string          Modified content
1262 1262
 	 */
1263
-	public function sensei_search_results_excerpt( $content ) {
1263
+	public function sensei_search_results_excerpt($content) {
1264 1264
 		global $post;
1265 1265
 
1266
-		if( is_search() && in_array( $post->post_type, array( 'course', 'lesson' ) ) ) {
1267
-			$content = '<p class="course-excerpt">' . the_excerpt( ) . '</p>';
1266
+		if (is_search() && in_array($post->post_type, array('course', 'lesson'))) {
1267
+			$content = '<p class="course-excerpt">'.the_excerpt( ).'</p>';
1268 1268
 		}
1269 1269
 
1270 1270
 		return $content;
@@ -1275,11 +1275,11 @@  discard block
 block discarded – undo
1275 1275
 	 * @param  integer $order_id ID of order
1276 1276
 	 * @return void
1277 1277
 	 */
1278
-	public function remove_active_course( $order_id ) {
1279
-		$order = new WC_Order( $order_id );
1278
+	public function remove_active_course($order_id) {
1279
+		$order = new WC_Order($order_id);
1280 1280
 
1281
-		foreach ( $order->get_items() as $item ) {
1282
-			if ( isset( $item['variation_id'] ) && ( 0 < $item['variation_id'] ) ) {
1281
+		foreach ($order->get_items() as $item) {
1282
+			if (isset($item['variation_id']) && (0 < $item['variation_id'])) {
1283 1283
 				// If item has variation_id then its a variation of the product
1284 1284
 				$item_id = $item['variation_id'];
1285 1285
 			} else {
@@ -1287,11 +1287,11 @@  discard block
 block discarded – undo
1287 1287
 				$item_id = $item['product_id'];
1288 1288
 			} 
1289 1289
 
1290
-            if ( $item_id > 0 ) {
1290
+            if ($item_id > 0) {
1291 1291
 
1292
-				$user_id = get_post_meta( $order_id, '_customer_user', true );
1292
+				$user_id = get_post_meta($order_id, '_customer_user', true);
1293 1293
 
1294
-				if( $user_id ) {
1294
+				if ($user_id) {
1295 1295
 
1296 1296
 					// Get all courses for product
1297 1297
 					$args = array(
@@ -1307,13 +1307,13 @@  discard block
 block discarded – undo
1307 1307
 						'order' => 'ASC',
1308 1308
 						'fields' => 'ids',
1309 1309
 					);
1310
-					$course_ids = get_posts( $args );
1310
+					$course_ids = get_posts($args);
1311 1311
 
1312
-					if( $course_ids && count( $course_ids ) > 0 ) {
1313
-						foreach( $course_ids as $course_id ) {
1312
+					if ($course_ids && count($course_ids) > 0) {
1313
+						foreach ($course_ids as $course_id) {
1314 1314
 
1315 1315
 							// Remove all course user meta
1316
-							Sensei_Utils::sensei_remove_user_from_course( $course_id, $user_id );
1316
+							Sensei_Utils::sensei_remove_user_from_course($course_id, $user_id);
1317 1317
 
1318 1318
 						} // End For Loop
1319 1319
 					} // End If Statement
@@ -1329,16 +1329,16 @@  discard block
 block discarded – undo
1329 1329
 	 * @param  integer $user_id User ID
1330 1330
 	 * @return void
1331 1331
 	 */
1332
-	public function activate_purchased_courses( $user_id = 0 ) {
1332
+	public function activate_purchased_courses($user_id = 0) {
1333 1333
 
1334
-		if( $user_id ) {
1334
+		if ($user_id) {
1335 1335
 
1336
-			if( Sensei_WC::is_woocommerce_active() ) {
1336
+			if (Sensei_WC::is_woocommerce_active()) {
1337 1337
 
1338 1338
 				// Get all user's orders
1339 1339
 				$order_args = array(
1340 1340
 					'post_type' => 'shop_order',
1341
-					'post_status' =>  array( 'wc-processing', 'wc-completed' ),
1341
+					'post_status' =>  array('wc-processing', 'wc-completed'),
1342 1342
 					'posts_per_page' => -1,
1343 1343
 					'meta_query' => array(
1344 1344
 						array(
@@ -1348,25 +1348,25 @@  discard block
 block discarded – undo
1348 1348
 					),
1349 1349
 				);
1350 1350
 
1351
-				$orders = get_posts( $order_args );
1351
+				$orders = get_posts($order_args);
1352 1352
 
1353 1353
 				$product_ids = array();
1354 1354
 				$order_ids = array();
1355 1355
 
1356
-				foreach( $orders as $post_id ) {
1356
+				foreach ($orders as $post_id) {
1357 1357
 
1358 1358
 					// Only process each order once
1359
-					$processed = get_post_meta( $post_id, 'sensei_products_processed', true );
1359
+					$processed = get_post_meta($post_id, 'sensei_products_processed', true);
1360 1360
 
1361
-					if( $processed && $processed == 'processed' ) {
1361
+					if ($processed && $processed == 'processed') {
1362 1362
 						continue;
1363 1363
 					}
1364 1364
 
1365 1365
 					// Get course product IDs from order
1366
-					$order = new WC_Order( $post_id );
1366
+					$order = new WC_Order($post_id);
1367 1367
 
1368 1368
 					$items = $order->get_items();
1369
-					foreach( $items as $item ) {
1369
+					foreach ($items as $item) {
1370 1370
                                             if (isset($item['variation_id']) && $item['variation_id'] > 0) {
1371 1371
                                                 $item_id = $item['variation_id'];
1372 1372
                                                 $product_type = 'variation';
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
 					$order_ids[] = $post_id;
1381 1381
 				}
1382 1382
 
1383
-				if( count( $product_ids ) > 0 ) {
1383
+				if (count($product_ids) > 0) {
1384 1384
 
1385 1385
 					// Get all courses from user's orders
1386 1386
 					$course_args = array(
@@ -1397,31 +1397,31 @@  discard block
 block discarded – undo
1397 1397
 						'order' => 'ASC',
1398 1398
 						'fields' => 'ids',
1399 1399
 					);
1400
-					$course_ids = get_posts( $course_args );
1400
+					$course_ids = get_posts($course_args);
1401 1401
 
1402
-					foreach( $course_ids as $course_id ) {
1402
+					foreach ($course_ids as $course_id) {
1403 1403
 
1404
-						$user_course_status = Sensei_Utils::user_course_status( intval($course_id), $user_id );
1404
+						$user_course_status = Sensei_Utils::user_course_status(intval($course_id), $user_id);
1405 1405
 
1406 1406
 						// Ignore course if already completed
1407
-						if( Sensei_Utils::user_completed_course( $user_course_status ) ) {
1407
+						if (Sensei_Utils::user_completed_course($user_course_status)) {
1408 1408
 							continue;
1409 1409
 						}
1410 1410
 
1411 1411
 						// Ignore course if already started
1412
-						if( $user_course_status ) {
1412
+						if ($user_course_status) {
1413 1413
 							continue;
1414 1414
 						}
1415 1415
 
1416 1416
 						// Mark course as started by user
1417
-						Sensei_Utils::user_start_course( $user_id, $course_id );
1417
+						Sensei_Utils::user_start_course($user_id, $course_id);
1418 1418
 					}
1419 1419
 				}
1420 1420
 
1421
-				if( count( $order_ids ) > 0 ) {
1422
-					foreach( $order_ids as $order_id ) {
1421
+				if (count($order_ids) > 0) {
1422
+					foreach ($order_ids as $order_id) {
1423 1423
 						// Mark order as processed
1424
-						update_post_meta( $order_id, 'sensei_products_processed', 'processed' );
1424
+						update_post_meta($order_id, 'sensei_products_processed', 'processed');
1425 1425
 					}
1426 1426
 				}
1427 1427
 			}
@@ -1435,28 +1435,28 @@  discard block
 block discarded – undo
1435 1435
 	public function activate_purchased_single_course() {
1436 1436
 		global $post, $current_user;
1437 1437
 
1438
-		if( Sensei_WC::is_woocommerce_active() ) {
1438
+		if (Sensei_WC::is_woocommerce_active()) {
1439 1439
 
1440
-			if( ! is_user_logged_in() ) return;
1441
-			if( ! isset( $post->ID ) ) return;
1440
+			if ( ! is_user_logged_in()) return;
1441
+			if ( ! isset($post->ID)) return;
1442 1442
 
1443 1443
 			$user_id = $current_user->ID;
1444 1444
 			$course_id = $post->ID;
1445
-			$course_product_id = (int) get_post_meta( $course_id, '_course_woocommerce_product', true );
1446
-			if( ! $course_product_id ) {
1445
+			$course_product_id = (int) get_post_meta($course_id, '_course_woocommerce_product', true);
1446
+			if ( ! $course_product_id) {
1447 1447
 				return;
1448 1448
 			}
1449 1449
 
1450
-			$user_course_status = Sensei_Utils::user_course_status( intval($course_id), $user_id );
1450
+			$user_course_status = Sensei_Utils::user_course_status(intval($course_id), $user_id);
1451 1451
 
1452 1452
 			// Ignore course if already completed
1453
-			if( Sensei_Utils::user_completed_course( $user_course_status ) ) {
1453
+			if (Sensei_Utils::user_completed_course($user_course_status)) {
1454 1454
 
1455 1455
 				return;
1456 1456
 			}
1457 1457
 
1458 1458
 			// Ignore course if already started
1459
-			if( $user_course_status ) {
1459
+			if ($user_course_status) {
1460 1460
 				return;
1461 1461
 			}
1462 1462
 
@@ -1464,7 +1464,7 @@  discard block
 block discarded – undo
1464 1464
 			$order_args = array(
1465 1465
 				'post_type' => 'shop_order',
1466 1466
 				'posts_per_page' => -1,
1467
-				'post_status' => array( 'wc-processing', 'wc-completed' ),
1467
+				'post_status' => array('wc-processing', 'wc-completed'),
1468 1468
 				'meta_query' => array(
1469 1469
 					array(
1470 1470
 						'key' => '_customer_user',
@@ -1473,27 +1473,27 @@  discard block
 block discarded – undo
1473 1473
 				),
1474 1474
 				'fields' => 'ids',
1475 1475
 			);
1476
-			$orders = get_posts( $order_args );
1476
+			$orders = get_posts($order_args);
1477 1477
 
1478
-			foreach( $orders as $order_post_id ) {
1478
+			foreach ($orders as $order_post_id) {
1479 1479
 
1480 1480
 				// Get course product IDs from order
1481
-				$order = new WC_Order( $order_post_id );
1481
+				$order = new WC_Order($order_post_id);
1482 1482
 
1483 1483
 				$items = $order->get_items();
1484
-				foreach( $items as $item ) {
1485
-                    $product = wc_get_product( $item['product_id'] );
1484
+				foreach ($items as $item) {
1485
+                    $product = wc_get_product($item['product_id']);
1486 1486
 
1487 1487
                     // handle product bundles
1488
-                    if( $product->is_type('bundle') ){
1488
+                    if ($product->is_type('bundle')) {
1489 1489
 
1490
-                        $bundled_product = new WC_Product_Bundle( $product->id );
1490
+                        $bundled_product = new WC_Product_Bundle($product->id);
1491 1491
                         $bundled_items = $bundled_product->get_bundled_items();
1492 1492
 
1493
-                        foreach( $bundled_items as $bundled_item ){
1493
+                        foreach ($bundled_items as $bundled_item) {
1494 1494
 
1495
-                            if( $bundled_item->product_id == $course_product_id ) {
1496
-                                Sensei_Utils::user_start_course( $user_id, $course_id );
1495
+                            if ($bundled_item->product_id == $course_product_id) {
1496
+                                Sensei_Utils::user_start_course($user_id, $course_id);
1497 1497
                                 return;
1498 1498
                             }
1499 1499
 
@@ -1502,8 +1502,8 @@  discard block
 block discarded – undo
1502 1502
                     } else {
1503 1503
 
1504 1504
                     // handle regular products
1505
-                        if( $item['product_id'] == $course_product_id ) {
1506
-                            Sensei_Utils::user_start_course( $user_id, $course_id );
1505
+                        if ($item['product_id'] == $course_product_id) {
1506
+                            Sensei_Utils::user_start_course($user_id, $course_id);
1507 1507
                             return;
1508 1508
                         }
1509 1509
 
@@ -1519,9 +1519,9 @@  discard block
 block discarded – undo
1519 1519
 	 * @param  array  $args Default arguments
1520 1520
 	 * @return array        Modified arguments
1521 1521
 	 */
1522
-	public function hide_sensei_activity( $args = array() ) {
1522
+	public function hide_sensei_activity($args = array()) {
1523 1523
 
1524
-		if( is_singular( 'lesson' ) || is_singular( 'course' ) ) {
1524
+		if (is_singular('lesson') || is_singular('course')) {
1525 1525
 			$args['type'] = 'comment';
1526 1526
 		}
1527 1527
 
@@ -1538,9 +1538,9 @@  discard block
 block discarded – undo
1538 1538
 
1539 1539
 		//if not posted from the sensei login form let
1540 1540
 		// WordPress or any other party handle the failed request
1541
-	    if( ! isset( $_REQUEST['form'] ) || 'sensei-login' != $_REQUEST['form']  ){
1541
+	    if ( ! isset($_REQUEST['form']) || 'sensei-login' != $_REQUEST['form']) {
1542 1542
 
1543
-	    	return ;
1543
+	    	return;
1544 1544
 
1545 1545
 	    }
1546 1546
 
@@ -1548,9 +1548,9 @@  discard block
 block discarded – undo
1548 1548
     	$referrer = add_query_arg('login', false, $_SERVER['HTTP_REFERER']);
1549 1549
 
1550 1550
    		 // if there's a valid referrer, and it's not the default log-in screen
1551
-	    if(!empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin')){
1551
+	    if ( ! empty($referrer) && ! strstr($referrer, 'wp-login') && ! strstr($referrer, 'wp-admin')) {
1552 1552
 	        // let's append some information (login=failed) to the URL for the theme to use
1553
-	        wp_redirect( esc_url_raw( add_query_arg('login', 'failed',  $referrer) ) );
1553
+	        wp_redirect(esc_url_raw(add_query_arg('login', 'failed', $referrer)));
1554 1554
 	    	exit;
1555 1555
     	}
1556 1556
 	}// End sensei_login_fail_redirect_to_front_end_login
@@ -1564,10 +1564,10 @@  discard block
 block discarded – undo
1564 1564
 
1565 1565
 
1566 1566
 		// Check that it is a sensei login request and if it has a valid nonce
1567
-	    if(  isset( $_REQUEST['form'] ) && 'sensei-login' == $_REQUEST['form'] ) {
1567
+	    if (isset($_REQUEST['form']) && 'sensei-login' == $_REQUEST['form']) {
1568 1568
 
1569 1569
 	    	// Validate the login request nonce
1570
-		    if( !wp_verify_nonce( $_REQUEST['_wpnonce'], 'sensei-login' ) ){
1570
+		    if ( ! wp_verify_nonce($_REQUEST['_wpnonce'], 'sensei-login')) {
1571 1571
 		    	return;
1572 1572
 		    }
1573 1573
 
@@ -1576,47 +1576,47 @@  discard block
 block discarded – undo
1576 1576
 		    $referrer = $_REQUEST['_wp_http_referer'];
1577 1577
 		    //$redirect = $_REQUEST['_sensei_redirect'];
1578 1578
 
1579
-		    if ( ( isset( $_REQUEST['log'] ) && !empty( $_REQUEST['log'] ) )
1580
-		    	 && ( isset( $_REQUEST['pwd'] ) && !empty( $_REQUEST['pwd'] ) ) ){
1579
+		    if ((isset($_REQUEST['log']) && ! empty($_REQUEST['log']))
1580
+		    	 && (isset($_REQUEST['pwd']) && ! empty($_REQUEST['pwd']))) {
1581 1581
 
1582 1582
 		    	// when the user has entered a password or username do the sensei login
1583 1583
 		    	$creds = array();
1584 1584
 
1585 1585
 		    	// check if the requests login is an email address
1586
-		    	if( is_email(  trim( $_REQUEST['log'] ) )  ){
1586
+		    	if (is_email(trim($_REQUEST['log']))) {
1587 1587
 		    		// query wordpress for the users details
1588
-		    		$user =	get_user_by( 'email', sanitize_email( $_REQUEST['log'] )  );
1588
+		    		$user = get_user_by('email', sanitize_email($_REQUEST['log']));
1589 1589
 
1590 1590
 		    		// validate the user object
1591
-		    		if( !$user ){
1591
+		    		if ( ! $user) {
1592 1592
 
1593 1593
 		    			// the email doesnt exist
1594
-                        wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) );
1594
+                        wp_redirect(esc_url_raw(add_query_arg('login', 'failed', $referrer)));
1595 1595
 		        		exit;
1596 1596
 
1597 1597
 		    		}
1598 1598
 
1599 1599
 		    		//assigne the username to the creds array for further processing
1600
-		    		$creds['user_login'] =  $user->user_login ;
1600
+		    		$creds['user_login'] = $user->user_login;
1601 1601
 
1602
-		    	}else{
1602
+		    	} else {
1603 1603
 
1604 1604
 		    		// process this as a default username login
1605
-		    		$creds['user_login'] = sanitize_text_field( $_REQUEST['log'] ) ;
1605
+		    		$creds['user_login'] = sanitize_text_field($_REQUEST['log']);
1606 1606
 
1607 1607
 		    	}
1608 1608
 
1609 1609
 				// get setup the rest of the creds array
1610
-				$creds['user_password'] = sanitize_text_field( $_REQUEST['pwd'] );
1611
-				$creds['remember'] = isset( $_REQUEST['rememberme'] ) ? true : false ;
1610
+				$creds['user_password'] = sanitize_text_field($_REQUEST['pwd']);
1611
+				$creds['remember'] = isset($_REQUEST['rememberme']) ? true : false;
1612 1612
 
1613 1613
 				//attempt logging in with the given details
1614
-				$user = wp_signon( $creds, false );
1614
+				$user = wp_signon($creds, false);
1615 1615
 
1616
-				if ( is_wp_error($user) ){ // on login failure
1617
-                    wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) );
1616
+				if (is_wp_error($user)) { // on login failure
1617
+                    wp_redirect(esc_url_raw(add_query_arg('login', 'failed', $referrer)));
1618 1618
                     exit;
1619
-				}else{ // on login success
1619
+				} else { // on login success
1620 1620
 
1621 1621
 					/**
1622 1622
 					* change the redirect url programatically
@@ -1626,21 +1626,21 @@  discard block
 block discarded – undo
1626 1626
 					* @param string $referrer the page where the current url wheresensei login form was posted from
1627 1627
 					*/
1628 1628
 
1629
-					$success_redirect_url = apply_filters('sesei_login_success_redirect_url', remove_query_arg( 'login', $referrer ) );
1629
+					$success_redirect_url = apply_filters('sesei_login_success_redirect_url', remove_query_arg('login', $referrer));
1630 1630
 
1631
-					wp_redirect( esc_url_raw( $success_redirect_url ) );
1631
+					wp_redirect(esc_url_raw($success_redirect_url));
1632 1632
 		        	exit;
1633 1633
 
1634 1634
 				}	// end is_wp_error($user)
1635 1635
 
1636
-		    }else{ // if username or password is empty
1636
+		    } else { // if username or password is empty
1637 1637
 
1638
-                wp_redirect( esc_url_raw( add_query_arg('login', 'emptyfields', $referrer) ) );
1638
+                wp_redirect(esc_url_raw(add_query_arg('login', 'emptyfields', $referrer)));
1639 1639
 		        exit;
1640 1640
 
1641 1641
 		    } // end if username $_REQUEST['log']  and password $_REQUEST['pwd'] is empty
1642 1642
 
1643
-	    }elseif( ( isset( $_GET['login'] ) ) ) {
1643
+	    }elseif ((isset($_GET['login']))) {
1644 1644
 	    	// else if this request is a redircect from a previously faile login request
1645 1645
 	    	$this->login_message_process();
1646 1646
 
@@ -1659,87 +1659,87 @@  discard block
 block discarded – undo
1659 1659
 	 * @return void redirect
1660 1660
 	 *
1661 1661
 	 */
1662
-	public function sensei_process_registration(){
1662
+	public function sensei_process_registration() {
1663 1663
 		global 	 $current_user;
1664 1664
 		// check the for the sensei specific registration requests
1665
-		if( !isset( $_POST['sensei_reg_username'] ) && ! isset( $_POST['sensei_reg_email'] ) && !isset( $_POST['sensei_reg_password'] )){
1665
+		if ( ! isset($_POST['sensei_reg_username']) && ! isset($_POST['sensei_reg_email']) && ! isset($_POST['sensei_reg_password'])) {
1666 1666
 			// exit functionas this is not a sensei registration request
1667
-			return ;
1667
+			return;
1668 1668
 		}
1669 1669
 		// check for spam throw cheating huh
1670
-		if( isset( $_POST['email_2'] ) &&  '' !== $_POST['email_2']   ){
1670
+		if (isset($_POST['email_2']) && '' !== $_POST['email_2']) {
1671 1671
 			$message = 'Error:  The spam field should be empty';
1672
-			Sensei()->notices->add_notice( $message, 'alert');
1672
+			Sensei()->notices->add_notice($message, 'alert');
1673 1673
 			return;
1674 1674
 		}
1675 1675
 
1676 1676
 		// retreive form variables
1677
-		$new_user_name		= sanitize_user( $_POST['sensei_reg_username'] );
1678
-		$new_user_email		= $_POST['sensei_reg_email'];
1679
-		$new_user_password	= $_POST['sensei_reg_password'];
1677
+		$new_user_name = sanitize_user($_POST['sensei_reg_username']);
1678
+		$new_user_email = $_POST['sensei_reg_email'];
1679
+		$new_user_password = $_POST['sensei_reg_password'];
1680 1680
 
1681 1681
 		// Check the username
1682 1682
 		$username_error_notice = '';
1683
-		if ( $new_user_name == '' ) {
1684
-			$username_error_notice =  __( '<strong>ERROR</strong>: Please enter a username.' );
1685
-		} elseif ( ! validate_username( $new_user_name ) ) {
1686
-			$username_error_notice =  __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' );
1687
-		} elseif ( username_exists( $new_user_name ) ) {
1688
-			$username_error_notice =  __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' );
1683
+		if ($new_user_name == '') {
1684
+			$username_error_notice = __('<strong>ERROR</strong>: Please enter a username.');
1685
+		} elseif ( ! validate_username($new_user_name)) {
1686
+			$username_error_notice = __('<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.');
1687
+		} elseif (username_exists($new_user_name)) {
1688
+			$username_error_notice = __('<strong>ERROR</strong>: This username is already registered. Please choose another one.');
1689 1689
 		}
1690 1690
 
1691 1691
 		// exit on username error
1692
-		if( '' !== $username_error_notice ){
1693
-			Sensei()->notices->add_notice( $username_error_notice , 'alert');
1692
+		if ('' !== $username_error_notice) {
1693
+			Sensei()->notices->add_notice($username_error_notice, 'alert');
1694 1694
 			return;
1695 1695
 		}
1696 1696
 
1697 1697
 		// Check the e-mail address
1698 1698
 		$email_error_notice = '';
1699
-		if ( $new_user_email == '' ) {
1700
-			$email_error_notice = __( '<strong>ERROR</strong>: Please type your e-mail address.' );
1701
-		} elseif ( ! is_email( $new_user_email ) ) {
1702
-			$email_error_notice = __( '<strong>ERROR</strong>: The email address isn&#8217;t correct.' );
1703
-		} elseif ( email_exists( $new_user_email ) ) {
1704
-			$email_error_notice = __( '<strong>ERROR</strong>: This email is already registered, please choose another one.' );
1699
+		if ($new_user_email == '') {
1700
+			$email_error_notice = __('<strong>ERROR</strong>: Please type your e-mail address.');
1701
+		} elseif ( ! is_email($new_user_email)) {
1702
+			$email_error_notice = __('<strong>ERROR</strong>: The email address isn&#8217;t correct.');
1703
+		} elseif (email_exists($new_user_email)) {
1704
+			$email_error_notice = __('<strong>ERROR</strong>: This email is already registered, please choose another one.');
1705 1705
 		}
1706 1706
 
1707 1707
 		// exit on email address error
1708
-		if( '' !== $email_error_notice ){
1709
-			Sensei()->notices->add_notice( $email_error_notice , 'alert');
1708
+		if ('' !== $email_error_notice) {
1709
+			Sensei()->notices->add_notice($email_error_notice, 'alert');
1710 1710
 			return;
1711 1711
 		}
1712 1712
 
1713 1713
 		//check user password
1714 1714
 
1715 1715
 		// exit on email address error
1716
-		if( empty( $new_user_password ) ){
1717
-			Sensei()->notices->add_notice(  __( '<strong>ERROR</strong>: The password field may not be empty, please enter a secure password.' )  , 'alert');
1716
+		if (empty($new_user_password)) {
1717
+			Sensei()->notices->add_notice(__('<strong>ERROR</strong>: The password field may not be empty, please enter a secure password.'), 'alert');
1718 1718
 			return;
1719 1719
 		}
1720 1720
 
1721 1721
 		// register user
1722
-		$user_id = wp_create_user( $new_user_name, $new_user_password, $new_user_email );
1723
-		if ( ! $user_id || is_wp_error( $user_id ) ) {
1724
-			Sensei()->notices->add_notice( sprintf( __( '<strong>ERROR</strong>: Couldn\'t register you&hellip; please contact the <a href="mailto:%s">webmaster</a> !' ), get_option( 'admin_email' ) ), 'alert');
1722
+		$user_id = wp_create_user($new_user_name, $new_user_password, $new_user_email);
1723
+		if ( ! $user_id || is_wp_error($user_id)) {
1724
+			Sensei()->notices->add_notice(sprintf(__('<strong>ERROR</strong>: Couldn\'t register you&hellip; please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email')), 'alert');
1725 1725
 		}
1726 1726
 
1727 1727
 		// notify the user
1728
-		wp_new_user_notification( $user_id, $new_user_password );
1728
+		wp_new_user_notification($user_id, $new_user_password);
1729 1729
 
1730 1730
 		// set global current user aka log the user in
1731
-		$current_user = get_user_by( 'id', $user_id );
1732
-		wp_set_auth_cookie( $user_id, true );
1731
+		$current_user = get_user_by('id', $user_id);
1732
+		wp_set_auth_cookie($user_id, true);
1733 1733
 
1734 1734
 		// Redirect
1735 1735
 		global $wp;
1736
-		if ( wp_get_referer() ) {
1737
-			$redirect = esc_url( wp_get_referer() );
1736
+		if (wp_get_referer()) {
1737
+			$redirect = esc_url(wp_get_referer());
1738 1738
 		} else {
1739
-			$redirect = esc_url( home_url( $wp->request ) );
1739
+			$redirect = esc_url(home_url($wp->request));
1740 1740
 		}
1741 1741
 
1742
-		wp_redirect( apply_filters( 'sensei_registration_redirect', $redirect ) );
1742
+		wp_redirect(apply_filters('sensei_registration_redirect', $redirect));
1743 1743
 		exit;
1744 1744
 
1745 1745
 	} // end  sensei_process_registration)()
@@ -1750,7 +1750,7 @@  discard block
 block discarded – undo
1750 1750
 	 * @return void redirect
1751 1751
 	 * @since 1.7.0
1752 1752
 	 */
1753
-	public function login_message_process(){
1753
+	public function login_message_process() {
1754 1754
 
1755 1755
 
1756 1756
 		    // setup the message variables
@@ -1758,16 +1758,16 @@  discard block
 block discarded – undo
1758 1758
 
1759 1759
 			//only output message if the url contains login=failed and login=emptyfields
1760 1760
 
1761
-			if( $_GET['login'] == 'failed' ){
1761
+			if ($_GET['login'] == 'failed') {
1762 1762
 
1763
-				$message = __('Incorrect login details', 'woothemes-sensei' );
1763
+				$message = __('Incorrect login details', 'woothemes-sensei');
1764 1764
 
1765
-			}elseif( $_GET['login'] == 'emptyfields'  ){
1765
+			}elseif ($_GET['login'] == 'emptyfields') {
1766 1766
 
1767
-				$message= __('Please enter your username and password', 'woothemes-sensei' );
1767
+				$message = __('Please enter your username and password', 'woothemes-sensei');
1768 1768
 			}
1769 1769
 
1770
-			Sensei()->notices->add_notice( $message, 'alert');
1770
+			Sensei()->notices->add_notice($message, 'alert');
1771 1771
 
1772 1772
 	}// end login_message_process
1773 1773
 
@@ -1779,11 +1779,11 @@  discard block
 block discarded – undo
1779 1779
      * @return void redirect
1780 1780
      *
1781 1781
      */
1782
-    public function sensei_show_admin_bar () {
1782
+    public function sensei_show_admin_bar() {
1783 1783
 
1784 1784
         if (current_user_can('edit_courses')) {
1785 1785
 
1786
-            add_filter( 'woocommerce_disable_admin_bar', '__return_false', 10, 1);
1786
+            add_filter('woocommerce_disable_admin_bar', '__return_false', 10, 1);
1787 1787
 
1788 1788
         }
1789 1789
 
@@ -1796,4 +1796,4 @@  discard block
 block discarded – undo
1796 1796
  * for backward compatibility
1797 1797
  * @since 1.9.0
1798 1798
  */
1799
-class WooThemes_Sensei_Frontend extends Sensei_Frontend{}
1799
+class WooThemes_Sensei_Frontend extends Sensei_Frontend {}
Please login to merge, or discard this patch.
Braces   +30 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly
3 6
 
4 7
 /**
5 8
  * Sensei Frontend Class
@@ -668,7 +671,9 @@  discard block
 block discarded – undo
668 671
 	public function sensei_breadcrumb( $id = 0 ) {
669 672
 
670 673
 		// Only output on lesson, quiz and taxonomy (module) pages
671
-		if( ! ( is_tax( 'module' ) || is_singular( 'lesson' ) || is_singular( 'quiz' ) ) ) return;
674
+		if( ! ( is_tax( 'module' ) || is_singular( 'lesson' ) || is_singular( 'quiz' ) ) ) {
675
+			return;
676
+		}
672 677
 
673 678
 		if( empty( $id )  ){
674 679
 
@@ -1094,17 +1099,26 @@  discard block
 block discarded – undo
1094 1099
 
1095 1100
 						<p class="form-row form-row-wide">
1096 1101
 							<label for="sensei_reg_username"><?php _e( 'Username', 'woothemes-sensei' ); ?> <span class="required">*</span></label>
1097
-							<input type="text" class="input-text" name="sensei_reg_username" id="sensei_reg_username" value="<?php if ( ! empty( $_POST['sensei_reg_username'] ) ) esc_attr_e( $_POST['sensei_reg_username'] ); ?>" />
1102
+							<input type="text" class="input-text" name="sensei_reg_username" id="sensei_reg_username" value="<?php if ( ! empty( $_POST['sensei_reg_username'] ) ) {
1103
+	esc_attr_e( $_POST['sensei_reg_username'] );
1104
+}
1105
+?>" />
1098 1106
 						</p>
1099 1107
 
1100 1108
 						<p class="form-row form-row-wide">
1101 1109
 							<label for="sensei_reg_email"><?php _e( 'Email address', 'woothemes-sensei' ); ?> <span class="required">*</span></label>
1102
-							<input type="email" class="input-text" name="sensei_reg_email" id="sensei_reg_email" value="<?php if ( ! empty( $_POST['sensei_reg_email'] ) ) esc_attr_e( $_POST['sensei_reg_email'] ); ?>" />
1110
+							<input type="email" class="input-text" name="sensei_reg_email" id="sensei_reg_email" value="<?php if ( ! empty( $_POST['sensei_reg_email'] ) ) {
1111
+	esc_attr_e( $_POST['sensei_reg_email'] );
1112
+}
1113
+?>" />
1103 1114
 						</p>
1104 1115
 
1105 1116
 						<p class="form-row form-row-wide">
1106 1117
 							<label for="sensei_reg_password"><?php _e( 'Password', 'woothemes-sensei' ); ?> <span class="required">*</span></label>
1107
-							<input type="password" class="input-text" name="sensei_reg_password" id="sensei_reg_password" value="<?php if ( ! empty( $_POST['sensei_reg_password'] ) ) esc_attr_e( $_POST['sensei_reg_password'] ); ?>" />
1118
+							<input type="password" class="input-text" name="sensei_reg_password" id="sensei_reg_password" value="<?php if ( ! empty( $_POST['sensei_reg_password'] ) ) {
1119
+	esc_attr_e( $_POST['sensei_reg_password'] );
1120
+}
1121
+?>" />
1108 1122
 						</p>
1109 1123
 
1110 1124
 						<!-- Spam Trap -->
@@ -1437,8 +1451,12 @@  discard block
 block discarded – undo
1437 1451
 
1438 1452
 		if( Sensei_WC::is_woocommerce_active() ) {
1439 1453
 
1440
-			if( ! is_user_logged_in() ) return;
1441
-			if( ! isset( $post->ID ) ) return;
1454
+			if( ! is_user_logged_in() ) {
1455
+				return;
1456
+			}
1457
+			if( ! isset( $post->ID ) ) {
1458
+				return;
1459
+			}
1442 1460
 
1443 1461
 			$user_id = $current_user->ID;
1444 1462
 			$course_id = $post->ID;
@@ -1599,7 +1617,7 @@  discard block
 block discarded – undo
1599 1617
 		    		//assigne the username to the creds array for further processing
1600 1618
 		    		$creds['user_login'] =  $user->user_login ;
1601 1619
 
1602
-		    	}else{
1620
+		    	} else{
1603 1621
 
1604 1622
 		    		// process this as a default username login
1605 1623
 		    		$creds['user_login'] = sanitize_text_field( $_REQUEST['log'] ) ;
@@ -1616,7 +1634,7 @@  discard block
 block discarded – undo
1616 1634
 				if ( is_wp_error($user) ){ // on login failure
1617 1635
                     wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) );
1618 1636
                     exit;
1619
-				}else{ // on login success
1637
+				} else{ // on login success
1620 1638
 
1621 1639
 					/**
1622 1640
 					* change the redirect url programatically
@@ -1633,14 +1651,14 @@  discard block
 block discarded – undo
1633 1651
 
1634 1652
 				}	// end is_wp_error($user)
1635 1653
 
1636
-		    }else{ // if username or password is empty
1654
+		    } else{ // if username or password is empty
1637 1655
 
1638 1656
                 wp_redirect( esc_url_raw( add_query_arg('login', 'emptyfields', $referrer) ) );
1639 1657
 		        exit;
1640 1658
 
1641 1659
 		    } // end if username $_REQUEST['log']  and password $_REQUEST['pwd'] is empty
1642 1660
 
1643
-	    }elseif( ( isset( $_GET['login'] ) ) ) {
1661
+	    } elseif( ( isset( $_GET['login'] ) ) ) {
1644 1662
 	    	// else if this request is a redircect from a previously faile login request
1645 1663
 	    	$this->login_message_process();
1646 1664
 
@@ -1762,7 +1780,7 @@  discard block
 block discarded – undo
1762 1780
 
1763 1781
 				$message = __('Incorrect login details', 'woothemes-sensei' );
1764 1782
 
1765
-			}elseif( $_GET['login'] == 'emptyfields'  ){
1783
+			} elseif( $_GET['login'] == 'emptyfields'  ){
1766 1784
 
1767 1785
 				$message= __('Please enter your username and password', 'woothemes-sensei' );
1768 1786
 			}
Please login to merge, or discard this patch.