@@ -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 User Quiz Class |
@@ -172,8 +175,7 @@ discard block |
||
172 | 175 | ++$correct_answers; |
173 | 176 | ++$graded_count; |
174 | 177 | $user_question_grade = 0; |
175 | - } |
|
176 | - elseif( intval( $user_question_grade ) > 0 ) { |
|
178 | + } elseif( intval( $user_question_grade ) > 0 ) { |
|
177 | 179 | $graded_class = 'user_right'; |
178 | 180 | ++$correct_answers; |
179 | 181 | $user_quiz_grade_total += $user_question_grade; |
@@ -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 Overview List Table Class |
@@ -155,8 +158,7 @@ discard block |
||
155 | 158 | |
156 | 159 | if( $this->lesson_id ) { |
157 | 160 | $activity_args['post_id'] = $this->lesson_id; |
158 | - } |
|
159 | - elseif( $this->course_id ) { |
|
161 | + } elseif( $this->course_id ) { |
|
160 | 162 | // Currently not possible to restrict to a single Course, as that requires WP_Comment to support multiple |
161 | 163 | // post_ids (i.e. every lesson within the Course), WP 4.1 ( https://core.trac.wordpress.org/changeset/29808 ) |
162 | 164 | if ( version_compare($wp_version, '4.1', '>=') ) { |
@@ -231,24 +233,19 @@ discard block |
||
231 | 233 | if( 'complete' == $item->comment_approved ) { |
232 | 234 | $status_html = '<span class="graded">' . __( 'Completed', 'woothemes-sensei' ) . '</span>'; |
233 | 235 | $grade = __( 'No Grade', 'woothemes-sensei' ); |
234 | - } |
|
235 | - elseif( 'graded' == $item->comment_approved ) { |
|
236 | + } elseif( 'graded' == $item->comment_approved ) { |
|
236 | 237 | $status_html = '<span class="graded">' . __( 'Graded', 'woothemes-sensei' ) . '</span>'; |
237 | 238 | $grade = get_comment_meta( $item->comment_ID, 'grade', true) . '%'; |
238 | - } |
|
239 | - elseif( 'passed' == $item->comment_approved ) { |
|
239 | + } elseif( 'passed' == $item->comment_approved ) { |
|
240 | 240 | $status_html = '<span class="passed">' . __( 'Passed', 'woothemes-sensei' ) . '</span>'; |
241 | 241 | $grade = get_comment_meta( $item->comment_ID, 'grade', true) . '%'; |
242 | - } |
|
243 | - elseif( 'failed' == $item->comment_approved ) { |
|
242 | + } elseif( 'failed' == $item->comment_approved ) { |
|
244 | 243 | $status_html = '<span class="failed">' . __( 'Failed', 'woothemes-sensei' ) . '</span>'; |
245 | 244 | $grade = get_comment_meta( $item->comment_ID, 'grade', true) . '%'; |
246 | - } |
|
247 | - elseif( 'ungraded' == $item->comment_approved ) { |
|
245 | + } elseif( 'ungraded' == $item->comment_approved ) { |
|
248 | 246 | $status_html = '<span class="ungraded">' . __( 'Ungraded', 'woothemes-sensei' ) . '</span>'; |
249 | 247 | $grade = __( 'N/A', 'woothemes-sensei' ); |
250 | - } |
|
251 | - else { |
|
248 | + } else { |
|
252 | 249 | $status_html = '<span class="in-progress">' . __( 'In Progress', 'woothemes-sensei' ) . '</span>'; |
253 | 250 | $grade = __( 'N/A', 'woothemes-sensei' ); |
254 | 251 | } |
@@ -276,8 +273,7 @@ discard block |
||
276 | 273 | $course_title = ''; |
277 | 274 | if ( !empty($course_id) && version_compare($wp_version, '4.1', '>=') ) { |
278 | 275 | $course_title = '<a href="' . esc_url( add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $course_id ), admin_url( 'admin.php' ) ) ) . '">' . get_the_title( $course_id ) . '</a>'; |
279 | - } |
|
280 | - else if ( !empty($course_id) ) { |
|
276 | + } else if ( !empty($course_id) ) { |
|
281 | 277 | $course_title = get_the_title( $course_id ); |
282 | 278 | } |
283 | 279 | $lesson_title = '<a href="' . add_query_arg( array( 'page' => $this->page_slug, 'lesson_id' => $item->comment_post_ID ), admin_url( 'admin.php' ) ) . '">' . get_the_title( $item->comment_post_ID ) . '</a>'; |
@@ -1,5 +1,8 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // security check, don't load file outside WP |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
5 | +// security check, don't load file outside WP |
|
3 | 6 | /** |
4 | 7 | * Sensei Autoloader Class |
5 | 8 | * |
@@ -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( '' ); |
@@ -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 Post Types Class |
@@ -146,7 +149,7 @@ discard block |
||
146 | 149 | |
147 | 150 | return get_page_uri( $settings_course_page->ID ); |
148 | 151 | |
149 | - }else{ |
|
152 | + } else{ |
|
150 | 153 | |
151 | 154 | return 'courses'; |
152 | 155 |
@@ -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 |
@@ -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 |
@@ -7,8 +7,9 @@ discard block |
||
7 | 7 | function woothemes_queue_update( $file, $file_id, $product_id ) { |
8 | 8 | global $woothemes_queued_updates; |
9 | 9 | |
10 | - if ( ! isset( $woothemes_queued_updates ) ) |
|
11 | - $woothemes_queued_updates = array(); |
|
10 | + if ( ! isset( $woothemes_queued_updates ) ) { |
|
11 | + $woothemes_queued_updates = array(); |
|
12 | + } |
|
12 | 13 | |
13 | 14 | $plugin = new stdClass(); |
14 | 15 | $plugin->file = $file; |
@@ -31,7 +32,9 @@ discard block |
||
31 | 32 | false !== $api || |
32 | 33 | ! isset( $args->slug ) || |
33 | 34 | 'woothemes-updater' != $args->slug |
34 | - ) return $api; |
|
35 | + ) { |
|
36 | + return $api; |
|
37 | + } |
|
35 | 38 | |
36 | 39 | $api = new stdClass(); |
37 | 40 | $api->name = 'WooThemes Updater'; |
@@ -54,7 +57,9 @@ discard block |
||
54 | 57 | */ |
55 | 58 | function woothemes_updater_notice() { |
56 | 59 | $active_plugins = apply_filters( 'active_plugins', get_option('active_plugins' ) ); |
57 | - if ( in_array( 'woothemes-updater/woothemes-updater.php', $active_plugins ) ) return; |
|
60 | + if ( in_array( 'woothemes-updater/woothemes-updater.php', $active_plugins ) ) { |
|
61 | + return; |
|
62 | + } |
|
58 | 63 | |
59 | 64 | $slug = 'woothemes-updater'; |
60 | 65 | $install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $slug ), 'install-plugin_' . $slug ); |
@@ -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 Lesson List Table Class |
@@ -204,31 +207,26 @@ discard block |
||
204 | 207 | $status_class = 'graded'; |
205 | 208 | |
206 | 209 | $grade = __( 'No Grade', 'woothemes-sensei' ); |
207 | - } |
|
208 | - elseif( 'graded' == $item->comment_approved ) { |
|
210 | + } elseif( 'graded' == $item->comment_approved ) { |
|
209 | 211 | $status = __( 'Graded', 'woothemes-sensei' ) ; |
210 | 212 | $status_class = 'graded'; |
211 | 213 | |
212 | 214 | $grade = get_comment_meta( $item->comment_ID, 'grade', true); |
213 | - } |
|
214 | - elseif( 'passed' == $item->comment_approved ) { |
|
215 | + } elseif( 'passed' == $item->comment_approved ) { |
|
215 | 216 | $status = __( 'Passed', 'woothemes-sensei' ); |
216 | 217 | $status_class = 'graded'; |
217 | 218 | |
218 | 219 | $grade = get_comment_meta( $item->comment_ID, 'grade', true); |
219 | - } |
|
220 | - elseif( 'failed' == $item->comment_approved ) { |
|
220 | + } elseif( 'failed' == $item->comment_approved ) { |
|
221 | 221 | $status = __( 'Failed', 'woothemes-sensei' ); |
222 | 222 | $status_class = 'failed'; |
223 | 223 | |
224 | 224 | $grade = get_comment_meta( $item->comment_ID, 'grade', true); |
225 | - } |
|
226 | - elseif( 'ungraded' == $item->comment_approved ) { |
|
225 | + } elseif( 'ungraded' == $item->comment_approved ) { |
|
227 | 226 | $status = __( 'Ungraded', 'woothemes-sensei' ); |
228 | 227 | $status_class = 'ungraded'; |
229 | 228 | |
230 | - } |
|
231 | - else { |
|
229 | + } else { |
|
232 | 230 | $status = __( 'In Progress', 'woothemes-sensei' ); |
233 | 231 | $user_end_date = ''; |
234 | 232 | } |