Completed
Push — master ( 97debb...7f4a4b )
by Dwain
06:38
created
includes/admin/class-sensei-learner-management.php 1 patch
Braces   +14 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'] );
Please login to merge, or discard this patch.
includes/class-sensei-learner.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
includes/emails/class-sensei-email-teacher-new-course-assignment.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
includes/class-sensei-course.php 1 patch
Braces   +13 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
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
@@ -616,7 +619,7 @@  discard block
 block discarded – undo
616 619
 
617 620
 			return $results_array;
618 621
 
619
-		}else{
622
+		} else{
620 623
 
621 624
 			//reset the pagination as this widgets do not need it
622 625
 			$post_args['paged'] = 1;
@@ -837,7 +840,7 @@  discard block
 block discarded – undo
837 840
 
838 841
             return $html;
839 842
 
840
-        }else{
843
+        } else{
841 844
 
842 845
             echo $html;
843 846
 
@@ -984,8 +987,7 @@  discard block
 block discarded – undo
984 987
 				$has_questions = get_post_meta( $lesson_id, '_quiz_has_questions', true );
985 988
 				if ( $has_questions && $boolean_check ) {
986 989
 					return true;
987
-				}
988
-				elseif ( $has_questions ) {
990
+				} elseif ( $has_questions ) {
989 991
 					$quiz_id = Sensei()->lesson->lesson_quizzes( $lesson_id );
990 992
 //					$questions = Sensei()->lesson->lesson_quiz_questions( $quiz_id );
991 993
 //					if( count( $questions ) > 0 ) {
@@ -1798,11 +1800,11 @@  discard block
 block discarded – undo
1798 1800
 
1799 1801
             $course_id = $email['course_id'];
1800 1802
 
1801
-        }elseif( isset( $email['lesson_id'] ) ){
1803
+        } elseif( isset( $email['lesson_id'] ) ){
1802 1804
 
1803 1805
             $course_id = Sensei()->lesson->get_course_id( $email['lesson_id'] );
1804 1806
 
1805
-        }elseif( isset( $email['quiz_id'] ) ){
1807
+        } elseif( isset( $email['quiz_id'] ) ){
1806 1808
 
1807 1809
             $lesson_id = Sensei()->quiz->get_lesson_id( $email['quiz_id'] );
1808 1810
             $course_id = Sensei()->lesson->get_course_id( $lesson_id );
@@ -1863,7 +1865,7 @@  discard block
 block discarded – undo
1863 1865
 
1864 1866
         if( isset( $_POST['disable_sensei_course_notification'] ) && 'on'== $_POST['disable_sensei_course_notification']  ) {
1865 1867
             $new_val = true;
1866
-        }else{
1868
+        } else{
1867 1869
             $new_val = false;
1868 1870
         }
1869 1871
 
@@ -1996,7 +1998,7 @@  discard block
 block discarded – undo
1996 1998
 
1997 1999
                 $classes[] = 'user-status-completed';
1998 2000
 
1999
-            }else{
2001
+            } else{
2000 2002
 
2001 2003
                 $classes[] = 'user-status-active';
2002 2004
 
@@ -2516,7 +2518,7 @@  discard block
 block discarded – undo
2516 2518
 
2517 2519
             $title = __('Lessons', 'woothemes-sensei');
2518 2520
 
2519
-        }elseif( empty( $none_module_lessons ) ){ // if the none module lessons are simply empty the title should not be shown
2521
+        } elseif( empty( $none_module_lessons ) ){ // if the none module lessons are simply empty the title should not be shown
2520 2522
 
2521 2523
             $title = '';
2522 2524
         }
@@ -2844,7 +2846,7 @@  discard block
 block discarded – undo
2844 2846
 
2845 2847
             $title = $term->name;
2846 2848
 
2847
-        }else{
2849
+        } else{
2848 2850
 
2849 2851
             $title = 'Course Category';
2850 2852
 
Please login to merge, or discard this patch.
templates/single-course/lessons.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit;
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
3 5
 /**
4 6
  * The Template for displaying the my course page data.
5 7
  *
Please login to merge, or discard this patch.
includes/class-sensei-settings-api.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
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
  * A settings API (wrapping the WordPress Settings API).
@@ -315,8 +318,9 @@  discard block
 block discarded – undo
315 318
 
316 319
             echo '<section id="' . $section_id . '">';
317 320
 
318
-            if ($section['name'])
319
-                echo "<h2>{$section['name']}</h2>\n";
321
+            if ($section['name']) {
322
+                            echo "<h2>{$section['name']}</h2>\n";
323
+            }
320 324
 
321 325
             echo '<table class="form-table">';
322 326
             do_settings_fields($page, $section_id );
Please login to merge, or discard this patch.
includes/class-sensei-admin.php 1 patch
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
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
  * Handles all admin views, assets and navigation.
@@ -732,7 +735,9 @@  discard block
 block discarded – undo
732 735
 		$types = array( 'course', 'lesson', 'question' );
733 736
 
734 737
 		foreach( $types as $type ) {
735
-			if( ! post_type_exists( $type ) ) continue;
738
+			if( ! post_type_exists( $type ) ) {
739
+				continue;
740
+			}
736 741
 
737 742
 			$num_posts = wp_count_posts( $type );
738 743
 
@@ -800,7 +805,9 @@  discard block
 block discarded – undo
800 805
 
801 806
 		$html = '';
802 807
 
803
-		if( 0 == count( $settings ) ) return $html;
808
+		if( 0 == count( $settings ) ) {
809
+			return $html;
810
+		}
804 811
 
805 812
 		$html .= '<div class="sensei-options-panel">' . "\n";
806 813
 
@@ -882,11 +889,11 @@  discard block
 block discarded – undo
882 889
                                     //backwards compatibility
883 890
                                     if( empty( $data ) || 'on' == $data ){
884 891
                                         $checked_value = 'on';
885
-                                    }elseif( 'yes' == $data  ) {
892
+                                    } elseif( 'yes' == $data  ) {
886 893
 
887 894
                                         $checked_value = 'yes';
888 895
 
889
-                                    }elseif( 'auto' == $data  ) {
896
+                                    } elseif( 'auto' == $data  ) {
890 897
 
891 898
                                         $checked_value = 'auto';
892 899
 
Please login to merge, or discard this patch.
includes/class-sensei-wc.php 1 patch
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
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
 /**
5 8
  * Sensei WooCommerce class
@@ -1200,7 +1203,7 @@  discard block
 block discarded – undo
1200 1203
 
1201 1204
 			$order = $order_id;
1202 1205
 
1203
-		}else{
1206
+		} else{
1204 1207
 
1205 1208
 			$order = new WC_Order( $order_id );
1206 1209
 		}
@@ -1315,7 +1318,9 @@  discard block
 block discarded – undo
1315 1318
 
1316 1319
         global $current_user;
1317 1320
 
1318
-        if ( ! isset( $current_user ) || !$current_user->ID > 0 ) return false;
1321
+        if ( ! isset( $current_user ) || !$current_user->ID > 0 ) {
1322
+        	return false;
1323
+        }
1319 1324
 
1320 1325
         $data_update = false;
1321 1326
 
@@ -1440,7 +1445,9 @@  discard block
 block discarded – undo
1440 1445
 
1441 1446
         $order = new WC_Order( $order_id );
1442 1447
 
1443
-        if ( ! isset ( $order ) ) return '';
1448
+        if ( ! isset ( $order ) ) {
1449
+        	return '';
1450
+        }
1444 1451
 
1445 1452
         if ( $order_status == 'wc-processing' && ( $order->post_status == 'wc-on-hold' || $order->post_status == 'wc-pending' || $order->post_status == 'wc-failed' ) ) {
1446 1453
 
@@ -1538,7 +1545,7 @@  discard block
 block discarded – undo
1538 1545
 
1539 1546
             $user_access_permission = true;
1540 1547
 
1541
-        }else{
1548
+        } else{
1542 1549
 
1543 1550
             $user_access_permission = false;
1544 1551
             // do not show the WC permissions message
Please login to merge, or discard this patch.
includes/class-sensei.php 1 patch
Braces   +28 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
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
  * Responsible for loading Sensei and setting up the Main WordPress hooks.
@@ -155,7 +158,9 @@  discard block
 block discarded – undo
155 158
         $this->init();
156 159
 
157 160
         // Installation
158
-        if ( is_admin() && ! defined( 'DOING_AJAX' ) ) $this->install();
161
+        if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
162
+        	$this->install();
163
+        }
159 164
 
160 165
         // Run this on activation.
161 166
         register_activation_hook( $this->file, array( $this, 'activation' ) );
@@ -506,7 +511,7 @@  discard block
 block discarded – undo
506 511
 
507 512
             $sensei_plugin_path =  $this->plugin_path;
508 513
 
509
-        }else{
514
+        } else{
510 515
 
511 516
             $sensei_plugin_path = plugin_dir_path( __FILE__ );
512 517
 
@@ -719,7 +724,9 @@  discard block
 block discarded – undo
719 724
      */
720 725
     public function access_settings () {
721 726
 
722
-        if( sensei_all_access() ) return true;
727
+        if( sensei_all_access() ) {
728
+        	return true;
729
+        }
723 730
 
724 731
         if ( isset( $this->settings->settings['access_permission'] ) && ( true == $this->settings->settings['access_permission'] ) ) {
725 732
             if ( is_user_logged_in() ) {
@@ -772,8 +779,9 @@  discard block
 block discarded – undo
772 779
         }
773 780
         $where = "WHERE comment_type IN ('" . join("', '", array_unique( $statuses ) ) . "')";
774 781
 
775
-        if ( $post_id > 0 )
776
-            $where .= $wpdb->prepare( " AND comment_post_ID = %d", $post_id );
782
+        if ( $post_id > 0 ) {
783
+                    $where .= $wpdb->prepare( " AND comment_post_ID = %d", $post_id );
784
+        }
777 785
 
778 786
         $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
779 787
 
@@ -781,16 +789,19 @@  discard block
 block discarded – undo
781 789
         $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed');
782 790
         foreach ( (array) $count as $row ) {
783 791
             // Don't count post-trashed toward totals
784
-            if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] )
785
-                $total += $row['num_comments'];
786
-            if ( isset( $approved[$row['comment_approved']] ) )
787
-                $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
792
+            if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
793
+                            $total += $row['num_comments'];
794
+            }
795
+            if ( isset( $approved[$row['comment_approved']] ) ) {
796
+                            $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
797
+            }
788 798
         }
