@@ -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 | } |
@@ -608,41 +608,41 @@ discard block |
||
| 608 | 608 | */ |
| 609 | 609 | function sensei_get_the_module_status(){ |
| 610 | 610 | |
| 611 | - global $sensei_modules_loop; |
|
| 612 | - $module_title = $sensei_modules_loop['current_module']->name; |
|
| 613 | - $module_term_id = $sensei_modules_loop['current_module']->term_id; |
|
| 614 | - $course_id = $sensei_modules_loop['course_id']; |
|
| 615 | - $module_progress = Sensei()->modules->get_user_module_progress( $module_term_id, $course_id, get_current_user_id() ); |
|
| 611 | + global $sensei_modules_loop; |
|
| 612 | + $module_title = $sensei_modules_loop['current_module']->name; |
|
| 613 | + $module_term_id = $sensei_modules_loop['current_module']->term_id; |
|
| 614 | + $course_id = $sensei_modules_loop['course_id']; |
|
| 615 | + $module_progress = Sensei()->modules->get_user_module_progress( $module_term_id, $course_id, get_current_user_id() ); |
|
| 616 | 616 | |
| 617 | - $module_status = ''; |
|
| 618 | - if ( $module_progress && $module_progress > 0) { |
|
| 617 | + $module_status = ''; |
|
| 618 | + if ( $module_progress && $module_progress > 0) { |
|
| 619 | 619 | |
| 620 | - $module_status = __('Completed', 'woothemes-sensei'); |
|
| 620 | + $module_status = __('Completed', 'woothemes-sensei'); |
|
| 621 | 621 | |
| 622 | - if ($module_progress < 100) { |
|
| 622 | + if ($module_progress < 100) { |
|
| 623 | 623 | |
| 624 | - $module_status = __('In progress', 'woothemes-sensei'); |
|
| 624 | + $module_status = __('In progress', 'woothemes-sensei'); |
|
| 625 | 625 | |
| 626 | - } |
|
| 626 | + } |
|
| 627 | 627 | |
| 628 | - } |
|
| 628 | + } |
|
| 629 | 629 | |
| 630 | - $module_status_html = '<p class="status module-status completed">' |
|
| 631 | - . strtolower( str_replace( ' ', '-', $module_status ) ) |
|
| 632 | - . '</p>'; |
|
| 630 | + $module_status_html = '<p class="status module-status completed">' |
|
| 631 | + . strtolower( str_replace( ' ', '-', $module_status ) ) |
|
| 632 | + . '</p>'; |
|
| 633 | 633 | |
| 634 | - /** |
|
| 635 | - * Filter the module status. |
|
| 636 | - * |
|
| 637 | - * This fires within the sensei_get_the_module_status function. |
|
| 638 | - * |
|
| 639 | - * @since 1.9.0 |
|
| 640 | - * |
|
| 641 | - * @param $module_status_html |
|
| 642 | - * @param $module_term_id |
|
| 643 | - * @param $course_id |
|
| 644 | - */ |
|
| 645 | - return apply_filters( 'sensei_the_module_status_html', $module_status_html , $module_term_id, $course_id ); |
|
| 634 | + /** |
|
| 635 | + * Filter the module status. |
|
| 636 | + * |
|
| 637 | + * This fires within the sensei_get_the_module_status function. |
|
| 638 | + * |
|
| 639 | + * @since 1.9.0 |
|
| 640 | + * |
|
| 641 | + * @param $module_status_html |
|
| 642 | + * @param $module_term_id |
|
| 643 | + * @param $course_id |
|
| 644 | + */ |
|
| 645 | + return apply_filters( 'sensei_the_module_status_html', $module_status_html , $module_term_id, $course_id ); |
|
| 646 | 646 | |
| 647 | 647 | } |
| 648 | 648 | |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | */ |
| 653 | 653 | function sensei_the_module_status(){ |
| 654 | 654 | |
| 655 | - echo sensei_get_the_module_status(); |
|
| 655 | + echo sensei_get_the_module_status(); |
|
| 656 | 656 | |
| 657 | 657 | } |
| 658 | 658 | |
@@ -673,21 +673,21 @@ discard block |
||
| 673 | 673 | */ |
| 674 | 674 | function sensei_quiz_has_questions(){ |
| 675 | 675 | |
| 676 | - global $sensei_question_loop; |
|
| 676 | + global $sensei_question_loop; |
|
| 677 | 677 | |
| 678 | - if( !isset( $sensei_question_loop['total'] ) ){ |
|
| 679 | - return false; |
|
| 680 | - } |
|
| 678 | + if( !isset( $sensei_question_loop['total'] ) ){ |
|
| 679 | + return false; |
|
| 680 | + } |
|
| 681 | 681 | |
| 682 | - if( $sensei_question_loop['current'] + 1 < $sensei_question_loop['total'] ){ |
|
| 682 | + if( $sensei_question_loop['current'] + 1 < $sensei_question_loop['total'] ){ |
|
| 683 | 683 | |
| 684 | - return true; |
|
| 684 | + return true; |
|
| 685 | 685 | |
| 686 | - }else{ |
|
| 686 | + }else{ |
|
| 687 | 687 | |
| 688 | - return false; |
|
| 688 | + return false; |
|
| 689 | 689 | |
| 690 | - } |
|
| 690 | + } |
|
| 691 | 691 | |
| 692 | 692 | }// end sensei_quiz_has_questions |
| 693 | 693 | |
@@ -698,15 +698,14 @@ discard block |
||
| 698 | 698 | * execution. |
| 699 | 699 | * |
| 700 | 700 | * @since 1.9.0 |
| 701 | - |
|
| 702 | 701 | */ |
| 703 | 702 | function sensei_setup_the_question(){ |
| 704 | 703 | |
| 705 | - global $sensei_question_loop; |
|
| 704 | + global $sensei_question_loop; |
|
| 706 | 705 | |
| 707 | - $sensei_question_loop['current']++; |
|
| 708 | - $index = $sensei_question_loop['current']; |
|
| 709 | - $sensei_question_loop['current_question'] = $sensei_question_loop['questions'][ $index ] ; |
|
| 706 | + $sensei_question_loop['current']++; |
|
| 707 | + $index = $sensei_question_loop['current']; |
|
| 708 | + $sensei_question_loop['current_question'] = $sensei_question_loop['questions'][ $index ] ; |
|
| 710 | 709 | |
| 711 | 710 | |
| 712 | 711 | }// end sensei_setup_the_question |
@@ -719,12 +718,12 @@ discard block |
||
| 719 | 718 | */ |
| 720 | 719 | function sensei_the_question_content(){ |
| 721 | 720 | |
| 722 | - global $sensei_question_loop; |
|
| 721 | + global $sensei_question_loop; |
|
| 723 | 722 | |
| 724 | - $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID ); |
|
| 723 | + $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID ); |
|
| 725 | 724 | |
| 726 | - // load the template that displays the question information. |
|
| 727 | - WooThemes_Sensei_Question::load_question_template( $question_type ); |
|
| 725 | + // load the template that displays the question information. |
|
| 726 | + WooThemes_Sensei_Question::load_question_template( $question_type ); |
|
| 728 | 727 | |
| 729 | 728 | }// end sensei_the_question_content |
| 730 | 729 | |
@@ -735,26 +734,26 @@ discard block |
||
| 735 | 734 | */ |
| 736 | 735 | function sensei_the_question_class(){ |
| 737 | 736 | |
| 738 | - global $sensei_question_loop; |
|
| 737 | + global $sensei_question_loop; |
|
| 739 | 738 | |
| 740 | - $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID ); |
|
| 739 | + $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID ); |
|
| 741 | 740 | |
| 742 | - /** |
|
| 743 | - * filter the sensei question class within |
|
| 744 | - * the quiz question loop. |
|
| 745 | - * |
|
| 746 | - * @since 1.9.0 |
|
| 747 | - */ |
|
| 748 | - $classes = apply_filters( 'sensei_question_classes', array( $question_type ) ); |
|
| 741 | + /** |
|
| 742 | + * filter the sensei question class within |
|
| 743 | + * the quiz question loop. |
|
| 744 | + * |
|
| 745 | + * @since 1.9.0 |
|
| 746 | + */ |
|
| 747 | + $classes = apply_filters( 'sensei_question_classes', array( $question_type ) ); |
|
| 749 | 748 | |
| 750 | - $html_classes = ''; |
|
| 751 | - foreach( $classes as $class ){ |
|
| 749 | + $html_classes = ''; |
|
| 750 | + foreach( $classes as $class ){ |
|
| 752 | 751 | |
| 753 | - $html_classes .= $class . ' '; |
|
| 752 | + $html_classes .= $class . ' '; |
|
| 754 | 753 | |
| 755 | - }// end foreach |
|
| 754 | + }// end foreach |
|
| 756 | 755 | |
| 757 | - esc_attr_e( trim( $html_classes ) ); |
|
| 756 | + esc_attr_e( trim( $html_classes ) ); |
|
| 758 | 757 | |
| 759 | 758 | } |
| 760 | 759 | |
@@ -765,12 +764,12 @@ discard block |
||
| 765 | 764 | */ |
| 766 | 765 | function sensei_get_the_question_id( ){ |
| 767 | 766 | |
| 768 | - global $sensei_question_loop; |
|
| 769 | - if( isset( $sensei_question_loop['current_question']->ID ) ){ |
|
| 767 | + global $sensei_question_loop; |
|
| 768 | + if( isset( $sensei_question_loop['current_question']->ID ) ){ |
|
| 770 | 769 | |
| 771 | - return $sensei_question_loop['current_question']->ID; |
|
| 770 | + return $sensei_question_loop['current_question']->ID; |
|
| 772 | 771 | |
| 773 | - } |
|
| 772 | + } |
|
| 774 | 773 | |
| 775 | 774 | }// end sensei_the_question_id |
| 776 | 775 | |
@@ -797,63 +796,63 @@ discard block |
||
| 797 | 796 | */ |
| 798 | 797 | function sensei_can_user_view_lesson( $lesson_id = '', $user_id = '' ){ |
| 799 | 798 | |
| 800 | - if( empty( $lesson_id ) ){ |
|
| 799 | + if( empty( $lesson_id ) ){ |
|
| 801 | 800 | |
| 802 | - $lesson_id = get_the_ID(); |
|
| 801 | + $lesson_id = get_the_ID(); |
|
| 803 | 802 | |
| 804 | - } |
|
| 803 | + } |
|
| 805 | 804 | |
| 806 | - if( empty( $user_id ) ){ |
|
| 805 | + if( empty( $user_id ) ){ |
|
| 807 | 806 | |
| 808 | - $user_id = get_current_user_id(); |
|
| 807 | + $user_id = get_current_user_id(); |
|
| 809 | 808 | |
| 810 | - } |
|
| 809 | + } |
|
| 811 | 810 | |
| 812 | - // Check for prerequisite lesson completions |
|
| 813 | - $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete( $lesson_id, $user_id ); |
|
| 814 | - $lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true ); |
|
| 815 | - $user_taking_course = Sensei_Utils::user_started_course( $lesson_course_id, $user_id ); |
|
| 811 | + // Check for prerequisite lesson completions |
|
| 812 | + $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete( $lesson_id, $user_id ); |
|
| 813 | + $lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true ); |
|
| 814 | + $user_taking_course = Sensei_Utils::user_started_course( $lesson_course_id, $user_id ); |
|
| 816 | 815 | |
| 817 | - $is_preview = false; |
|
| 818 | - if( Sensei_Utils::is_preview_lesson( $lesson_id ) ) { |
|
| 816 | + $is_preview = false; |
|
| 817 | + if( Sensei_Utils::is_preview_lesson( $lesson_id ) ) { |
|
| 819 | 818 | |
| 820 | - $is_preview = true; |
|
| 821 | - $pre_requisite_complete = true; |
|
| 819 | + $is_preview = true; |
|
| 820 | + $pre_requisite_complete = true; |
|
| 822 | 821 | |
| 823 | - }; |
|
| 822 | + }; |
|
| 824 | 823 | |
| 825 | 824 | |
| 826 | - $user_can_access_lesson = false; |
|
| 825 | + $user_can_access_lesson = false; |
|
| 827 | 826 | |
| 828 | - if( is_user_logged_in() && $user_taking_course ){ |
|
| 827 | + if( is_user_logged_in() && $user_taking_course ){ |
|
| 829 | 828 | |
| 830 | - $user_can_access_lesson = true; |
|
| 829 | + $user_can_access_lesson = true; |
|
| 831 | 830 | |
| 832 | - } |
|
| 831 | + } |
|
| 833 | 832 | |
| 834 | 833 | |
| 835 | - $access_permission = false; |
|
| 834 | + $access_permission = false; |
|
| 836 | 835 | |
| 837 | - if ( ! Sensei()->settings->get('access_permission') || sensei_all_access() ) { |
|
| 836 | + if ( ! Sensei()->settings->get('access_permission') || sensei_all_access() ) { |
|
| 838 | 837 | |
| 839 | - $access_permission = true; |
|
| 838 | + $access_permission = true; |
|
| 840 | 839 | |
| 841 | - } |
|
| 840 | + } |
|
| 842 | 841 | |
| 843 | - $can_user_view_lesson = $access_permission || ( $user_can_access_lesson && $pre_requisite_complete ) || $is_preview; |
|
| 842 | + $can_user_view_lesson = $access_permission || ( $user_can_access_lesson && $pre_requisite_complete ) || $is_preview; |
|
| 844 | 843 | |
| 845 | - /** |
|
| 846 | - * Filter the can user view lesson function |
|
| 847 | - * |
|
| 848 | - * @since 1.9.0 |
|
| 849 | - * |
|
| 850 | - * @hooked Sensei_WC::alter_can_user_view_lesson |
|
| 851 | - * |
|
| 852 | - * @param bool $can_user_view_lesson |
|
| 853 | - * @param string $lesson_id |
|
| 854 | - * @param string $user_id |
|
| 855 | - */ |
|
| 856 | - return apply_filters( 'sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id ); |
|
| 844 | + /** |
|
| 845 | + * Filter the can user view lesson function |
|
| 846 | + * |
|
| 847 | + * @since 1.9.0 |
|
| 848 | + * |
|
| 849 | + * @hooked Sensei_WC::alter_can_user_view_lesson |
|
| 850 | + * |
|
| 851 | + * @param bool $can_user_view_lesson |
|
| 852 | + * @param string $lesson_id |
|
| 853 | + * @param string $user_id |
|
| 854 | + */ |
|
| 855 | + return apply_filters( 'sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id ); |
|
| 857 | 856 | |
| 858 | 857 | } // end sensei_can_current_user_view_lesson |
| 859 | 858 | |
@@ -865,49 +864,49 @@ discard block |
||
| 865 | 864 | */ |
| 866 | 865 | function sensei_the_single_lesson_meta(){ |
| 867 | 866 | |
| 868 | - // if the lesson meta is included within theme load that instead of the function content |
|
| 869 | - $template = Sensei_Templates::locate_template( 'single-lesson/lesson-meta.php' ); |
|
| 870 | - if( ! empty( $template ) ){ |
|
| 867 | + // if the lesson meta is included within theme load that instead of the function content |
|
| 868 | + $template = Sensei_Templates::locate_template( 'single-lesson/lesson-meta.php' ); |
|
| 869 | + if( ! empty( $template ) ){ |
|
| 871 | 870 | |
| 872 | - Sensei_Templates::get_template( 'single-lesson/lesson-meta.php' ); |
|
| 873 | - return; |
|
| 871 | + Sensei_Templates::get_template( 'single-lesson/lesson-meta.php' ); |
|
| 872 | + return; |
|
| 874 | 873 | |
| 875 | - } |
|
| 876 | - |
|
| 877 | - // Get the meta info |
|
| 878 | - $lesson_course_id = absint( get_post_meta( get_the_ID(), '_lesson_course', true ) ); |
|
| 879 | - $is_preview = Sensei_Utils::is_preview_lesson( get_the_ID() ); |
|
| 874 | + } |
|
| 880 | 875 | |
| 881 | - // Complete Lesson Logic |
|
| 882 | - do_action( 'sensei_complete_lesson' ); |
|
| 883 | - // Check that the course has been started |
|
| 884 | - if ( Sensei()->access_settings() |
|
| 885 | - || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) |
|
| 886 | - || $is_preview ) { |
|
| 887 | - ?> |
|
| 876 | + // Get the meta info |
|
| 877 | + $lesson_course_id = absint( get_post_meta( get_the_ID(), '_lesson_course', true ) ); |
|
| 878 | + $is_preview = Sensei_Utils::is_preview_lesson( get_the_ID() ); |
|
| 879 | + |
|
| 880 | + // Complete Lesson Logic |
|
| 881 | + do_action( 'sensei_complete_lesson' ); |
|
| 882 | + // Check that the course has been started |
|
| 883 | + if ( Sensei()->access_settings() |
|
| 884 | + || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) |
|
| 885 | + || $is_preview ) { |
|
| 886 | + ?> |
|
| 888 | 887 | <section class="lesson-meta"> |
| 889 | 888 | <?php |
| 890 | - if( apply_filters( 'sensei_video_position', 'top', get_the_ID() ) == 'bottom' ) { |
|
| 889 | + if( apply_filters( 'sensei_video_position', 'top', get_the_ID() ) == 'bottom' ) { |
|
| 891 | 890 | |
| 892 | - do_action( 'sensei_lesson_video', get_the_ID() ); |
|
| 891 | + do_action( 'sensei_lesson_video', get_the_ID() ); |
|
| 893 | 892 | |
| 894 | - } |
|
| 895 | - ?> |
|
| 893 | + } |
|
| 894 | + ?> |
|
| 896 | 895 | <?php do_action( 'sensei_frontend_messages' ); ?> |
| 897 | 896 | |
| 898 | 897 | <?php if ( ! $is_preview |
| 899 | - || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) ) { |
|
| 898 | + || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) ) { |
|
| 900 | 899 | |
| 901 | - 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() ) ); |
|
| 900 | + 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() ) ); |
|
| 902 | 901 | |
| 903 | - } ?> |
|
| 902 | + } ?> |
|
| 904 | 903 | </section> |
| 905 | 904 | |
| 906 | 905 | <?php do_action( 'sensei_lesson_back_link', $lesson_course_id ); ?> |
| 907 | 906 | |
| 908 | 907 | <?php } |
| 909 | 908 | |
| 910 | - do_action( 'sensei_lesson_meta_extra', get_the_ID() ); |
|
| 909 | + do_action( 'sensei_lesson_meta_extra', get_the_ID() ); |
|
| 911 | 910 | |
| 912 | 911 | } // end the_single_lesson_meta |
| 913 | 912 | |
@@ -923,16 +922,16 @@ discard block |
||
| 923 | 922 | */ |
| 924 | 923 | function get_sensei_header(){ |
| 925 | 924 | |
| 926 | - if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 925 | + if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 927 | 926 | |
| 928 | - get_header(); |
|
| 927 | + get_header(); |
|
| 929 | 928 | |
| 930 | - /** |
|
| 931 | - * sensei_before_main_content hook |
|
| 932 | - * |
|
| 933 | - * @hooked sensei_output_content_wrapper - 10 (outputs opening divs for the content) |
|
| 934 | - */ |
|
| 935 | - do_action( 'sensei_before_main_content' ); |
|
| 929 | + /** |
|
| 930 | + * sensei_before_main_content hook |
|
| 931 | + * |
|
| 932 | + * @hooked sensei_output_content_wrapper - 10 (outputs opening divs for the content) |
|
| 933 | + */ |
|
| 934 | + do_action( 'sensei_before_main_content' ); |
|
| 936 | 935 | |
| 937 | 936 | }// end get_sensei_header |
| 938 | 937 | |
@@ -948,28 +947,28 @@ discard block |
||
| 948 | 947 | */ |
| 949 | 948 | function get_sensei_footer(){ |
| 950 | 949 | |
| 951 | - /** |
|
| 952 | - * sensei_pagination hook |
|
| 953 | - * |
|
| 954 | - * @hooked sensei_pagination - 10 (outputs pagination) |
|
| 955 | - */ |
|
| 956 | - do_action( 'sensei_pagination' ); |
|
| 957 | - |
|
| 958 | - /** |
|
| 959 | - * sensei_after_main_content hook |
|
| 960 | - * |
|
| 961 | - * @hooked sensei_output_content_wrapper_end - 10 (outputs closing divs for the content) |
|
| 962 | - */ |
|
| 963 | - do_action( 'sensei_after_main_content' ); |
|
| 964 | - |
|
| 965 | - /** |
|
| 966 | - * sensei_sidebar hook |
|
| 967 | - * |
|
| 968 | - * @hooked sensei_get_sidebar - 10 |
|
| 969 | - */ |
|
| 970 | - do_action( 'sensei_sidebar' ); |
|
| 971 | - |
|
| 972 | - get_footer(); |
|
| 950 | + /** |
|
| 951 | + * sensei_pagination hook |
|
| 952 | + * |
|
| 953 | + * @hooked sensei_pagination - 10 (outputs pagination) |
|
| 954 | + */ |
|
| 955 | + do_action( 'sensei_pagination' ); |
|
| 956 | + |
|
| 957 | + /** |
|
| 958 | + * sensei_after_main_content hook |
|
| 959 | + * |
|
| 960 | + * @hooked sensei_output_content_wrapper_end - 10 (outputs closing divs for the content) |
|
| 961 | + */ |
|
| 962 | + do_action( 'sensei_after_main_content' ); |
|
| 963 | + |
|
| 964 | + /** |
|
| 965 | + * sensei_sidebar hook |
|
| 966 | + * |
|
| 967 | + * @hooked sensei_get_sidebar - 10 |
|
| 968 | + */ |
|
| 969 | + do_action( 'sensei_sidebar' ); |
|
| 970 | + |
|
| 971 | + get_footer(); |
|
| 973 | 972 | |
| 974 | 973 | }// end get_sensei_header |
| 975 | 974 | |
@@ -981,14 +980,14 @@ discard block |
||
| 981 | 980 | */ |
| 982 | 981 | function the_no_permissions_title(){ |
| 983 | 982 | |
| 984 | - /** |
|
| 985 | - * Filter the no permissions title just before it is echo'd on the |
|
| 986 | - * no-permissions.php file. |
|
| 987 | - * |
|
| 988 | - * @since 1.9.0 |
|
| 989 | - * @param $no_permissions_title |
|
| 990 | - */ |
|
| 991 | - echo apply_filters( 'sensei_the_no_permissions_title', Sensei()->permissions_message['title'] ); |
|
| 983 | + /** |
|
| 984 | + * Filter the no permissions title just before it is echo'd on the |
|
| 985 | + * no-permissions.php file. |
|
| 986 | + * |
|
| 987 | + * @since 1.9.0 |
|
| 988 | + * @param $no_permissions_title |
|
| 989 | + */ |
|
| 990 | + echo apply_filters( 'sensei_the_no_permissions_title', Sensei()->permissions_message['title'] ); |
|
| 992 | 991 | |
| 993 | 992 | } |
| 994 | 993 | |
@@ -999,14 +998,14 @@ discard block |
||
| 999 | 998 | */ |
| 1000 | 999 | function the_no_permissions_message( $post_id ){ |
| 1001 | 1000 | |
| 1002 | - /** |
|
| 1003 | - * Filter the no permissions message just before it is echo'd on the |
|
| 1004 | - * no-permissions.php file. |
|
| 1005 | - * |
|
| 1006 | - * @since 1.9.0 |
|
| 1007 | - * @param $no_permissions_message |
|
| 1008 | - */ |
|
| 1009 | - echo apply_filters( 'sensei_the_no_permissions_message', Sensei()->permissions_message['message'] , $post_id ); |
|
| 1001 | + /** |
|
| 1002 | + * Filter the no permissions message just before it is echo'd on the |
|
| 1003 | + * no-permissions.php file. |
|
| 1004 | + * |
|
| 1005 | + * @since 1.9.0 |
|
| 1006 | + * @param $no_permissions_message |
|
| 1007 | + */ |
|
| 1008 | + echo apply_filters( 'sensei_the_no_permissions_message', Sensei()->permissions_message['message'] , $post_id ); |
|
| 1010 | 1009 | |
| 1011 | 1010 | } |
| 1012 | 1011 | |
@@ -1017,8 +1016,8 @@ discard block |
||
| 1017 | 1016 | */ |
| 1018 | 1017 | function sensei_the_excerpt( $post_id ){ |
| 1019 | 1018 | |
| 1020 | - global $post; |
|
| 1021 | - the_excerpt( $post ); |
|
| 1019 | + global $post; |
|
| 1020 | + the_excerpt( $post ); |
|
| 1022 | 1021 | |
| 1023 | 1022 | } |
| 1024 | 1023 | |
@@ -1032,9 +1031,9 @@ discard block |
||
| 1032 | 1031 | */ |
| 1033 | 1032 | function sensei_get_current_page_url(){ |
| 1034 | 1033 | |
| 1035 | - global $wp; |
|
| 1036 | - $current_page_url = home_url( $wp->request ); |
|
| 1037 | - return $current_page_url; |
|
| 1034 | + global $wp; |
|
| 1035 | + $current_page_url = home_url( $wp->request ); |
|
| 1036 | + return $current_page_url; |
|
| 1038 | 1037 | |
| 1039 | 1038 | } |
| 1040 | 1039 | |
@@ -1046,7 +1045,7 @@ discard block |
||
| 1046 | 1045 | */ |
| 1047 | 1046 | function sensei_the_my_courses_content(){ |
| 1048 | 1047 | |
| 1049 | - echo Sensei()->course->load_user_courses_content( wp_get_current_user() ); |
|
| 1048 | + echo Sensei()->course->load_user_courses_content( wp_get_current_user() ); |
|
| 1050 | 1049 | |
| 1051 | 1050 | } // sensei_the_my_courses_content |
| 1052 | 1051 | |
@@ -1061,7 +1060,7 @@ discard block |
||
| 1061 | 1060 | */ |
| 1062 | 1061 | function sensei_load_template( $template_name ){ |
| 1063 | 1062 | |
| 1064 | - Sensei_Templates::get_template( $template_name ); |
|
| 1063 | + Sensei_Templates::get_template( $template_name ); |
|
| 1065 | 1064 | |
| 1066 | 1065 | } |
| 1067 | 1066 | |
@@ -1075,7 +1074,7 @@ discard block |
||
| 1075 | 1074 | */ |
| 1076 | 1075 | function sensei_load_template_part( $slug, $name ){ |
| 1077 | 1076 | |
| 1078 | - Sensei_Templates::get_part( $slug, $name ); |
|
| 1077 | + Sensei_Templates::get_part( $slug, $name ); |
|
| 1079 | 1078 | |
| 1080 | 1079 | } |
| 1081 | 1080 | |
@@ -1094,17 +1093,17 @@ discard block |
||
| 1094 | 1093 | */ |
| 1095 | 1094 | function sensei_the_lesson_excerpt( $lesson_id = '' ) { |
| 1096 | 1095 | |
| 1097 | - if( empty( $lesson_id )){ |
|
| 1096 | + if( empty( $lesson_id )){ |
|
| 1098 | 1097 | |
| 1099 | - $lesson_id = get_the_ID(); |
|
| 1098 | + $lesson_id = get_the_ID(); |
|
| 1100 | 1099 | |
| 1101 | - } |
|
| 1100 | + } |
|
| 1102 | 1101 | |
| 1103 | - if( 'lesson' != get_post_type( $lesson_id ) ){ |
|
| 1104 | - return; |
|
| 1105 | - } |
|
| 1102 | + if( 'lesson' != get_post_type( $lesson_id ) ){ |
|
| 1103 | + return; |
|
| 1104 | + } |
|
| 1106 | 1105 | |
| 1107 | - echo Sensei_Lesson::lesson_excerpt( get_post( $lesson_id ), false ); |
|
| 1106 | + echo Sensei_Lesson::lesson_excerpt( get_post( $lesson_id ), false ); |
|
| 1108 | 1107 | |
| 1109 | 1108 | }// End lesson_excerpt() |
| 1110 | 1109 | |
@@ -1114,16 +1113,16 @@ discard block |
||
| 1114 | 1113 | * @since 1.9.0 |
| 1115 | 1114 | */ |
| 1116 | 1115 | function sensei_the_course_results_lessons(){ |
| 1117 | - // load backwards compatible template name if it exists in the users theme |
|
| 1118 | - $located_template= locate_template( Sensei()->template_url . 'course-results/course-lessons.php' ); |
|
| 1119 | - if( $located_template ){ |
|
| 1116 | + // load backwards compatible template name if it exists in the users theme |
|
| 1117 | + $located_template= locate_template( Sensei()->template_url . 'course-results/course-lessons.php' ); |
|
| 1118 | + if( $located_template ){ |
|
| 1120 | 1119 | |
| 1121 | - Sensei_Templates::get_template( 'course-results/course-lessons.php' ); |
|
| 1122 | - return; |
|
| 1120 | + Sensei_Templates::get_template( 'course-results/course-lessons.php' ); |
|
| 1121 | + return; |
|
| 1123 | 1122 | |
| 1124 | - } |
|
| 1123 | + } |
|
| 1125 | 1124 | |
| 1126 | - Sensei_Templates::get_template( 'course-results/lessons.php' ); |
|
| 1125 | + Sensei_Templates::get_template( 'course-results/lessons.php' ); |
|
| 1127 | 1126 | } |
| 1128 | 1127 | |
| 1129 | 1128 | /** |
@@ -1135,7 +1134,7 @@ discard block |
||
| 1135 | 1134 | */ |
| 1136 | 1135 | function sensei_courses_per_row(){ |
| 1137 | 1136 | |
| 1138 | - echo Sensei_Course::get_loop_number_of_columns(); |
|
| 1137 | + echo Sensei_Course::get_loop_number_of_columns(); |
|
| 1139 | 1138 | |
| 1140 | 1139 | } |
| 1141 | 1140 | |
@@ -1149,7 +1148,7 @@ discard block |
||
| 1149 | 1148 | */ |
| 1150 | 1149 | function sensei_get_template( $template_name, $args, $path ){ |
| 1151 | 1150 | |
| 1152 | - Sensei_Templates::get_template( $template_name, $args, $path ); |
|
| 1151 | + Sensei_Templates::get_template( $template_name, $args, $path ); |
|
| 1153 | 1152 | |
| 1154 | 1153 | } |
| 1155 | 1154 | |
@@ -1163,14 +1162,14 @@ discard block |
||
| 1163 | 1162 | */ |
| 1164 | 1163 | function get_the_lesson_status_class(){ |
| 1165 | 1164 | |
| 1166 | - $status_class = ''; |
|
| 1167 | - $lesson_completed = Sensei_Utils::user_completed_lesson( get_the_ID(), get_current_user_id() ); |
|
| 1165 | + $status_class = ''; |
|
| 1166 | + $lesson_completed = Sensei_Utils::user_completed_lesson( get_the_ID(), get_current_user_id() ); |
|
| 1168 | 1167 | |
| 1169 | - if ( $lesson_completed ) { |
|
| 1170 | - $status_class = 'completed'; |
|
| 1171 | - } |
|
| 1168 | + if ( $lesson_completed ) { |
|
| 1169 | + $status_class = 'completed'; |
|
| 1170 | + } |
|
| 1172 | 1171 | |
| 1173 | - return $status_class; |
|
| 1172 | + return $status_class; |
|
| 1174 | 1173 | |
| 1175 | 1174 | }// end get_the_lesson_status_class |
| 1176 | 1175 | /** |
@@ -1182,5 +1181,5 @@ discard block |
||
| 1182 | 1181 | */ |
| 1183 | 1182 | function sensei_the_lesson_status_class(){ |
| 1184 | 1183 | |
| 1185 | - echo get_the_lesson_status_class(); |
|
| 1184 | + echo get_the_lesson_status_class(); |
|
| 1186 | 1185 | } |
@@ -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,16 +606,16 @@ 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 | 611 | global $sensei_modules_loop; |
| 612 | 612 | $module_title = $sensei_modules_loop['current_module']->name; |
| 613 | 613 | $module_term_id = $sensei_modules_loop['current_module']->term_id; |
| 614 | 614 | $course_id = $sensei_modules_loop['course_id']; |
| 615 | - $module_progress = Sensei()->modules->get_user_module_progress( $module_term_id, $course_id, get_current_user_id() ); |
|
| 615 | + $module_progress = Sensei()->modules->get_user_module_progress($module_term_id, $course_id, get_current_user_id()); |
|
| 616 | 616 | |
| 617 | - $module_status = ''; |
|
| 618 | - if ( $module_progress && $module_progress > 0) { |
|
| 617 | + $module_status = ''; |
|
| 618 | + if ($module_progress && $module_progress > 0) { |
|
| 619 | 619 | |
| 620 | 620 | $module_status = __('Completed', 'woothemes-sensei'); |
| 621 | 621 | |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | $module_status_html = '<p class="status module-status completed">' |
| 631 | - . strtolower( str_replace( ' ', '-', $module_status ) ) |
|
| 631 | + . strtolower(str_replace(' ', '-', $module_status)) |
|
| 632 | 632 | . '</p>'; |
| 633 | 633 | |
| 634 | 634 | /** |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | * @param $module_term_id |
| 643 | 643 | * @param $course_id |
| 644 | 644 | */ |
| 645 | - return apply_filters( 'sensei_the_module_status_html', $module_status_html , $module_term_id, $course_id ); |
|
| 645 | + return apply_filters('sensei_the_module_status_html', $module_status_html, $module_term_id, $course_id); |
|
| 646 | 646 | |
| 647 | 647 | } |
| 648 | 648 | |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | * Print out the current module status |
| 651 | 651 | * @since 1.9.0 |
| 652 | 652 | */ |
| 653 | -function sensei_the_module_status(){ |
|
| 653 | +function sensei_the_module_status() { |
|
| 654 | 654 | |
| 655 | 655 | echo sensei_get_the_module_status(); |
| 656 | 656 | |
@@ -671,19 +671,19 @@ discard block |
||
| 671 | 671 | * |
| 672 | 672 | * @return bool |
| 673 | 673 | */ |
| 674 | -function sensei_quiz_has_questions(){ |
|
| 674 | +function sensei_quiz_has_questions() { |
|
| 675 | 675 | |
| 676 | 676 | global $sensei_question_loop; |
| 677 | 677 | |
| 678 | - if( !isset( $sensei_question_loop['total'] ) ){ |
|
| 678 | + if ( ! isset($sensei_question_loop['total'])) { |
|
| 679 | 679 | return false; |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | - if( $sensei_question_loop['current'] + 1 < $sensei_question_loop['total'] ){ |
|
| 682 | + if ($sensei_question_loop['current'] + 1 < $sensei_question_loop['total']) { |
|
| 683 | 683 | |
| 684 | 684 | return true; |
| 685 | 685 | |
| 686 | - }else{ |
|
| 686 | + } else { |
|
| 687 | 687 | |
| 688 | 688 | return false; |
| 689 | 689 | |
@@ -700,13 +700,13 @@ discard block |
||
| 700 | 700 | * @since 1.9.0 |
| 701 | 701 | |
| 702 | 702 | */ |
| 703 | -function sensei_setup_the_question(){ |
|
| 703 | +function sensei_setup_the_question() { |
|
| 704 | 704 | |
| 705 | 705 | global $sensei_question_loop; |
| 706 | 706 | |
| 707 | 707 | $sensei_question_loop['current']++; |
| 708 | 708 | $index = $sensei_question_loop['current']; |
| 709 | - $sensei_question_loop['current_question'] = $sensei_question_loop['questions'][ $index ] ; |
|
| 709 | + $sensei_question_loop['current_question'] = $sensei_question_loop['questions'][$index]; |
|
| 710 | 710 | |
| 711 | 711 | |
| 712 | 712 | }// end sensei_setup_the_question |
@@ -717,14 +717,14 @@ discard block |
||
| 717 | 717 | * This function gets the type and loads the template that will handle it. |
| 718 | 718 | * |
| 719 | 719 | */ |
| 720 | -function sensei_the_question_content(){ |
|
| 720 | +function sensei_the_question_content() { |
|
| 721 | 721 | |
| 722 | 722 | global $sensei_question_loop; |
| 723 | 723 | |
| 724 | - $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID ); |
|
| 724 | + $question_type = Sensei()->question->get_question_type($sensei_question_loop['current_question']->ID); |
|
| 725 | 725 | |
| 726 | 726 | // load the template that displays the question information. |
| 727 | - WooThemes_Sensei_Question::load_question_template( $question_type ); |
|
| 727 | + WooThemes_Sensei_Question::load_question_template($question_type); |
|
| 728 | 728 | |
| 729 | 729 | }// end sensei_the_question_content |
| 730 | 730 | |
@@ -733,11 +733,11 @@ discard block |
||
| 733 | 733 | * |
| 734 | 734 | * @since 1.9.0 |
| 735 | 735 | */ |
| 736 | -function sensei_the_question_class(){ |
|
| 736 | +function sensei_the_question_class() { |
|
| 737 | 737 | |
| 738 | 738 | global $sensei_question_loop; |
| 739 | 739 | |
| 740 | - $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID ); |
|
| 740 | + $question_type = Sensei()->question->get_question_type($sensei_question_loop['current_question']->ID); |
|
| 741 | 741 | |
| 742 | 742 | /** |
| 743 | 743 | * filter the sensei question class within |
@@ -745,16 +745,16 @@ discard block |
||
| 745 | 745 | * |
| 746 | 746 | * @since 1.9.0 |
| 747 | 747 | */ |
| 748 | - $classes = apply_filters( 'sensei_question_classes', array( $question_type ) ); |
|
| 748 | + $classes = apply_filters('sensei_question_classes', array($question_type)); |
|
| 749 | 749 | |
| 750 | 750 | $html_classes = ''; |
| 751 | - foreach( $classes as $class ){ |
|
| 751 | + foreach ($classes as $class) { |
|
| 752 | 752 | |
| 753 | - $html_classes .= $class . ' '; |
|
| 753 | + $html_classes .= $class.' '; |
|
| 754 | 754 | |
| 755 | 755 | }// end foreach |
| 756 | 756 | |
| 757 | - esc_attr_e( trim( $html_classes ) ); |
|
| 757 | + esc_attr_e(trim($html_classes)); |
|
| 758 | 758 | |
| 759 | 759 | } |
| 760 | 760 | |
@@ -763,10 +763,10 @@ discard block |
||
| 763 | 763 | * |
| 764 | 764 | * @since 1.9.0 |
| 765 | 765 | */ |
| 766 | -function sensei_get_the_question_id( ){ |
|
| 766 | +function sensei_get_the_question_id( ) { |
|
| 767 | 767 | |
| 768 | 768 | global $sensei_question_loop; |
| 769 | - if( isset( $sensei_question_loop['current_question']->ID ) ){ |
|
| 769 | + if (isset($sensei_question_loop['current_question']->ID)) { |
|
| 770 | 770 | |
| 771 | 771 | return $sensei_question_loop['current_question']->ID; |
| 772 | 772 | |
@@ -795,27 +795,27 @@ discard block |
||
| 795 | 795 | * @param string $lesson_id |
| 796 | 796 | * @return bool |
| 797 | 797 | */ |
| 798 | -function sensei_can_user_view_lesson( $lesson_id = '', $user_id = '' ){ |
|
| 798 | +function sensei_can_user_view_lesson($lesson_id = '', $user_id = '') { |
|
| 799 | 799 | |
| 800 | - if( empty( $lesson_id ) ){ |
|
| 800 | + if (empty($lesson_id)) { |
|
| 801 | 801 | |
| 802 | 802 | $lesson_id = get_the_ID(); |
| 803 | 803 | |
| 804 | 804 | } |
| 805 | 805 | |
| 806 | - if( empty( $user_id ) ){ |
|
| 806 | + if (empty($user_id)) { |
|
| 807 | 807 | |
| 808 | 808 | $user_id = get_current_user_id(); |
| 809 | 809 | |
| 810 | 810 | } |
| 811 | 811 | |
| 812 | 812 | // Check for prerequisite lesson completions |
| 813 | - $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete( $lesson_id, $user_id ); |
|
| 814 | - $lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true ); |
|
| 815 | - $user_taking_course = Sensei_Utils::user_started_course( $lesson_course_id, $user_id ); |
|
| 813 | + $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete($lesson_id, $user_id); |
|
| 814 | + $lesson_course_id = get_post_meta($lesson_id, '_lesson_course', true); |
|
| 815 | + $user_taking_course = Sensei_Utils::user_started_course($lesson_course_id, $user_id); |
|
| 816 | 816 | |
| 817 | 817 | $is_preview = false; |
| 818 | - if( Sensei_Utils::is_preview_lesson( $lesson_id ) ) { |
|
| 818 | + if (Sensei_Utils::is_preview_lesson($lesson_id)) { |
|
| 819 | 819 | |
| 820 | 820 | $is_preview = true; |
| 821 | 821 | $pre_requisite_complete = true; |
@@ -823,24 +823,24 @@ discard block |
||
| 823 | 823 | }; |
| 824 | 824 | |
| 825 | 825 | |
| 826 | - $user_can_access_lesson = false; |
|
| 826 | + $user_can_access_lesson = false; |
|
| 827 | 827 | |
| 828 | - if( is_user_logged_in() && $user_taking_course ){ |
|
| 828 | + if (is_user_logged_in() && $user_taking_course) { |
|
| 829 | 829 | |
| 830 | - $user_can_access_lesson = true; |
|
| 830 | + $user_can_access_lesson = true; |
|
| 831 | 831 | |
| 832 | 832 | } |
| 833 | 833 | |
| 834 | 834 | |
| 835 | 835 | $access_permission = false; |
| 836 | 836 | |
| 837 | - if ( ! Sensei()->settings->get('access_permission') || sensei_all_access() ) { |
|
| 837 | + if ( ! Sensei()->settings->get('access_permission') || sensei_all_access()) { |
|
| 838 | 838 | |
| 839 | 839 | $access_permission = true; |
| 840 | 840 | |
| 841 | 841 | } |
| 842 | 842 | |
| 843 | - $can_user_view_lesson = $access_permission || ( $user_can_access_lesson && $pre_requisite_complete ) || $is_preview; |
|
| 843 | + $can_user_view_lesson = $access_permission || ($user_can_access_lesson && $pre_requisite_complete) || $is_preview; |
|
| 844 | 844 | |
| 845 | 845 | /** |
| 846 | 846 | * Filter the can user view lesson function |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | * @param string $lesson_id |
| 854 | 854 | * @param string $user_id |
| 855 | 855 | */ |
| 856 | - return apply_filters( 'sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id ); |
|
| 856 | + return apply_filters('sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id); |
|
| 857 | 857 | |
| 858 | 858 | } // end sensei_can_current_user_view_lesson |
| 859 | 859 | |
@@ -863,51 +863,51 @@ discard block |
||
| 863 | 863 | * The function should only be called on the single lesson |
| 864 | 864 | * |
| 865 | 865 | */ |
| 866 | -function sensei_the_single_lesson_meta(){ |
|
| 866 | +function sensei_the_single_lesson_meta() { |
|
| 867 | 867 | |
| 868 | 868 | // if the lesson meta is included within theme load that instead of the function content |
| 869 | - $template = Sensei_Templates::locate_template( 'single-lesson/lesson-meta.php' ); |
|
| 870 | - if( ! empty( $template ) ){ |
|
| 869 | + $template = Sensei_Templates::locate_template('single-lesson/lesson-meta.php'); |
|
| 870 | + if ( ! empty($template)) { |
|
| 871 | 871 | |
| 872 | - Sensei_Templates::get_template( 'single-lesson/lesson-meta.php' ); |
|
| 872 | + Sensei_Templates::get_template('single-lesson/lesson-meta.php'); |
|
| 873 | 873 | return; |
| 874 | 874 | |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 877 | // Get the meta info |
| 878 | - $lesson_course_id = absint( get_post_meta( get_the_ID(), '_lesson_course', true ) ); |
|
| 879 | - $is_preview = Sensei_Utils::is_preview_lesson( get_the_ID() ); |
|
| 878 | + $lesson_course_id = absint(get_post_meta(get_the_ID(), '_lesson_course', true)); |
|
| 879 | + $is_preview = Sensei_Utils::is_preview_lesson(get_the_ID()); |
|
| 880 | 880 | |
| 881 | 881 | // Complete Lesson Logic |
| 882 | - do_action( 'sensei_complete_lesson' ); |
|
| 882 | + do_action('sensei_complete_lesson'); |
|
| 883 | 883 | // Check that the course has been started |
| 884 | - if ( Sensei()->access_settings() |
|
| 885 | - || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) |
|
| 886 | - || $is_preview ) { |
|
| 884 | + if (Sensei()->access_settings() |
|
| 885 | + || Sensei_Utils::user_started_course($lesson_course_id, get_current_user_id()) |
|
| 886 | + || $is_preview) { |
|
| 887 | 887 | ?> |
| 888 | 888 | <section class="lesson-meta"> |
| 889 | 889 | <?php |
| 890 | - if( apply_filters( 'sensei_video_position', 'top', get_the_ID() ) == 'bottom' ) { |
|
| 890 | + if (apply_filters('sensei_video_position', 'top', get_the_ID()) == 'bottom') { |
|
| 891 | 891 | |
| 892 | - do_action( 'sensei_lesson_video', get_the_ID() ); |
|
| 892 | + do_action('sensei_lesson_video', get_the_ID()); |
|
| 893 | 893 | |
| 894 | 894 | } |
| 895 | 895 | ?> |
| 896 | - <?php do_action( 'sensei_frontend_messages' ); ?> |
|
| 896 | + <?php do_action('sensei_frontend_messages'); ?> |
|
| 897 | 897 | |
| 898 | 898 | <?php if ( ! $is_preview |
| 899 | - || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) ) { |
|
| 899 | + || Sensei_Utils::user_started_course($lesson_course_id, get_current_user_id())) { |
|
| 900 | 900 | |
| 901 | - 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() ) ); |
|
| 901 | + 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())); |
|
| 902 | 902 | |
| 903 | 903 | } ?> |
| 904 | 904 | </section> |
| 905 | 905 | |
| 906 | - <?php do_action( 'sensei_lesson_back_link', $lesson_course_id ); ?> |
|
| 906 | + <?php do_action('sensei_lesson_back_link', $lesson_course_id); ?> |
|
| 907 | 907 | |
| 908 | 908 | <?php } |
| 909 | 909 | |
| 910 | - do_action( 'sensei_lesson_meta_extra', get_the_ID() ); |
|
| 910 | + do_action('sensei_lesson_meta_extra', get_the_ID()); |
|
| 911 | 911 | |
| 912 | 912 | } // end the_single_lesson_meta |
| 913 | 913 | |
@@ -921,9 +921,9 @@ discard block |
||
| 921 | 921 | * |
| 922 | 922 | * @since 1.9.0 |
| 923 | 923 | */ |
| 924 | -function get_sensei_header(){ |
|
| 924 | +function get_sensei_header() { |
|
| 925 | 925 | |
| 926 | - if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 926 | + if ( ! defined('ABSPATH')) exit; |
|
| 927 | 927 | |
| 928 | 928 | get_header(); |
| 929 | 929 | |
@@ -932,7 +932,7 @@ discard block |
||
| 932 | 932 | * |
| 933 | 933 | * @hooked sensei_output_content_wrapper - 10 (outputs opening divs for the content) |
| 934 | 934 | */ |
| 935 | - do_action( 'sensei_before_main_content' ); |
|
| 935 | + do_action('sensei_before_main_content'); |
|
| 936 | 936 | |
| 937 | 937 | }// end get_sensei_header |
| 938 | 938 | |
@@ -946,28 +946,28 @@ discard block |
||
| 946 | 946 | * |
| 947 | 947 | * @since 1.9.0 |
| 948 | 948 | */ |
| 949 | -function get_sensei_footer(){ |
|
| 949 | +function get_sensei_footer() { |
|
| 950 | 950 | |
| 951 | 951 | /** |
| 952 | 952 | * sensei_pagination hook |
| 953 | 953 | * |
| 954 | 954 | * @hooked sensei_pagination - 10 (outputs pagination) |
| 955 | 955 | */ |
| 956 | - do_action( 'sensei_pagination' ); |
|
| 956 | + do_action('sensei_pagination'); |
|
| 957 | 957 | |
| 958 | 958 | /** |
| 959 | 959 | * sensei_after_main_content hook |
| 960 | 960 | * |
| 961 | 961 | * @hooked sensei_output_content_wrapper_end - 10 (outputs closing divs for the content) |
| 962 | 962 | */ |
| 963 | - do_action( 'sensei_after_main_content' ); |
|
| 963 | + do_action('sensei_after_main_content'); |
|
| 964 | 964 | |
| 965 | 965 | /** |
| 966 | 966 | * sensei_sidebar hook |
| 967 | 967 | * |
| 968 | 968 | * @hooked sensei_get_sidebar - 10 |
| 969 | 969 | */ |
| 970 | - do_action( 'sensei_sidebar' ); |
|
| 970 | + do_action('sensei_sidebar'); |
|
| 971 | 971 | |
| 972 | 972 | get_footer(); |
| 973 | 973 | |
@@ -979,7 +979,7 @@ discard block |
||
| 979 | 979 | * |
| 980 | 980 | * @since 1.9.0 |
| 981 | 981 | */ |
| 982 | -function the_no_permissions_title(){ |
|
| 982 | +function the_no_permissions_title() { |
|
| 983 | 983 | |
| 984 | 984 | /** |
| 985 | 985 | * Filter the no permissions title just before it is echo'd on the |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | * @since 1.9.0 |
| 989 | 989 | * @param $no_permissions_title |
| 990 | 990 | */ |
| 991 | - echo apply_filters( 'sensei_the_no_permissions_title', Sensei()->permissions_message['title'] ); |
|
| 991 | + echo apply_filters('sensei_the_no_permissions_title', Sensei()->permissions_message['title']); |
|
| 992 | 992 | |
| 993 | 993 | } |
| 994 | 994 | |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | * |
| 998 | 998 | * @since 1.9.0 |
| 999 | 999 | */ |
| 1000 | -function the_no_permissions_message( $post_id ){ |
|
| 1000 | +function the_no_permissions_message($post_id) { |
|
| 1001 | 1001 | |
| 1002 | 1002 | /** |
| 1003 | 1003 | * Filter the no permissions message just before it is echo'd on the |
@@ -1006,7 +1006,7 @@ discard block |
||
| 1006 | 1006 | * @since 1.9.0 |
| 1007 | 1007 | * @param $no_permissions_message |
| 1008 | 1008 | */ |
| 1009 | - echo apply_filters( 'sensei_the_no_permissions_message', Sensei()->permissions_message['message'] , $post_id ); |
|
| 1009 | + echo apply_filters('sensei_the_no_permissions_message', Sensei()->permissions_message['message'], $post_id); |
|
| 1010 | 1010 | |
| 1011 | 1011 | } |
| 1012 | 1012 | |
@@ -1015,10 +1015,10 @@ discard block |
||
| 1015 | 1015 | * |
| 1016 | 1016 | * @since 1.9.0 |
| 1017 | 1017 | */ |
| 1018 | -function sensei_the_excerpt( $post_id ){ |
|
| 1018 | +function sensei_the_excerpt($post_id) { |
|
| 1019 | 1019 | |
| 1020 | 1020 | global $post; |
| 1021 | - the_excerpt( $post ); |
|
| 1021 | + the_excerpt($post); |
|
| 1022 | 1022 | |
| 1023 | 1023 | } |
| 1024 | 1024 | |
@@ -1030,10 +1030,10 @@ discard block |
||
| 1030 | 1030 | * @global WP $wp |
| 1031 | 1031 | * @return string $current_page_url |
| 1032 | 1032 | */ |
| 1033 | - function sensei_get_current_page_url(){ |
|
| 1033 | + function sensei_get_current_page_url() { |
|
| 1034 | 1034 | |
| 1035 | 1035 | global $wp; |
| 1036 | - $current_page_url = home_url( $wp->request ); |
|
| 1036 | + $current_page_url = home_url($wp->request); |
|
| 1037 | 1037 | return $current_page_url; |
| 1038 | 1038 | |
| 1039 | 1039 | } |
@@ -1044,9 +1044,9 @@ discard block |
||
| 1044 | 1044 | * |
| 1045 | 1045 | * @since 1.9.0 |
| 1046 | 1046 | */ |
| 1047 | -function sensei_the_my_courses_content(){ |
|
| 1047 | +function sensei_the_my_courses_content() { |
|
| 1048 | 1048 | |
| 1049 | - echo Sensei()->course->load_user_courses_content( wp_get_current_user() ); |
|
| 1049 | + echo Sensei()->course->load_user_courses_content(wp_get_current_user()); |
|
| 1050 | 1050 | |
| 1051 | 1051 | } // sensei_the_my_courses_content |
| 1052 | 1052 | |
@@ -1059,9 +1059,9 @@ discard block |
||
| 1059 | 1059 | * |
| 1060 | 1060 | * @since 1.9.0 |
| 1061 | 1061 | */ |
| 1062 | -function sensei_load_template( $template_name ){ |
|
| 1062 | +function sensei_load_template($template_name) { |
|
| 1063 | 1063 | |
| 1064 | - Sensei_Templates::get_template( $template_name ); |
|
| 1064 | + Sensei_Templates::get_template($template_name); |
|
| 1065 | 1065 | |
| 1066 | 1066 | } |
| 1067 | 1067 | |
@@ -1073,9 +1073,9 @@ discard block |
||
| 1073 | 1073 | * @param string $name the name of the template. |
| 1074 | 1074 | * @since 1.9.0 |
| 1075 | 1075 | */ |
| 1076 | -function sensei_load_template_part( $slug, $name ){ |
|
| 1076 | +function sensei_load_template_part($slug, $name) { |
|
| 1077 | 1077 | |
| 1078 | - Sensei_Templates::get_part( $slug, $name ); |
|
| 1078 | + Sensei_Templates::get_part($slug, $name); |
|
| 1079 | 1079 | |
| 1080 | 1080 | } |
| 1081 | 1081 | |
@@ -1092,19 +1092,19 @@ discard block |
||
| 1092 | 1092 | * @access public |
| 1093 | 1093 | * @param string $lesson_id |
| 1094 | 1094 | */ |
| 1095 | -function sensei_the_lesson_excerpt( $lesson_id = '' ) { |
|
| 1095 | +function sensei_the_lesson_excerpt($lesson_id = '') { |
|
| 1096 | 1096 | |
| 1097 | - if( empty( $lesson_id )){ |
|
| 1097 | + if (empty($lesson_id)) { |
|
| 1098 | 1098 | |
| 1099 | 1099 | $lesson_id = get_the_ID(); |
| 1100 | 1100 | |
| 1101 | 1101 | } |
| 1102 | 1102 | |
| 1103 | - if( 'lesson' != get_post_type( $lesson_id ) ){ |
|
| 1103 | + if ('lesson' != get_post_type($lesson_id)) { |
|
| 1104 | 1104 | return; |
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | - echo Sensei_Lesson::lesson_excerpt( get_post( $lesson_id ), false ); |
|
| 1107 | + echo Sensei_Lesson::lesson_excerpt(get_post($lesson_id), false); |
|
| 1108 | 1108 | |
| 1109 | 1109 | }// End lesson_excerpt() |
| 1110 | 1110 | |
@@ -1113,17 +1113,17 @@ discard block |
||
| 1113 | 1113 | * |
| 1114 | 1114 | * @since 1.9.0 |
| 1115 | 1115 | */ |
| 1116 | -function sensei_the_course_results_lessons(){ |
|
| 1116 | +function sensei_the_course_results_lessons() { |
|
| 1117 | 1117 | // load backwards compatible template name if it exists in the users theme |
| 1118 | - $located_template= locate_template( Sensei()->template_url . 'course-results/course-lessons.php' ); |
|
| 1119 | - if( $located_template ){ |
|
| 1118 | + $located_template = locate_template(Sensei()->template_url.'course-results/course-lessons.php'); |
|
| 1119 | + if ($located_template) { |
|
| 1120 | 1120 | |
| 1121 | - Sensei_Templates::get_template( 'course-results/course-lessons.php' ); |
|
| 1121 | + Sensei_Templates::get_template('course-results/course-lessons.php'); |
|
| 1122 | 1122 | return; |
| 1123 | 1123 | |
| 1124 | 1124 | } |
| 1125 | 1125 | |
| 1126 | - Sensei_Templates::get_template( 'course-results/lessons.php' ); |
|
| 1126 | + Sensei_Templates::get_template('course-results/lessons.php'); |
|
| 1127 | 1127 | } |
| 1128 | 1128 | |
| 1129 | 1129 | /** |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | * @uses Sensei_Course::get_loop_number_of_columns |
| 1134 | 1134 | * @since 1.9.0 |
| 1135 | 1135 | */ |
| 1136 | -function sensei_courses_per_row(){ |
|
| 1136 | +function sensei_courses_per_row() { |
|
| 1137 | 1137 | |
| 1138 | 1138 | echo Sensei_Course::get_loop_number_of_columns(); |
| 1139 | 1139 | |
@@ -1147,9 +1147,9 @@ discard block |
||
| 1147 | 1147 | * @param $args |
| 1148 | 1148 | * @param $path |
| 1149 | 1149 | */ |
| 1150 | -function sensei_get_template( $template_name, $args, $path ){ |
|
| 1150 | +function sensei_get_template($template_name, $args, $path) { |
|
| 1151 | 1151 | |
| 1152 | - Sensei_Templates::get_template( $template_name, $args, $path ); |
|
| 1152 | + Sensei_Templates::get_template($template_name, $args, $path); |
|
| 1153 | 1153 | |
| 1154 | 1154 | } |
| 1155 | 1155 | |
@@ -1161,12 +1161,12 @@ discard block |
||
| 1161 | 1161 | * |
| 1162 | 1162 | * @return string $status_class |
| 1163 | 1163 | */ |
| 1164 | -function get_the_lesson_status_class(){ |
|
| 1164 | +function get_the_lesson_status_class() { |
|
| 1165 | 1165 | |
| 1166 | 1166 | $status_class = ''; |
| 1167 | - $lesson_completed = Sensei_Utils::user_completed_lesson( get_the_ID(), get_current_user_id() ); |
|
| 1167 | + $lesson_completed = Sensei_Utils::user_completed_lesson(get_the_ID(), get_current_user_id()); |
|
| 1168 | 1168 | |
| 1169 | - if ( $lesson_completed ) { |
|
| 1169 | + if ($lesson_completed) { |
|
| 1170 | 1170 | $status_class = 'completed'; |
| 1171 | 1171 | } |
| 1172 | 1172 | |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | * |
| 1181 | 1181 | * @since 1.9.0 |
| 1182 | 1182 | */ |
| 1183 | -function sensei_the_lesson_status_class(){ |
|
| 1183 | +function sensei_the_lesson_status_class() { |
|
| 1184 | 1184 | |
| 1185 | 1185 | echo get_the_lesson_status_class(); |
| 1186 | 1186 | } |