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