@@ -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 | |
@@ -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(); |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | * This function simply loads the question type template |
| 403 | 403 | * |
| 404 | 404 | * @since 1.9.0 |
| 405 | - * @param $question_type |
|
| 405 | + * @param string $question_type |
|
| 406 | 406 | */ |
| 407 | 407 | public static function load_question_template( $question_type ){ |
| 408 | 408 | |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | * Get the questions media markup |
| 488 | 488 | * |
| 489 | 489 | * @since 1.9.0 |
| 490 | - * @param $question_id |
|
| 490 | + * @param string $question_id |
|
| 491 | 491 | * @return string |
| 492 | 492 | */ |
| 493 | 493 | public static function get_the_question_media( $question_id ){ |
@@ -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 Question Class |
@@ -211,7 +214,9 @@ discard block |
||
| 211 | 214 | |
| 212 | 215 | $lesson_id = get_post_meta( $quiz, '_quiz_lesson', true ); |
| 213 | 216 | |
| 214 | - if( ! $lesson_id ) continue; |
|
| 217 | + if( ! $lesson_id ) { |
|
| 218 | + continue; |
|
| 219 | + } |
|
| 215 | 220 | |
| 216 | 221 | $lessons[ $lesson_id ]['title'] = get_the_title( $lesson_id ); |
| 217 | 222 | $lessons[ $lesson_id ]['link'] = admin_url( 'post.php?post=' . $lesson_id . '&action=edit' ); |
@@ -880,7 +885,7 @@ discard block |
||
| 880 | 885 | |
| 881 | 886 | $merged_options = array_merge( $question_data[ 'question_wrong_answers' ], $question_data[ 'question_right_answer' ] ); |
| 882 | 887 | |
| 883 | - } else { |
|
| 888 | + } else { |
|
| 884 | 889 | |
| 885 | 890 | array_push( $question_data[ 'question_wrong_answers' ], $question_data[ 'question_right_answer' ] ); |
| 886 | 891 | $merged_options = $question_data[ 'question_wrong_answers' ]; |
@@ -908,7 +913,7 @@ discard block |
||
| 908 | 913 | |
| 909 | 914 | $user_correct = true; |
| 910 | 915 | |
| 911 | - } else if( $question_data[ 'user_question_grade' ] > 0 ) { |
|
| 916 | + } else if( $question_data[ 'user_question_grade' ] > 0 ) { |
|
| 912 | 917 | |
| 913 | 918 | $user_correct = true; |
| 914 | 919 | |
@@ -923,7 +928,7 @@ discard block |
||
| 923 | 928 | |
| 924 | 929 | $answer_class .= ' right_answer'; |
| 925 | 930 | |
| 926 | - } elseif( !is_array($question_data['question_right_answer']) && $question_data['question_right_answer'] == $answer ) { |
|
| 931 | + } elseif( !is_array($question_data['question_right_answer']) && $question_data['question_right_answer'] == $answer ) { |
|
| 927 | 932 | |
| 928 | 933 | $answer_class .= ' right_answer'; |
| 929 | 934 | |
@@ -1006,13 +1011,13 @@ discard block |
||
| 1006 | 1011 | } |
| 1007 | 1012 | } |
| 1008 | 1013 | |
| 1009 | - }else{ |
|
| 1014 | + } else{ |
|
| 1010 | 1015 | |
| 1011 | 1016 | $answer_options_sorted = $question_answers_options; |
| 1012 | 1017 | |
| 1013 | 1018 | } |
| 1014 | 1019 | |
| 1015 | - }else{ |
|
| 1020 | + } else{ |
|
| 1016 | 1021 | |
| 1017 | 1022 | $answer_options_sorted = $question_answers_options; |
| 1018 | 1023 | |
@@ -1075,12 +1080,12 @@ discard block |
||
| 1075 | 1080 | |
| 1076 | 1081 | $right_answer = ucfirst($right_answer); |
| 1077 | 1082 | |
| 1078 | - }elseif( 'multiple-choice' == $type ) { |
|
| 1083 | + } elseif( 'multiple-choice' == $type ) { |
|
| 1079 | 1084 | |
| 1080 | 1085 | $right_answer = (array) $right_answer; |
| 1081 | 1086 | $right_answer = implode( ', ', $right_answer ); |
| 1082 | 1087 | |
| 1083 | - }elseif( 'gap-fill' == $type ) { |
|
| 1088 | + } elseif( 'gap-fill' == $type ) { |
|
| 1084 | 1089 | |
| 1085 | 1090 | $right_answer_array = explode( '||', $right_answer ); |
| 1086 | 1091 | if ( isset( $right_answer_array[0] ) ) { $gapfill_pre = $right_answer_array[0]; } else { $gapfill_pre = ''; } |
@@ -1089,7 +1094,7 @@ discard block |
||
| 1089 | 1094 | |
| 1090 | 1095 | $right_answer = $gapfill_pre . ' <span class="highlight">' . $gapfill_gap . '</span> ' . $gapfill_post; |
| 1091 | 1096 | |
| 1092 | - }else{ |
|
| 1097 | + } else{ |
|
| 1093 | 1098 | |
| 1094 | 1099 | // for non auto gradable question types no answer should be returned. |
| 1095 | 1100 | $right_answer = ''; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * |
| 124 | 124 | * This function hooks into the quiz page and accepts the answer form save post. |
| 125 | 125 | * @since 1.7.3 |
| 126 | - * @return bool $saved; |
|
| 126 | + * @return boolean|null $saved; |
|
| 127 | 127 | */ |
| 128 | 128 | public function user_save_quiz_answers_listener(){ |
| 129 | 129 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @param int $lesson_id |
| 215 | 215 | * @param int $user_id |
| 216 | 216 | * |
| 217 | - * @return array $answers or false |
|
| 217 | + * @return boolean $answers or false |
|
| 218 | 218 | */ |
| 219 | 219 | public function get_user_answers( $lesson_id, $user_id ){ |
| 220 | 220 | |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | * @type int $question_id |
| 708 | 708 | * @type int $question_grade |
| 709 | 709 | * } |
| 710 | - * @param $lesson_id |
|
| 710 | + * @param integer $lesson_id |
|
| 711 | 711 | * @param $user_id (Optional) will use the current user if not supplied |
| 712 | 712 | * |
| 713 | 713 | * @return bool |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | * |
| 755 | 755 | * @since 1.7.4 |
| 756 | 756 | * |
| 757 | - * @param $lesson_id |
|
| 757 | + * @param integer $lesson_id |
|
| 758 | 758 | * @param $user_id (Optional) will use the current user if not supplied |
| 759 | 759 | * |
| 760 | 760 | * @return array $user_quiz_grades or false if none exists for this users |
@@ -1090,7 +1090,6 @@ discard block |
||
| 1090 | 1090 | * Filter the single title and add the Quiz to it. |
| 1091 | 1091 | * |
| 1092 | 1092 | * @param string $title |
| 1093 | - * @param int $id title post id |
|
| 1094 | 1093 | * @return string $quiz_title |
| 1095 | 1094 | */ |
| 1096 | 1095 | public static function single_quiz_title( $title, $post_id ){ |
@@ -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 ] ); |
@@ -178,8 +178,8 @@ |
||
| 178 | 178 | * |
| 179 | 179 | * @since 1.9.0 |
| 180 | 180 | * |
| 181 | - * @param $hook_tag |
|
| 182 | - * @param $version |
|
| 181 | + * @param string $hook_tag |
|
| 182 | + * @param string $version |
|
| 183 | 183 | * @param $alternative |
| 184 | 184 | * @param array $args |
| 185 | 185 | */ |
@@ -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 |
@@ -103,8 +103,8 @@ |
||
| 103 | 103 | * |
| 104 | 104 | * @since 1.9.0 |
| 105 | 105 | * |
| 106 | - * @param $title |
|
| 107 | - * @param $shortcode_specific_override |
|
| 106 | + * @param string $title |
|
| 107 | + * @param string $shortcode_specific_override |
|
| 108 | 108 | * @return string |
| 109 | 109 | */ |
| 110 | 110 | public static function generate_shortcode_courses( $title , $shortcode_specific_override ){ |
@@ -166,7 +166,7 @@ |
||
| 166 | 166 | |
| 167 | 167 | Sensei_Templates::get_template( 'user/my-courses.php' ); |
| 168 | 168 | |
| 169 | - }else{ |
|
| 169 | + } else{ |
|
| 170 | 170 | |
| 171 | 171 | Sensei()->frontend->sensei_login_form(); |
| 172 | 172 | |
@@ -114,7 +114,7 @@ |
||
| 114 | 114 | * |
| 115 | 115 | * @since 1.9.0 |
| 116 | 116 | * |
| 117 | - * @param array $category_ids |
|
| 117 | + * @param array $categories |
|
| 118 | 118 | * @return array |
| 119 | 119 | */ |
| 120 | 120 | public function generate_term_ids( $categories = array() ){ |
@@ -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 |