@@ -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 |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | * |
| 373 | 373 | * @access public |
| 374 | 374 | * @param int $post_id |
| 375 | - * @return void |
|
| 375 | + * @return integer|null |
|
| 376 | 376 | */ |
| 377 | 377 | public function meta_box_save ( $post_id ) { |
| 378 | 378 | global $post, $messages; |
@@ -848,7 +848,6 @@ discard block |
||
| 848 | 848 | * course_count function. |
| 849 | 849 | * |
| 850 | 850 | * @access public |
| 851 | - * @param array $exclude (default: array()) |
|
| 852 | 851 | * @param string $post_status (default: 'publish') |
| 853 | 852 | * @return int |
| 854 | 853 | */ |
@@ -1159,7 +1158,6 @@ discard block |
||
| 1159 | 1158 | * |
| 1160 | 1159 | * @since 1.4.0 |
| 1161 | 1160 | * @param object $user Queried user object |
| 1162 | - * @param boolean $manage Whether the user has permission to manage the courses |
|
| 1163 | 1161 | * @return string HTML displayng course data |
| 1164 | 1162 | */ |
| 1165 | 1163 | public function load_user_courses_content( $user = false ) { |
@@ -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 Class |
@@ -614,7 +617,7 @@ discard block |
||
| 614 | 617 | |
| 615 | 618 | return $results_array; |
| 616 | 619 | |
| 617 | - }else{ |
|
| 620 | + } else{ |
|
| 618 | 621 | |
| 619 | 622 | //reset the pagination as this widgets do not need it |
| 620 | 623 | $post_args['paged'] = 1; |
@@ -835,7 +838,7 @@ discard block |
||
| 835 | 838 | |
| 836 | 839 | return $html; |
| 837 | 840 | |
| 838 | - }else{ |
|
| 841 | + } else{ |
|
| 839 | 842 | |
| 840 | 843 | echo $html; |
| 841 | 844 | |
@@ -982,8 +985,7 @@ discard block |
||
| 982 | 985 | $has_questions = get_post_meta( $lesson_id, '_quiz_has_questions', true ); |
| 983 | 986 | if ( $has_questions && $boolean_check ) { |
| 984 | 987 | return true; |
| 985 | - } |
|
| 986 | - elseif ( $has_questions ) { |
|
| 988 | + } elseif ( $has_questions ) { |
|
| 987 | 989 | $quiz_id = Sensei()->lesson->lesson_quizzes( $lesson_id ); |
| 988 | 990 | // $questions = Sensei()->lesson->lesson_quiz_questions( $quiz_id ); |
| 989 | 991 | // if( count( $questions ) > 0 ) { |
@@ -1805,11 +1807,11 @@ discard block |
||
| 1805 | 1807 | |
| 1806 | 1808 | $course_id = $email['course_id']; |
| 1807 | 1809 | |
| 1808 | - }elseif( isset( $email['lesson_id'] ) ){ |
|
| 1810 | + } elseif( isset( $email['lesson_id'] ) ){ |
|
| 1809 | 1811 | |
| 1810 | 1812 | $course_id = Sensei()->lesson->get_course_id( $email['lesson_id'] ); |
| 1811 | 1813 | |
| 1812 | - }elseif( isset( $email['quiz_id'] ) ){ |
|
| 1814 | + } elseif( isset( $email['quiz_id'] ) ){ |
|
| 1813 | 1815 | |
| 1814 | 1816 | $lesson_id = Sensei()->quiz->get_lesson_id( $email['quiz_id'] ); |
| 1815 | 1817 | $course_id = Sensei()->lesson->get_course_id( $lesson_id ); |
@@ -1870,7 +1872,7 @@ discard block |
||
| 1870 | 1872 | |
| 1871 | 1873 | if( isset( $_POST['disable_sensei_course_notification'] ) && 'on'== $_POST['disable_sensei_course_notification'] ) { |
| 1872 | 1874 | $new_val = true; |
| 1873 | - }else{ |
|
| 1875 | + } else{ |
|
| 1874 | 1876 | $new_val = false; |
| 1875 | 1877 | } |
| 1876 | 1878 | |
@@ -2009,7 +2011,7 @@ discard block |
||
| 2009 | 2011 | |
| 2010 | 2012 | $classes[] = 'user-status-completed'; |
| 2011 | 2013 | |
| 2012 | - }else{ |
|
| 2014 | + } else{ |
|
| 2013 | 2015 | |
| 2014 | 2016 | $classes[] = 'user-status-active'; |
| 2015 | 2017 | |
@@ -2826,7 +2828,7 @@ discard block |
||
| 2826 | 2828 | |
| 2827 | 2829 | $title = $term->name; |
| 2828 | 2830 | |
| 2829 | - }else{ |
|
| 2831 | + } else{ |
|
| 2830 | 2832 | |
| 2831 | 2833 | $title = 'Course Category'; |
| 2832 | 2834 | |
@@ -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( '' ); |
@@ -473,7 +473,6 @@ discard block |
||
| 473 | 473 | * Remove Sensei custom menu items depending on settings and logged in status. |
| 474 | 474 | * |
| 475 | 475 | * @access public |
| 476 | - * @param object $item |
|
| 477 | 476 | * @return object $item |
| 478 | 477 | */ |
| 479 | 478 | public function sensei_wp_nav_menu_objects( $sorted_menu_items ) { |
@@ -530,7 +529,7 @@ discard block |
||
| 530 | 529 | * |
| 531 | 530 | * @deprecated since 1.9.0 |
| 532 | 531 | * @since 1.2.0 |
| 533 | - * @return void |
|
| 532 | + * @return string|null |
|
| 534 | 533 | */ |
| 535 | 534 | function sensei_course_image( $course_id, $width = '100', $height = '100', $return = false ) { |
| 536 | 535 | |
@@ -551,7 +550,7 @@ discard block |
||
| 551 | 550 | /** |
| 552 | 551 | * sensei_lesson_image output for lesson image |
| 553 | 552 | * @since 1.2.0 |
| 554 | - * @return void |
|
| 553 | + * @return string|null |
|
| 555 | 554 | * @deprecated since 1.9.0 |
| 556 | 555 | */ |
| 557 | 556 | function sensei_lesson_image( $lesson_id, $width = '100', $height = '100', $return = false, $widget = false ) { |
@@ -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 Frontend Class |
@@ -560,7 +563,7 @@ discard block |
||
| 560 | 563 | |
| 561 | 564 | return Sensei()->lesson->lesson_image( $lesson_id, $width, $height, $widget ); |
| 562 | 565 | |
| 563 | - }else{ |
|
| 566 | + } else{ |
|
| 564 | 567 | |
| 565 | 568 | echo Sensei()->lesson->lesson_image( $lesson_id, $width, $height, $widget ); |
| 566 | 569 | |
@@ -661,7 +664,9 @@ discard block |
||
| 661 | 664 | public function sensei_breadcrumb( $id = 0 ) { |
| 662 | 665 | |
| 663 | 666 | // Only output on lesson, quiz and taxonomy (module) pages |
| 664 | - if( ! ( is_tax( 'module' ) || is_singular( 'lesson' ) || is_singular( 'quiz' ) ) ) return; |
|
| 667 | + if( ! ( is_tax( 'module' ) || is_singular( 'lesson' ) || is_singular( 'quiz' ) ) ) { |
|
| 668 | + return; |
|
| 669 | + } |
|
| 665 | 670 | |
| 666 | 671 | if( empty( $id ) ){ |
| 667 | 672 | |
@@ -1065,17 +1070,26 @@ discard block |
||
| 1065 | 1070 | |
| 1066 | 1071 | <p class="form-row form-row-wide"> |
| 1067 | 1072 | <label for="sensei_reg_username"><?php _e( 'Username', 'woothemes-sensei' ); ?> <span class="required">*</span></label> |
| 1068 | - <input type="text" class="input-text" name="sensei_reg_username" id="sensei_reg_username" value="<?php if ( ! empty( $_POST['sensei_reg_username'] ) ) esc_attr_e( $_POST['sensei_reg_username'] ); ?>" /> |
|
| 1073 | + <input type="text" class="input-text" name="sensei_reg_username" id="sensei_reg_username" value="<?php if ( ! empty( $_POST['sensei_reg_username'] ) ) { |
|
| 1074 | + esc_attr_e( $_POST['sensei_reg_username'] ); |
|
| 1075 | +} |
|
| 1076 | +?>" /> |
|
| 1069 | 1077 | </p> |
| 1070 | 1078 | |
| 1071 | 1079 | <p class="form-row form-row-wide"> |
| 1072 | 1080 | <label for="sensei_reg_email"><?php _e( 'Email address', 'woothemes-sensei' ); ?> <span class="required">*</span></label> |
| 1073 | - <input type="email" class="input-text" name="sensei_reg_email" id="sensei_reg_email" value="<?php if ( ! empty( $_POST['sensei_reg_email'] ) ) esc_attr_e( $_POST['sensei_reg_email'] ); ?>" /> |
|
| 1081 | + <input type="email" class="input-text" name="sensei_reg_email" id="sensei_reg_email" value="<?php if ( ! empty( $_POST['sensei_reg_email'] ) ) { |
|
| 1082 | + esc_attr_e( $_POST['sensei_reg_email'] ); |
|
| 1083 | +} |
|
| 1084 | +?>" /> |
|
| 1074 | 1085 | </p> |
| 1075 | 1086 | |
| 1076 | 1087 | <p class="form-row form-row-wide"> |
| 1077 | 1088 | <label for="sensei_reg_password"><?php _e( 'Password', 'woothemes-sensei' ); ?> <span class="required">*</span></label> |
| 1078 | - <input type="password" class="input-text" name="sensei_reg_password" id="sensei_reg_password" value="<?php if ( ! empty( $_POST['sensei_reg_password'] ) ) esc_attr_e( $_POST['sensei_reg_password'] ); ?>" /> |
|
| 1089 | + <input type="password" class="input-text" name="sensei_reg_password" id="sensei_reg_password" value="<?php if ( ! empty( $_POST['sensei_reg_password'] ) ) { |
|
| 1090 | + esc_attr_e( $_POST['sensei_reg_password'] ); |
|
| 1091 | +} |
|
| 1092 | +?>" /> |
|
| 1079 | 1093 | </p> |
| 1080 | 1094 | |
| 1081 | 1095 | <!-- Spam Trap --> |
@@ -1408,8 +1422,12 @@ discard block |
||
| 1408 | 1422 | |
| 1409 | 1423 | if( WooThemes_Sensei_Utils::sensei_is_woocommerce_activated() ) { |
| 1410 | 1424 | |
| 1411 | - if( ! is_user_logged_in() ) return; |
|
| 1412 | - if( ! isset( $post->ID ) ) return; |
|
| 1425 | + if( ! is_user_logged_in() ) { |
|
| 1426 | + return; |
|
| 1427 | + } |
|
| 1428 | + if( ! isset( $post->ID ) ) { |
|
| 1429 | + return; |
|
| 1430 | + } |
|
| 1413 | 1431 | |
| 1414 | 1432 | $user_id = $current_user->ID; |
| 1415 | 1433 | $course_id = $post->ID; |
@@ -1572,7 +1590,7 @@ discard block |
||
| 1572 | 1590 | //assigne the username to the creds array for further processing |
| 1573 | 1591 | $creds['user_login'] = $user->user_login ; |
| 1574 | 1592 | |
| 1575 | - }else{ |
|
| 1593 | + } else{ |
|
| 1576 | 1594 | |
| 1577 | 1595 | // process this as a default username login |
| 1578 | 1596 | $creds['user_login'] = sanitize_text_field( $_REQUEST['log'] ) ; |
@@ -1589,7 +1607,7 @@ discard block |
||
| 1589 | 1607 | if ( is_wp_error($user) ){ // on login failure |
| 1590 | 1608 | wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) ); |
| 1591 | 1609 | exit; |
| 1592 | - }else{ // on login success |
|
| 1610 | + } else{ // on login success |
|
| 1593 | 1611 | |
| 1594 | 1612 | /** |
| 1595 | 1613 | * change the redirect url programatically |
@@ -1606,7 +1624,7 @@ discard block |
||
| 1606 | 1624 | |
| 1607 | 1625 | } // end is_wp_error($user) |
| 1608 | 1626 | |
| 1609 | - }else{ // if username or password is empty |
|
| 1627 | + } else{ // if username or password is empty |
|
| 1610 | 1628 | |
| 1611 | 1629 | wp_redirect( esc_url_raw( add_query_arg('login', 'emptyfields', $referrer) ) ); |
| 1612 | 1630 | exit; |
@@ -1615,7 +1633,7 @@ discard block |
||
| 1615 | 1633 | |
| 1616 | 1634 | return ; |
| 1617 | 1635 | |
| 1618 | - }elseif( ( isset( $_GET['login'] ) ) ) { |
|
| 1636 | + } elseif( ( isset( $_GET['login'] ) ) ) { |
|
| 1619 | 1637 | // else if this request is a redircect from a previously faile login request |
| 1620 | 1638 | $this->login_message_process(); |
| 1621 | 1639 | |
@@ -1736,7 +1754,7 @@ discard block |
||
| 1736 | 1754 | |
| 1737 | 1755 | $message = __('Incorrect login details', 'woothemes-sensei' ); |
| 1738 | 1756 | |
| 1739 | - }elseif( $_GET['login'] == 'emptyfields' ){ |
|
| 1757 | + } elseif( $_GET['login'] == 'emptyfields' ){ |
|
| 1740 | 1758 | |
| 1741 | 1759 | $message= __('Please enter your username and password', 'woothemes-sensei' ); |
| 1742 | 1760 | } |
@@ -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 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | * |
| 240 | 240 | * @access public |
| 241 | 241 | * @param int $post_id |
| 242 | - * @return void |
|
| 242 | + * @return integer|null |
|
| 243 | 243 | */ |
| 244 | 244 | public function meta_box_save ( $post_id ) { |
| 245 | 245 | |
@@ -2418,7 +2418,7 @@ discard block |
||
| 2418 | 2418 | * |
| 2419 | 2419 | * @access private |
| 2420 | 2420 | * @param array $data (default: array()) |
| 2421 | - * @return void |
|
| 2421 | + * @return boolean |
|
| 2422 | 2422 | */ |
| 2423 | 2423 | private function lesson_delete_question( $data = array() ) { |
| 2424 | 2424 | |
@@ -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 | } |
@@ -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 | |