@@ -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 | * Renders the [sensei_courses] shortcode |
@@ -77,7 +80,7 @@ discard block |
||
77 | 80 | |
78 | 81 | $this->order = 'ASC'; |
79 | 82 | |
80 | - }else{ |
|
83 | + } else{ |
|
81 | 84 | |
82 | 85 | // for everything else use the value passed or the default DESC |
83 | 86 | $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'DESC'; |
@@ -139,7 +142,7 @@ discard block |
||
139 | 142 | $teacher_query_by = 'author__in'; |
140 | 143 | $this->teacher = $teachers; |
141 | 144 | |
142 | - }else{ |
|
145 | + } else{ |
|
143 | 146 | // when users passed in a single teacher value |
144 | 147 | $teacher_query_by = is_numeric( $this->teacher )? 'author':'author_name'; |
145 | 148 |
@@ -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 | * This class is loaded int WP by the shortcode loader class. |
5 | 8 | * |
@@ -75,7 +78,7 @@ discard block |
||
75 | 78 | |
76 | 79 | $this->order = 'ASC'; |
77 | 80 | |
78 | - }else{ |
|
81 | + } else{ |
|
79 | 82 | |
80 | 83 | // for everything else use the value passed or the default DESC |
81 | 84 | $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'ASC'; |
@@ -121,11 +124,11 @@ discard block |
||
121 | 124 | $included_courses = $completed_ids; |
122 | 125 | |
123 | 126 | |
124 | - }elseif( 'active'==$this->status ){ |
|
127 | + } elseif( 'active'==$this->status ){ |
|
125 | 128 | |
126 | 129 | $included_courses = $active_ids; |
127 | 130 | |
128 | - }else{ // all courses |
|
131 | + } else{ // all courses |
|
129 | 132 | |
130 | 133 | if( empty( $completed_ids ) ){ |
131 | 134 | |
@@ -142,7 +145,7 @@ discard block |
||
142 | 145 | |
143 | 146 | $included_courses = array('-1000'); // don't show any courses |
144 | 147 | |
145 | - }else{ |
|
148 | + } else{ |
|
146 | 149 | $included_courses = Sensei_Utils::array_zip_merge( $active_ids, $completed_ids ); |
147 | 150 | } |
148 | 151 |
@@ -1,5 +1,8 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // security check |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
5 | +// security check |
|
3 | 6 | /** |
4 | 7 | * Sensei Shortcode Loader Class |
5 | 8 | * |
@@ -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 | * Renders the [sensei_teachers] shortcode. Will show a list of teachers |
@@ -149,7 +152,7 @@ discard block |
||
149 | 152 | // exclude this user as it is already in the list |
150 | 153 | unset( $users[ $index ] ); |
151 | 154 | |
152 | - }else{ |
|
155 | + } else{ |
|
153 | 156 | |
154 | 157 | // add teh user to the list of users |
155 | 158 | $array_unique_users_ids[] = $user->ID; |
@@ -239,9 +242,7 @@ discard block |
||
239 | 242 | |
240 | 243 | $user_public_name = $user->first_name . ' ' . $user->last_name; |
241 | 244 | |
242 | - } |
|
243 | - |
|
244 | - else { |
|
245 | + } else { |
|
245 | 246 | |
246 | 247 | $user_public_name = $user->display_name; |
247 | 248 |
@@ -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 |
@@ -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 |
@@ -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 Overview List Table Class |
@@ -306,8 +309,7 @@ discard block |
||
306 | 309 | // Output course data |
307 | 310 | if ( $this->csv_output ) { |
308 | 311 | $course_title = apply_filters( 'the_title', $item->post_title, $item->ID ); |
309 | - } |
|
310 | - else { |
|
312 | + } else { |
|
311 | 313 | $url = add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $item->ID ), admin_url( 'admin.php' ) ); |
312 | 314 | |
313 | 315 | $course_title = '<strong><a class="row-title" href="' . esc_url( $url ) . '">' . apply_filters( 'the_title', $item->post_title, $item->ID ) . '</a></strong>'; |
@@ -363,16 +365,14 @@ discard block |
||
363 | 365 | // Output lesson data |
364 | 366 | if ( $this->csv_output ) { |
365 | 367 | $lesson_title = apply_filters( 'the_title', $item->post_title, $item->ID ); |
366 | - } |
|
367 | - else { |
|
368 | + } else { |
|
368 | 369 | $url = add_query_arg( array( 'page' => $this->page_slug, 'lesson_id' => $item->ID ), admin_url( 'admin.php' ) ); |
369 | 370 | $lesson_title = '<strong><a class="row-title" href="' . esc_url( $url ) . '">' . apply_filters( 'the_title', $item->post_title, $item->ID ) . '</a></strong>'; |
370 | 371 | |
371 | 372 | if ( $course_id ) { |
372 | 373 | $url = add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $course_id ), admin_url( 'admin.php' ) ); |
373 | 374 | $course_title = '<a href="' . esc_url( $url ) . '">' . $course_title . '</a>'; |
374 | - } |
|
375 | - else { |
|
375 | + } else { |
|
376 | 376 | $course_title = __('n/a', 'woothemes-sensei'); |
377 | 377 | } |
378 | 378 | if ( is_numeric( $lesson_average_grade ) ) { |
@@ -423,8 +423,7 @@ discard block |
||
423 | 423 | // Output the users data |
424 | 424 | if ( $this->csv_output ) { |
425 | 425 | $user_name = Sensei()->learners->get_learner_full_name( $item->ID ); |
426 | - } |
|
427 | - else { |
|
426 | + } else { |
|
428 | 427 | $url = add_query_arg( array( 'page' => $this->page_slug, 'user_id' => $item->ID ), admin_url( 'admin.php' ) ); |
429 | 428 | $user_name = '<strong><a class="row-title" href="' . esc_url( $url ) . '">' . $item->display_name . '</a></strong>'; |
430 | 429 | $user_average_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 Teacher class |
@@ -414,7 +417,7 @@ discard block |
||
414 | 417 | $existing_term = get_term_by( 'slug', $new_author_term_slug, 'module'); |
415 | 418 | $term_id = $existing_term->term_id; |
416 | 419 | |
417 | - }else{ |
|
420 | + } else{ |
|
418 | 421 | |
419 | 422 | // for a new term simply get the term from the returned value |
420 | 423 | $term_id = $new_term['term_id']; |
@@ -495,7 +498,7 @@ discard block |
||
495 | 498 | 'post_author' => $new_author |
496 | 499 | ) ); |
497 | 500 | } |
498 | - }else{ |
|
501 | + } else{ |
|
499 | 502 | wp_update_post( array( |
500 | 503 | 'ID' => $lesson_quizzes, |
501 | 504 | 'post_author' => $new_author |
@@ -789,7 +792,7 @@ discard block |
||
789 | 792 | // merge the post types instead of overwriting it |
790 | 793 | $new_post_types = array_merge( $current_post_types, array( 'course' ) ); |
791 | 794 | |
792 | - }else{ |
|
795 | + } else{ |
|
793 | 796 | |
794 | 797 | // in this instance it is probably just one post type in string format |
795 | 798 | $new_post_types = array( $current_post_types , 'course'); |
@@ -979,7 +982,7 @@ discard block |
||
979 | 982 | $course_learner_ids[] = $user->ID; |
980 | 983 | } |
981 | 984 | |
982 | - }else{ |
|
985 | + } else{ |
|
983 | 986 | |
984 | 987 | $user = get_userdata( $activity_comments->user_id ); |
985 | 988 | $course_learner_ids[] = $user->ID; |
@@ -996,7 +999,7 @@ discard block |
||
996 | 999 | |
997 | 1000 | $args[ 'include'] = array( 0 ); |
998 | 1001 | |
999 | - }else{ |
|
1002 | + } else{ |
|
1000 | 1003 | |
1001 | 1004 | $args[ 'include'] = $learner_ids_for_teacher_courses; |
1002 | 1005 | |
@@ -1164,7 +1167,7 @@ discard block |
||
1164 | 1167 | |
1165 | 1168 | $teachers_courses[] = $course->ID; |
1166 | 1169 | |
1167 | - }else{ |
|
1170 | + } else{ |
|
1168 | 1171 | |
1169 | 1172 | $teachers_courses[] = $course; |
1170 | 1173 | |
@@ -1534,7 +1537,7 @@ discard block |
||
1534 | 1537 | |
1535 | 1538 | return true; |
1536 | 1539 | |
1537 | - }else{ |
|
1540 | + } else{ |
|
1538 | 1541 | |
1539 | 1542 | return false; |
1540 | 1543 |
@@ -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; |