@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ){ exit; } // Exit if accessed directly |
|
| 2 | +if ( ! defined('ABSPATH')) { exit; } // Exit if accessed directly |
|
| 3 | 3 | |
| 4 | 4 | /*************************************************************************************************** |
| 5 | 5 | * Output tags. |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | * @param string $type (default: 'newcourses') |
| 13 | 13 | * @return void |
| 14 | 14 | */ |
| 15 | - function sensei_course_archive_next_link( $type = 'newcourses' ) { |
|
| 15 | + function sensei_course_archive_next_link($type = 'newcourses') { |
|
| 16 | 16 | |
| 17 | - _deprecated_function('sensei_course_archive_next_link', '1.9.0','This is no longer used or required in Sensei.'); |
|
| 17 | + _deprecated_function('sensei_course_archive_next_link', '1.9.0', 'This is no longer used or required in Sensei.'); |
|
| 18 | 18 | |
| 19 | 19 | } // End sensei_course_archive_next_link() |
| 20 | 20 | |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | function course_single_lessons() { |
| 28 | 28 | |
| 29 | 29 | // load backwards compatible template name if it exists in the users theme |
| 30 | - $located_template= locate_template( Sensei()->template_url . 'single-course/course-lessons.php' ); |
|
| 31 | - if( $located_template ){ |
|
| 30 | + $located_template = locate_template(Sensei()->template_url.'single-course/course-lessons.php'); |
|
| 31 | + if ($located_template) { |
|
| 32 | 32 | |
| 33 | - Sensei_Templates::get_template( 'single-course/course-lessons.php' ); |
|
| 33 | + Sensei_Templates::get_template('single-course/course-lessons.php'); |
|
| 34 | 34 | return; |
| 35 | 35 | |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - Sensei_Templates::get_template( 'single-course/lessons.php' ); |
|
| 38 | + Sensei_Templates::get_template('single-course/lessons.php'); |
|
| 39 | 39 | |
| 40 | 40 | } // End course_single_lessons() |
| 41 | 41 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | function lesson_single_meta() { |
| 50 | 50 | |
| 51 | - _deprecated_function('lesson_single_meta','1.9;0', 'WooThemes_Sensei_Lesson::the_lesson_meta' ); |
|
| 51 | + _deprecated_function('lesson_single_meta', '1.9;0', 'WooThemes_Sensei_Lesson::the_lesson_meta'); |
|
| 52 | 52 | sensei_the_single_lesson_meta(); |
| 53 | 53 | |
| 54 | 54 | } // End lesson_single_meta() |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | * @return void |
| 63 | 63 | * @deprecated since 1.9.0 |
| 64 | 64 | */ |
| 65 | - function quiz_questions( $return = false ) { |
|
| 65 | + function quiz_questions($return = false) { |
|
| 66 | 66 | |
| 67 | - Sensei_Templates::get_template( 'single-quiz/quiz-questions.php' ); |
|
| 67 | + Sensei_Templates::get_template('single-quiz/quiz-questions.php'); |
|
| 68 | 68 | |
| 69 | 69 | } // End quiz_questions() |
| 70 | 70 | |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | * @return void |
| 77 | 77 | * @deprecated |
| 78 | 78 | */ |
| 79 | - function quiz_question_type( $question_type = 'multiple-choice' ) { |
|
| 79 | + function quiz_question_type($question_type = 'multiple-choice') { |
|
| 80 | 80 | |
| 81 | - Sensei_Templates::get_template( 'single-quiz/question_type-' . $question_type . '.php' ); |
|
| 81 | + Sensei_Templates::get_template('single-quiz/question_type-'.$question_type.'.php'); |
|
| 82 | 82 | |
| 83 | 83 | } // End lesson_single_meta() |
| 84 | 84 | |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | * @param mixed $course_id |
| 95 | 95 | * @return bool |
| 96 | 96 | */ |
| 97 | - function sensei_check_prerequisite_course( $course_id ) { |
|
| 97 | + function sensei_check_prerequisite_course($course_id) { |
|
| 98 | 98 | |
| 99 | - return Sensei_Course::is_prerequisite_complete( $course_id ); |
|
| 99 | + return Sensei_Course::is_prerequisite_complete($course_id); |
|
| 100 | 100 | |
| 101 | 101 | } // End sensei_check_prerequisite_course() |
| 102 | 102 | |
@@ -108,16 +108,16 @@ discard block |
||
| 108 | 108 | * @param mixed $course_id |
| 109 | 109 | * @return void |
| 110 | 110 | */ |
| 111 | - function sensei_start_course_form( $course_id ) { |
|
| 111 | + function sensei_start_course_form($course_id) { |
|
| 112 | 112 | |
| 113 | - $prerequisite_complete = sensei_check_prerequisite_course( $course_id ); |
|
| 113 | + $prerequisite_complete = sensei_check_prerequisite_course($course_id); |
|
| 114 | 114 | |
| 115 | - if ( $prerequisite_complete ) { |
|
| 116 | - ?><form method="POST" action="<?php echo esc_url( get_permalink() ); ?>"> |
|
| 115 | + if ($prerequisite_complete) { |
|
| 116 | + ?><form method="POST" action="<?php echo esc_url(get_permalink()); ?>"> |
|
| 117 | 117 | |
| 118 | - <input type="hidden" name="<?php echo esc_attr( 'woothemes_sensei_start_course_noonce' ); ?>" id="<?php echo esc_attr( 'woothemes_sensei_start_course_noonce' ); ?>" value="<?php echo esc_attr( wp_create_nonce( 'woothemes_sensei_start_course_noonce' ) ); ?>" /> |
|
| 118 | + <input type="hidden" name="<?php echo esc_attr('woothemes_sensei_start_course_noonce'); ?>" id="<?php echo esc_attr('woothemes_sensei_start_course_noonce'); ?>" value="<?php echo esc_attr(wp_create_nonce('woothemes_sensei_start_course_noonce')); ?>" /> |
|
| 119 | 119 | |
| 120 | - <span><input name="course_start" type="submit" class="course-start" value="<?php _e( 'Start taking this Course', 'woothemes-sensei' ); ?>"/></span> |
|
| 120 | + <span><input name="course_start" type="submit" class="course-start" value="<?php _e('Start taking this Course', 'woothemes-sensei'); ?>"/></span> |
|
| 121 | 121 | |
| 122 | 122 | </form><?php |
| 123 | 123 | } // End If Statement |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | * @param mixed $course_id |
| 133 | 133 | * @return void |
| 134 | 134 | */ |
| 135 | - function sensei_wc_add_to_cart( $course_id ) { |
|
| 135 | + function sensei_wc_add_to_cart($course_id) { |
|
| 136 | 136 | |
| 137 | - Sensei_WC::the_add_to_cart_button_html( $course_id ); |
|
| 137 | + Sensei_WC::the_add_to_cart_button_html($course_id); |
|
| 138 | 138 | |
| 139 | 139 | } // End sensei_wc_add_to_cart() |
| 140 | 140 | |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | * @param int $wc_post_id (default: 0) |
| 147 | 147 | * @return bool |
| 148 | 148 | */ |
| 149 | - function sensei_check_if_product_is_in_cart( $wc_product_id = 0 ) { |
|
| 150 | - return Sensei_WC::is_product_in_cart( $wc_product_id ); |
|
| 149 | + function sensei_check_if_product_is_in_cart($wc_product_id = 0) { |
|
| 150 | + return Sensei_WC::is_product_in_cart($wc_product_id); |
|
| 151 | 151 | } // End sensei_check_if_product_is_in_cart() |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -157,16 +157,16 @@ discard block |
||
| 157 | 157 | * @param mixed $post_id |
| 158 | 158 | * @return void |
| 159 | 159 | */ |
| 160 | - function sensei_simple_course_price( $post_id ) { |
|
| 160 | + function sensei_simple_course_price($post_id) { |
|
| 161 | 161 | |
| 162 | 162 | //WooCommerce Pricing |
| 163 | - if ( Sensei_WC::is_woocommerce_active() ) { |
|
| 164 | - $wc_post_id = get_post_meta( $post_id, '_course_woocommerce_product', true ); |
|
| 165 | - if ( 0 < $wc_post_id ) { |
|
| 163 | + if (Sensei_WC::is_woocommerce_active()) { |
|
| 164 | + $wc_post_id = get_post_meta($post_id, '_course_woocommerce_product', true); |
|
| 165 | + if (0 < $wc_post_id) { |
|
| 166 | 166 | // Get the product |
| 167 | - $product = Sensei()->sensei_get_woocommerce_product_object( $wc_post_id ); |
|
| 167 | + $product = Sensei()->sensei_get_woocommerce_product_object($wc_post_id); |
|
| 168 | 168 | |
| 169 | - if ( isset( $product ) && !empty( $product ) && $product->is_purchasable() && $product->is_in_stock() && !sensei_check_if_product_is_in_cart( $wc_post_id ) ) { ?> |
|
| 169 | + if (isset($product) && ! empty($product) && $product->is_purchasable() && $product->is_in_stock() && ! sensei_check_if_product_is_in_cart($wc_post_id)) { ?> |
|
| 170 | 170 | <span class="course-price"><?php echo $product->get_price_html(); ?></span> |
| 171 | 171 | <?php } // End If Statement |
| 172 | 172 | } // End If Statement |
@@ -180,11 +180,11 @@ discard block |
||
| 180 | 180 | * @param array $widget_args (default: array()) |
| 181 | 181 | * @return array |
| 182 | 182 | */ |
| 183 | - function sensei_recent_comments_widget_filter( $widget_args = array() ) { |
|
| 184 | - if ( ! isset( $widget_args['post_type'] ) ) $widget_args['post_type'] = array( 'post', 'page' ); |
|
| 183 | + function sensei_recent_comments_widget_filter($widget_args = array()) { |
|
| 184 | + if ( ! isset($widget_args['post_type'])) $widget_args['post_type'] = array('post', 'page'); |
|
| 185 | 185 | return $widget_args; |
| 186 | 186 | } // End sensei_recent_comments_widget_filter() |
| 187 | - add_filter( 'widget_comments_args', 'sensei_recent_comments_widget_filter', 10, 1 ); |
|
| 187 | + add_filter('widget_comments_args', 'sensei_recent_comments_widget_filter', 10, 1); |
|
| 188 | 188 | |
| 189 | 189 | /** |
| 190 | 190 | * sensei_course_archive_filter function. |
@@ -193,26 +193,26 @@ discard block |
||
| 193 | 193 | * @param WP_Query $query ( default: array ( ) ) |
| 194 | 194 | * @return void |
| 195 | 195 | */ |
| 196 | - function sensei_course_archive_filter( $query ) { |
|
| 196 | + function sensei_course_archive_filter($query) { |
|
| 197 | 197 | |
| 198 | 198 | |
| 199 | - if ( ! $query->is_main_query() ) |
|
| 199 | + if ( ! $query->is_main_query()) |
|
| 200 | 200 | return; |
| 201 | 201 | |
| 202 | 202 | // Apply Filter only if on frontend and when course archive is running |
| 203 | - $course_page_id = intval( Sensei()->settings->settings[ 'course_page' ] ); |
|
| 203 | + $course_page_id = intval(Sensei()->settings->settings['course_page']); |
|
| 204 | 204 | |
| 205 | - if ( ! is_admin() && 0 < $course_page_id && 0 < intval( $query->get( 'page_id' ) ) && $query->get( 'page_id' ) == $course_page_id ) { |
|
| 205 | + if ( ! is_admin() && 0 < $course_page_id && 0 < intval($query->get('page_id')) && $query->get('page_id') == $course_page_id) { |
|
| 206 | 206 | // Check for pagination settings |
| 207 | - if ( isset( Sensei()->settings->settings[ 'course_archive_amount' ] ) && ( 0 < absint( Sensei()->settings->settings[ 'course_archive_amount' ] ) ) ) { |
|
| 208 | - $amount = absint( Sensei()->settings->settings[ 'course_archive_amount' ] ); |
|
| 207 | + if (isset(Sensei()->settings->settings['course_archive_amount']) && (0 < absint(Sensei()->settings->settings['course_archive_amount']))) { |
|
| 208 | + $amount = absint(Sensei()->settings->settings['course_archive_amount']); |
|
| 209 | 209 | } else { |
| 210 | - $amount = $query->get( 'posts_per_page' ); |
|
| 210 | + $amount = $query->get('posts_per_page'); |
|
| 211 | 211 | } // End If Statement |
| 212 | - $query->set( 'posts_per_page', $amount ); |
|
| 212 | + $query->set('posts_per_page', $amount); |
|
| 213 | 213 | } // End If Statement |
| 214 | 214 | } // End sensei_course_archive_filter() |
| 215 | - add_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 ); |
|
| 215 | + add_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1); |
|
| 216 | 216 | |
| 217 | 217 | /** |
| 218 | 218 | * sensei_complete_lesson_button description |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * @return html |
| 221 | 221 | */ |
| 222 | 222 | function sensei_complete_lesson_button() { |
| 223 | - do_action( 'sensei_complete_lesson_button' ); |
|
| 223 | + do_action('sensei_complete_lesson_button'); |
|
| 224 | 224 | } // End sensei_complete_lesson_button() |
| 225 | 225 | |
| 226 | 226 | /** |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @return html |
| 230 | 230 | */ |
| 231 | 231 | function sensei_reset_lesson_button() { |
| 232 | - do_action( 'sensei_reset_lesson_button' ); |
|
| 232 | + do_action('sensei_reset_lesson_button'); |
|
| 233 | 233 | } // End sensei_reset_lesson_button() |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -238,20 +238,20 @@ discard block |
||
| 238 | 238 | * @param integer $lesson_id |
| 239 | 239 | * @return array $return_values |
| 240 | 240 | */ |
| 241 | - function sensei_get_prev_next_lessons( $lesson_id = 0 ) { |
|
| 241 | + function sensei_get_prev_next_lessons($lesson_id = 0) { |
|
| 242 | 242 | |
| 243 | 243 | $return_values = array(); |
| 244 | 244 | $return_values['prev_lesson'] = 0; |
| 245 | 245 | $return_values['next_lesson'] = 0; |
| 246 | - if ( 0 < $lesson_id ) { |
|
| 246 | + if (0 < $lesson_id) { |
|
| 247 | 247 | // Get the List of Lessons in the Course |
| 248 | - $lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true ); |
|
| 248 | + $lesson_course_id = get_post_meta($lesson_id, '_lesson_course', true); |
|
| 249 | 249 | $all_lessons = array(); |
| 250 | 250 | |
| 251 | - $modules = Sensei()->modules->get_course_modules( intval( $lesson_course_id ) ); |
|
| 251 | + $modules = Sensei()->modules->get_course_modules(intval($lesson_course_id)); |
|
| 252 | 252 | |
| 253 | - if( !empty( $modules ) ){ |
|
| 254 | - foreach( (array) $modules as $module ) { |
|
| 253 | + if ( ! empty($modules)) { |
|
| 254 | + foreach ((array) $modules as $module) { |
|
| 255 | 255 | |
| 256 | 256 | $args = array( |
| 257 | 257 | 'post_type' => 'lesson', |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | 'meta_query' => array( |
| 261 | 261 | array( |
| 262 | 262 | 'key' => '_lesson_course', |
| 263 | - 'value' => intval( $lesson_course_id ), |
|
| 263 | + 'value' => intval($lesson_course_id), |
|
| 264 | 264 | 'compare' => '=' |
| 265 | 265 | ) |
| 266 | 266 | ), |
@@ -268,18 +268,18 @@ discard block |
||
| 268 | 268 | array( |
| 269 | 269 | 'taxonomy' => Sensei()->modules->taxonomy, |
| 270 | 270 | 'field' => 'id', |
| 271 | - 'terms' => intval( $module->term_id ) |
|
| 271 | + 'terms' => intval($module->term_id) |
|
| 272 | 272 | ) |
| 273 | 273 | ), |
| 274 | - 'meta_key' => '_order_module_' . $module->term_id, |
|
| 274 | + 'meta_key' => '_order_module_'.$module->term_id, |
|
| 275 | 275 | 'orderby' => 'meta_value_num date', |
| 276 | 276 | 'order' => 'ASC', |
| 277 | 277 | 'suppress_filters' => 0 |
| 278 | 278 | ); |
| 279 | 279 | |
| 280 | - $lessons = get_posts( $args ); |
|
| 281 | - if ( 0 < count( $lessons ) ) { |
|
| 282 | - foreach ($lessons as $lesson_item){ |
|
| 280 | + $lessons = get_posts($args); |
|
| 281 | + if (0 < count($lessons)) { |
|
| 282 | + foreach ($lessons as $lesson_item) { |
|
| 283 | 283 | $all_lessons[] = $lesson_item->ID; |
| 284 | 284 | } // End For Loop |
| 285 | 285 | } // End If Statement |
@@ -292,36 +292,36 @@ discard block |
||
| 292 | 292 | 'post_type' => 'lesson', |
| 293 | 293 | 'posts_per_page' => -1, |
| 294 | 294 | 'suppress_filters' => 0, |
| 295 | - 'meta_key' => '_order_' . $lesson_course_id, |
|
| 295 | + 'meta_key' => '_order_'.$lesson_course_id, |
|
| 296 | 296 | 'orderby' => 'meta_value_num date', |
| 297 | 297 | 'order' => 'ASC', |
| 298 | 298 | 'meta_query' => array( |
| 299 | 299 | array( |
| 300 | 300 | 'key' => '_lesson_course', |
| 301 | - 'value' => intval( $lesson_course_id ), |
|
| 301 | + 'value' => intval($lesson_course_id), |
|
| 302 | 302 | ), |
| 303 | 303 | ), |
| 304 | 304 | 'post__not_in' => $all_lessons, |
| 305 | 305 | ); |
| 306 | 306 | |
| 307 | - $other_lessons = get_posts( $args ); |
|
| 308 | - if ( 0 < count( $other_lessons ) ) { |
|
| 309 | - foreach ($other_lessons as $lesson_item){ |
|
| 307 | + $other_lessons = get_posts($args); |
|
| 308 | + if (0 < count($other_lessons)) { |
|
| 309 | + foreach ($other_lessons as $lesson_item) { |
|
| 310 | 310 | $all_lessons[] = $lesson_item->ID; |
| 311 | 311 | } // End For Loop |
| 312 | 312 | } // End If Statement |
| 313 | 313 | |
| 314 | - if ( 0 < count( $all_lessons ) ) { |
|
| 314 | + if (0 < count($all_lessons)) { |
|
| 315 | 315 | $found_index = false; |
| 316 | - foreach ( $all_lessons as $lesson ){ |
|
| 317 | - if ( $found_index && $return_values['next_lesson'] == 0 ) { |
|
| 316 | + foreach ($all_lessons as $lesson) { |
|
| 317 | + if ($found_index && $return_values['next_lesson'] == 0) { |
|
| 318 | 318 | $return_values['next_lesson'] = $lesson; |
| 319 | 319 | } // End If Statement |
| 320 | - if ( $lesson == $lesson_id ) { |
|
| 320 | + if ($lesson == $lesson_id) { |
|
| 321 | 321 | // Is the current post |
| 322 | 322 | $found_index = true; |
| 323 | 323 | } // End If Statement |
| 324 | - if ( !$found_index ) { |
|
| 324 | + if ( ! $found_index) { |
|
| 325 | 325 | $return_values['prev_lesson'] = $lesson; |
| 326 | 326 | } // End If Statement |
| 327 | 327 | } // End For Loop |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | * @param int|WP_Post $post_id Optional. Defaults to current post |
| 341 | 341 | * @return string $excerpt |
| 342 | 342 | */ |
| 343 | - function sensei_get_excerpt( $post_id = '' ) { |
|
| 343 | + function sensei_get_excerpt($post_id = '') { |
|
| 344 | 344 | |
| 345 | 345 | global $post; |
| 346 | 346 | _deprecated_function('sensei_get_excerpt', 'use the wordpress excerpt functionality.'); |
@@ -348,14 +348,14 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - function sensei_has_user_started_course( $post_id = 0, $user_id = 0 ) { |
|
| 352 | - _deprecated_function( __FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_started_course()" ); |
|
| 353 | - return Sensei_Utils::user_started_course( $post_id, $user_id ); |
|
| 351 | + function sensei_has_user_started_course($post_id = 0, $user_id = 0) { |
|
| 352 | + _deprecated_function(__FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_started_course()"); |
|
| 353 | + return Sensei_Utils::user_started_course($post_id, $user_id); |
|
| 354 | 354 | } // End sensei_has_user_started_course() |
| 355 | 355 | |
| 356 | - function sensei_has_user_completed_lesson( $post_id = 0, $user_id = 0 ) { |
|
| 357 | - _deprecated_function( __FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_completed_lesson()" ); |
|
| 358 | - return Sensei_Utils::user_completed_lesson( $post_id, $user_id ); |
|
| 356 | + function sensei_has_user_completed_lesson($post_id = 0, $user_id = 0) { |
|
| 357 | + _deprecated_function(__FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_completed_lesson()"); |
|
| 358 | + return Sensei_Utils::user_completed_lesson($post_id, $user_id); |
|
| 359 | 359 | } // End sensei_has_user_completed_lesson() |
| 360 | 360 | |
| 361 | 361 | /** |
@@ -367,9 +367,9 @@ discard block |
||
| 367 | 367 | * @param int $user_id |
| 368 | 368 | * @return bool |
| 369 | 369 | */ |
| 370 | -function sensei_has_user_completed_prerequisite_lesson( $current_lesson_id, $user_id ) { |
|
| 370 | +function sensei_has_user_completed_prerequisite_lesson($current_lesson_id, $user_id) { |
|
| 371 | 371 | |
| 372 | - return WooThemes_Sensei_Lesson::is_pre_requisite_complete( $current_lesson_id, $user_id ); |
|
| 372 | + return WooThemes_Sensei_Lesson::is_pre_requisite_complete($current_lesson_id, $user_id); |
|
| 373 | 373 | |
| 374 | 374 | } // End sensei_has_user_completed_prerequisite_lesson() |
| 375 | 375 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | * @return bool |
| 393 | 393 | * |
| 394 | 394 | */ |
| 395 | -function sensei_have_modules( $course_post_id = '' ){ |
|
| 395 | +function sensei_have_modules($course_post_id = '') { |
|
| 396 | 396 | |
| 397 | 397 | global $post, $wp_query, $sensei_modules_loop; |
| 398 | 398 | |
@@ -400,23 +400,23 @@ discard block |
||
| 400 | 400 | wp_reset_query(); |
| 401 | 401 | $post = $wp_query->post; |
| 402 | 402 | |
| 403 | - if( empty( $course_post_id ) ){ |
|
| 403 | + if (empty($course_post_id)) { |
|
| 404 | 404 | |
| 405 | 405 | $course_id = $post->ID; |
| 406 | 406 | |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | // doesn't apply to none course post types |
| 410 | - if( ! sensei_is_a_course( $course_id ) ){ |
|
| 410 | + if ( ! sensei_is_a_course($course_id)) { |
|
| 411 | 411 | return false; |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | // check the current item compared to the total number of modules |
| 415 | - if( $sensei_modules_loop[ 'current' ] + 1 > $sensei_modules_loop[ 'total' ] ){ |
|
| 415 | + if ($sensei_modules_loop['current'] + 1 > $sensei_modules_loop['total']) { |
|
| 416 | 416 | |
| 417 | 417 | return false; |
| 418 | 418 | |
| 419 | - }else{ |
|
| 419 | + } else { |
|
| 420 | 420 | |
| 421 | 421 | return true; |
| 422 | 422 | |
@@ -430,27 +430,27 @@ discard block |
||
| 430 | 430 | * |
| 431 | 431 | * @since 1.9.0 |
| 432 | 432 | */ |
| 433 | -function sensei_setup_module(){ |
|
| 433 | +function sensei_setup_module() { |
|
| 434 | 434 | |
| 435 | 435 | global $sensei_modules_loop, $wp_query; |
| 436 | 436 | |
| 437 | 437 | // increment the index |
| 438 | - $sensei_modules_loop[ 'current' ]++; |
|
| 439 | - $index = $sensei_modules_loop[ 'current' ]; |
|
| 440 | - if( isset( $sensei_modules_loop['modules'][ $index ] ) ) { |
|
| 438 | + $sensei_modules_loop['current']++; |
|
| 439 | + $index = $sensei_modules_loop['current']; |
|
| 440 | + if (isset($sensei_modules_loop['modules'][$index])) { |
|
| 441 | 441 | |
| 442 | 442 | $sensei_modules_loop['current_module'] = $sensei_modules_loop['modules'][$index]; |
| 443 | 443 | // setup the query for the module lessons |
| 444 | 444 | $course_id = $sensei_modules_loop['course_id']; |
| 445 | 445 | $module_term_id = $sensei_modules_loop['current_module']->term_id; |
| 446 | - $modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id ); |
|
| 446 | + $modules_query = Sensei()->modules->get_lessons_query($course_id, $module_term_id); |
|
| 447 | 447 | |
| 448 | 448 | // setup the global wp-query only if the lessons |
| 449 | - if( $modules_query->have_posts() ){ |
|
| 449 | + if ($modules_query->have_posts()) { |
|
| 450 | 450 | |
| 451 | 451 | $wp_query = $modules_query; |
| 452 | 452 | |
| 453 | - }else{ |
|
| 453 | + } else { |
|
| 454 | 454 | |
| 455 | 455 | wp_reset_query(); |
| 456 | 456 | |
@@ -474,30 +474,30 @@ discard block |
||
| 474 | 474 | * |
| 475 | 475 | * @return bool |
| 476 | 476 | */ |
| 477 | -function sensei_module_has_lessons(){ |
|
| 477 | +function sensei_module_has_lessons() { |
|
| 478 | 478 | |
| 479 | 479 | global $wp_query, $sensei_modules_loop; |
| 480 | 480 | |
| 481 | - if( 'lesson' == $wp_query->get('post_type') ){ |
|
| 481 | + if ('lesson' == $wp_query->get('post_type')) { |
|
| 482 | 482 | |
| 483 | 483 | return have_posts(); |
| 484 | 484 | |
| 485 | - }else{ |
|
| 485 | + } else { |
|
| 486 | 486 | |
| 487 | 487 | // if the loop has not been initiated check the first module has lessons |
| 488 | - if( -1 == $sensei_modules_loop[ 'current' ] ){ |
|
| 488 | + if ( -1 == $sensei_modules_loop['current'] ) { |
|
| 489 | 489 | |
| 490 | 490 | $index = 0; |
| 491 | 491 | |
| 492 | - if( isset( $sensei_modules_loop['modules'][ $index ] ) ) { |
|
| 492 | + if (isset($sensei_modules_loop['modules'][$index])) { |
|
| 493 | 493 | // setup the query for the module lessons |
| 494 | 494 | $course_id = $sensei_modules_loop['course_id']; |
| 495 | 495 | |
| 496 | - $module_term_id = $sensei_modules_loop['modules'][ $index ] ->term_id; |
|
| 497 | - $modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id ); |
|
| 496 | + $module_term_id = $sensei_modules_loop['modules'][$index] ->term_id; |
|
| 497 | + $modules_query = Sensei()->modules->get_lessons_query($course_id, $module_term_id); |
|
| 498 | 498 | |
| 499 | 499 | // setup the global wp-query only if the lessons |
| 500 | - if( $modules_query->have_posts() ){ |
|
| 500 | + if ($modules_query->have_posts()) { |
|
| 501 | 501 | |
| 502 | 502 | return true; |
| 503 | 503 | |
@@ -521,9 +521,9 @@ discard block |
||
| 521 | 521 | * @uses sensei_the_module_title |
| 522 | 522 | * @return string |
| 523 | 523 | */ |
| 524 | -function sensei_the_module_title_attribute(){ |
|
| 524 | +function sensei_the_module_title_attribute() { |
|
| 525 | 525 | |
| 526 | - esc_attr_e( sensei_get_the_module_title() ); |
|
| 526 | + esc_attr_e(sensei_get_the_module_title()); |
|
| 527 | 527 | |
| 528 | 528 | } |
| 529 | 529 | |
@@ -534,11 +534,11 @@ discard block |
||
| 534 | 534 | * |
| 535 | 535 | * @return string |
| 536 | 536 | */ |
| 537 | -function sensei_the_module_permalink(){ |
|
| 537 | +function sensei_the_module_permalink() { |
|
| 538 | 538 | |
| 539 | 539 | global $sensei_modules_loop; |
| 540 | 540 | $course_id = $sensei_modules_loop['course_id']; |
| 541 | - $module_url = add_query_arg('course_id', $course_id, get_term_link( $sensei_modules_loop['current_module'], 'module' ) ); |
|
| 541 | + $module_url = add_query_arg('course_id', $course_id, get_term_link($sensei_modules_loop['current_module'], 'module')); |
|
| 542 | 542 | $module_term_id = $sensei_modules_loop['current_module']->term_id; |
| 543 | 543 | |
| 544 | 544 | /** |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | * @param int $module_term_id |
| 551 | 551 | * @param string $course_id |
| 552 | 552 | */ |
| 553 | - echo esc_url_raw( apply_filters( 'sensei_the_module_permalink', $module_url, $module_term_id ,$course_id ) ); |
|
| 553 | + echo esc_url_raw(apply_filters('sensei_the_module_permalink', $module_url, $module_term_id, $course_id)); |
|
| 554 | 554 | |
| 555 | 555 | }// end sensei_the_module_permalink |
| 556 | 556 | |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | * |
| 563 | 563 | * @return string |
| 564 | 564 | */ |
| 565 | -function sensei_get_the_module_title(){ |
|
| 565 | +function sensei_get_the_module_title() { |
|
| 566 | 566 | |
| 567 | 567 | global $sensei_modules_loop; |
| 568 | 568 | |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | * @param $module_term_id |
| 582 | 582 | * @param $course_id |
| 583 | 583 | */ |
| 584 | - return apply_filters( 'sensei_the_module_title', $module_title , $module_term_id, $course_id ); |
|
| 584 | + return apply_filters('sensei_the_module_title', $module_title, $module_term_id, $course_id); |
|
| 585 | 585 | |
| 586 | 586 | } |
| 587 | 587 | |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | * @uses sensei_get_the_module_title |
| 594 | 594 | * @return string |
| 595 | 595 | */ |
| 596 | -function sensei_the_module_title(){ |
|
| 596 | +function sensei_the_module_title() { |
|
| 597 | 597 | |
| 598 | 598 | echo sensei_get_the_module_title(); |
| 599 | 599 | |
@@ -606,9 +606,9 @@ discard block |
||
| 606 | 606 | * @since 1.9.0 |
| 607 | 607 | * @return string |
| 608 | 608 | */ |
| 609 | -function sensei_get_the_module_status(){ |
|
| 609 | +function sensei_get_the_module_status() { |
|
| 610 | 610 | |
| 611 | - if( ! is_user_logged_in() ){ |
|
| 611 | + if ( ! is_user_logged_in()) { |
|
| 612 | 612 | return ''; |
| 613 | 613 | } |
| 614 | 614 | |
@@ -616,10 +616,10 @@ discard block |
||
| 616 | 616 | $module_title = $sensei_modules_loop['current_module']->name; |
| 617 | 617 | $module_term_id = $sensei_modules_loop['current_module']->term_id; |
| 618 | 618 | $course_id = $sensei_modules_loop['course_id']; |
| 619 | - $module_progress = Sensei()->modules->get_user_module_progress( $module_term_id, $course_id, get_current_user_id() ); |
|
| 619 | + $module_progress = Sensei()->modules->get_user_module_progress($module_term_id, $course_id, get_current_user_id()); |
|
| 620 | 620 | |
| 621 | - $module_status = ''; |
|
| 622 | - if ( $module_progress && $module_progress > 0) { |
|
| 621 | + $module_status = ''; |
|
| 622 | + if ($module_progress && $module_progress > 0) { |
|
| 623 | 623 | |
| 624 | 624 | $module_status = __('Completed', 'woothemes-sensei'); |
| 625 | 625 | |
@@ -631,12 +631,12 @@ discard block |
||
| 631 | 631 | |
| 632 | 632 | } |
| 633 | 633 | |
| 634 | - if ( empty( $module_status ) ){ |
|
| 634 | + if (empty($module_status)) { |
|
| 635 | 635 | return ''; |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | - $status_class = strtolower( str_replace( ' ', '-', $module_status ) ); |
|
| 639 | - $module_status_html = '<p class="status module-status ' . $status_class . '">' |
|
| 638 | + $status_class = strtolower(str_replace(' ', '-', $module_status)); |
|
| 639 | + $module_status_html = '<p class="status module-status '.$status_class.'">' |
|
| 640 | 640 | . $module_status |
| 641 | 641 | . '</p>'; |
| 642 | 642 | |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | * @param $module_term_id |
| 652 | 652 | * @param $course_id |
| 653 | 653 | */ |
| 654 | - return apply_filters( 'sensei_the_module_status_html', $module_status_html , $module_term_id, $course_id ); |
|
| 654 | + return apply_filters('sensei_the_module_status_html', $module_status_html, $module_term_id, $course_id); |
|
| 655 | 655 | |
| 656 | 656 | } |
| 657 | 657 | |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | * Print out the current module status |
| 660 | 660 | * @since 1.9.0 |
| 661 | 661 | */ |
| 662 | -function sensei_the_module_status(){ |
|
| 662 | +function sensei_the_module_status() { |
|
| 663 | 663 | |
| 664 | 664 | echo sensei_get_the_module_status(); |
| 665 | 665 | |
@@ -680,19 +680,19 @@ discard block |
||
| 680 | 680 | * |
| 681 | 681 | * @return bool |
| 682 | 682 | */ |
| 683 | -function sensei_quiz_has_questions(){ |
|
| 683 | +function sensei_quiz_has_questions() { |
|
| 684 | 684 | |
| 685 | 685 | global $sensei_question_loop; |
| 686 | 686 | |
| 687 | - if( !isset( $sensei_question_loop['total'] ) ){ |
|
| 687 | + if ( ! isset($sensei_question_loop['total'])) { |
|
| 688 | 688 | return false; |
| 689 | 689 | } |
| 690 | 690 | |
| 691 | - if( $sensei_question_loop['current'] + 1 < $sensei_question_loop['total'] ){ |
|
| 691 | + if ($sensei_question_loop['current'] + 1 < $sensei_question_loop['total']) { |
|
| 692 | 692 | |
| 693 | 693 | return true; |
| 694 | 694 | |
| 695 | - }else{ |
|
| 695 | + } else { |
|
| 696 | 696 | |
| 697 | 697 | return false; |
| 698 | 698 | |
@@ -709,13 +709,13 @@ discard block |
||
| 709 | 709 | * @since 1.9.0 |
| 710 | 710 | |
| 711 | 711 | */ |
| 712 | -function sensei_setup_the_question(){ |
|
| 712 | +function sensei_setup_the_question() { |
|
| 713 | 713 | |
| 714 | 714 | global $sensei_question_loop; |
| 715 | 715 | |
| 716 | 716 | $sensei_question_loop['current']++; |
| 717 | 717 | $index = $sensei_question_loop['current']; |
| 718 | - $sensei_question_loop['current_question'] = $sensei_question_loop['questions'][ $index ] ; |
|
| 718 | + $sensei_question_loop['current_question'] = $sensei_question_loop['questions'][$index]; |
|
| 719 | 719 | |
| 720 | 720 | |
| 721 | 721 | }// end sensei_setup_the_question |
@@ -726,14 +726,14 @@ discard block |
||
| 726 | 726 | * This function gets the type and loads the template that will handle it. |
| 727 | 727 | * |
| 728 | 728 | */ |
| 729 | -function sensei_the_question_content(){ |
|
| 729 | +function sensei_the_question_content() { |
|
| 730 | 730 | |
| 731 | 731 | global $sensei_question_loop; |
| 732 | 732 | |
| 733 | - $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID ); |
|
| 733 | + $question_type = Sensei()->question->get_question_type($sensei_question_loop['current_question']->ID); |
|
| 734 | 734 | |
| 735 | 735 | // load the template that displays the question information. |
| 736 | - WooThemes_Sensei_Question::load_question_template( $question_type ); |
|
| 736 | + WooThemes_Sensei_Question::load_question_template($question_type); |
|
| 737 | 737 | |
| 738 | 738 | }// end sensei_the_question_content |
| 739 | 739 | |
@@ -742,11 +742,11 @@ discard block |
||
| 742 | 742 | * |
| 743 | 743 | * @since 1.9.0 |
| 744 | 744 | */ |
| 745 | -function sensei_the_question_class(){ |
|
| 745 | +function sensei_the_question_class() { |
|
| 746 | 746 | |
| 747 | 747 | global $sensei_question_loop; |
| 748 | 748 | |
| 749 | - $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID ); |
|
| 749 | + $question_type = Sensei()->question->get_question_type($sensei_question_loop['current_question']->ID); |
|
| 750 | 750 | |
| 751 | 751 | /** |
| 752 | 752 | * filter the sensei question class within |
@@ -754,16 +754,16 @@ discard block |
||
| 754 | 754 | * |
| 755 | 755 | * @since 1.9.0 |
| 756 | 756 | */ |
| 757 | - $classes = apply_filters( 'sensei_question_classes', array( $question_type ) ); |
|
| 757 | + $classes = apply_filters('sensei_question_classes', array($question_type)); |
|
| 758 | 758 | |
| 759 | 759 | $html_classes = ''; |
| 760 | - foreach( $classes as $class ){ |
|
| 760 | + foreach ($classes as $class) { |
|
| 761 | 761 | |
| 762 | - $html_classes .= $class . ' '; |
|
| 762 | + $html_classes .= $class.' '; |
|
| 763 | 763 | |
| 764 | 764 | }// end foreach |
| 765 | 765 | |
| 766 | - esc_attr_e( trim( $html_classes ) ); |
|
| 766 | + esc_attr_e(trim($html_classes)); |
|
| 767 | 767 | |
| 768 | 768 | } |
| 769 | 769 | |
@@ -772,10 +772,10 @@ discard block |
||
| 772 | 772 | * |
| 773 | 773 | * @since 1.9.0 |
| 774 | 774 | */ |
| 775 | -function sensei_get_the_question_id( ){ |
|
| 775 | +function sensei_get_the_question_id( ) { |
|
| 776 | 776 | |
| 777 | 777 | global $sensei_question_loop; |
| 778 | - if( isset( $sensei_question_loop['current_question']->ID ) ){ |
|
| 778 | + if (isset($sensei_question_loop['current_question']->ID)) { |
|
| 779 | 779 | |
| 780 | 780 | return $sensei_question_loop['current_question']->ID; |
| 781 | 781 | |
@@ -804,27 +804,27 @@ discard block |
||
| 804 | 804 | * @param string $lesson_id |
| 805 | 805 | * @return bool |
| 806 | 806 | */ |
| 807 | -function sensei_can_user_view_lesson( $lesson_id = '', $user_id = '' ){ |
|
| 807 | +function sensei_can_user_view_lesson($lesson_id = '', $user_id = '') { |
|
| 808 | 808 | |
| 809 | - if( empty( $lesson_id ) ){ |
|
| 809 | + if (empty($lesson_id)) { |
|
| 810 | 810 | |
| 811 | 811 | $lesson_id = get_the_ID(); |
| 812 | 812 | |
| 813 | 813 | } |
| 814 | 814 | |
| 815 | - if( empty( $user_id ) ){ |
|
| 815 | + if (empty($user_id)) { |
|
| 816 | 816 | |
| 817 | 817 | $user_id = get_current_user_id(); |
| 818 | 818 | |
| 819 | 819 | } |
| 820 | 820 | |
| 821 | 821 | // Check for prerequisite lesson completions |
| 822 | - $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete( $lesson_id, $user_id ); |
|
| 823 | - $lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true ); |
|
| 824 | - $user_taking_course = Sensei_Utils::user_started_course( $lesson_course_id, $user_id ); |
|
| 822 | + $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete($lesson_id, $user_id); |
|
| 823 | + $lesson_course_id = get_post_meta($lesson_id, '_lesson_course', true); |
|
| 824 | + $user_taking_course = Sensei_Utils::user_started_course($lesson_course_id, $user_id); |
|
| 825 | 825 | |
| 826 | 826 | $is_preview = false; |
| 827 | - if( Sensei_Utils::is_preview_lesson( $lesson_id ) ) { |
|
| 827 | + if (Sensei_Utils::is_preview_lesson($lesson_id)) { |
|
| 828 | 828 | |
| 829 | 829 | $is_preview = true; |
| 830 | 830 | $pre_requisite_complete = true; |
@@ -832,24 +832,24 @@ discard block |
||
| 832 | 832 | }; |
| 833 | 833 | |
| 834 | 834 | |
| 835 | - $user_can_access_lesson = false; |
|
| 835 | + $user_can_access_lesson = false; |
|
| 836 | 836 | |
| 837 | - if( is_user_logged_in() && $user_taking_course ){ |
|
| 837 | + if (is_user_logged_in() && $user_taking_course) { |
|
| 838 | 838 | |
| 839 | - $user_can_access_lesson = true; |
|
| 839 | + $user_can_access_lesson = true; |
|
| 840 | 840 | |
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | |
| 844 | 844 | $access_permission = false; |
| 845 | 845 | |
| 846 | - if ( ! Sensei()->settings->get('access_permission') || sensei_all_access() ) { |
|
| 846 | + if ( ! Sensei()->settings->get('access_permission') || sensei_all_access()) { |
|
| 847 | 847 | |
| 848 | 848 | $access_permission = true; |
| 849 | 849 | |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | - $can_user_view_lesson = $access_permission || ( $user_can_access_lesson && $pre_requisite_complete ) || $is_preview; |
|
| 852 | + $can_user_view_lesson = $access_permission || ($user_can_access_lesson && $pre_requisite_complete) || $is_preview; |
|
| 853 | 853 | |
| 854 | 854 | /** |
| 855 | 855 | * Filter the can user view lesson function |
@@ -862,7 +862,7 @@ discard block |
||
| 862 | 862 | * @param string $lesson_id |
| 863 | 863 | * @param string $user_id |
| 864 | 864 | */ |
| 865 | - return apply_filters( 'sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id ); |
|
| 865 | + return apply_filters('sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id); |
|
| 866 | 866 | |
| 867 | 867 | } // end sensei_can_current_user_view_lesson |
| 868 | 868 | |
@@ -872,51 +872,51 @@ discard block |
||
| 872 | 872 | * The function should only be called on the single lesson |
| 873 | 873 | * |
| 874 | 874 | */ |
| 875 | -function sensei_the_single_lesson_meta(){ |
|
| 875 | +function sensei_the_single_lesson_meta() { |
|
| 876 | 876 | |
| 877 | 877 | // if the lesson meta is included within theme load that instead of the function content |
| 878 | - $template = Sensei_Templates::locate_template( 'single-lesson/lesson-meta.php' ); |
|
| 879 | - if( ! empty( $template ) ){ |
|
| 878 | + $template = Sensei_Templates::locate_template('single-lesson/lesson-meta.php'); |
|
| 879 | + if ( ! empty($template)) { |
|
| 880 | 880 | |
| 881 | - Sensei_Templates::get_template( 'single-lesson/lesson-meta.php' ); |
|
| 881 | + Sensei_Templates::get_template('single-lesson/lesson-meta.php'); |
|
| 882 | 882 | return; |
| 883 | 883 | |
| 884 | 884 | } |
| 885 | 885 | |
| 886 | 886 | // Get the meta info |
| 887 | - $lesson_course_id = absint( get_post_meta( get_the_ID(), '_lesson_course', true ) ); |
|
| 888 | - $is_preview = Sensei_Utils::is_preview_lesson( get_the_ID() ); |
|
| 887 | + $lesson_course_id = absint(get_post_meta(get_the_ID(), '_lesson_course', true)); |
|
| 888 | + $is_preview = Sensei_Utils::is_preview_lesson(get_the_ID()); |
|
| 889 | 889 | |
| 890 | 890 | // Complete Lesson Logic |
| 891 | - do_action( 'sensei_complete_lesson' ); |
|
| 891 | + do_action('sensei_complete_lesson'); |
|
| 892 | 892 | // Check that the course has been started |
| 893 | - if ( Sensei()->access_settings() |
|
| 894 | - || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) |
|
| 895 | - || $is_preview ) { |
|
| 893 | + if (Sensei()->access_settings() |
|
| 894 | + || Sensei_Utils::user_started_course($lesson_course_id, get_current_user_id()) |
|
| 895 | + || $is_preview) { |
|
| 896 | 896 | ?> |
| 897 | 897 | <section class="lesson-meta"> |
| 898 | 898 | <?php |
| 899 | - if( apply_filters( 'sensei_video_position', 'top', get_the_ID() ) == 'bottom' ) { |
|
| 899 | + if (apply_filters('sensei_video_position', 'top', get_the_ID()) == 'bottom') { |
|
| 900 | 900 | |
| 901 | - do_action( 'sensei_lesson_video', get_the_ID() ); |
|
| 901 | + do_action('sensei_lesson_video', get_the_ID()); |
|
| 902 | 902 | |
| 903 | 903 | } |
| 904 | 904 | ?> |
| 905 | - <?php do_action( 'sensei_frontend_messages' ); ?> |
|
| 905 | + <?php do_action('sensei_frontend_messages'); ?> |
|
| 906 | 906 | |
| 907 | 907 | <?php if ( ! $is_preview |
| 908 | - || Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) ) { |
|
| 908 | + || Sensei_Utils::user_started_course($lesson_course_id, get_current_user_id())) { |
|
| 909 | 909 | |
| 910 | - sensei_do_deprecated_action( 'sensei_lesson_quiz_meta','1.9.0', 'sensei_single_lesson_content_inside_before' ,array( get_the_ID(), get_current_user_id() ) ); |
|
| 910 | + sensei_do_deprecated_action('sensei_lesson_quiz_meta', '1.9.0', 'sensei_single_lesson_content_inside_before', array(get_the_ID(), get_current_user_id())); |
|
| 911 | 911 | |
| 912 | 912 | } ?> |
| 913 | 913 | </section> |
| 914 | 914 | |
| 915 | - <?php do_action( 'sensei_lesson_back_link', $lesson_course_id ); ?> |
|
| 915 | + <?php do_action('sensei_lesson_back_link', $lesson_course_id); ?> |
|
| 916 | 916 | |
| 917 | 917 | <?php } |
| 918 | 918 | |
| 919 | - do_action( 'sensei_lesson_meta_extra', get_the_ID() ); |
|
| 919 | + do_action('sensei_lesson_meta_extra', get_the_ID()); |
|
| 920 | 920 | |
| 921 | 921 | } // end the_single_lesson_meta |
| 922 | 922 | |
@@ -930,9 +930,9 @@ discard block |
||
| 930 | 930 | * |
| 931 | 931 | * @since 1.9.0 |
| 932 | 932 | */ |
| 933 | -function get_sensei_header(){ |
|
| 933 | +function get_sensei_header() { |
|
| 934 | 934 | |
| 935 | - if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 935 | + if ( ! defined('ABSPATH')) exit; |
|
| 936 | 936 | |
| 937 | 937 | get_header(); |
| 938 | 938 | |
@@ -941,7 +941,7 @@ discard block |
||
| 941 | 941 | * |
| 942 | 942 | * @hooked sensei_output_content_wrapper - 10 (outputs opening divs for the content) |
| 943 | 943 | */ |
| 944 | - do_action( 'sensei_before_main_content' ); |
|
| 944 | + do_action('sensei_before_main_content'); |
|
| 945 | 945 | |
| 946 | 946 | }// end get_sensei_header |
| 947 | 947 | |
@@ -955,28 +955,28 @@ discard block |
||
| 955 | 955 | * |
| 956 | 956 | * @since 1.9.0 |
| 957 | 957 | */ |
| 958 | -function get_sensei_footer(){ |
|
| 958 | +function get_sensei_footer() { |
|
| 959 | 959 | |
| 960 | 960 | /** |
| 961 | 961 | * sensei_pagination hook |
| 962 | 962 | * |
| 963 | 963 | * @hooked sensei_pagination - 10 (outputs pagination) |
| 964 | 964 | */ |
| 965 | - do_action( 'sensei_pagination' ); |
|
| 965 | + do_action('sensei_pagination'); |
|
| 966 | 966 | |
| 967 | 967 | /** |
| 968 | 968 | * sensei_after_main_content hook |
| 969 | 969 | * |
| 970 | 970 | * @hooked sensei_output_content_wrapper_end - 10 (outputs closing divs for the content) |
| 971 | 971 | */ |
| 972 | - do_action( 'sensei_after_main_content' ); |
|
| 972 | + do_action('sensei_after_main_content'); |
|
| 973 | 973 | |
| 974 | 974 | /** |
| 975 | 975 | * sensei_sidebar hook |
| 976 | 976 | * |
| 977 | 977 | * @hooked sensei_get_sidebar - 10 |
| 978 | 978 | */ |
| 979 | - do_action( 'sensei_sidebar' ); |
|
| 979 | + do_action('sensei_sidebar'); |
|
| 980 | 980 | |
| 981 | 981 | get_footer(); |
| 982 | 982 | |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | * |
| 989 | 989 | * @since 1.9.0 |
| 990 | 990 | */ |
| 991 | -function the_no_permissions_title(){ |
|
| 991 | +function the_no_permissions_title() { |
|
| 992 | 992 | |
| 993 | 993 | /** |
| 994 | 994 | * Filter the no permissions title just before it is echo'd on the |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | * @since 1.9.0 |
| 998 | 998 | * @param $no_permissions_title |
| 999 | 999 | */ |
| 1000 | - echo apply_filters( 'sensei_the_no_permissions_title', Sensei()->permissions_message['title'] ); |
|
| 1000 | + echo apply_filters('sensei_the_no_permissions_title', Sensei()->permissions_message['title']); |
|
| 1001 | 1001 | |
| 1002 | 1002 | } |
| 1003 | 1003 | |
@@ -1006,7 +1006,7 @@ discard block |
||
| 1006 | 1006 | * |
| 1007 | 1007 | * @since 1.9.0 |
| 1008 | 1008 | */ |
| 1009 | -function the_no_permissions_message( $post_id ){ |
|
| 1009 | +function the_no_permissions_message($post_id) { |
|
| 1010 | 1010 | |
| 1011 | 1011 | /** |
| 1012 | 1012 | * Filter the no permissions message just before it is echo'd on the |
@@ -1015,7 +1015,7 @@ discard block |
||
| 1015 | 1015 | * @since 1.9.0 |
| 1016 | 1016 | * @param $no_permissions_message |
| 1017 | 1017 | */ |
| 1018 | - echo apply_filters( 'sensei_the_no_permissions_message', Sensei()->permissions_message['message'] , $post_id ); |
|
| 1018 | + echo apply_filters('sensei_the_no_permissions_message', Sensei()->permissions_message['message'], $post_id); |
|
| 1019 | 1019 | |
| 1020 | 1020 | } |
| 1021 | 1021 | |
@@ -1024,10 +1024,10 @@ discard block |
||
| 1024 | 1024 | * |
| 1025 | 1025 | * @since 1.9.0 |
| 1026 | 1026 | */ |
| 1027 | -function sensei_the_excerpt( $post_id ){ |
|
| 1027 | +function sensei_the_excerpt($post_id) { |
|
| 1028 | 1028 | |
| 1029 | 1029 | global $post; |
| 1030 | - the_excerpt( $post ); |
|
| 1030 | + the_excerpt($post); |
|
| 1031 | 1031 | |
| 1032 | 1032 | } |
| 1033 | 1033 | |
@@ -1039,10 +1039,10 @@ discard block |
||
| 1039 | 1039 | * @global WP $wp |
| 1040 | 1040 | * @return string $current_page_url |
| 1041 | 1041 | */ |
| 1042 | - function sensei_get_current_page_url(){ |
|
| 1042 | + function sensei_get_current_page_url() { |
|
| 1043 | 1043 | |
| 1044 | 1044 | global $wp; |
| 1045 | - $current_page_url = home_url( $wp->request ); |
|
| 1045 | + $current_page_url = home_url($wp->request); |
|
| 1046 | 1046 | return $current_page_url; |
| 1047 | 1047 | |
| 1048 | 1048 | } |
@@ -1053,9 +1053,9 @@ discard block |
||
| 1053 | 1053 | * |
| 1054 | 1054 | * @since 1.9.0 |
| 1055 | 1055 | */ |
| 1056 | -function sensei_the_my_courses_content(){ |
|
| 1056 | +function sensei_the_my_courses_content() { |
|
| 1057 | 1057 | |
| 1058 | - echo Sensei()->course->load_user_courses_content( wp_get_current_user() ); |
|
| 1058 | + echo Sensei()->course->load_user_courses_content(wp_get_current_user()); |
|
| 1059 | 1059 | |
| 1060 | 1060 | } // sensei_the_my_courses_content |
| 1061 | 1061 | |
@@ -1068,9 +1068,9 @@ discard block |
||
| 1068 | 1068 | * |
| 1069 | 1069 | * @since 1.9.0 |
| 1070 | 1070 | */ |
| 1071 | -function sensei_load_template( $template_name ){ |
|
| 1071 | +function sensei_load_template($template_name) { |
|
| 1072 | 1072 | |
| 1073 | - Sensei_Templates::get_template( $template_name ); |
|
| 1073 | + Sensei_Templates::get_template($template_name); |
|
| 1074 | 1074 | |
| 1075 | 1075 | } |
| 1076 | 1076 | |
@@ -1082,9 +1082,9 @@ discard block |
||
| 1082 | 1082 | * @param string $name the name of the template. |
| 1083 | 1083 | * @since 1.9.0 |
| 1084 | 1084 | */ |
| 1085 | -function sensei_load_template_part( $slug, $name ){ |
|
| 1085 | +function sensei_load_template_part($slug, $name) { |
|
| 1086 | 1086 | |
| 1087 | - Sensei_Templates::get_part( $slug, $name ); |
|
| 1087 | + Sensei_Templates::get_part($slug, $name); |
|
| 1088 | 1088 | |
| 1089 | 1089 | } |
| 1090 | 1090 | |
@@ -1101,19 +1101,19 @@ discard block |
||
| 1101 | 1101 | * @access public |
| 1102 | 1102 | * @param string $lesson_id |
| 1103 | 1103 | */ |
| 1104 | -function sensei_the_lesson_excerpt( $lesson_id = '' ) { |
|
| 1104 | +function sensei_the_lesson_excerpt($lesson_id = '') { |
|
| 1105 | 1105 | |
| 1106 | - if( empty( $lesson_id )){ |
|
| 1106 | + if (empty($lesson_id)) { |
|
| 1107 | 1107 | |
| 1108 | 1108 | $lesson_id = get_the_ID(); |
| 1109 | 1109 | |
| 1110 | 1110 | } |
| 1111 | 1111 | |
| 1112 | - if( 'lesson' != get_post_type( $lesson_id ) ){ |
|
| 1112 | + if ('lesson' != get_post_type($lesson_id)) { |
|
| 1113 | 1113 | return; |
| 1114 | 1114 | } |
| 1115 | 1115 | |
| 1116 | - echo Sensei_Lesson::lesson_excerpt( get_post( $lesson_id ), false ); |
|
| 1116 | + echo Sensei_Lesson::lesson_excerpt(get_post($lesson_id), false); |
|
| 1117 | 1117 | |
| 1118 | 1118 | }// End lesson_excerpt() |
| 1119 | 1119 | |
@@ -1122,17 +1122,17 @@ discard block |
||
| 1122 | 1122 | * |
| 1123 | 1123 | * @since 1.9.0 |
| 1124 | 1124 | */ |
| 1125 | -function sensei_the_course_results_lessons(){ |
|
| 1125 | +function sensei_the_course_results_lessons() { |
|
| 1126 | 1126 | // load backwards compatible template name if it exists in the users theme |
| 1127 | - $located_template= locate_template( Sensei()->template_url . 'course-results/course-lessons.php' ); |
|
| 1128 | - if( $located_template ){ |
|
| 1127 | + $located_template = locate_template(Sensei()->template_url.'course-results/course-lessons.php'); |
|
| 1128 | + if ($located_template) { |
|
| 1129 | 1129 | |
| 1130 | - Sensei_Templates::get_template( 'course-results/course-lessons.php' ); |
|
| 1130 | + Sensei_Templates::get_template('course-results/course-lessons.php'); |
|
| 1131 | 1131 | return; |
| 1132 | 1132 | |
| 1133 | 1133 | } |
| 1134 | 1134 | |
| 1135 | - Sensei_Templates::get_template( 'course-results/lessons.php' ); |
|
| 1135 | + Sensei_Templates::get_template('course-results/lessons.php'); |
|
| 1136 | 1136 | } |
| 1137 | 1137 | |
| 1138 | 1138 | /** |
@@ -1142,7 +1142,7 @@ discard block |
||
| 1142 | 1142 | * @uses Sensei_Course::get_loop_number_of_columns |
| 1143 | 1143 | * @since 1.9.0 |
| 1144 | 1144 | */ |
| 1145 | -function sensei_courses_per_row(){ |
|
| 1145 | +function sensei_courses_per_row() { |
|
| 1146 | 1146 | |
| 1147 | 1147 | echo Sensei_Course::get_loop_number_of_columns(); |
| 1148 | 1148 | |
@@ -1156,9 +1156,9 @@ discard block |
||
| 1156 | 1156 | * @param $args |
| 1157 | 1157 | * @param $path |
| 1158 | 1158 | */ |
| 1159 | -function sensei_get_template( $template_name, $args, $path ){ |
|
| 1159 | +function sensei_get_template($template_name, $args, $path) { |
|
| 1160 | 1160 | |
| 1161 | - Sensei_Templates::get_template( $template_name, $args, $path ); |
|
| 1161 | + Sensei_Templates::get_template($template_name, $args, $path); |
|
| 1162 | 1162 | |
| 1163 | 1163 | } |
| 1164 | 1164 | |
@@ -1170,12 +1170,12 @@ discard block |
||
| 1170 | 1170 | * |
| 1171 | 1171 | * @return string $status_class |
| 1172 | 1172 | */ |
| 1173 | -function get_the_lesson_status_class(){ |
|
| 1173 | +function get_the_lesson_status_class() { |
|
| 1174 | 1174 | |
| 1175 | 1175 | $status_class = ''; |
| 1176 | - $lesson_completed = Sensei_Utils::user_completed_lesson( get_the_ID(), get_current_user_id() ); |
|
| 1176 | + $lesson_completed = Sensei_Utils::user_completed_lesson(get_the_ID(), get_current_user_id()); |
|
| 1177 | 1177 | |
| 1178 | - if ( $lesson_completed ) { |
|
| 1178 | + if ($lesson_completed) { |
|
| 1179 | 1179 | $status_class = 'completed'; |
| 1180 | 1180 | } |
| 1181 | 1181 | |
@@ -1189,7 +1189,7 @@ discard block |
||
| 1189 | 1189 | * |
| 1190 | 1190 | * @since 1.9.0 |
| 1191 | 1191 | */ |
| 1192 | -function sensei_the_lesson_status_class(){ |
|
| 1192 | +function sensei_the_lesson_status_class() { |
|
| 1193 | 1193 | |
| 1194 | 1194 | echo get_the_lesson_status_class(); |
| 1195 | 1195 | } |