@@ -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 Lessons Class |
@@ -378,8 +381,7 @@ discard block |
||
| 378 | 381 | $quiz_questions = Sensei()->lesson->lesson_quiz_questions( $quiz_id ); |
| 379 | 382 | if( 0 < count( $quiz_questions ) ) { |
| 380 | 383 | update_post_meta( $post_id, '_quiz_has_questions', '1' ); |
| 381 | - } |
|
| 382 | - else { |
|
| 384 | + } else { |
|
| 383 | 385 | delete_post_meta( $post_id, '_quiz_has_questions' ); |
| 384 | 386 | } |
| 385 | 387 | |
@@ -390,7 +392,9 @@ discard block |
||
| 390 | 392 | |
| 391 | 393 | public function get_submitted_setting_value( $field = false ) { |
| 392 | 394 | |
| 393 | - if( ! $field ) return; |
|
| 395 | + if( ! $field ) { |
|
| 396 | + return; |
|
| 397 | + } |
|
| 394 | 398 | |
| 395 | 399 | $value = false; |
| 396 | 400 | |
@@ -1507,7 +1511,7 @@ discard block |
||
| 1507 | 1511 | |
| 1508 | 1512 | $field_name = 'answer_feedback_boolean'; |
| 1509 | 1513 | |
| 1510 | - }elseif( 'multiple-choice' == $question_type ){ |
|
| 1514 | + } elseif( 'multiple-choice' == $question_type ){ |
|
| 1511 | 1515 | |
| 1512 | 1516 | $field_name = 'answer_feedback_multiple_choice'; |
| 1513 | 1517 | |
@@ -1603,7 +1607,9 @@ discard block |
||
| 1603 | 1607 | |
| 1604 | 1608 | $html = ''; |
| 1605 | 1609 | |
| 1606 | - if( ! $lesson_id && ! $quiz_id ) return $html; |
|
| 1610 | + if( ! $lesson_id && ! $quiz_id ) { |
|
| 1611 | + return $html; |
|
| 1612 | + } |
|
| 1607 | 1613 | |
| 1608 | 1614 | $settings = $this->get_quiz_settings( $quiz_id ); |
| 1609 | 1615 | |
@@ -2258,11 +2264,11 @@ discard block |
||
| 2258 | 2264 | |
| 2259 | 2265 | $answer_feedback = $data[ 'answer_feedback_boolean' ]; |
| 2260 | 2266 | |
| 2261 | - }elseif( isset( $data[ 'answer_feedback_multiple_choice' ] ) && !empty( $data[ 'answer_feedback_multiple_choice' ] ) ){ |
|
| 2267 | + } elseif( isset( $data[ 'answer_feedback_multiple_choice' ] ) && !empty( $data[ 'answer_feedback_multiple_choice' ] ) ){ |
|
| 2262 | 2268 | |
| 2263 | 2269 | $answer_feedback = $data[ 'answer_feedback_multiple_choice' ]; |
| 2264 | 2270 | |
| 2265 | - }elseif( isset( $data[ 'answer_feedback' ] ) ){ |
|
| 2271 | + } elseif( isset( $data[ 'answer_feedback' ] ) ){ |
|
| 2266 | 2272 | |
| 2267 | 2273 | $answer_feedback = $data[ 'answer_feedback' ]; |
| 2268 | 2274 | |
@@ -2275,8 +2281,7 @@ discard block |
||
| 2275 | 2281 | // Handle the extended question text |
| 2276 | 2282 | if ( isset( $data[ 'question_description' ] ) && ( '' != $data[ 'question_description' ] ) ) { |
| 2277 | 2283 | $post_content = $data[ 'question_description' ]; |
| 2278 | - } |
|
| 2279 | - else { |
|
| 2284 | + } else { |
|
| 2280 | 2285 | $post_content = ''; |
| 2281 | 2286 | } |
| 2282 | 2287 | // Question Query Arguments |
@@ -2484,8 +2489,7 @@ discard block |
||
| 2484 | 2489 | 'key' => '_lesson_course', |
| 2485 | 2490 | 'value' => $course_id, |
| 2486 | 2491 | ); |
| 2487 | - } |
|
| 2488 | - else { |
|
| 2492 | + } else { |
|
| 2489 | 2493 | // Simple check for connection to a Course |
| 2490 | 2494 | $post_args['meta_query'][] = array( |
| 2491 | 2495 | 'key' => '_lesson_course', |
@@ -2613,9 +2617,13 @@ discard block |
||
| 2613 | 2617 | // Fetch each question in the order in which they were asked |
| 2614 | 2618 | $questions = array(); |
| 2615 | 2619 | foreach( $selected_questions as $question_id ) { |
| 2616 | - if( ! $question_id ) continue; |
|
| 2620 | + if( ! $question_id ) { |
|
| 2621 | + continue; |
|
| 2622 | + } |
|
| 2617 | 2623 | $question = get_post( $question_id ); |
| 2618 | - if( ! isset( $question ) || ! isset( $question->ID ) ) continue; |
|
| 2624 | + if( ! isset( $question ) || ! isset( $question->ID ) ) { |
|
| 2625 | + continue; |
|
| 2626 | + } |
|
| 2619 | 2627 | $questions[] = $question; |
| 2620 | 2628 | } |
| 2621 | 2629 | |
@@ -2628,7 +2636,9 @@ discard block |
||
| 2628 | 2636 | |
| 2629 | 2637 | // Set array of questions that already exist so we can prevent duplicates from appearing |
| 2630 | 2638 | foreach( $questions_array as $question ) { |
| 2631 | - if( 'question' != $question->post_type ) continue; |
|
| 2639 | + if( 'question' != $question->post_type ) { |
|
| 2640 | + continue; |
|
| 2641 | + } |
|
| 2632 | 2642 | $existing_questions[] = $question->ID; |
| 2633 | 2643 | } |
| 2634 | 2644 | |
@@ -2668,7 +2678,9 @@ discard block |
||
| 2668 | 2678 | |
| 2669 | 2679 | // Add selected questions to existing questions array to prevent duplicates from being added |
| 2670 | 2680 | foreach( $questions_array as $cat_question ) { |
| 2671 | - if( in_array( $cat_question->ID, $existing_questions ) ) continue; |
|
| 2681 | + if( in_array( $cat_question->ID, $existing_questions ) ) { |
|
| 2682 | + continue; |
|
| 2683 | + } |
|
| 2672 | 2684 | $existing_questions[] = $cat_question->ID; |
| 2673 | 2685 | } |
| 2674 | 2686 | } |
@@ -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 Quiz Class |
@@ -104,7 +107,7 @@ discard block |
||
| 104 | 107 | global $post; |
| 105 | 108 | if( 'quiz' == get_post_type( $post ) ){ |
| 106 | 109 | $quiz_id = $post->ID; |
| 107 | - }else{ |
|
| 110 | + } else{ |
|
| 108 | 111 | return false; |
| 109 | 112 | } |
| 110 | 113 | |
@@ -234,7 +237,7 @@ discard block |
||
| 234 | 237 | |
| 235 | 238 | $encoded_user_answers = $transient_cached_answers; |
| 236 | 239 | |
| 237 | - }else{ |
|
| 240 | + } else{ |
|
| 238 | 241 | |
| 239 | 242 | $encoded_user_answers = WooThemes_Sensei_Utils::get_user_data( 'quiz_answers', $lesson_id , $user_id ); |
| 240 | 243 | |
@@ -424,7 +427,7 @@ discard block |
||
| 424 | 427 | // compress the answer for saving |
| 425 | 428 | if( 'multi-line' == $question_type ) { |
| 426 | 429 | $answer = esc_html( $answer ); |
| 427 | - }elseif( 'file-upload' == $question_type ){ |
|
| 430 | + } elseif( 'file-upload' == $question_type ){ |
|
| 428 | 431 | $file_key = 'file_upload_' . $question_id; |
| 429 | 432 | if( isset( $files[ $file_key ] ) ) { |
| 430 | 433 | $attachment_id = WooThemes_Sensei_Utils::upload_file( $files[ $file_key ] ); |
@@ -1,5 +1,8 @@ |
||
| 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 Analysis User Profile List Table Class |
@@ -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 Administration Class |
@@ -210,13 +213,15 @@ discard block |
||
| 210 | 213 | |
| 211 | 214 | $option_value = get_option( $option ); |
| 212 | 215 | |
| 213 | - if ( $option_value > 0 && get_post( $option_value ) ) |
|
| 214 | - return; |
|
| 216 | + if ( $option_value > 0 && get_post( $option_value ) ) { |
|
| 217 | + return; |
|
| 218 | + } |
|
| 215 | 219 | |
| 216 | 220 | $page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", $slug ) ); |
| 217 | 221 | if ( $page_found ) : |
| 218 | - if ( ! $option_value ) |
|
| 219 | - update_option( $option, $page_found ); |
|
| 222 | + if ( ! $option_value ) { |
|
| 223 | + update_option( $option, $page_found ); |
|
| 224 | + } |
|
| 220 | 225 | return; |
| 221 | 226 | endif; |
| 222 | 227 | |
@@ -723,7 +728,9 @@ discard block |
||
| 723 | 728 | $types = array( 'course', 'lesson', 'question' ); |
| 724 | 729 | |
| 725 | 730 | foreach( $types as $type ) { |
| 726 | - if( ! post_type_exists( $type ) ) continue; |
|
| 731 | + if( ! post_type_exists( $type ) ) { |
|
| 732 | + continue; |
|
| 733 | + } |
|
| 727 | 734 | |
| 728 | 735 | $num_posts = wp_count_posts( $type ); |
| 729 | 736 | |
@@ -791,7 +798,9 @@ discard block |
||
| 791 | 798 | |
| 792 | 799 | $html = ''; |
| 793 | 800 | |
| 794 | - if( 0 == count( $settings ) ) return $html; |
|
| 801 | + if( 0 == count( $settings ) ) { |
|
| 802 | + return $html; |
|
| 803 | + } |
|
| 795 | 804 | |
| 796 | 805 | $html .= '<div class="sensei-options-panel">' . "\n"; |
| 797 | 806 | |
@@ -873,11 +882,11 @@ discard block |
||
| 873 | 882 | //backwards compatibility |
| 874 | 883 | if( empty( $data ) || 'on' == $data ){ |
| 875 | 884 | $checked_value = 'on'; |
| 876 | - }elseif( 'yes' == $data ) { |
|
| 885 | + } elseif( 'yes' == $data ) { |
|
| 877 | 886 | |
| 878 | 887 | $checked_value = 'yes'; |
| 879 | 888 | |
| 880 | - }elseif( 'auto' == $data ) { |
|
| 889 | + } elseif( 'auto' == $data ) { |
|
| 881 | 890 | |
| 882 | 891 | $checked_value = 'auto'; |
| 883 | 892 | |
@@ -28,8 +28,9 @@ |
||
| 28 | 28 | $found_files = array(); |
| 29 | 29 | $retrieved_files = (array) self::get_files( $pattern, $flags, $p . '/' ); |
| 30 | 30 | foreach ( $retrieved_files as $file ) { |
| 31 | - if ( ! in_array( $file, self::$found_files ) ) |
|
| 32 | - $found_files[] = $file; |
|
| 31 | + if ( ! in_array( $file, self::$found_files ) ) { |
|
| 32 | + $found_files[] = $file; |
|
| 33 | + } |
|
| 33 | 34 | } |
| 34 | 35 | |
| 35 | 36 | self::$found_files = array_merge( self::$found_files, $found_files ); |
@@ -1,5 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + exit; |
|
| 4 | +} |
|
| 3 | 5 | /** |
| 4 | 6 | * The Template for displaying the my course page data. |
| 5 | 7 | * |
@@ -1,5 +1,8 @@ |
||
| 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 Analysis User Profile List Table Class |
@@ -1,5 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + exit; |
|
| 4 | +} |
|
| 3 | 5 | /** |
| 4 | 6 | * The Template for displaying the my course page data. |
| 5 | 7 | * |
@@ -1,5 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + exit; |
|
| 4 | +} |
|
| 3 | 5 | /** |
| 4 | 6 | * The Template for displaying the my course page data. |
| 5 | 7 | * |