@@ -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 | } |