789 799
 
790 800
         $stats['total_comments'] = $total;
791 801
         foreach ( $approved as $key ) {
792
-            if ( empty($stats[$key]) )
793
-                $stats[$key] = 0;
802
+            if ( empty($stats[$key]) ) {
803
+                            $stats[$key] = 0;
804
+            }
794 805
         }
795 806
 
796 807
         $stats = (object) $stats;
@@ -831,8 +842,9 @@  discard block
 block discarded – undo
831 842
     public function get_image_size( $image_size ) {
832 843
 
833 844
         // Only return sizes we define in settings
834
-        if ( ! in_array( $image_size, array( 'course_archive_image', 'course_single_image', 'lesson_archive_image', 'lesson_single_image' ) ) )
835
-            return apply_filters( 'sensei_get_image_size_' . $image_size, '' );
845
+        if ( ! in_array( $image_size, array( 'course_archive_image', 'course_single_image', 'lesson_archive_image', 'lesson_single_image' ) ) ) {
846
+                    return apply_filters( 'sensei_get_image_size_' . $image_size, '' );
847
+        }
836 848
 
837 849
         if( ! isset( $this->settings->settings[ $image_size . '_width' ] ) ) {
838 850
             $this->settings->settings[ $image_size . '_width' ] = false;
@@ -895,7 +907,7 @@  discard block
 block discarded – undo
895 907
             require_once( 'class-sensei-modules.php');
896 908
             Sensei()->modules = new Sensei_Core_Modules( $this->file );
897 909
 
898
-        }else{
910
+        } else{
899 911
             // fallback for people still using the modules extension.
900 912
             global $sensei_modules;
901 913
             Sensei()->modules = $sensei_modules;
@@ -942,7 +954,7 @@  discard block
 block discarded – undo
942 954
 
943 955
             update_option('sensei_flush_rewrite_rules', '2');
944 956
 
945
-        }elseif( '2' == $option ) {
957
+        } elseif( '2' == $option ) {
946 958
 
947 959
             flush_rewrite_rules();
948 960
             update_option('sensei_flush_rewrite_rules', '0');
Please login to merge, or discard this patch.