@@ -5,18 +5,18 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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,70 +248,70 @@ discard block |
||
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 | - if( !empty( $modules ) ){ |
|
254 | - foreach( (array) $modules as $module ) { |
|
255 | - |
|
256 | - $args = array( |
|
257 | - 'post_type' => 'lesson', |
|
258 | - 'post_status' => 'publish', |
|
259 | - 'posts_per_page' => -1, |
|
260 | - 'meta_query' => array( |
|
261 | - array( |
|
262 | - 'key' => '_lesson_course', |
|
263 | - 'value' => intval( $lesson_course_id ), |
|
264 | - 'compare' => '=' |
|
265 | - ) |
|
266 | - ), |
|
267 | - 'tax_query' => array( |
|
268 | - array( |
|
269 | - 'taxonomy' => Sensei()->modules->taxonomy, |
|
270 | - 'field' => 'id', |
|
271 | - 'terms' => intval( $module->term_id ) |
|
272 | - ) |
|
273 | - ), |
|
274 | - 'meta_key' => '_order_module_' . $module->term_id, |
|
275 | - 'orderby' => 'meta_value_num date', |
|
276 | - 'order' => 'ASC', |
|
277 | - 'suppress_filters' => 0 |
|
278 | - ); |
|
279 | - |
|
280 | - $lessons = get_posts( $args ); |
|
281 | - if ( 0 < count( $lessons ) ) { |
|
282 | - foreach ($lessons as $lesson_item){ |
|
283 | - $all_lessons[] = $lesson_item->ID; |
|
284 | - } // End For Loop |
|
285 | - } // End If Statement |
|
286 | - |
|
287 | - }//end for each |
|
288 | - |
|
289 | - }// end if empty modules |
|
290 | - |
|
291 | - $args = array( |
|
292 | - 'post_type' => 'lesson', |
|
293 | - 'posts_per_page' => -1, |
|
294 | - 'suppress_filters' => 0, |
|
295 | - 'meta_key' => '_order_' . $lesson_course_id, |
|
296 | - 'orderby' => 'meta_value_num date', |
|
297 | - 'order' => 'ASC', |
|
298 | - 'meta_query' => array( |
|
299 | - array( |
|
300 | - 'key' => '_lesson_course', |
|
301 | - 'value' => intval( $lesson_course_id ), |
|
302 | - ), |
|
303 | - ), |
|
304 | - 'post__not_in' => $all_lessons, |
|
305 | - ); |
|
306 | - |
|
307 | - $other_lessons = get_posts( $args ); |
|
308 | - if ( 0 < count( $other_lessons ) ) { |
|
251 | + $modules = Sensei()->modules->get_course_modules( intval( $lesson_course_id ) ); |
|
252 | + |
|
253 | + if( !empty( $modules ) ){ |
|
254 | + foreach( (array) $modules as $module ) { |
|
255 | + |
|
256 | + $args = array( |
|
257 | + 'post_type' => 'lesson', |
|
258 | + 'post_status' => 'publish', |
|
259 | + 'posts_per_page' => -1, |
|
260 | + 'meta_query' => array( |
|
261 | + array( |
|
262 | + 'key' => '_lesson_course', |
|
263 | + 'value' => intval( $lesson_course_id ), |
|
264 | + 'compare' => '=' |
|
265 | + ) |
|
266 | + ), |
|
267 | + 'tax_query' => array( |
|
268 | + array( |
|
269 | + 'taxonomy' => Sensei()->modules->taxonomy, |
|
270 | + 'field' => 'id', |
|
271 | + 'terms' => intval( $module->term_id ) |
|
272 | + ) |
|
273 | + ), |
|
274 | + 'meta_key' => '_order_module_' . $module->term_id, |
|
275 | + 'orderby' => 'meta_value_num date', |
|
276 | + 'order' => 'ASC', |
|
277 | + 'suppress_filters' => 0 |
|
278 | + ); |
|
279 | + |
|
280 | + $lessons = get_posts( $args ); |
|
281 | + if ( 0 < count( $lessons ) ) { |
|
282 | + foreach ($lessons as $lesson_item){ |
|
283 | + $all_lessons[] = $lesson_item->ID; |
|
284 | + } // End For Loop |
|
285 | + } // End If Statement |
|
286 | + |
|
287 | + }//end for each |
|
288 | + |
|
289 | + }// end if empty modules |
|
290 | + |
|
291 | + $args = array( |
|
292 | + 'post_type' => 'lesson', |
|
293 | + 'posts_per_page' => -1, |
|
294 | + 'suppress_filters' => 0, |
|
295 | + 'meta_key' => '_order_' . $lesson_course_id, |
|
296 | + 'orderby' => 'meta_value_num date', |
|
297 | + 'order' => 'ASC', |
|
298 | + 'meta_query' => array( |
|
299 | + array( |
|
300 | + 'key' => '_lesson_course', |
|
301 | + 'value' => intval( $lesson_course_id ), |
|
302 | + ), |
|
303 | + ), |
|
304 | + 'post__not_in' => $all_lessons, |
|
305 | + ); |
|
306 | + |
|
307 | + $other_lessons = get_posts( $args ); |
|
308 | + if ( 0 < count( $other_lessons ) ) { |
|
309 | 309 | foreach ($other_lessons as $lesson_item){ |
310 | 310 | $all_lessons[] = $lesson_item->ID; |
311 | 311 | } // End For Loop |
312 | 312 | } // End If Statement |
313 | 313 | |
314 | - if ( 0 < count( $all_lessons ) ) { |
|
314 | + if ( 0 < count( $all_lessons ) ) { |
|
315 | 315 | $found_index = false; |
316 | 316 | foreach ( $all_lessons as $lesson ){ |
317 | 317 | if ( $found_index && $return_values['next_lesson'] == 0 ) { |
@@ -342,9 +342,9 @@ discard block |
||
342 | 342 | */ |
343 | 343 | function sensei_get_excerpt( $post_id = '' ) { |
344 | 344 | |
345 | - global $post; |
|
346 | - _deprecated_function('sensei_get_excerpt', 'use the wordpress excerpt functionality.'); |
|
347 | - return get_the_excerpt(); |
|
345 | + global $post; |
|
346 | + _deprecated_function('sensei_get_excerpt', 'use the wordpress excerpt functionality.'); |
|
347 | + return get_the_excerpt(); |
|
348 | 348 | |
349 | 349 | } |
350 | 350 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | */ |
370 | 370 | function sensei_has_user_completed_prerequisite_lesson( $current_lesson_id, $user_id ) { |
371 | 371 | |
372 | - return WooThemes_Sensei_Lesson::is_pre_requisite_complete( $current_lesson_id, $user_id ); |
|
372 | + return WooThemes_Sensei_Lesson::is_pre_requisite_complete( $current_lesson_id, $user_id ); |
|
373 | 373 | |
374 | 374 | } // End sensei_has_user_completed_prerequisite_lesson() |
375 | 375 | |
@@ -484,27 +484,27 @@ discard block |
||
484 | 484 | |
485 | 485 | }else{ |
486 | 486 | |
487 | - // if the loop has not been initiated check the first module has lessons |
|
488 | - if( -1 == $sensei_modules_loop[ 'current' ] ){ |
|
487 | + // if the loop has not been initiated check the first module has lessons |
|
488 | + if( -1 == $sensei_modules_loop[ 'current' ] ){ |
|
489 | 489 | |
490 | - $index = 0; |
|
490 | + $index = 0; |
|
491 | 491 | |
492 | - if( isset( $sensei_modules_loop['modules'][ $index ] ) ) { |
|
493 | - // setup the query for the module lessons |
|
494 | - $course_id = $sensei_modules_loop['course_id']; |
|
492 | + if( isset( $sensei_modules_loop['modules'][ $index ] ) ) { |
|
493 | + // setup the query for the module lessons |
|
494 | + $course_id = $sensei_modules_loop['course_id']; |
|
495 | 495 | |
496 | - $module_term_id = $sensei_modules_loop['modules'][ $index ] ->term_id; |
|
497 | - $modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id ); |
|
496 | + $module_term_id = $sensei_modules_loop['modules'][ $index ] ->term_id; |
|
497 | + $modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id ); |
|
498 | 498 | |
499 | - // setup the global wp-query only if the lessons |
|
500 | - if( $modules_query->have_posts() ){ |
|
499 | + // setup the global wp-query only if the lessons |
|
500 | + if( $modules_query->have_posts() ){ |
|
501 | 501 | |
502 | - return true; |
|
502 | + return true; |
|
503 | 503 | |
504 | - } |
|
505 | - } |
|
506 | - } |
|
507 | - // default to false if the first module doesn't have posts |
|
504 | + } |
|
505 | + } |
|
506 | + } |
|
507 | + // default to false if the first module doesn't have posts |
|
508 | 508 | return false; |
509 | 509 | |
510 | 510 | } |
@@ -612,46 +612,46 @@ discard block |
||
612 | 612 | return ''; |
613 | 613 | } |
614 | 614 | |
615 | - global $sensei_modules_loop; |
|
616 | - $module_title = $sensei_modules_loop['current_module']->name; |
|
617 | - $module_term_id = $sensei_modules_loop['current_module']->term_id; |
|
618 | - $course_id = $sensei_modules_loop['course_id']; |
|
619 | - $module_progress = Sensei()->modules->get_user_module_progress( $module_term_id, $course_id, get_current_user_id() ); |
|
615 | + global $sensei_modules_loop; |
|
616 | + $module_title = $sensei_modules_loop['current_module']->name; |
|
617 | + $module_term_id = $sensei_modules_loop['current_module']->term_id; |
|
618 | + $course_id = $sensei_modules_loop['course_id']; |
|
619 | + $module_progress = Sensei()->modules->get_user_module_progress( $module_term_id, $course_id, get_current_user_id() ); |
|
620 | 620 | |
621 | - $module_status = ''; |
|
622 | - if ( $module_progress && $module_progress > 0) { |
|
621 | + $module_status = ''; |
|
622 | + if ( $module_progress && $module_progress > 0) { |
|
623 | 623 | |
624 | - $module_status = __('Completed', 'woothemes-sensei'); |
|
624 | + $module_status = __('Completed', 'woothemes-sensei'); |
|
625 | 625 | |
626 | - if ($module_progress < 100) { |
|
626 | + if ($module_progress < 100) { |
|
627 | 627 | |
628 | - $module_status = __('In progress', 'woothemes-sensei'); |
|
628 | + $module_status = __('In progress', 'woothemes-sensei'); |
|
629 | 629 | |
630 | - } |
|
630 | + } |
|
631 | 631 | |
632 | - } |
|
632 | + } |
|
633 | 633 | |
634 | 634 | if ( empty( $module_status ) ){ |
635 | 635 | return ''; |
636 | 636 | } |
637 | 637 | |
638 | 638 | $status_class = strtolower( str_replace( ' ', '-', $module_status ) ); |
639 | - $module_status_html = '<p class="status module-status ' . $status_class . '">' |
|
640 | - . $module_status |
|
641 | - . '</p>'; |
|
642 | - |
|
643 | - /** |
|
644 | - * Filter the module status. |
|
645 | - * |
|
646 | - * This fires within the sensei_get_the_module_status function. |
|
647 | - * |
|
648 | - * @since 1.9.0 |
|
649 | - * |
|
650 | - * @param $module_status_html |
|
651 | - * @param $module_term_id |
|
652 | - * @param $course_id |
|
653 | - */ |
|
654 | - return apply_filters( 'sensei_the_module_status_html', $module_status_html , $module_term_id, $course_id ); |
|
639 | + $module_status_html = '<p class="status module-status ' . $status_class . '">' |
|
640 | + . $module_status |
|
641 | + . '</p>'; |
|
642 | + |
|
643 | + /** |
|
644 | + * Filter the module status. |
|
645 | + * |
|
646 | + * This fires within the sensei_get_the_module_status function. |
|
647 | + * |
|
648 | + * @since 1.9.0 |
|
649 | + * |
|
650 | + * @param $module_status_html |
|
651 | + * @param $module_term_id |
|
652 | + * @param $course_id |
|
653 | + */ |
|
654 | + return apply_filters( 'sensei_the_module_status_html', $module_status_html , $module_term_id, $course_id ); |
|
655 | 655 | |
656 | 656 | } |
657 | 657 | |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | */ |
662 | 662 | function sensei_the_module_status(){ |
663 | 663 | |
664 | - echo sensei_get_the_module_status(); |
|
664 | + echo sensei_get_the_module_status(); |
|
665 | 665 | |
666 | 666 | } |
667 | 667 | |
@@ -682,21 +682,21 @@ discard block |
||
682 | 682 | */ |
683 | 683 | function sensei_quiz_has_questions(){ |
684 | 684 | |
685 | - global $sensei_question_loop; |
|
685 | + global $sensei_question_loop; |
|
686 | 686 | |
687 | - if( !isset( $sensei_question_loop['total'] ) ){ |
|
688 | - return false; |
|
689 | - } |
|
687 | + if( !isset( $sensei_question_loop['total'] ) ){ |
|
688 | + return false; |
|
689 | + } |
|
690 | 690 | |
691 | - if( $sensei_question_loop['current'] + 1 < $sensei_question_loop['total'] ){ |
|
691 | + if( $sensei_question_loop['current'] + 1 < $sensei_question_loop['total'] ){ |
|
692 | 692 | |
693 | - return true; |
|
693 | + return true; |
|
694 | 694 | |
695 | - }else{ |
|
695 | + }else{ |
|
696 | 696 | |
697 | - return false; |
|
697 | + return false; |
|
698 | 698 | |
699 | - } |
|
699 | + } |
|
700 | 700 | |
701 | 701 | }// end sensei_quiz_has_questions |
702 | 702 | |
@@ -707,15 +707,14 @@ discard block |
||
707 | 707 | * execution. |
708 | 708 | * |
709 | 709 | * @since 1.9.0 |
710 | - |
|
711 | 710 | */ |
712 | 711 | function sensei_setup_the_question(){ |
713 | 712 | |
714 | - global $sensei_question_loop; |
|
713 | + global $sensei_question_loop; |
|
715 | 714 | |
716 | - $sensei_question_loop['current']++; |
|
717 | - $index = $sensei_question_loop['current']; |
|
718 | - $sensei_question_loop['current_question'] = $sensei_question_loop['questions'][ $index ] ; |
|
715 | + $sensei_question_loop['current']++; |
|
716 | + $index = $sensei_question_loop['current']; |
|
717 | + $sensei_question_loop['current_question'] = $sensei_question_loop['questions'][ $index ] ; |
|
719 | 718 | |
720 | 719 | |
721 | 720 | }// end sensei_setup_the_question |
@@ -728,12 +727,12 @@ discard block |
||
728 | 727 | */ |
729 | 728 | function sensei_the_question_content(){ |
730 | 729 | |
731 | - global $sensei_question_loop; |
|
730 | + global $sensei_question_loop; |
|
732 | 731 | |
733 | - $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID ); |
|
732 | + $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID ); |
|
734 | 733 | |
735 | - // load the template that displays the question information. |
|
736 | - WooThemes_Sensei_Question::load_question_template( $question_type ); |
|
734 | + // load the template that displays the question information. |
|
735 | + WooThemes_Sensei_Question::load_question_template( $question_type ); |
|
737 | 736 | |
738 | 737 | }// end sensei_the_question_content |
739 | 738 | |
@@ -744,26 +743,26 @@ discard block |
||
744 | 743 | */ |
745 | 744 | function sensei_the_question_class(){ |
746 | 745 | |
747 | - global $sensei_question_loop; |
|
746 | + global $sensei_question_loop; |
|
748 | 747 | |
749 | - $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID ); |
|
748 | + $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID ); |
|
750 | 749 | |
751 | - /** |
|
752 | - * filter the sensei question class within |
|
753 | - * the quiz question loop. |
|
754 | - * |
|
755 | - * @since 1.9.0 |
|
756 | - */ |
|
757 | - $classes = apply_filters( 'sensei_question_classes', array( $question_type ) ); |
|
750 | + /** |
|
751 | + * filter the sensei question class within |
|
752 | + * the quiz question loop. |
|
753 | + * |
|
754 | + * @since 1.9.0 |
|
755 | + */ |
|
756 | + $classes = apply_filters( 'sensei_question_classes', array( $question_type ) ); |
|
758 | 757 | |
759 | - $html_classes = ''; |
|
760 | - foreach( $classes as $class ){ |
|
758 | + $html_classes = ''; |
|
759 | + foreach( $classes as $class ){ |
|
761 | 760 | |
762 | - $html_classes .= $class . ' '; |
|
761 | + $html_classes .= $class . ' '; |
|
763 | 762 | |
764 | - }// end foreach |
|
763 | + }// end foreach |
|
765 | 764 | |
766 | - esc_attr_e( trim( $html_classes ) ); |
|
765 | + esc_attr_e( trim( $html_classes ) ); |
|
767 | 766 | |
768 | 767 | } |
769 | 768 | |
@@ -774,12 +773,12 @@ discard block |
||
774 | 773 | */ |
775 | 774 | function sensei_get_the_question_id( ){ |
776 | 775 | |
777 | - global $sensei_question_loop; |
|
778 | - if( isset( $sensei_question_loop['current_question']->ID ) ){ |
|
776 | + global $sensei_question_loop; |
|
777 | + if( isset( $sensei_question_loop['current_question']->ID ) ){ |
|
779 | 778 | |
780 | - return $sensei_question_loop['current_question']->ID; |
|
779 | + return $sensei_question_loop['current_question']->ID; |
|
781 | 780 | |
782 | - } |
|
781 | + } |
|
783 | 782 | |
784 | 783 | }// end sensei_the_question_id |
785 | 784 | |
@@ -806,63 +805,63 @@ discard block |
||
806 | 805 | */ |
807 | 806 | function sensei_can_user_view_lesson( $lesson_id = '', $user_id = '' ){ |
808 | 807 | |
809 | - if( empty( $lesson_id ) ){ |
|
808 | + if( empty( $lesson_id ) ){ |
|
810 | 809 | |
811 | - $lesson_id = get_the_ID(); |
|
810 | + $lesson_id = get_the_ID(); |
|
812 | 811 | |
813 | - } |
|
812 | + } |
|
814 | 813 | |
815 | - if( empty( $user_id ) ){ |
|
814 | + if( empty( $user_id ) ){ |
|
816 | 815 | |
817 | - $user_id = get_current_user_id(); |
|
816 | + $user_id = get_current_user_id(); |
|
818 | 817 | |
819 | - } |
|
818 | + } |
|
820 | 819 | |
821 | - // Check for prerequisite lesson completions |
|
822 | - $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete( $lesson_id, $user_id ); |
|
823 | - $lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true ); |
|
824 | - $user_taking_course = Sensei_Utils::user_started_course( $lesson_course_id, $user_id ); |
|
820 | + // Check for prerequisite lesson completions |
|
821 | + $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete( $lesson_id, $user_id ); |
|
822 | + $lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true ); |
|
823 | + $user_taking_course = Sensei_Utils::user_started_course( $lesson_course_id, $user_id ); |
|
825 | 824 | |
826 | - $is_preview = false; |
|
827 | - if( Sensei_Utils::is_preview_lesson( $lesson_id ) ) { |
|
825 | + $is_preview = false; |
|
826 | + if( Sensei_Utils::is_preview_lesson( $lesson_id ) ) { |
|
828 | 827 | |
829 | - $is_preview = true; |
|
830 | - $pre_requisite_complete = true; |
|
828 | + $is_preview = true; |
|
829 | + $pre_requisite_complete = true; |
|
831 | 830 | |
832 | - }; |
|
831 | + }; |
|
833 | 832 | |
834 | 833 | |
835 | - $user_can_access_lesson = false; |
|
834 | + $user_can_access_lesson = false; |
|
836 | 835 | |
837 | - if( is_user_logged_in() && $user_taking_course ){ |
|
836 | + if( is_user_logged_in() && $user_taking_course ){ |
|
838 | 837 | |
839 | - $user_can_access_lesson = true; |
|
838 | + $user_can_access_lesson = true; |
|
840 | 839 | |
841 | - } |
|
840 | + } |
|
842 | 841 | |
843 | 842 | |
844 | - $access_permission = false; |
|
843 | + $access_permission = false; |
|
845 | 844 | |
846 | - if ( ! Sensei()->settings->get('access_permission') || sensei_all_access() ) { |
|
845 | + if ( ! Sensei()->settings->get('access_permission') || sensei_all_access() ) { |
|
847 | 846 | |
848 | - $access_permission = true; |
|
847 | + $access_permission = true; |
|
849 | 848 | |
850 | - } |
|
849 | + } |
|
851 | 850 | |
852 | - $can_user_view_lesson = $access_permission || ( $user_can_access_lesson && $pre_requisite_complete ) || $is_preview; |
|
851 | + $can_user_view_lesson = $access_permission || ( $user_can_access_lesson && $pre_requisite_complete ) || $is_preview; |
|
853 | 852 | |
854 | - /** |
|
855 | - * Filter the can user view lesson function |
|
856 | - * |
|
857 | - * @since 1.9.0 |
|
858 | - * |
|
859 | - * @hooked Sensei_WC::alter_can_user_view_lesson |
|
860 | - * |
|
861 | - * @param bool $can_user_view_lesson |
|
862 | - * @param string $lesson_id |
|
863 | - * @param string $user_id |
|
864 | - */ |
|
865 | - return apply_filters( 'sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id ); |
|
853 | + /** |
|
854 | + * Filter the can user view lesson function |
|
855 | + * |
|
856 | + * @since 1.9.0 |
|
857 | + * |
|
858 | + * @hooked Sensei_WC::alter_can_user_view_lesson |
|
859 | + * |
|
860 | + * @param bool $can_user_view_lesson |
|
861 | + * @param string $lesson_id |
|
862 | + * @param string $user_id |
|
863 | + */ |
|
864 | + return apply_filters( 'sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id ); |
|
866 | 865 | |
867 | 866 | } // end sensei_can_current_user_view_lesson |
868 | 867 | |
@@ -874,49 +873,49 @@ discard block |
||
874 | 873 | */ |
875 | 874 | function sensei_the_single_lesson_meta(){ |
876 | 875 | |
877 | - // if the lesson meta is included within theme load that instead of the function content |
|
878 | - $template = Sensei_Templates::locate_template( 'single-lesson/lesson-meta.php' ); |
|
879 | - if( ! empty( $template ) ){ |
|
876 | + // if the lesson meta is included within theme load that instead of the function content |
|
877 | + $template = Sensei_Templates::locate_template( 'single-lesson/lesson-meta.php' ); |
|
878 | + if( ! empty( $template ) ){ |
|
880 | 879 | |
881 | - Sensei_Templates::get_template( 'single-lesson/lesson-meta.php' ); |
|
882 | - return; |
|
880 | + Sensei_Templates::get_template( 'single-lesson/lesson-meta.php' ); |
|
881 | + return; |
|
883 | 882 | |
884 | - } |
|
885 | - |
|
886 | - // Get the meta info |
|
887 | - $lesson_course_id = absint( get_post_meta( get_the_ID(), '_lesson_course', true ) ); |
|
888 | - $is_preview = Sensei_Utils::is_preview_lesson( get_the_ID() ); |
|
883 | + } |
|
889 | 884 | |
890 | - // Complete Lesson Logic |
|
891 | - do_action( 'sensei_complete_lesson' ); |
|
892 | - // Check that the course has been started |
|
893 | - if ( Sensei()->access_settings() |
|
894 | - || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) |
|
895 | - || $is_preview ) { |
|
896 | - ?> |
|
885 | + // Get the meta info |
|
886 | + $lesson_course_id = absint( get_post_meta( get_the_ID(), '_lesson_course', true ) ); |
|
887 | + $is_preview = Sensei_Utils::is_preview_lesson( get_the_ID() ); |
|
888 | + |
|
889 | + // Complete Lesson Logic |
|
890 | + do_action( 'sensei_complete_lesson' ); |
|
891 | + // Check that the course has been started |
|
892 | + if ( Sensei()->access_settings() |
|
893 | + || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) |
|
894 | + || $is_preview ) { |
|
895 | + ?> |
|
897 | 896 | <section class="lesson-meta"> |
898 | 897 | <?php |
899 | - if( apply_filters( 'sensei_video_position', 'top', get_the_ID() ) == 'bottom' ) { |
|
898 | + if( apply_filters( 'sensei_video_position', 'top', get_the_ID() ) == 'bottom' ) { |
|
900 | 899 | |
901 | - do_action( 'sensei_lesson_video', get_the_ID() ); |
|
900 | + do_action( 'sensei_lesson_video', get_the_ID() ); |
|
902 | 901 | |
903 | - } |
|
904 | - ?> |
|
902 | + } |
|
903 | + ?> |
|
905 | 904 | <?php do_action( 'sensei_frontend_messages' ); ?> |
906 | 905 | |
907 | 906 | <?php if ( ! $is_preview |
908 | - || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) ) { |
|
907 | + || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) ) { |
|
909 | 908 | |
910 | - 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() ) ); |
|
909 | + 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() ) ); |
|
911 | 910 | |
912 | - } ?> |
|
911 | + } ?> |
|
913 | 912 | </section> |
914 | 913 | |
915 | 914 | <?php do_action( 'sensei_lesson_back_link', $lesson_course_id ); ?> |
916 | 915 | |
917 | 916 | <?php } |
918 | 917 | |
919 | - do_action( 'sensei_lesson_meta_extra', get_the_ID() ); |
|
918 | + do_action( 'sensei_lesson_meta_extra', get_the_ID() ); |
|
920 | 919 | |
921 | 920 | } // end the_single_lesson_meta |
922 | 921 | |
@@ -932,16 +931,16 @@ discard block |
||
932 | 931 | */ |
933 | 932 | function get_sensei_header(){ |
934 | 933 | |
935 | - if ( ! defined( 'ABSPATH' ) ) exit; |
|
934 | + if ( ! defined( 'ABSPATH' ) ) exit; |
|
936 | 935 | |
937 | - get_header(); |
|
936 | + get_header(); |
|
938 | 937 | |
939 | - /** |
|
940 | - * sensei_before_main_content hook |
|
941 | - * |
|
942 | - * @hooked sensei_output_content_wrapper - 10 (outputs opening divs for the content) |
|
943 | - */ |
|
944 | - do_action( 'sensei_before_main_content' ); |
|
938 | + /** |
|
939 | + * sensei_before_main_content hook |
|
940 | + * |
|
941 | + * @hooked sensei_output_content_wrapper - 10 (outputs opening divs for the content) |
|
942 | + */ |
|
943 | + do_action( 'sensei_before_main_content' ); |
|
945 | 944 | |
946 | 945 | }// end get_sensei_header |
947 | 946 | |
@@ -957,28 +956,28 @@ discard block |
||
957 | 956 | */ |
958 | 957 | function get_sensei_footer(){ |
959 | 958 | |
960 | - /** |
|
961 | - * sensei_pagination hook |
|
962 | - * |
|
963 | - * @hooked sensei_pagination - 10 (outputs pagination) |
|
964 | - */ |
|
965 | - do_action( 'sensei_pagination' ); |
|
966 | - |
|
967 | - /** |
|
968 | - * sensei_after_main_content hook |
|
969 | - * |
|
970 | - * @hooked sensei_output_content_wrapper_end - 10 (outputs closing divs for the content) |
|
971 | - */ |
|
972 | - do_action( 'sensei_after_main_content' ); |
|
973 | - |
|
974 | - /** |
|
975 | - * sensei_sidebar hook |
|
976 | - * |
|
977 | - * @hooked sensei_get_sidebar - 10 |
|
978 | - */ |
|
979 | - do_action( 'sensei_sidebar' ); |
|
980 | - |
|
981 | - get_footer(); |
|
959 | + /** |
|
960 | + * sensei_pagination hook |
|
961 | + * |
|
962 | + * @hooked sensei_pagination - 10 (outputs pagination) |
|
963 | + */ |
|
964 | + do_action( 'sensei_pagination' ); |
|
965 | + |
|
966 | + /** |
|
967 | + * sensei_after_main_content hook |
|
968 | + * |
|
969 | + * @hooked sensei_output_content_wrapper_end - 10 (outputs closing divs for the content) |
|
970 | + */ |
|
971 | + do_action( 'sensei_after_main_content' ); |
|
972 | + |
|
973 | + /** |
|
974 | + * sensei_sidebar hook |
|
975 | + * |
|
976 | + * @hooked sensei_get_sidebar - 10 |
|
977 | + */ |
|
978 | + do_action( 'sensei_sidebar' ); |
|
979 | + |
|
980 | + get_footer(); |
|
982 | 981 | |
983 | 982 | }// end get_sensei_header |
984 | 983 | |
@@ -990,14 +989,14 @@ discard block |
||
990 | 989 | */ |
991 | 990 | function the_no_permissions_title(){ |
992 | 991 | |
993 | - /** |
|
994 | - * Filter the no permissions title just before it is echo'd on the |
|
995 | - * no-permissions.php file. |
|
996 | - * |
|
997 | - * @since 1.9.0 |
|
998 | - * @param $no_permissions_title |
|
999 | - */ |
|
1000 | - echo apply_filters( 'sensei_the_no_permissions_title', Sensei()->permissions_message['title'] ); |
|
992 | + /** |
|
993 | + * Filter the no permissions title just before it is echo'd on the |
|
994 | + * no-permissions.php file. |
|
995 | + * |
|
996 | + * @since 1.9.0 |
|
997 | + * @param $no_permissions_title |
|
998 | + */ |
|
999 | + echo apply_filters( 'sensei_the_no_permissions_title', Sensei()->permissions_message['title'] ); |
|
1001 | 1000 | |
1002 | 1001 | } |
1003 | 1002 | |
@@ -1008,14 +1007,14 @@ discard block |
||
1008 | 1007 | */ |
1009 | 1008 | function the_no_permissions_message( $post_id ){ |
1010 | 1009 | |
1011 | - /** |
|
1012 | - * Filter the no permissions message just before it is echo'd on the |
|
1013 | - * no-permissions.php file. |
|
1014 | - * |
|
1015 | - * @since 1.9.0 |
|
1016 | - * @param $no_permissions_message |
|
1017 | - */ |
|
1018 | - echo apply_filters( 'sensei_the_no_permissions_message', Sensei()->permissions_message['message'] , $post_id ); |
|
1010 | + /** |
|
1011 | + * Filter the no permissions message just before it is echo'd on the |
|
1012 | + * no-permissions.php file. |
|
1013 | + * |
|
1014 | + * @since 1.9.0 |
|
1015 | + * @param $no_permissions_message |
|
1016 | + */ |
|
1017 | + echo apply_filters( 'sensei_the_no_permissions_message', Sensei()->permissions_message['message'] , $post_id ); |
|
1019 | 1018 | |
1020 | 1019 | } |
1021 | 1020 | |
@@ -1026,8 +1025,8 @@ discard block |
||
1026 | 1025 | */ |
1027 | 1026 | function sensei_the_excerpt( $post_id ){ |
1028 | 1027 | |
1029 | - global $post; |
|
1030 | - the_excerpt( $post ); |
|
1028 | + global $post; |
|
1029 | + the_excerpt( $post ); |
|
1031 | 1030 | |
1032 | 1031 | } |
1033 | 1032 | |
@@ -1041,9 +1040,9 @@ discard block |
||
1041 | 1040 | */ |
1042 | 1041 | function sensei_get_current_page_url(){ |
1043 | 1042 | |
1044 | - global $wp; |
|
1045 | - $current_page_url = home_url( $wp->request ); |
|
1046 | - return $current_page_url; |
|
1043 | + global $wp; |
|
1044 | + $current_page_url = home_url( $wp->request ); |
|
1045 | + return $current_page_url; |
|
1047 | 1046 | |
1048 | 1047 | } |
1049 | 1048 | |
@@ -1055,7 +1054,7 @@ discard block |
||
1055 | 1054 | */ |
1056 | 1055 | function sensei_the_my_courses_content(){ |
1057 | 1056 | |
1058 | - echo Sensei()->course->load_user_courses_content( wp_get_current_user() ); |
|
1057 | + echo Sensei()->course->load_user_courses_content( wp_get_current_user() ); |
|
1059 | 1058 | |
1060 | 1059 | } // sensei_the_my_courses_content |
1061 | 1060 | |
@@ -1070,7 +1069,7 @@ discard block |
||
1070 | 1069 | */ |
1071 | 1070 | function sensei_load_template( $template_name ){ |
1072 | 1071 | |
1073 | - Sensei_Templates::get_template( $template_name ); |
|
1072 | + Sensei_Templates::get_template( $template_name ); |
|
1074 | 1073 | |
1075 | 1074 | } |
1076 | 1075 | |
@@ -1084,7 +1083,7 @@ discard block |
||
1084 | 1083 | */ |
1085 | 1084 | function sensei_load_template_part( $slug, $name ){ |
1086 | 1085 | |
1087 | - Sensei_Templates::get_part( $slug, $name ); |
|
1086 | + Sensei_Templates::get_part( $slug, $name ); |
|
1088 | 1087 | |
1089 | 1088 | } |
1090 | 1089 | |
@@ -1103,17 +1102,17 @@ discard block |
||
1103 | 1102 | */ |
1104 | 1103 | function sensei_the_lesson_excerpt( $lesson_id = '' ) { |
1105 | 1104 | |
1106 | - if( empty( $lesson_id )){ |
|
1105 | + if( empty( $lesson_id )){ |
|
1107 | 1106 | |
1108 | - $lesson_id = get_the_ID(); |
|
1107 | + $lesson_id = get_the_ID(); |
|
1109 | 1108 | |
1110 | - } |
|
1109 | + } |
|
1111 | 1110 | |
1112 | - if( 'lesson' != get_post_type( $lesson_id ) ){ |
|
1113 | - return; |
|
1114 | - } |
|
1111 | + if( 'lesson' != get_post_type( $lesson_id ) ){ |
|
1112 | + return; |
|
1113 | + } |
|
1115 | 1114 | |
1116 | - echo Sensei_Lesson::lesson_excerpt( get_post( $lesson_id ), false ); |
|
1115 | + echo Sensei_Lesson::lesson_excerpt( get_post( $lesson_id ), false ); |
|
1117 | 1116 | |
1118 | 1117 | }// End lesson_excerpt() |
1119 | 1118 | |
@@ -1123,16 +1122,16 @@ discard block |
||
1123 | 1122 | * @since 1.9.0 |
1124 | 1123 | */ |
1125 | 1124 | function sensei_the_course_results_lessons(){ |
1126 | - // load backwards compatible template name if it exists in the users theme |
|
1127 | - $located_template= locate_template( Sensei()->template_url . 'course-results/course-lessons.php' ); |
|
1128 | - if( $located_template ){ |
|
1125 | + // load backwards compatible template name if it exists in the users theme |
|
1126 | + $located_template= locate_template( Sensei()->template_url . 'course-results/course-lessons.php' ); |
|
1127 | + if( $located_template ){ |
|
1129 | 1128 | |
1130 | - Sensei_Templates::get_template( 'course-results/course-lessons.php' ); |
|
1131 | - return; |
|
1129 | + Sensei_Templates::get_template( 'course-results/course-lessons.php' ); |
|
1130 | + return; |
|
1132 | 1131 | |
1133 | - } |
|
1132 | + } |
|
1134 | 1133 | |
1135 | - Sensei_Templates::get_template( 'course-results/lessons.php' ); |
|
1134 | + Sensei_Templates::get_template( 'course-results/lessons.php' ); |
|
1136 | 1135 | } |
1137 | 1136 | |
1138 | 1137 | /** |
@@ -1144,7 +1143,7 @@ discard block |
||
1144 | 1143 | */ |
1145 | 1144 | function sensei_courses_per_row(){ |
1146 | 1145 | |
1147 | - echo Sensei_Course::get_loop_number_of_columns(); |
|
1146 | + echo Sensei_Course::get_loop_number_of_columns(); |
|
1148 | 1147 | |
1149 | 1148 | } |
1150 | 1149 | |
@@ -1158,7 +1157,7 @@ discard block |
||
1158 | 1157 | */ |
1159 | 1158 | function sensei_get_template( $template_name, $args, $path ){ |
1160 | 1159 | |
1161 | - Sensei_Templates::get_template( $template_name, $args, $path ); |
|
1160 | + Sensei_Templates::get_template( $template_name, $args, $path ); |
|
1162 | 1161 | |
1163 | 1162 | } |
1164 | 1163 | |
@@ -1172,14 +1171,14 @@ discard block |
||
1172 | 1171 | */ |
1173 | 1172 | function get_the_lesson_status_class(){ |
1174 | 1173 | |
1175 | - $status_class = ''; |
|
1176 | - $lesson_completed = Sensei_Utils::user_completed_lesson( get_the_ID(), get_current_user_id() ); |
|
1174 | + $status_class = ''; |
|
1175 | + $lesson_completed = Sensei_Utils::user_completed_lesson( get_the_ID(), get_current_user_id() ); |
|
1177 | 1176 | |
1178 | - if ( $lesson_completed ) { |
|
1179 | - $status_class = 'completed'; |
|
1180 | - } |
|
1177 | + if ( $lesson_completed ) { |
|
1178 | + $status_class = 'completed'; |
|
1179 | + } |
|
1181 | 1180 | |
1182 | - return $status_class; |
|
1181 | + return $status_class; |
|
1183 | 1182 | |
1184 | 1183 | }// end get_the_lesson_status_class |
1185 | 1184 | /** |
@@ -1191,5 +1190,5 @@ discard block |
||
1191 | 1190 | */ |
1192 | 1191 | function sensei_the_lesson_status_class(){ |
1193 | 1192 | |
1194 | - echo get_the_lesson_status_class(); |
|
1193 | + echo get_the_lesson_status_class(); |
|
1195 | 1194 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ){ exit; } // Exit if accessed directly |
|
2 | +if ( ! defined('ABSPATH')) { exit; } // Exit if accessed directly |
|
3 | 3 | |
4 | 4 | /*************************************************************************************************** |
5 | 5 | * Output tags. |
@@ -12,9 +12,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
180 | 180 | * @param array $widget_args (default: array()) |
181 | 181 | * @return array |
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 |
||
193 | 193 | * @param WP_Query $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 |
||
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 |
||
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,20 +238,20 @@ discard block |
||
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 | - if( !empty( $modules ) ){ |
|
254 | - foreach( (array) $modules as $module ) { |
|
253 | + if ( ! empty($modules)) { |
|
254 | + foreach ((array) $modules as $module) { |
|
255 | 255 | |
256 | 256 | $args = array( |
257 | 257 | 'post_type' => 'lesson', |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | 'meta_query' => array( |
261 | 261 | array( |
262 | 262 | 'key' => '_lesson_course', |
263 | - 'value' => intval( $lesson_course_id ), |
|
263 | + 'value' => intval($lesson_course_id), |
|
264 | 264 | 'compare' => '=' |
265 | 265 | ) |
266 | 266 | ), |
@@ -268,18 +268,18 @@ discard block |
||
268 | 268 | array( |
269 | 269 | 'taxonomy' => Sensei()->modules->taxonomy, |
270 | 270 | 'field' => 'id', |
271 | - 'terms' => intval( $module->term_id ) |
|
271 | + 'terms' => intval($module->term_id) |
|
272 | 272 | ) |
273 | 273 | ), |
274 | - 'meta_key' => '_order_module_' . $module->term_id, |
|
274 | + 'meta_key' => '_order_module_'.$module->term_id, |
|
275 | 275 | 'orderby' => 'meta_value_num date', |
276 | 276 | 'order' => 'ASC', |
277 | 277 | 'suppress_filters' => 0 |
278 | 278 | ); |
279 | 279 | |
280 | - $lessons = get_posts( $args ); |
|
281 | - if ( 0 < count( $lessons ) ) { |
|
282 | - foreach ($lessons as $lesson_item){ |
|
280 | + $lessons = get_posts($args); |
|
281 | + if (0 < count($lessons)) { |
|
282 | + foreach ($lessons as $lesson_item) { |
|
283 | 283 | $all_lessons[] = $lesson_item->ID; |
284 | 284 | } // End For Loop |
285 | 285 | } // End If Statement |
@@ -292,36 +292,36 @@ discard block |
||
292 | 292 | 'post_type' => 'lesson', |
293 | 293 | 'posts_per_page' => -1, |
294 | 294 | 'suppress_filters' => 0, |
295 | - 'meta_key' => '_order_' . $lesson_course_id, |
|
295 | + 'meta_key' => '_order_'.$lesson_course_id, |
|
296 | 296 | 'orderby' => 'meta_value_num date', |
297 | 297 | 'order' => 'ASC', |
298 | 298 | 'meta_query' => array( |
299 | 299 | array( |
300 | 300 | 'key' => '_lesson_course', |
301 | - 'value' => intval( $lesson_course_id ), |
|
301 | + 'value' => intval($lesson_course_id), |
|
302 | 302 | ), |
303 | 303 | ), |
304 | 304 | 'post__not_in' => $all_lessons, |
305 | 305 | ); |
306 | 306 | |
307 | - $other_lessons = get_posts( $args ); |
|
308 | - if ( 0 < count( $other_lessons ) ) { |
|
309 | - foreach ($other_lessons as $lesson_item){ |
|
307 | + $other_lessons = get_posts($args); |
|
308 | + if (0 < count($other_lessons)) { |
|
309 | + foreach ($other_lessons as $lesson_item) { |
|
310 | 310 | $all_lessons[] = $lesson_item->ID; |
311 | 311 | } // End For Loop |
312 | 312 | } // End If Statement |
313 | 313 | |
314 | - if ( 0 < count( $all_lessons ) ) { |
|
314 | + if (0 < count($all_lessons)) { |
|
315 | 315 | $found_index = false; |
316 | - foreach ( $all_lessons as $lesson ){ |
|
317 | - if ( $found_index && $return_values['next_lesson'] == 0 ) { |
|
316 | + foreach ($all_lessons as $lesson) { |
|
317 | + if ($found_index && $return_values['next_lesson'] == 0) { |
|
318 | 318 | $return_values['next_lesson'] = $lesson; |
319 | 319 | } // End If Statement |
320 | - if ( $lesson == $lesson_id ) { |
|
320 | + if ($lesson == $lesson_id) { |
|
321 | 321 | // Is the current post |
322 | 322 | $found_index = true; |
323 | 323 | } // End If Statement |
324 | - if ( !$found_index ) { |
|
324 | + if ( ! $found_index) { |
|
325 | 325 | $return_values['prev_lesson'] = $lesson; |
326 | 326 | } // End If Statement |
327 | 327 | } // End For Loop |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * @param int|WP_Post $post_id Optional. Defaults to current post |
341 | 341 | * @return string $excerpt |
342 | 342 | */ |
343 | - function sensei_get_excerpt( $post_id = '' ) { |
|
343 | + function sensei_get_excerpt($post_id = '') { |
|
344 | 344 | |
345 | 345 | global $post; |
346 | 346 | _deprecated_function('sensei_get_excerpt', 'use the wordpress excerpt functionality.'); |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | |
349 | 349 | } |
350 | 350 | |
351 | - function sensei_has_user_started_course( $post_id = 0, $user_id = 0 ) { |
|
352 | - _deprecated_function( __FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_started_course()" ); |
|
353 | - return Sensei_Utils::user_started_course( $post_id, $user_id ); |
|
351 | + function sensei_has_user_started_course($post_id = 0, $user_id = 0) { |
|
352 | + _deprecated_function(__FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_started_course()"); |
|
353 | + return Sensei_Utils::user_started_course($post_id, $user_id); |
|
354 | 354 | } // End sensei_has_user_started_course() |
355 | 355 | |
356 | - function sensei_has_user_completed_lesson( $post_id = 0, $user_id = 0 ) { |
|
357 | - _deprecated_function( __FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_completed_lesson()" ); |
|
358 | - return Sensei_Utils::user_completed_lesson( $post_id, $user_id ); |
|
356 | + function sensei_has_user_completed_lesson($post_id = 0, $user_id = 0) { |
|
357 | + _deprecated_function(__FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_completed_lesson()"); |
|
358 | + return Sensei_Utils::user_completed_lesson($post_id, $user_id); |
|
359 | 359 | } // End sensei_has_user_completed_lesson() |
360 | 360 | |
361 | 361 | /** |
@@ -367,9 +367,9 @@ discard block |
||
367 | 367 | * @param int $user_id |
368 | 368 | * @return bool |
369 | 369 | */ |
370 | -function sensei_has_user_completed_prerequisite_lesson( $current_lesson_id, $user_id ) { |
|
370 | +function sensei_has_user_completed_prerequisite_lesson($current_lesson_id, $user_id) { |
|
371 | 371 | |
372 | - return WooThemes_Sensei_Lesson::is_pre_requisite_complete( $current_lesson_id, $user_id ); |
|
372 | + return WooThemes_Sensei_Lesson::is_pre_requisite_complete($current_lesson_id, $user_id); |
|
373 | 373 | |
374 | 374 | } // End sensei_has_user_completed_prerequisite_lesson() |
375 | 375 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | * @return bool |
393 | 393 | * |
394 | 394 | */ |
395 | -function sensei_have_modules( $course_post_id = '' ){ |
|
395 | +function sensei_have_modules($course_post_id = '') { |
|
396 | 396 | |
397 | 397 | global $post, $wp_query, $sensei_modules_loop; |
398 | 398 | |
@@ -400,23 +400,23 @@ discard block |
||
400 | 400 | wp_reset_query(); |
401 | 401 | $post = $wp_query->post; |
402 | 402 | |
403 | - if( empty( $course_post_id ) ){ |
|
403 | + if (empty($course_post_id)) { |
|
404 | 404 | |
405 | 405 | $course_id = $post->ID; |
406 | 406 | |
407 | 407 | } |
408 | 408 | |
409 | 409 | // doesn't apply to none course post types |
410 | - if( ! sensei_is_a_course( $course_id ) ){ |
|
410 | + if ( ! sensei_is_a_course($course_id)) { |
|
411 | 411 | return false; |
412 | 412 | } |
413 | 413 | |
414 | 414 | // check the current item compared to the total number of modules |
415 | - if( $sensei_modules_loop[ 'current' ] + 1 > $sensei_modules_loop[ 'total' ] ){ |
|
415 | + if ($sensei_modules_loop['current'] + 1 > $sensei_modules_loop['total']) { |
|
416 | 416 | |
417 | 417 | return false; |
418 | 418 | |
419 | - }else{ |
|
419 | + } else { |
|
420 | 420 | |
421 | 421 | return true; |
422 | 422 | |
@@ -430,27 +430,27 @@ discard block |
||
430 | 430 | * |
431 | 431 | * @since 1.9.0 |
432 | 432 | */ |
433 | -function sensei_setup_module(){ |
|
433 | +function sensei_setup_module() { |
|
434 | 434 | |
435 | 435 | global $sensei_modules_loop, $wp_query; |
436 | 436 | |
437 | 437 | // increment the index |
438 | - $sensei_modules_loop[ 'current' ]++; |
|
439 | - $index = $sensei_modules_loop[ 'current' ]; |
|
440 | - if( isset( $sensei_modules_loop['modules'][ $index ] ) ) { |
|
438 | + $sensei_modules_loop['current']++; |
|
439 | + $index = $sensei_modules_loop['current']; |
|
440 | + if (isset($sensei_modules_loop['modules'][$index])) { |
|
441 | 441 | |
442 | 442 | $sensei_modules_loop['current_module'] = $sensei_modules_loop['modules'][$index]; |
443 | 443 | // setup the query for the module lessons |
444 | 444 | $course_id = $sensei_modules_loop['course_id']; |
445 | 445 | $module_term_id = $sensei_modules_loop['current_module']->term_id; |
446 | - $modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id ); |
|
446 | + $modules_query = Sensei()->modules->get_lessons_query($course_id, $module_term_id); |
|
447 | 447 | |
448 | 448 | // setup the global wp-query only if the lessons |
449 | - if( $modules_query->have_posts() ){ |
|
449 | + if ($modules_query->have_posts()) { |
|
450 | 450 | |
451 | 451 | $wp_query = $modules_query; |
452 | 452 | |
453 | - }else{ |
|
453 | + } else { |
|
454 | 454 | |
455 | 455 | wp_reset_query(); |
456 | 456 | |
@@ -474,30 +474,30 @@ discard block |
||
474 | 474 | * |
475 | 475 | * @return bool |
476 | 476 | */ |
477 | -function sensei_module_has_lessons(){ |
|
477 | +function sensei_module_has_lessons() { |
|
478 | 478 | |
479 | 479 | global $wp_query, $sensei_modules_loop; |
480 | 480 | |
481 | - if( 'lesson' == $wp_query->get('post_type') ){ |
|
481 | + if ('lesson' == $wp_query->get('post_type')) { |
|
482 | 482 | |
483 | 483 | return have_posts(); |
484 | 484 | |
485 | - }else{ |
|
485 | + } else { |
|
486 | 486 | |
487 | 487 | // if the loop has not been initiated check the first module has lessons |
488 | - if( -1 == $sensei_modules_loop[ 'current' ] ){ |
|
488 | + if ( -1 == $sensei_modules_loop['current'] ) { |
|
489 | 489 | |
490 | 490 | $index = 0; |
491 | 491 | |
492 | - if( isset( $sensei_modules_loop['modules'][ $index ] ) ) { |
|
492 | + if (isset($sensei_modules_loop['modules'][$index])) { |
|
493 | 493 | // setup the query for the module lessons |
494 | 494 | $course_id = $sensei_modules_loop['course_id']; |
495 | 495 | |
496 | - $module_term_id = $sensei_modules_loop['modules'][ $index ] ->term_id; |
|
497 | - $modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id ); |
|
496 | + $module_term_id = $sensei_modules_loop['modules'][$index] ->term_id; |
|
497 | + $modules_query = Sensei()->modules->get_lessons_query($course_id, $module_term_id); |
|
498 | 498 | |
499 | 499 | // setup the global wp-query only if the lessons |
500 | - if( $modules_query->have_posts() ){ |
|
500 | + if ($modules_query->have_posts()) { |
|
501 | 501 | |
502 | 502 | return true; |
503 | 503 | |
@@ -521,9 +521,9 @@ discard block |
||
521 | 521 | * @uses sensei_the_module_title |
522 | 522 | * @return string |
523 | 523 | */ |
524 | -function sensei_the_module_title_attribute(){ |
|
524 | +function sensei_the_module_title_attribute() { |
|
525 | 525 | |
526 | - esc_attr_e( sensei_get_the_module_title() ); |
|
526 | + esc_attr_e(sensei_get_the_module_title()); |
|
527 | 527 | |
528 | 528 | } |
529 | 529 | |
@@ -534,11 +534,11 @@ discard block |
||
534 | 534 | * |
535 | 535 | * @return string |
536 | 536 | */ |
537 | -function sensei_the_module_permalink(){ |
|
537 | +function sensei_the_module_permalink() { |
|
538 | 538 | |
539 | 539 | global $sensei_modules_loop; |
540 | 540 | $course_id = $sensei_modules_loop['course_id']; |
541 | - $module_url = add_query_arg('course_id', $course_id, get_term_link( $sensei_modules_loop['current_module'], 'module' ) ); |
|
541 | + $module_url = add_query_arg('course_id', $course_id, get_term_link($sensei_modules_loop['current_module'], 'module')); |
|
542 | 542 | $module_term_id = $sensei_modules_loop['current_module']->term_id; |
543 | 543 | |
544 | 544 | /** |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | * @param int $module_term_id |
551 | 551 | * @param string $course_id |
552 | 552 | */ |
553 | - echo esc_url_raw( apply_filters( 'sensei_the_module_permalink', $module_url, $module_term_id ,$course_id ) ); |
|
553 | + echo esc_url_raw(apply_filters('sensei_the_module_permalink', $module_url, $module_term_id, $course_id)); |
|
554 | 554 | |
555 | 555 | }// end sensei_the_module_permalink |
556 | 556 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | * |
563 | 563 | * @return string |
564 | 564 | */ |
565 | -function sensei_get_the_module_title(){ |
|
565 | +function sensei_get_the_module_title() { |
|
566 | 566 | |
567 | 567 | global $sensei_modules_loop; |
568 | 568 | |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * @param $module_term_id |
582 | 582 | * @param $course_id |
583 | 583 | */ |
584 | - return apply_filters( 'sensei_the_module_title', $module_title , $module_term_id, $course_id ); |
|
584 | + return apply_filters('sensei_the_module_title', $module_title, $module_term_id, $course_id); |
|
585 | 585 | |
586 | 586 | } |
587 | 587 | |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | * @uses sensei_get_the_module_title |
594 | 594 | * @return string |
595 | 595 | */ |
596 | -function sensei_the_module_title(){ |
|
596 | +function sensei_the_module_title() { |
|
597 | 597 | |
598 | 598 | echo sensei_get_the_module_title(); |
599 | 599 | |
@@ -606,9 +606,9 @@ discard block |
||
606 | 606 | * @since 1.9.0 |
607 | 607 | * @return string |
608 | 608 | */ |
609 | -function sensei_get_the_module_status(){ |
|
609 | +function sensei_get_the_module_status() { |
|
610 | 610 | |
611 | - if( ! is_user_logged_in() ){ |
|
611 | + if ( ! is_user_logged_in()) { |
|
612 | 612 | return ''; |
613 | 613 | } |
614 | 614 | |
@@ -616,10 +616,10 @@ discard block |
||
616 | 616 | $module_title = $sensei_modules_loop['current_module']->name; |
617 | 617 | $module_term_id = $sensei_modules_loop['current_module']->term_id; |
618 | 618 | $course_id = $sensei_modules_loop['course_id']; |
619 | - $module_progress = Sensei()->modules->get_user_module_progress( $module_term_id, $course_id, get_current_user_id() ); |
|
619 | + $module_progress = Sensei()->modules->get_user_module_progress($module_term_id, $course_id, get_current_user_id()); |
|
620 | 620 | |
621 | - $module_status = ''; |
|
622 | - if ( $module_progress && $module_progress > 0) { |
|
621 | + $module_status = ''; |
|
622 | + if ($module_progress && $module_progress > 0) { |
|
623 | 623 | |
624 | 624 | $module_status = __('Completed', 'woothemes-sensei'); |
625 | 625 | |
@@ -631,12 +631,12 @@ discard block |
||
631 | 631 | |
632 | 632 | } |
633 | 633 | |
634 | - if ( empty( $module_status ) ){ |
|
634 | + if (empty($module_status)) { |
|
635 | 635 | return ''; |
636 | 636 | } |
637 | 637 | |
638 | - $status_class = strtolower( str_replace( ' ', '-', $module_status ) ); |
|
639 | - $module_status_html = '<p class="status module-status ' . $status_class . '">' |
|
638 | + $status_class = strtolower(str_replace(' ', '-', $module_status)); |
|
639 | + $module_status_html = '<p class="status module-status '.$status_class.'">' |
|
640 | 640 | . $module_status |
641 | 641 | . '</p>'; |
642 | 642 | |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | * @param $module_term_id |
652 | 652 | * @param $course_id |
653 | 653 | */ |
654 | - return apply_filters( 'sensei_the_module_status_html', $module_status_html , $module_term_id, $course_id ); |
|
654 | + return apply_filters('sensei_the_module_status_html', $module_status_html, $module_term_id, $course_id); |
|
655 | 655 | |
656 | 656 | } |
657 | 657 | |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | * Print out the current module status |
660 | 660 | * @since 1.9.0 |
661 | 661 | */ |
662 | -function sensei_the_module_status(){ |
|
662 | +function sensei_the_module_status() { |
|
663 | 663 | |
664 | 664 | echo sensei_get_the_module_status(); |
665 | 665 | |
@@ -680,19 +680,19 @@ discard block |
||
680 | 680 | * |
681 | 681 | * @return bool |
682 | 682 | */ |
683 | -function sensei_quiz_has_questions(){ |
|
683 | +function sensei_quiz_has_questions() { |
|
684 | 684 | |
685 | 685 | global $sensei_question_loop; |
686 | 686 | |
687 | - if( !isset( $sensei_question_loop['total'] ) ){ |
|
687 | + if ( ! isset($sensei_question_loop['total'])) { |
|
688 | 688 | return false; |
689 | 689 | } |
690 | 690 | |
691 | - if( $sensei_question_loop['current'] + 1 < $sensei_question_loop['total'] ){ |
|
691 | + if ($sensei_question_loop['current'] + 1 < $sensei_question_loop['total']) { |
|
692 | 692 | |
693 | 693 | return true; |
694 | 694 | |
695 | - }else{ |
|
695 | + } else { |
|
696 | 696 | |
697 | 697 | return false; |
698 | 698 | |
@@ -709,13 +709,13 @@ discard block |
||
709 | 709 | * @since 1.9.0 |
710 | 710 | |
711 | 711 | */ |
712 | -function sensei_setup_the_question(){ |
|
712 | +function sensei_setup_the_question() { |
|
713 | 713 | |
714 | 714 | global $sensei_question_loop; |
715 | 715 | |
716 | 716 | $sensei_question_loop['current']++; |
717 | 717 | $index = $sensei_question_loop['current']; |
718 | - $sensei_question_loop['current_question'] = $sensei_question_loop['questions'][ $index ] ; |
|
718 | + $sensei_question_loop['current_question'] = $sensei_question_loop['questions'][$index]; |
|
719 | 719 | |
720 | 720 | |
721 | 721 | }// end sensei_setup_the_question |
@@ -726,14 +726,14 @@ discard block |
||
726 | 726 | * This function gets the type and loads the template that will handle it. |
727 | 727 | * |
728 | 728 | */ |
729 | -function sensei_the_question_content(){ |
|
729 | +function sensei_the_question_content() { |
|
730 | 730 | |
731 | 731 | global $sensei_question_loop; |
732 | 732 | |
733 | - $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID ); |
|
733 | + $question_type = Sensei()->question->get_question_type($sensei_question_loop['current_question']->ID); |
|
734 | 734 | |
735 | 735 | // load the template that displays the question information. |
736 | - WooThemes_Sensei_Question::load_question_template( $question_type ); |
|
736 | + WooThemes_Sensei_Question::load_question_template($question_type); |
|
737 | 737 | |
738 | 738 | }// end sensei_the_question_content |
739 | 739 | |
@@ -742,11 +742,11 @@ discard block |
||
742 | 742 | * |
743 | 743 | * @since 1.9.0 |
744 | 744 | */ |
745 | -function sensei_the_question_class(){ |
|
745 | +function sensei_the_question_class() { |
|
746 | 746 | |
747 | 747 | global $sensei_question_loop; |
748 | 748 | |
749 | - $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID ); |
|
749 | + $question_type = Sensei()->question->get_question_type($sensei_question_loop['current_question']->ID); |
|
750 | 750 | |
751 | 751 | /** |
752 | 752 | * filter the sensei question class within |
@@ -754,16 +754,16 @@ discard block |
||
754 | 754 | * |
755 | 755 | * @since 1.9.0 |
756 | 756 | */ |
757 | - $classes = apply_filters( 'sensei_question_classes', array( $question_type ) ); |
|
757 | + $classes = apply_filters('sensei_question_classes', array($question_type)); |
|
758 | 758 | |
759 | 759 | $html_classes = ''; |
760 | - foreach( $classes as $class ){ |
|
760 | + foreach ($classes as $class) { |
|
761 | 761 | |
762 | - $html_classes .= $class . ' '; |
|
762 | + $html_classes .= $class.' '; |
|
763 | 763 | |
764 | 764 | }// end foreach |
765 | 765 | |
766 | - esc_attr_e( trim( $html_classes ) ); |
|
766 | + esc_attr_e(trim($html_classes)); |
|
767 | 767 | |
768 | 768 | } |
769 | 769 | |
@@ -772,10 +772,10 @@ discard block |
||
772 | 772 | * |
773 | 773 | * @since 1.9.0 |
774 | 774 | */ |
775 | -function sensei_get_the_question_id( ){ |
|
775 | +function sensei_get_the_question_id( ) { |
|
776 | 776 | |
777 | 777 | global $sensei_question_loop; |
778 | - if( isset( $sensei_question_loop['current_question']->ID ) ){ |
|
778 | + if (isset($sensei_question_loop['current_question']->ID)) { |
|
779 | 779 | |
780 | 780 | return $sensei_question_loop['current_question']->ID; |
781 | 781 | |
@@ -804,27 +804,27 @@ discard block |
||
804 | 804 | * @param string $lesson_id |
805 | 805 | * @return bool |
806 | 806 | */ |
807 | -function sensei_can_user_view_lesson( $lesson_id = '', $user_id = '' ){ |
|
807 | +function sensei_can_user_view_lesson($lesson_id = '', $user_id = '') { |
|
808 | 808 | |
809 | - if( empty( $lesson_id ) ){ |
|
809 | + if (empty($lesson_id)) { |
|
810 | 810 | |
811 | 811 | $lesson_id = get_the_ID(); |
812 | 812 | |
813 | 813 | } |
814 | 814 | |
815 | - if( empty( $user_id ) ){ |
|
815 | + if (empty($user_id)) { |
|
816 | 816 | |
817 | 817 | $user_id = get_current_user_id(); |
818 | 818 | |
819 | 819 | } |
820 | 820 | |
821 | 821 | // Check for prerequisite lesson completions |
822 | - $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete( $lesson_id, $user_id ); |
|
823 | - $lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true ); |
|
824 | - $user_taking_course = Sensei_Utils::user_started_course( $lesson_course_id, $user_id ); |
|
822 | + $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete($lesson_id, $user_id); |
|
823 | + $lesson_course_id = get_post_meta($lesson_id, '_lesson_course', true); |
|
824 | + $user_taking_course = Sensei_Utils::user_started_course($lesson_course_id, $user_id); |
|
825 | 825 | |
826 | 826 | $is_preview = false; |
827 | - if( Sensei_Utils::is_preview_lesson( $lesson_id ) ) { |
|
827 | + if (Sensei_Utils::is_preview_lesson($lesson_id)) { |
|
828 | 828 | |
829 | 829 | $is_preview = true; |
830 | 830 | $pre_requisite_complete = true; |
@@ -832,24 +832,24 @@ discard block |
||
832 | 832 | }; |
833 | 833 | |
834 | 834 | |
835 | - $user_can_access_lesson = false; |
|
835 | + $user_can_access_lesson = false; |
|
836 | 836 | |
837 | - if( is_user_logged_in() && $user_taking_course ){ |
|
837 | + if (is_user_logged_in() && $user_taking_course) { |
|
838 | 838 | |
839 | - $user_can_access_lesson = true; |
|
839 | + $user_can_access_lesson = true; |
|
840 | 840 | |
841 | 841 | } |
842 | 842 | |
843 | 843 | |
844 | 844 | $access_permission = false; |
845 | 845 | |
846 | - if ( ! Sensei()->settings->get('access_permission') || sensei_all_access() ) { |
|
846 | + if ( ! Sensei()->settings->get('access_permission') || sensei_all_access()) { |
|
847 | 847 | |
848 | 848 | $access_permission = true; |
849 | 849 | |
850 | 850 | } |
851 | 851 | |
852 | - $can_user_view_lesson = $access_permission || ( $user_can_access_lesson && $pre_requisite_complete ) || $is_preview; |
|
852 | + $can_user_view_lesson = $access_permission || ($user_can_access_lesson && $pre_requisite_complete) || $is_preview; |
|
853 | 853 | |
854 | 854 | /** |
855 | 855 | * Filter the can user view lesson function |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | * @param string $lesson_id |
863 | 863 | * @param string $user_id |
864 | 864 | */ |
865 | - return apply_filters( 'sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id ); |
|
865 | + return apply_filters('sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id); |
|
866 | 866 | |
867 | 867 | } // end sensei_can_current_user_view_lesson |
868 | 868 | |
@@ -872,51 +872,51 @@ discard block |
||
872 | 872 | * The function should only be called on the single lesson |
873 | 873 | * |
874 | 874 | */ |
875 | -function sensei_the_single_lesson_meta(){ |
|
875 | +function sensei_the_single_lesson_meta() { |
|
876 | 876 | |
877 | 877 | // if the lesson meta is included within theme load that instead of the function content |
878 | - $template = Sensei_Templates::locate_template( 'single-lesson/lesson-meta.php' ); |
|
879 | - if( ! empty( $template ) ){ |
|
878 | + $template = Sensei_Templates::locate_template('single-lesson/lesson-meta.php'); |
|
879 | + if ( ! empty($template)) { |
|
880 | 880 | |
881 | - Sensei_Templates::get_template( 'single-lesson/lesson-meta.php' ); |
|
881 | + Sensei_Templates::get_template('single-lesson/lesson-meta.php'); |
|
882 | 882 | return; |
883 | 883 | |
884 | 884 | } |
885 | 885 | |
886 | 886 | // Get the meta info |
887 | - $lesson_course_id = absint( get_post_meta( get_the_ID(), '_lesson_course', true ) ); |
|
888 | - $is_preview = Sensei_Utils::is_preview_lesson( get_the_ID() ); |
|
887 | + $lesson_course_id = absint(get_post_meta(get_the_ID(), '_lesson_course', true)); |
|
888 | + $is_preview = Sensei_Utils::is_preview_lesson(get_the_ID()); |
|
889 | 889 | |
890 | 890 | // Complete Lesson Logic |
891 | - do_action( 'sensei_complete_lesson' ); |
|
891 | + do_action('sensei_complete_lesson'); |
|
892 | 892 | // Check that the course has been started |
893 | - if ( Sensei()->access_settings() |
|
894 | - || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) |
|
895 | - || $is_preview ) { |
|
893 | + if (Sensei()->access_settings() |
|
894 | + || Sensei_Utils::user_started_course($lesson_course_id, get_current_user_id()) |
|
895 | + || $is_preview) { |
|
896 | 896 | ?> |
897 | 897 | <section class="lesson-meta"> |
898 | 898 | <?php |
899 | - if( apply_filters( 'sensei_video_position', 'top', get_the_ID() ) == 'bottom' ) { |
|
899 | + if (apply_filters('sensei_video_position', 'top', get_the_ID()) == 'bottom') { |
|
900 | 900 | |
901 | - do_action( 'sensei_lesson_video', get_the_ID() ); |
|
901 | + do_action('sensei_lesson_video', get_the_ID()); |
|
902 | 902 | |
903 | 903 | } |
904 | 904 | ?> |
905 | - <?php do_action( 'sensei_frontend_messages' ); ?> |
|
905 | + <?php do_action('sensei_frontend_messages'); ?> |
|
906 | 906 | |
907 | 907 | <?php if ( ! $is_preview |
908 | - || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) ) { |
|
908 | + || Sensei_Utils::user_started_course($lesson_course_id, get_current_user_id())) { |
|
909 | 909 | |
910 | - 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() ) ); |
|
910 | + 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())); |
|
911 | 911 | |
912 | 912 | } ?> |
913 | 913 | </section> |
914 | 914 | |
915 | - <?php do_action( 'sensei_lesson_back_link', $lesson_course_id ); ?> |
|
915 | + <?php do_action('sensei_lesson_back_link', $lesson_course_id); ?> |
|
916 | 916 | |
917 | 917 | <?php } |
918 | 918 | |
919 | - do_action( 'sensei_lesson_meta_extra', get_the_ID() ); |
|
919 | + do_action('sensei_lesson_meta_extra', get_the_ID()); |
|
920 | 920 | |
921 | 921 | } // end the_single_lesson_meta |
922 | 922 | |
@@ -930,9 +930,9 @@ discard block |
||
930 | 930 | * |
931 | 931 | * @since 1.9.0 |
932 | 932 | */ |
933 | -function get_sensei_header(){ |
|
933 | +function get_sensei_header() { |
|
934 | 934 | |
935 | - if ( ! defined( 'ABSPATH' ) ) exit; |
|
935 | + if ( ! defined('ABSPATH')) exit; |
|
936 | 936 | |
937 | 937 | get_header(); |
938 | 938 | |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | * |
942 | 942 | * @hooked sensei_output_content_wrapper - 10 (outputs opening divs for the content) |
943 | 943 | */ |
944 | - do_action( 'sensei_before_main_content' ); |
|
944 | + do_action('sensei_before_main_content'); |
|
945 | 945 | |
946 | 946 | }// end get_sensei_header |
947 | 947 | |
@@ -955,28 +955,28 @@ discard block |
||
955 | 955 | * |
956 | 956 | * @since 1.9.0 |
957 | 957 | */ |
958 | -function get_sensei_footer(){ |
|
958 | +function get_sensei_footer() { |
|
959 | 959 | |
960 | 960 | /** |
961 | 961 | * sensei_pagination hook |
962 | 962 | * |
963 | 963 | * @hooked sensei_pagination - 10 (outputs pagination) |
964 | 964 | */ |
965 | - do_action( 'sensei_pagination' ); |
|
965 | + do_action('sensei_pagination'); |
|
966 | 966 | |
967 | 967 | /** |
968 | 968 | * sensei_after_main_content hook |
969 | 969 | * |
970 | 970 | * @hooked sensei_output_content_wrapper_end - 10 (outputs closing divs for the content) |
971 | 971 | */ |
972 | - do_action( 'sensei_after_main_content' ); |
|
972 | + do_action('sensei_after_main_content'); |
|
973 | 973 | |
974 | 974 | /** |
975 | 975 | * sensei_sidebar hook |
976 | 976 | * |
977 | 977 | * @hooked sensei_get_sidebar - 10 |
978 | 978 | */ |
979 | - do_action( 'sensei_sidebar' ); |
|
979 | + do_action('sensei_sidebar'); |
|
980 | 980 | |
981 | 981 | get_footer(); |
982 | 982 | |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | * |
989 | 989 | * @since 1.9.0 |
990 | 990 | */ |
991 | -function the_no_permissions_title(){ |
|
991 | +function the_no_permissions_title() { |
|
992 | 992 | |
993 | 993 | /** |
994 | 994 | * Filter the no permissions title just before it is echo'd on the |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | * @since 1.9.0 |
998 | 998 | * @param $no_permissions_title |
999 | 999 | */ |
1000 | - echo apply_filters( 'sensei_the_no_permissions_title', Sensei()->permissions_message['title'] ); |
|
1000 | + echo apply_filters('sensei_the_no_permissions_title', Sensei()->permissions_message['title']); |
|
1001 | 1001 | |
1002 | 1002 | } |
1003 | 1003 | |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | * |
1007 | 1007 | * @since 1.9.0 |
1008 | 1008 | */ |
1009 | -function the_no_permissions_message( $post_id ){ |
|
1009 | +function the_no_permissions_message($post_id) { |
|
1010 | 1010 | |
1011 | 1011 | /** |
1012 | 1012 | * Filter the no permissions message just before it is echo'd on the |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | * @since 1.9.0 |
1016 | 1016 | * @param $no_permissions_message |
1017 | 1017 | */ |
1018 | - echo apply_filters( 'sensei_the_no_permissions_message', Sensei()->permissions_message['message'] , $post_id ); |
|
1018 | + echo apply_filters('sensei_the_no_permissions_message', Sensei()->permissions_message['message'], $post_id); |
|
1019 | 1019 | |
1020 | 1020 | } |
1021 | 1021 | |
@@ -1024,10 +1024,10 @@ discard block |
||
1024 | 1024 | * |
1025 | 1025 | * @since 1.9.0 |
1026 | 1026 | */ |
1027 | -function sensei_the_excerpt( $post_id ){ |
|
1027 | +function sensei_the_excerpt($post_id) { |
|
1028 | 1028 | |
1029 | 1029 | global $post; |
1030 | - the_excerpt( $post ); |
|
1030 | + the_excerpt($post); |
|
1031 | 1031 | |
1032 | 1032 | } |
1033 | 1033 | |
@@ -1039,10 +1039,10 @@ discard block |
||
1039 | 1039 | * @global WP $wp |
1040 | 1040 | * @return string $current_page_url |
1041 | 1041 | */ |
1042 | - function sensei_get_current_page_url(){ |
|
1042 | + function sensei_get_current_page_url() { |
|
1043 | 1043 | |
1044 | 1044 | global $wp; |
1045 | - $current_page_url = home_url( $wp->request ); |
|
1045 | + $current_page_url = home_url($wp->request); |
|
1046 | 1046 | return $current_page_url; |
1047 | 1047 | |
1048 | 1048 | } |
@@ -1053,9 +1053,9 @@ discard block |
||
1053 | 1053 | * |
1054 | 1054 | * @since 1.9.0 |
1055 | 1055 | */ |
1056 | -function sensei_the_my_courses_content(){ |
|
1056 | +function sensei_the_my_courses_content() { |
|
1057 | 1057 | |
1058 | - echo Sensei()->course->load_user_courses_content( wp_get_current_user() ); |
|
1058 | + echo Sensei()->course->load_user_courses_content(wp_get_current_user()); |
|
1059 | 1059 | |
1060 | 1060 | } // sensei_the_my_courses_content |
1061 | 1061 | |
@@ -1068,9 +1068,9 @@ discard block |
||
1068 | 1068 | * |
1069 | 1069 | * @since 1.9.0 |
1070 | 1070 | */ |
1071 | -function sensei_load_template( $template_name ){ |
|
1071 | +function sensei_load_template($template_name) { |
|
1072 | 1072 | |
1073 | - Sensei_Templates::get_template( $template_name ); |
|
1073 | + Sensei_Templates::get_template($template_name); |
|
1074 | 1074 | |
1075 | 1075 | } |
1076 | 1076 | |
@@ -1082,9 +1082,9 @@ discard block |
||
1082 | 1082 | * @param string $name the name of the template. |
1083 | 1083 | * @since 1.9.0 |
1084 | 1084 | */ |
1085 | -function sensei_load_template_part( $slug, $name ){ |
|
1085 | +function sensei_load_template_part($slug, $name) { |
|
1086 | 1086 | |
1087 | - Sensei_Templates::get_part( $slug, $name ); |
|
1087 | + Sensei_Templates::get_part($slug, $name); |
|
1088 | 1088 | |
1089 | 1089 | } |
1090 | 1090 | |
@@ -1101,19 +1101,19 @@ discard block |
||
1101 | 1101 | * @access public |
1102 | 1102 | * @param string $lesson_id |
1103 | 1103 | */ |
1104 | -function sensei_the_lesson_excerpt( $lesson_id = '' ) { |
|
1104 | +function sensei_the_lesson_excerpt($lesson_id = '') { |
|
1105 | 1105 | |
1106 | - if( empty( $lesson_id )){ |
|
1106 | + if (empty($lesson_id)) { |
|
1107 | 1107 | |
1108 | 1108 | $lesson_id = get_the_ID(); |
1109 | 1109 | |
1110 | 1110 | } |
1111 | 1111 | |
1112 | - if( 'lesson' != get_post_type( $lesson_id ) ){ |
|
1112 | + if ('lesson' != get_post_type($lesson_id)) { |
|
1113 | 1113 | return; |
1114 | 1114 | } |
1115 | 1115 | |
1116 | - echo Sensei_Lesson::lesson_excerpt( get_post( $lesson_id ), false ); |
|
1116 | + echo Sensei_Lesson::lesson_excerpt(get_post($lesson_id), false); |
|
1117 | 1117 | |
1118 | 1118 | }// End lesson_excerpt() |
1119 | 1119 | |
@@ -1122,17 +1122,17 @@ discard block |
||
1122 | 1122 | * |
1123 | 1123 | * @since 1.9.0 |
1124 | 1124 | */ |
1125 | -function sensei_the_course_results_lessons(){ |
|
1125 | +function sensei_the_course_results_lessons() { |
|
1126 | 1126 | // load backwards compatible template name if it exists in the users theme |
1127 | - $located_template= locate_template( Sensei()->template_url . 'course-results/course-lessons.php' ); |
|
1128 | - if( $located_template ){ |
|
1127 | + $located_template = locate_template(Sensei()->template_url.'course-results/course-lessons.php'); |
|
1128 | + if ($located_template) { |
|
1129 | 1129 | |
1130 | - Sensei_Templates::get_template( 'course-results/course-lessons.php' ); |
|
1130 | + Sensei_Templates::get_template('course-results/course-lessons.php'); |
|
1131 | 1131 | return; |
1132 | 1132 | |
1133 | 1133 | } |
1134 | 1134 | |
1135 | - Sensei_Templates::get_template( 'course-results/lessons.php' ); |
|
1135 | + Sensei_Templates::get_template('course-results/lessons.php'); |
|
1136 | 1136 | } |
1137 | 1137 | |
1138 | 1138 | /** |
@@ -1142,7 +1142,7 @@ discard block |
||
1142 | 1142 | * @uses Sensei_Course::get_loop_number_of_columns |
1143 | 1143 | * @since 1.9.0 |
1144 | 1144 | */ |
1145 | -function sensei_courses_per_row(){ |
|
1145 | +function sensei_courses_per_row() { |
|
1146 | 1146 | |
1147 | 1147 | echo Sensei_Course::get_loop_number_of_columns(); |
1148 | 1148 | |
@@ -1156,9 +1156,9 @@ discard block |
||
1156 | 1156 | * @param $args |
1157 | 1157 | * @param $path |
1158 | 1158 | */ |
1159 | -function sensei_get_template( $template_name, $args, $path ){ |
|
1159 | +function sensei_get_template($template_name, $args, $path) { |
|
1160 | 1160 | |
1161 | - Sensei_Templates::get_template( $template_name, $args, $path ); |
|
1161 | + Sensei_Templates::get_template($template_name, $args, $path); |
|
1162 | 1162 | |
1163 | 1163 | } |
1164 | 1164 | |
@@ -1170,12 +1170,12 @@ discard block |
||
1170 | 1170 | * |
1171 | 1171 | * @return string $status_class |
1172 | 1172 | */ |
1173 | -function get_the_lesson_status_class(){ |
|
1173 | +function get_the_lesson_status_class() { |
|
1174 | 1174 | |
1175 | 1175 | $status_class = ''; |
1176 | - $lesson_completed = Sensei_Utils::user_completed_lesson( get_the_ID(), get_current_user_id() ); |
|
1176 | + $lesson_completed = Sensei_Utils::user_completed_lesson(get_the_ID(), get_current_user_id()); |
|
1177 | 1177 | |
1178 | - if ( $lesson_completed ) { |
|
1178 | + if ($lesson_completed) { |
|
1179 | 1179 | $status_class = 'completed'; |
1180 | 1180 | } |
1181 | 1181 | |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | * |
1190 | 1190 | * @since 1.9.0 |
1191 | 1191 | */ |
1192 | -function sensei_the_lesson_status_class(){ |
|
1192 | +function sensei_the_lesson_status_class() { |
|
1193 | 1193 | |
1194 | 1194 | echo get_the_lesson_status_class(); |
1195 | 1195 | } |