@@ -10,6 +10,9 @@ |
||
| 10 | 10 | private static $found_files = array(); |
| 11 | 11 | private static $custom_hooks_found = ''; |
| 12 | 12 | |
| 13 | + /** |
|
| 14 | + * @param string $pattern |
|
| 15 | + */ |
|
| 13 | 16 | private static function get_files( $pattern, $flags = 0, $path = '' ) { |
| 14 | 17 | |
| 15 | 18 | if ( ! $path && ( $dir = dirname( $pattern ) ) != '.' ) { |
@@ -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 ); |
@@ -21,6 +21,7 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * Constructor |
| 23 | 23 | * @since 1.0.0 |
| 24 | + * @param string $file |
|
| 24 | 25 | * @return void |
| 25 | 26 | */ |
| 26 | 27 | public function __construct ( $file ) { |
@@ -215,6 +216,7 @@ discard block |
||
| 215 | 216 | /** |
| 216 | 217 | * An individual users' profile view for analysis, showing their Courses |
| 217 | 218 | * @since 1.2.0 |
| 219 | + * @param integer $user_id |
|
| 218 | 220 | * @return void |
| 219 | 221 | */ |
| 220 | 222 | public function analysis_user_profile_view( $user_id ) { |
@@ -242,6 +244,7 @@ discard block |
||
| 242 | 244 | /** |
| 243 | 245 | * An individual Course view for analysis, showing the Courses Lessons |
| 244 | 246 | * @since 1.2.0 |
| 247 | + * @param integer $course_id |
|
| 245 | 248 | * @return void |
| 246 | 249 | */ |
| 247 | 250 | public function analysis_course_view( $course_id ) { |
@@ -269,6 +272,8 @@ discard block |
||
| 269 | 272 | /** |
| 270 | 273 | * An individual Course view for analysis, showing a specific Learners Lessons |
| 271 | 274 | * @since 1.2.0 |
| 275 | + * @param integer $course_id |
|
| 276 | + * @param integer $user_id |
|
| 272 | 277 | * @return void |
| 273 | 278 | */ |
| 274 | 279 | public function analysis_user_course_view( $course_id, $user_id ) { |
@@ -296,6 +301,7 @@ discard block |
||
| 296 | 301 | /** |
| 297 | 302 | * An individual Course view for analysis, showing all the Learners |
| 298 | 303 | * @since 1.2.0 |
| 304 | + * @param integer $course_id |
|
| 299 | 305 | * @return void |
| 300 | 306 | */ |
| 301 | 307 | public function analysis_course_users_view( $course_id ) { |
@@ -323,6 +329,7 @@ discard block |
||
| 323 | 329 | /** |
| 324 | 330 | * An individual Lesson view for analysis, showing all the Learners |
| 325 | 331 | * @since 1.2.0 |
| 332 | + * @param integer $lesson_id |
|
| 326 | 333 | * @return void |
| 327 | 334 | */ |
| 328 | 335 | public function analysis_lesson_users_view( $lesson_id ) { |
@@ -633,7 +640,7 @@ discard block |
||
| 633 | 640 | /** |
| 634 | 641 | * Write array data to CSV |
| 635 | 642 | * @since 1.2.0 |
| 636 | - * @param array $report_array data array |
|
| 643 | + * @param array $report_data data array |
|
| 637 | 644 | * @return void |
| 638 | 645 | */ |
| 639 | 646 | public function report_write_download( $report_data = array() ) { |
@@ -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 Analysis Class |
@@ -153,24 +156,19 @@ discard block |
||
| 153 | 156 | if ( 0 < $lesson_id ) { |
| 154 | 157 | // Viewing a specific Lesson and all its Learners |
| 155 | 158 | $this->analysis_lesson_users_view( $lesson_id ); |
| 156 | - } |
|
| 157 | - elseif ( 0 < $course_id && !$user_id && 'user' == $type ) { |
|
| 159 | + } elseif ( 0 < $course_id && !$user_id && 'user' == $type ) { |
|
| 158 | 160 | // Viewing a specific Course and all its Learners |
| 159 | 161 | $this->analysis_course_users_view( $course_id ); |
| 160 | - } |
|
| 161 | - elseif ( 0 < $course_id && 0 < $user_id ) { |
|
| 162 | + } elseif ( 0 < $course_id && 0 < $user_id ) { |
|
| 162 | 163 | // Viewing a specific Learner on a specific Course, showing their Lessons |
| 163 | 164 | $this->analysis_user_course_view( $course_id, $user_id ); |
| 164 | - } |
|
| 165 | - elseif( 0 < $course_id ) { |
|
| 165 | + } elseif( 0 < $course_id ) { |
|
| 166 | 166 | // Viewing a specific Course and all it's Lessons |
| 167 | 167 | $this->analysis_course_view( $course_id ); |
| 168 | - } |
|
| 169 | - elseif ( 0 < $user_id ) { |
|
| 168 | + } elseif ( 0 < $user_id ) { |
|
| 170 | 169 | // Viewing a specific Learner, and their Courses |
| 171 | 170 | $this->analysis_user_profile_view( $user_id ); |
| 172 | - } |
|
| 173 | - else { |
|
| 171 | + } else { |
|
| 174 | 172 | // Overview of all Learners, all Courses, or all Lessons |
| 175 | 173 | $this->analysis_default_view( $type ); |
| 176 | 174 | } // End If Statement |
@@ -569,20 +567,16 @@ discard block |
||
| 569 | 567 | if ( 0 < $lesson_id ) { |
| 570 | 568 | // Viewing a specific Lesson and all its Learners |
| 571 | 569 | $sensei_analysis_report_object = $this->load_report_object( 'Lesson', $lesson_id ); |
| 572 | - } |
|
| 573 | - elseif ( 0 < $course_id && 0 < $user_id ) { |
|
| 570 | + } elseif ( 0 < $course_id && 0 < $user_id ) { |
|
| 574 | 571 | // Viewing a specific User on a specific Course |
| 575 | 572 | $sensei_analysis_report_object = $this->load_report_object( 'Course', $course_id, $user_id ); |
| 576 | - } |
|
| 577 | - elseif( 0 < $course_id ) { |
|
| 573 | + } elseif( 0 < $course_id ) { |
|
| 578 | 574 | // Viewing a specific Course and all it's Lessons, or it's Learners |
| 579 | 575 | $sensei_analysis_report_object = $this->load_report_object( 'Course', $course_id ); |
| 580 | - } |
|
| 581 | - elseif ( 0 < $user_id ) { |
|
| 576 | + } elseif ( 0 < $user_id ) { |
|
| 582 | 577 | // Viewing a specific Learner, and their Courses |
| 583 | 578 | $sensei_analysis_report_object = $this->load_report_object( 'User_Profile', $user_id ); |
| 584 | - } |
|
| 585 | - else { |
|
| 579 | + } else { |
|
| 586 | 580 | // Overview of all Learners, all Courses, or all Lessons |
| 587 | 581 | $sensei_analysis_report_object = $this->load_report_object( 'Overview', $type ); |
| 588 | 582 | } // End If Statement |
@@ -40,6 +40,7 @@ discard block |
||
| 40 | 40 | * Constructor for the email class hooks in all emails that can be sent. |
| 41 | 41 | * |
| 42 | 42 | * @access public |
| 43 | + * @param string $file |
|
| 43 | 44 | * @return void |
| 44 | 45 | */ |
| 45 | 46 | function __construct( $file ) { |
@@ -140,7 +141,7 @@ discard block |
||
| 140 | 141 | * Wraps a message in the sensei mail template. |
| 141 | 142 | * |
| 142 | 143 | * @access public |
| 143 | - * @param mixed $content |
|
| 144 | + * @param null|string $content |
|
| 144 | 145 | * @return string |
| 145 | 146 | */ |
| 146 | 147 | function wrap_message( $content ) { |
@@ -198,6 +199,9 @@ discard block |
||
| 198 | 199 | remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
| 199 | 200 | } |
| 200 | 201 | |
| 202 | + /** |
|
| 203 | + * @param string $email_template |
|
| 204 | + */ |
|
| 201 | 205 | function get_content( $email_template ) { |
| 202 | 206 | |
| 203 | 207 | $message = $this->load_template( $email_template ); |
@@ -210,7 +210,9 @@ |
||
| 210 | 210 | function load_template( $template = '' ) { |
| 211 | 211 | global $email_template; |
| 212 | 212 | |
| 213 | - if( ! $template ) return; |
|
| 213 | + if( ! $template ) { |
|
| 214 | + return; |
|
| 215 | + } |
|
| 214 | 216 | |
| 215 | 217 | $email_template = $template . '.php'; |
| 216 | 218 | $template = Sensei_Templates::template_loader( '' ); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * Constructor |
| 23 | 23 | * @since 1.3.0 |
| 24 | 24 | * |
| 25 | - * @param $file |
|
| 25 | + * @param string $file |
|
| 26 | 26 | */ |
| 27 | 27 | public function __construct ( $file ) { |
| 28 | 28 | $this->name = __( 'Grading', 'woothemes-sensei' ); |
@@ -330,6 +330,7 @@ discard block |
||
| 330 | 330 | /** |
| 331 | 331 | * Return array of valid statuses for either Course or Lesson |
| 332 | 332 | * @since 1.7.0 |
| 333 | + * @param string $type |
|
| 333 | 334 | * @return array |
| 334 | 335 | */ |
| 335 | 336 | public function get_stati( $type ) { |
@@ -529,7 +530,7 @@ discard block |
||
| 529 | 530 | * the grades as the Grader selected theme and saves the total grade and |
| 530 | 531 | * individual question grades. |
| 531 | 532 | * |
| 532 | - * @return bool |
|
| 533 | + * @return false|null |
|
| 533 | 534 | */ |
| 534 | 535 | public function admin_process_grading_submission() { |
| 535 | 536 | |
@@ -906,8 +907,8 @@ discard block |
||
| 906 | 907 | * Grading logic specifically for the gap fill questions |
| 907 | 908 | * |
| 908 | 909 | * @since 1.9.0 |
| 909 | - * @param $question_id |
|
| 910 | - * @param $user_answer |
|
| 910 | + * @param integer $question_id |
|
| 911 | + * @param string $user_answer |
|
| 911 | 912 | * |
| 912 | 913 | * @return bool | int false or the grade given to the user answer |
| 913 | 914 | */ |
@@ -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 Grading Class |
@@ -130,8 +133,7 @@ discard block |
||
| 130 | 133 | $object_name = 'WooThemes_Sensei_Grading_' . $name; |
| 131 | 134 | if ( is_null($optional_data) ) { |
| 132 | 135 | $sensei_grading_object = new $object_name( $data ); |
| 133 | - } |
|
| 134 | - else { |
|
| 136 | + } else { |
|
| 135 | 137 | $sensei_grading_object = new $object_name( $data, $optional_data ); |
| 136 | 138 | } // End If Statement |
| 137 | 139 | if ( 'Main' == $name ) { |
@@ -150,8 +152,7 @@ discard block |
||
| 150 | 152 | |
| 151 | 153 | if ( isset( $_GET['quiz_id'] ) && 0 < intval( $_GET['quiz_id'] ) && isset( $_GET['user'] ) && 0 < intval( $_GET['user'] ) ) { |
| 152 | 154 | $this->grading_user_quiz_view(); |
| 153 | - } |
|
| 154 | - else { |
|
| 155 | + } else { |
|
| 155 | 156 | $this->grading_default_view(); |
| 156 | 157 | } // End If Statement |
| 157 | 158 | } // End grading_page() |
@@ -273,8 +274,7 @@ discard block |
||
| 273 | 274 | if ( version_compare($wp_version, '4.1', '>=') ) { |
| 274 | 275 | $url = add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $course_id ), admin_url( 'admin.php' ) ); |
| 275 | 276 | $title .= sprintf( ' <span class="course-title">> <a href="%s">%s</a></span>', esc_url( $url ), get_the_title( $course_id ) ); |
| 276 | - } |
|
| 277 | - else { |
|
| 277 | + } else { |
|
| 278 | 278 | $title .= sprintf( ' <span class="course-title">> %s</span>', get_the_title( $course_id ) ); |
| 279 | 279 | } |
| 280 | 280 | } |
@@ -309,8 +309,7 @@ discard block |
||
| 309 | 309 | if ( version_compare($wp_version, '4.1', '>=') ) { |
| 310 | 310 | $url = add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $course_id ), admin_url( 'admin.php' ) ); |
| 311 | 311 | $title .= sprintf( ' <span class="course-title">> <a href="%s">%s</a></span>', esc_url( $url ), get_the_title( $course_id ) ); |
| 312 | - } |
|
| 313 | - else { |
|
| 312 | + } else { |
|
| 314 | 313 | $title .= sprintf( ' <span class="course-title">> %s</span>', get_the_title( $course_id ) ); |
| 315 | 314 | } |
| 316 | 315 | $url = add_query_arg( array( 'page' => $this->page_slug, 'lesson_id' => $lesson_id ), admin_url( 'admin.php' ) ); |
@@ -379,8 +378,7 @@ discard block |
||
| 379 | 378 | |
| 380 | 379 | if ( 'course' == $args['type'] ) { |
| 381 | 380 | $type = 'sensei_course_status'; |
| 382 | - } |
|
| 383 | - else { |
|
| 381 | + } else { |
|
| 384 | 382 | $type = 'sensei_lesson_status'; |
| 385 | 383 | } |
| 386 | 384 | $cache_key = 'sensei-' . $args['type'] . '-statuses'; |
@@ -390,15 +388,13 @@ discard block |
||
| 390 | 388 | // Restrict to specific posts |
| 391 | 389 | if ( isset( $args['post__in'] ) && !empty( $args['post__in'] ) && is_array( $args['post__in'] ) ) { |
| 392 | 390 | $query .= ' AND comment_post_ID IN (' . implode( ',', array_map( 'absint', $args['post__in'] ) ) . ')'; |
| 393 | - } |
|
| 394 | - elseif ( !empty( $args['post_id'] ) ) { |
|
| 391 | + } elseif ( !empty( $args['post_id'] ) ) { |
|
| 395 | 392 | $query .= $wpdb->prepare( ' AND comment_post_ID = %d', $args['post_id'] ); |
| 396 | 393 | } |
| 397 | 394 | // Restrict to specific users |
| 398 | 395 | if ( isset( $args['user_id'] ) && is_array( $args['user_id'] ) ) { |
| 399 | 396 | $query .= ' AND user_id IN (' . implode( ',', array_map( 'absint', $args['user_id'] ) ) . ')'; |
| 400 | - } |
|
| 401 | - elseif ( !empty( $args['user_id'] ) ) { |
|
| 397 | + } elseif ( !empty( $args['user_id'] ) ) { |
|
| 402 | 398 | $query .= $wpdb->prepare( ' AND user_id = %d', $args['user_id'] ); |
| 403 | 399 | } |
| 404 | 400 | $query .= ' GROUP BY comment_approved'; |
@@ -601,8 +597,7 @@ discard block |
||
| 601 | 597 | // set the users total quiz grade |
| 602 | 598 | if ( 0 < intval( $quiz_grade_total ) ) { |
| 603 | 599 | $grade = abs( round( ( doubleval( $quiz_grade ) * 100 ) / ( $quiz_grade_total ), 2 ) ); |
| 604 | - } |
|
| 605 | - else { |
|
| 600 | + } else { |
|
| 606 | 601 | $grade = 0; |
| 607 | 602 | } |
| 608 | 603 | WooThemes_Sensei_Utils::sensei_grade_quiz( $quiz_id, $grade, $user_id ); |
@@ -615,8 +610,7 @@ discard block |
||
| 615 | 610 | // Student has reached the pass mark and lesson is complete |
| 616 | 611 | if ( $quiz_passmark <= $grade ) { |
| 617 | 612 | $lesson_status = 'passed'; |
| 618 | - } |
|
| 619 | - else { |
|
| 613 | + } else { |
|
| 620 | 614 | $lesson_status = 'failed'; |
| 621 | 615 | } // End If Statement |
| 622 | 616 | } |
@@ -761,8 +755,7 @@ discard block |
||
| 761 | 755 | // Question has a zero grade, so skip grading |
| 762 | 756 | if ( 0 == $achievable_grade ) { |
| 763 | 757 | $all_question_grades[ $question_id ] = $achievable_grade; |
| 764 | - } |
|
| 765 | - elseif ( in_array( $question_type, $autogradable_question_types ) ) { |
|
| 758 | + } elseif ( in_array( $question_type, $autogradable_question_types ) ) { |
|
| 766 | 759 | // Get user question grade |
| 767 | 760 | $question_grade = WooThemes_Sensei_Utils::sensei_grade_question_auto( $question_id, $question_type, $answer, $user_id ); |
| 768 | 761 | $all_question_grades[ $question_id ] = $question_grade; |
@@ -784,8 +777,7 @@ discard block |
||
| 784 | 777 | // Check for zero total from grades |
| 785 | 778 | if ( 0 < $quiz_total ) { |
| 786 | 779 | $grade = abs( round( ( doubleval( $grade_total ) * 100 ) / ( $quiz_total ), 2 ) ); |
| 787 | - } |
|
| 788 | - else { |
|
| 780 | + } else { |
|
| 789 | 781 | $grade = 0; |
| 790 | 782 | } |
| 791 | 783 | WooThemes_Sensei_Utils::sensei_grade_quiz( $quiz_id, $grade, $user_id, $quiz_grade_type ); |
@@ -945,19 +937,19 @@ discard block |
||
| 945 | 937 | |
| 946 | 938 | return Sensei()->question->get_question_grade($question_id); |
| 947 | 939 | |
| 948 | - }else{ |
|
| 940 | + } else{ |
|
| 949 | 941 | |
| 950 | 942 | return false; |
| 951 | 943 | |
| 952 | 944 | } |
| 953 | 945 | |
| 954 | - }else{ |
|
| 946 | + } else{ |
|
| 955 | 947 | |
| 956 | 948 | return false; |
| 957 | 949 | |
| 958 | 950 | } |
| 959 | 951 | |
| 960 | - }else{ |
|
| 952 | + } else{ |
|
| 961 | 953 | |
| 962 | 954 | // Case Sensitive Check that the 'gap' is "exactly" equal to the given answer |
| 963 | 955 | if ( trim(strtolower($gapfill_array[1])) == trim(strtolower( $user_answer )) ) { |
@@ -970,13 +962,13 @@ discard block |
||
| 970 | 962 | |
| 971 | 963 | return Sensei()->question->get_question_grade( $question_id ); |
| 972 | 964 | |
| 973 | - }else{ |
|
| 965 | + } else{ |
|
| 974 | 966 | |
| 975 | 967 | return false; |
| 976 | 968 | |
| 977 | 969 | } |
| 978 | 970 | |
| 979 | - }else{ |
|
| 971 | + } else{ |
|
| 980 | 972 | |
| 981 | 973 | return false; |
| 982 | 974 | |
@@ -21,6 +21,7 @@ |
||
| 21 | 21 | /** |
| 22 | 22 | * Constructor |
| 23 | 23 | * @since 1.6.0 |
| 24 | + * @param string $file |
|
| 24 | 25 | * @return void |
| 25 | 26 | */ |
| 26 | 27 | public function __construct ( $file ) { |
@@ -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 Learners Class |
@@ -342,7 +345,7 @@ discard block |
||
| 342 | 345 | |
| 343 | 346 | $name = $full_name; |
| 344 | 347 | |
| 345 | - }else{ |
|
| 348 | + } else{ |
|
| 346 | 349 | |
| 347 | 350 | $name = $full_name . ' ['. $user->display_name .']'; |
| 348 | 351 | |
@@ -359,11 +362,17 @@ discard block |
||
| 359 | 362 | |
| 360 | 363 | $result = false; |
| 361 | 364 | |
| 362 | - if( ! isset( $_POST['add_learner_submit'] ) ) return $result; |
|
| 365 | + if( ! isset( $_POST['add_learner_submit'] ) ) { |
|
| 366 | + return $result; |
|
| 367 | + } |
|
| 363 | 368 | |
| 364 | - if ( ! isset( $_POST['add_learner_nonce'] ) || ! wp_verify_nonce( $_POST['add_learner_nonce'], 'add_learner_to_sensei' ) ) return $result; |
|
| 369 | + if ( ! isset( $_POST['add_learner_nonce'] ) || ! wp_verify_nonce( $_POST['add_learner_nonce'], 'add_learner_to_sensei' ) ) { |
|
| 370 | + return $result; |
|
| 371 | + } |
|
| 365 | 372 | |
| 366 | - if( ( ! isset( $_POST['add_user_id'] ) || '' == $_POST['add_user_id'] ) || ! isset( $_POST['add_post_type'] ) || ! isset( $_POST['add_course_id'] ) || ! isset( $_POST['add_lesson_id'] ) ) return $result; |
|
| 373 | + if( ( ! isset( $_POST['add_user_id'] ) || '' == $_POST['add_user_id'] ) || ! isset( $_POST['add_post_type'] ) || ! isset( $_POST['add_course_id'] ) || ! isset( $_POST['add_lesson_id'] ) ) { |
|
| 374 | + return $result; |
|
| 375 | + } |
|
| 367 | 376 | |
| 368 | 377 | $post_type = $_POST['add_post_type']; |
| 369 | 378 | $user_id = absint( $_POST['add_user_id'] ); |
@@ -479,7 +488,7 @@ discard block |
||
| 479 | 488 | |
| 480 | 489 | $full_name = trim( $user->first_name ) . ' ' . trim( $user->last_name ); |
| 481 | 490 | |
| 482 | - }else{ |
|
| 491 | + } else{ |
|
| 483 | 492 | |
| 484 | 493 | $full_name = $user->display_name; |
| 485 | 494 | |
@@ -44,6 +44,7 @@ |
||
| 44 | 44 | /** |
| 45 | 45 | * Constructor |
| 46 | 46 | * @since 1.2.0 |
| 47 | + * @param string $token |
|
| 47 | 48 | * @return void |
| 48 | 49 | */ |
| 49 | 50 | public function __construct ( $token ) { |
@@ -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 Generic List Table Class |
@@ -131,8 +134,9 @@ discard block |
||
| 131 | 134 | * @return array |
| 132 | 135 | */ |
| 133 | 136 | function get_column_info() { |
| 134 | - if ( isset( $this->_column_headers ) ) |
|
| 135 | - return $this->_column_headers; |
|
| 137 | + if ( isset( $this->_column_headers ) ) { |
|
| 138 | + return $this->_column_headers; |
|
| 139 | + } |
|
| 136 | 140 | |
| 137 | 141 | $columns = $this->get_columns(); |
| 138 | 142 | $hidden = get_hidden_columns( $this->screen ); |
@@ -152,12 +156,14 @@ discard block |
||
| 152 | 156 | |
| 153 | 157 | $sortable = array(); |
| 154 | 158 | foreach ( $_sortable as $id => $data ) { |
| 155 | - if ( empty( $data ) ) |
|
| 156 | - continue; |
|
| 159 | + if ( empty( $data ) ) { |
|
| 160 | + continue; |
|
| 161 | + } |
|
| 157 | 162 | |
| 158 | 163 | $data = (array) $data; |
| 159 | - if ( !isset( $data[1] ) ) |
|
| 160 | - $data[1] = false; |
|
| 164 | + if ( !isset( $data[1] ) ) { |
|
| 165 | + $data[1] = false; |
|
| 166 | + } |
|
| 161 | 167 | |
| 162 | 168 | $sortable[$id] = $data; |
| 163 | 169 | } |
@@ -188,8 +194,9 @@ discard block |
||
| 188 | 194 | $class = "class='$column_name column-$column_name'"; |
| 189 | 195 | |
| 190 | 196 | $style = ''; |
| 191 | - if ( in_array( $column_name, $hidden ) ) |
|
| 192 | - $style = ' style="display:none;"'; |
|
| 197 | + if ( in_array( $column_name, $hidden ) ) { |
|
| 198 | + $style = ' style="display:none;"'; |
|
| 199 | + } |
|
| 193 | 200 | |
| 194 | 201 | $attributes = "$class$style"; |
| 195 | 202 | |
@@ -299,7 +299,7 @@ |
||
| 299 | 299 | * @param integer $sender_id ID of sender |
| 300 | 300 | * @param integer $receiver_id ID of receiver |
| 301 | 301 | * @param string $message Message content |
| 302 | - * @param string $post_id ID of post related to message |
|
| 302 | + * @param integer $post_id ID of post related to message |
|
| 303 | 303 | * @return mixed Message ID on success, boolean false on failure |
| 304 | 304 | */ |
| 305 | 305 | private function save_new_message_post( $sender_id = 0, $receiver_id = 0, $message = '', $post_id = 0 ) { |
@@ -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 Messages Class |
@@ -73,7 +76,9 @@ discard block |
||
| 73 | 76 | |
| 74 | 77 | public function add_meta_box( $post_type, $post ) { |
| 75 | 78 | |
| 76 | - if( ! $post_type == $this->post_type ) return; |
|
| 79 | + if( ! $post_type == $this->post_type ) { |
|
| 80 | + return; |
|
| 81 | + } |
|
| 77 | 82 | |
| 78 | 83 | add_meta_box( $this->post_type . '-data', __( 'Message Information', 'woothemes-sensei' ), array( $this, 'meta_box_content' ), $this->post_type, 'normal', 'default' ); |
| 79 | 84 | |
@@ -138,7 +143,9 @@ discard block |
||
| 138 | 143 | public function save_message( $post_id = 0 ) { |
| 139 | 144 | global $post; |
| 140 | 145 | |
| 141 | - if( $this->post_type != get_post_type() ) return; |
|
| 146 | + if( $this->post_type != get_post_type() ) { |
|
| 147 | + return; |
|
| 148 | + } |
|
| 142 | 149 | |
| 143 | 150 | if( isset( $_POST['sender'] ) && $_POST['sender'] ) { |
| 144 | 151 | update_post_meta( $post_id, '_sender', $_POST['sender'] ); |
@@ -174,7 +181,9 @@ discard block |
||
| 174 | 181 | |
| 175 | 182 | if( ! isset( Sensei()->settings->settings['messages_disable'] ) || ! Sensei()->settings->settings['messages_disable'] ) { |
| 176 | 183 | |
| 177 | - if( ! is_user_logged_in() ) return; |
|
| 184 | + if( ! is_user_logged_in() ) { |
|
| 185 | + return; |
|
| 186 | + } |
|
| 178 | 187 | |
| 179 | 188 | if( isset( $_GET['contact'] ) ) { |
| 180 | 189 | $html .= $this->teacher_contact_form( $post ); |
@@ -185,7 +194,7 @@ discard block |
||
| 185 | 194 | $contact_button_text = __( 'Contact Lesson Teacher', 'woothemes-sensei' ); |
| 186 | 195 | } elseif( 'course' == $post->post_type ) { |
| 187 | 196 | $contact_button_text = __( 'Contact Course Teacher', 'woothemes-sensei' ); |
| 188 | - }else{ |
|
| 197 | + } else{ |
|
| 189 | 198 | $contact_button_text = __( 'Contact Teacher', 'woothemes-sensei' ); |
| 190 | 199 | } |
| 191 | 200 | |
@@ -203,14 +212,18 @@ discard block |
||
| 203 | 212 | |
| 204 | 213 | public function teacher_contact_form( $post ) { |
| 205 | 214 | |
| 206 | - if( ! is_user_logged_in() ) return; |
|
| 215 | + if( ! is_user_logged_in() ) { |
|
| 216 | + return; |
|
| 217 | + } |
|
| 207 | 218 | |
| 208 | 219 | global $current_user; |
| 209 | 220 | wp_get_current_user(); |
| 210 | 221 | |
| 211 | 222 | $html = ''; |
| 212 | 223 | |
| 213 | - if( ! isset( $post->ID ) ) return $html; |
|
| 224 | + if( ! isset( $post->ID ) ) { |
|
| 225 | + return $html; |
|
| 226 | + } |
|
| 214 | 227 | |
| 215 | 228 | //confirm private message |
| 216 | 229 | $confirmation = ''; |
@@ -244,9 +257,13 @@ discard block |
||
| 244 | 257 | |
| 245 | 258 | public function save_new_message() { |
| 246 | 259 | |
| 247 | - if( ! isset( $_POST['sensei_message_teacher_nonce'] ) ) return; |
|
| 260 | + if( ! isset( $_POST['sensei_message_teacher_nonce'] ) ) { |
|
| 261 | + return; |
|
| 262 | + } |
|
| 248 | 263 | |
| 249 | - if( ! wp_verify_nonce( $_POST['sensei_message_teacher_nonce'], 'message_teacher' ) ) return; |
|
| 264 | + if( ! wp_verify_nonce( $_POST['sensei_message_teacher_nonce'], 'message_teacher' ) ) { |
|
| 265 | + return; |
|
| 266 | + } |
|
| 250 | 267 | |
| 251 | 268 | $message_id = $this->save_new_message_post( $_POST['sender_id'], $_POST['receiver_id'], $_POST['contact_message'], $_POST['post_id'] ); |
| 252 | 269 | |
@@ -257,12 +274,16 @@ discard block |
||
| 257 | 274 | // Get comment object |
| 258 | 275 | $comment = get_comment( $comment_id ); |
| 259 | 276 | |
| 260 | - if( is_null( $comment ) ) return; |
|
| 277 | + if( is_null( $comment ) ) { |
|
| 278 | + return; |
|
| 279 | + } |
|
| 261 | 280 | |
| 262 | 281 | // Get message post object |
| 263 | 282 | $message = get_post( $comment->comment_post_ID ); |
| 264 | 283 | |
| 265 | - if( $message->post_type != $this->post_type ) return; |
|
| 284 | + if( $message->post_type != $this->post_type ) { |
|
| 285 | + return; |
|
| 286 | + } |
|
| 266 | 287 | |
| 267 | 288 | // Force comment to be approved |
| 268 | 289 | wp_set_comment_status( $comment_id, 'approve' ); |
@@ -360,7 +381,9 @@ discard block |
||
| 360 | 381 | */ |
| 361 | 382 | private function view_message( $message_id, $user_id = 0) { |
| 362 | 383 | |
| 363 | - if( ! is_user_logged_in() ) return false; |
|
| 384 | + if( ! is_user_logged_in() ) { |
|
| 385 | + return false; |
|
| 386 | + } |
|
| 364 | 387 | |
| 365 | 388 | if( $user_id == 0 ) { |
| 366 | 389 | global $current_user; |
@@ -424,9 +447,7 @@ discard block |
||
| 424 | 447 | |
| 425 | 448 | wp_redirect($my_courses_url, 303); |
| 426 | 449 | exit; |
| 427 | - } |
|
| 428 | - |
|
| 429 | - else { |
|
| 450 | + } else { |
|
| 430 | 451 | |
| 431 | 452 | wp_redirect(home_url('/wp-login.php'), 303); |
| 432 | 453 | exit; |
@@ -442,7 +463,9 @@ discard block |
||
| 442 | 463 | public function message_list( $query ) { |
| 443 | 464 | global $current_user; |
| 444 | 465 | |
| 445 | - if( is_admin() ) return; |
|
| 466 | + if( is_admin() ) { |
|
| 467 | + return; |
|
| 468 | + } |
|
| 446 | 469 | |
| 447 | 470 | if( is_post_type_archive( $this->post_type ) && $query->is_main_query() ) { |
| 448 | 471 | wp_get_current_user(); |
@@ -1942,6 +1942,7 @@ |
||
| 1942 | 1942 | * Hooked into 'get_terms' |
| 1943 | 1943 | * |
| 1944 | 1944 | * @since 1.8.0 |
| 1945 | + * @param string[] $taxonomies |
|
| 1945 | 1946 | */ |
| 1946 | 1947 | public function append_teacher_name_to_module( $terms, $taxonomies, $args ) |
| 1947 | 1948 | { |
@@ -1,6 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 3 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | + exit; |
|
| 5 | +} |
|
| 4 | 6 | |
| 5 | 7 | /** |
| 6 | 8 | * Sensei Modules Class |
@@ -401,8 +403,9 @@ discard block |
||
| 401 | 403 | $term = urldecode(stripslashes($_GET['term'])); |
| 402 | 404 | |
| 403 | 405 | // Return nothing if term is empty |
| 404 | - if (empty($term)) |
|
| 405 | - die(); |
|
| 406 | + if (empty($term)) { |
|
| 407 | + die(); |
|
| 408 | + } |
|
| 406 | 409 | |
| 407 | 410 | // Set a default if none is given |
| 408 | 411 | $default = isset($_GET['default']) ? $_GET['default'] : __('No course', 'woothemes-sensei'); |
@@ -789,7 +792,9 @@ discard block |
||
| 789 | 792 | ); |
| 790 | 793 | $lessons = get_posts($args); |
| 791 | 794 | |
| 792 | - if (is_wp_error($lessons) || 0 >= count($lessons)) return 0; |
|
| 795 | + if (is_wp_error($lessons) || 0 >= count($lessons)) { |
|
| 796 | + return 0; |
|
| 797 | + } |
|
| 793 | 798 | |
| 794 | 799 | $completed = false; |
| 795 | 800 | $lesson_count = 0; |
@@ -1378,7 +1383,7 @@ discard block |
||
| 1378 | 1383 | |
| 1379 | 1384 | return $lesson_query->posts; |
| 1380 | 1385 | |
| 1381 | - }else{ |
|
| 1386 | + } else{ |
|
| 1382 | 1387 | |
| 1383 | 1388 | return array(); |
| 1384 | 1389 | |
@@ -33,10 +33,6 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * |
| 35 | 35 | * |
| 36 | - * @param string $message |
|
| 37 | - * @param string $type defaults to alert options( alert, tick , download , note ) |
|
| 38 | - * |
|
| 39 | - * @return void |
|
| 40 | 36 | */ |
| 41 | 37 | |
| 42 | 38 | public function add_notice( $content , $type = 'alert' ){ |
@@ -47,10 +43,6 @@ discard block |
||
| 47 | 43 | /** |
| 48 | 44 | * Output all notices added |
| 49 | 45 | * |
| 50 | - * @param string $message |
|
| 51 | - * @param string $type |
|
| 52 | - * |
|
| 53 | - * @return void |
|
| 54 | 46 | */ |
| 55 | 47 | |
| 56 | 48 | public function print_notices(){ |
@@ -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 |