Completed
Push — master ( b09b8b...45e17f )
by Dwain
07:46
created
includes/emails/class-woothemes-sensei-email-teacher-quiz-submitted.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/emails/class-woothemes-sensei-email-teacher-new-message.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/emails/class-woothemes-sensei-email-new-message-reply.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/emails/class-woothemes-sensei-email-learner-graded-quiz.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-utils.php 1 patch
Braces   +41 added lines, -35 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 Utilities Class
@@ -181,8 +184,7 @@  discard block
 block discarded – undo
181 184
 				// ...use a filter to switch the encoding back
182 185
 				add_filter( 'comments_clauses', array( __CLASS__, 'comment_multiple_status_filter' ) );
183 186
 			}
184
-		}
185
-		else {
187
+		} else {
186 188
 			$args['status'] = 'any'; // 'log' == 'sensei_user_answer'
187 189
 		}
188 190
 
@@ -307,8 +309,12 @@  discard block
 block discarded – undo
307 309
 				}
308 310
 
309 311
 				foreach( $activities as $activity ) {
310
-					if( '' == $activity->comment_type ) continue;
311
-					if( strpos( 'sensei_', $activity->comment_type ) != 0 ) continue;
312
+					if( '' == $activity->comment_type ) {
313
+						continue;
314
+					}
315
+					if( strpos( 'sensei_', $activity->comment_type ) != 0 ) {
316
+						continue;
317
+					}
312 318
 					$dataset_changes = wp_delete_comment( intval( $activity->comment_ID ), true );
313 319
 					wp_cache_flush();
314 320
 				}
@@ -360,11 +366,13 @@  discard block
 block discarded – undo
360 366
             $emails[] = $user->user_email;
361 367
         }
362 368
 
363
-        if ( is_email( $customer_email ) )
364
-            $emails[] = $customer_email;
369
+        if ( is_email( $customer_email ) ) {
370
+                    $emails[] = $customer_email;
371
+        }
365 372
 
366
-        if ( sizeof( $emails ) == 0 )
367
-            return false;
373
+        if ( sizeof( $emails ) == 0 ) {
374
+                    return false;
375
+        }
368 376
 
369 377
         return Sensei_WC::has_customer_bought_product( $user_id, $product_id );
370 378
 
@@ -379,7 +387,9 @@  discard block
 block discarded – undo
379 387
 	 */
380 388
 	public static function sensei_text_editor( $content = '', $editor_id = 'senseitexteditor', $input_name = '' ) {
381 389
 
382
-		if( ! $input_name ) $input_name = $editor_id;
390
+		if( ! $input_name ) {
391
+			$input_name = $editor_id;
392
+		}
383 393
 
384 394
 		$buttons = 'bold,italic,underline,strikethrough,blockquote,bullist,numlist,justifyleft,justifycenter,justifyright,undo,redo,pastetext';
385 395
 
@@ -689,8 +699,7 @@  discard block
 block discarded – undo
689 699
 				if ( $has_questions ) {
690 700
 					$status = 'passed'; // Force a pass
691 701
 					$metadata['grade'] = 0;
692
-				}
693
-				else {
702
+				} else {
694 703
 					$status = 'complete';
695 704
 				}
696 705
 			}
@@ -738,7 +747,9 @@  discard block
 block discarded – undo
738 747
 	public static function sensei_remove_user_from_lesson( $lesson_id = 0, $user_id = 0, $from_course = false ) {
739 748
 
740 749
 
741
-		if( ! $lesson_id ) return false;
750
+		if( ! $lesson_id ) {
751
+			return false;
752
+		}
742 753
 
743 754
 		if( intval( $user_id ) == 0 ) {
744 755
 			$user_id = get_current_user_id();
@@ -776,7 +787,9 @@  discard block
 block discarded – undo
776 787
 	public static function sensei_remove_user_from_course( $course_id = 0, $user_id = 0 ) {
777 788
 
778 789
 
779
-		if( ! $course_id ) return false;
790
+		if( ! $course_id ) {
791
+			return false;
792
+		}
780 793
 
781 794
 		if( intval( $user_id ) == 0 ) {
782 795
 			$user_id = get_current_user_id();
@@ -844,8 +857,7 @@  discard block
 block discarded – undo
844 857
 		if( $question ) {
845 858
 			if ( is_object( $question ) ) {
846 859
 				$user_answer_id = $question->comment_ID;
847
-			}
848
-			else {
860
+			} else {
849 861
 				if( intval( $user_id ) == 0 ) {
850 862
 					$user_id = get_current_user_id();
851 863
 				}
@@ -872,8 +884,7 @@  discard block
 block discarded – undo
872 884
 		if( $question ) {
873 885
 			if ( is_object( $question ) ) {
874 886
 				$user_answer_id = $question->comment_ID;
875
-			}
876
-			else {
887
+			} else {
877 888
 				if( intval( $user_id ) == 0 ) {
878 889
 					$user_id = get_current_user_id();
879 890
 				}
@@ -938,8 +949,7 @@  discard block
 block discarded – undo
938 949
 			if ( !empty($notes) ) {
939 950
 				$user_lesson_id = WooThemes_Sensei_Utils::sensei_get_activity_value( array( 'post_id' => $question_id, 'user_id' => $user_id, 'type' => 'sensei_user_answer', 'field' => 'comment_ID' ) );
940 951
 				$activity_logged = update_comment_meta( $user_lesson_id, 'answer_note', $notes );
941
-			}
942
-			else {
952
+			} else {
943 953
 				$activity_logged = true;
944 954
 			}
945 955
 		}
@@ -1451,8 +1461,7 @@  discard block
 block discarded – undo
1451 1461
 							$lessons_completed++;
1452 1462
 							break;
1453 1463
 					}
1454
-				}
1455
-				else {
1464
+				} else {
1456 1465
 					switch ( $lesson_status->comment_approved ) {
1457 1466
 						case 'complete': // Lesson has no quiz/questions
1458 1467
 						case 'graded': // Lesson has quiz, but it's not important what the grade was
@@ -1500,11 +1509,9 @@  discard block
 block discarded – undo
1500 1509
 		if( $course ) {
1501 1510
 			if ( is_object( $course ) && is_a( $course,'WP_Comment') ) {
1502 1511
 				$user_course_status = $course->comment_approved;
1503
-			}
1504
-			elseif ( !is_numeric( $course ) && ! is_a( $course,'WP_Post') ) {
1512
+			} elseif ( !is_numeric( $course ) && ! is_a( $course,'WP_Post') ) {
1505 1513
 				$user_course_status = $course;
1506
-			}
1507
-			else {
1514
+			} else {
1508 1515
 				if( ! $user_id ) {
1509 1516
 					$user_id = get_current_user_id();
1510 1517
 				}
@@ -1564,11 +1571,9 @@  discard block
 block discarded – undo
1564 1571
 			if ( is_object( $lesson ) ) {
1565 1572
 				$user_lesson_status = $lesson->comment_approved;
1566 1573
 				$lesson_id = $lesson->comment_post_ID;
1567
-			}
1568
-			elseif ( ! is_numeric( $lesson ) ) {
1574
+			} elseif ( ! is_numeric( $lesson ) ) {
1569 1575
 				$user_lesson_status = $lesson;
1570
-			}
1571
-			else {
1576
+			} else {
1572 1577
 				if( ! $user_id ) {
1573 1578
 					$user_id = get_current_user_id();
1574 1579
 				}
@@ -1581,8 +1586,7 @@  discard block
 block discarded – undo
1581 1586
 
1582 1587
 				if ( $_user_lesson_status ) {
1583 1588
 					$user_lesson_status = $_user_lesson_status->comment_approved;
1584
-				}
1585
-				else {
1589
+				} else {
1586 1590
 					return false; // No status means not complete
1587 1591
 				}
1588 1592
 				$lesson_id = $lesson;
@@ -1683,7 +1687,9 @@  discard block
 block discarded – undo
1683 1687
 
1684 1688
 	public static function user_passed_quiz( $quiz_id = 0, $user_id = 0 ) {
1685 1689
 
1686
-		if( ! $quiz_id  ) return false;
1690
+		if( ! $quiz_id  ) {
1691
+			return false;
1692
+		}
1687 1693
 
1688 1694
 		if( ! $user_id ) {
1689 1695
 			$user_id = get_current_user_id();
@@ -1921,7 +1927,7 @@  discard block
 block discarded – undo
1921 1927
             $start_function = 'user_start_'.$post_type;
1922 1928
             $sensei_user_activity_id = self::$start_function( $user_id, $post_id );
1923 1929
 
1924
-        }else{
1930
+        } else{
1925 1931
 
1926 1932
             $sensei_user_activity_id = $sensei_user_status->comment_ID;
1927 1933
 
@@ -2138,7 +2144,7 @@  discard block
 block discarded – undo
2138 2144
 
2139 2145
             return round( $val, $precision, $mode );
2140 2146
 
2141
-        }else{
2147
+        } else{
2142 2148
 
2143 2149
             return round( $val, $precision );
2144 2150
 
Please login to merge, or discard this patch.
includes/template-functions.php 1 patch
Braces   +13 added lines, -8 removed lines patch added patch discarded remove patch
@@ -181,7 +181,9 @@  discard block
 block discarded – undo
181 181
 	 * @return void
182 182
 	 */
183 183
 	function sensei_recent_comments_widget_filter( $widget_args = array() ) {
184
-		if ( ! isset( $widget_args['post_type'] ) ) $widget_args['post_type'] = array( 'post', 'page' );
184
+		if ( ! isset( $widget_args['post_type'] ) ) {
185
+			$widget_args['post_type'] = array( 'post', 'page' );
186
+		}
185 187
 		return $widget_args;
186 188
 	} // End sensei_recent_comments_widget_filter()
187 189
 	add_filter( 'widget_comments_args', 'sensei_recent_comments_widget_filter', 10, 1 );
@@ -196,8 +198,9 @@  discard block
 block discarded – undo
196 198
 	function sensei_course_archive_filter( $query ) {
197 199
 
198 200
 
199
-		if ( ! $query->is_main_query() )
200
-        	return;
201
+		if ( ! $query->is_main_query() ) {
202
+		        	return;
203
+		}
201 204
 
202 205
 		// Apply Filter only if on frontend and when course archive is running
203 206
 		$course_page_id = intval( Sensei()->settings->settings[ 'course_page' ] );
@@ -412,7 +415,7 @@  discard block
 block discarded – undo
412 415
 
413 416
 		return false;
414 417
 
415
-	}else{
418
+	} else{
416 419
 
417 420
 		return true;
418 421
 
@@ -446,7 +449,7 @@  discard block
 block discarded – undo
446 449
 
447 450
 			$wp_query = $modules_query;
448 451
 
449
-		}else{
452
+		} else{
450 453
 
451 454
 			wp_reset_query();
452 455
 
@@ -478,7 +481,7 @@  discard block
 block discarded – undo
478 481
 
479 482
 		return have_posts();
480 483
 
481
-	}else{
484
+	} else{
482 485
 
483 486
         // if the loop has not been initiated check the first module has lessons
484 487
         if( -1 == $sensei_modules_loop[ 'current' ]  ){
@@ -622,7 +625,7 @@  discard block
 block discarded – undo
622 625
 
623 626
         return true;
624 627
 
625
-    }else{
628
+    } else{
626 629
 
627 630
         return false;
628 631
 
@@ -865,7 +868,9 @@  discard block
 block discarded – undo
865 868
  */
866 869
 function get_sensei_header(){
867 870
 
868
-    if ( ! defined( 'ABSPATH' ) ) exit;
871
+    if ( ! defined( 'ABSPATH' ) ) {
872
+    	exit;
873
+    }
869 874
 
870 875
     get_header();
871 876
 
Please login to merge, or discard this patch.
includes/class-sensei-frontend.php 1 patch
Braces   +30 added lines, -12 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 Frontend Class
@@ -668,7 +671,9 @@  discard block
 block discarded – undo
668 671
 	public function sensei_breadcrumb( $id = 0 ) {
669 672
 
670 673
 		// Only output on lesson, quiz and taxonomy (module) pages
671
-		if( ! ( is_tax( 'module' ) || is_singular( 'lesson' ) || is_singular( 'quiz' ) ) ) return;
674
+		if( ! ( is_tax( 'module' ) || is_singular( 'lesson' ) || is_singular( 'quiz' ) ) ) {
675
+			return;
676
+		}
672 677
 
673 678
 		if( empty( $id )  ){
674 679
 
@@ -1094,17 +1099,26 @@  discard block
 block discarded – undo
1094 1099
 
1095 1100
 						<p class="form-row form-row-wide">
1096 1101
 							<label for="sensei_reg_username"><?php _e( 'Username', 'woothemes-sensei' ); ?> <span class="required">*</span></label>
1097
-							<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'] ); ?>" />
1102
+							<input type="text" class="input-text" name="sensei_reg_username" id="sensei_reg_username" value="<?php if ( ! empty( $_POST['sensei_reg_username'] ) ) {
1103
+	esc_attr_e( $_POST['sensei_reg_username'] );
1104
+}
1105
+?>" />
1098 1106
 						</p>
1099 1107
 
1100 1108
 						<p class="form-row form-row-wide">
1101 1109
 							<label for="sensei_reg_email"><?php _e( 'Email address', 'woothemes-sensei' ); ?> <span class="required">*</span></label>
1102
-							<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'] ); ?>" />
1110
+							<input type="email" class="input-text" name="sensei_reg_email" id="sensei_reg_email" value="<?php if ( ! empty( $_POST['sensei_reg_email'] ) ) {
1111
+	esc_attr_e( $_POST['sensei_reg_email'] );
1112
+}
1113
+?>" />
1103 1114
 						</p>
1104 1115
 
1105 1116
 						<p class="form-row form-row-wide">
1106 1117
 							<label for="sensei_reg_password"><?php _e( 'Password', 'woothemes-sensei' ); ?> <span class="required">*</span></label>
1107
-							<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'] ); ?>" />
1118
+							<input type="password" class="input-text" name="sensei_reg_password" id="sensei_reg_password" value="<?php if ( ! empty( $_POST['sensei_reg_password'] ) ) {
1119
+	esc_attr_e( $_POST['sensei_reg_password'] );
1120
+}
1121
+?>" />
1108 1122
 						</p>
1109 1123
 
1110 1124
 						<!-- Spam Trap -->
@@ -1437,8 +1451,12 @@  discard block
 block discarded – undo
1437 1451
 
1438 1452
 		if( Sensei_WC::is_woocommerce_active() ) {
1439 1453
 
1440
-			if( ! is_user_logged_in() ) return;
1441
-			if( ! isset( $post->ID ) ) return;
1454
+			if( ! is_user_logged_in() ) {
1455
+				return;
1456
+			}
1457
+			if( ! isset( $post->ID ) ) {
1458
+				return;
1459
+			}
1442 1460
 
1443 1461
 			$user_id = $current_user->ID;
1444 1462
 			$course_id = $post->ID;
@@ -1599,7 +1617,7 @@  discard block
 block discarded – undo
1599 1617
 		    		//assigne the username to the creds array for further processing
1600 1618
 		    		$creds['user_login'] =  $user->user_login ;
1601 1619
 
1602
-		    	}else{
1620
+		    	} else{
1603 1621
 
1604 1622
 		    		// process this as a default username login
1605 1623
 		    		$creds['user_login'] = sanitize_text_field( $_REQUEST['log'] ) ;
@@ -1616,7 +1634,7 @@  discard block
 block discarded – undo
1616 1634
 				if ( is_wp_error($user) ){ // on login failure
1617 1635
                     wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) );
1618 1636
                     exit;
1619
-				}else{ // on login success
1637
+				} else{ // on login success
1620 1638
 
1621 1639
 					/**
1622 1640
 					* change the redirect url programatically
@@ -1633,14 +1651,14 @@  discard block
 block discarded – undo
1633 1651
 
1634 1652
 				}	// end is_wp_error($user)
1635 1653
 
1636
-		    }else{ // if username or password is empty
1654
+		    } else{ // if username or password is empty
1637 1655
 
1638 1656
                 wp_redirect( esc_url_raw( add_query_arg('login', 'emptyfields', $referrer) ) );
1639 1657
 		        exit;
1640 1658
 
1641 1659
 		    } // end if username $_REQUEST['log']  and password $_REQUEST['pwd'] is empty
1642 1660
 
1643
-	    }elseif( ( isset( $_GET['login'] ) ) ) {
1661
+	    } elseif( ( isset( $_GET['login'] ) ) ) {
1644 1662
 	    	// else if this request is a redircect from a previously faile login request
1645 1663
 	    	$this->login_message_process();
1646 1664
 
@@ -1762,7 +1780,7 @@  discard block
 block discarded – undo
1762 1780
 
1763 1781
 				$message = __('Incorrect login details', 'woothemes-sensei' );
1764 1782
 
1765
-			}elseif( $_GET['login'] == 'emptyfields'  ){
1783
+			} elseif( $_GET['login'] == 'emptyfields'  ){
1766 1784
 
1767 1785
 				$message= __('Please enter your username and password', 'woothemes-sensei' );
1768 1786
 			}
Please login to merge, or discard this patch.
includes/class-sensei.php 1 patch
Braces   +35 added lines, -20 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_Main
@@ -159,7 +162,9 @@  discard block
 block discarded – undo
159 162
         $this->init();
160 163
 
161 164
         // Installation
162
-        if ( is_admin() && ! defined( 'DOING_AJAX' ) ) $this->install();
165
+        if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
166
+        	$this->install();
167
+        }
163 168
 
164 169
         // Run this on activation.
165 170
         register_activation_hook( $this->file, array( $this, 'activation' ) );
@@ -447,7 +452,9 @@  discard block
 block discarded – undo
447 452
      **/
448 453
     public function virtual_order_payment_complete( $order_status, $order_id ) {
449 454
         $order = new WC_Order( $order_id );
450
-        if ( ! isset ( $order ) ) return '';
455
+        if ( ! isset ( $order ) ) {
456
+        	return '';
457
+        }
451 458
         if ( $order_status == 'wc-processing' && ( $order->post_status == 'wc-on-hold' || $order->post_status == 'wc-pending' || $order->post_status == 'wc-failed' ) ) {
452 459
             $virtual_order = true;
453 460
 
@@ -612,7 +619,7 @@  discard block
 block discarded – undo
612 619
 
613 620
             $sensei_plugin_path =  $this->plugin_path;
614 621
 
615
-        }else{
622
+        } else{
616 623
 
617 624
             $sensei_plugin_path = plugin_dir_path( __FILE__ );
618 625
 
@@ -647,7 +654,9 @@  discard block
 block discarded – undo
647 654
     public function woocommerce_course_update ( $course_id = 0, $order_user = array()  ) {
648 655
         global $current_user;
649 656
 
650
-        if ( ! isset( $current_user ) || !$current_user->ID > 0 ) return false;
657
+        if ( ! isset( $current_user ) || !$current_user->ID > 0 ) {
658
+        	return false;
659
+        }
651 660
 
652 661
         $data_update = false;
653 662
 
@@ -731,8 +740,7 @@  discard block
 block discarded – undo
731 740
 
732 741
                     $prerequisite_complete = Sensei_Utils::user_completed_course( $course_prerequisite_id, $current_user->ID );
733 742
 
734
-                }
735
-                else {
743
+                } else {
736 744
                     $prerequisite_complete = true;
737 745
                 } // End If Statement
738 746
                 // Handles restrictions
@@ -859,7 +867,9 @@  discard block
 block discarded – undo
859 867
      */
860 868
     public function access_settings () {
861 869
 
862
-        if( sensei_all_access() ) return true;
870
+        if( sensei_all_access() ) {
871
+        	return true;
872
+        }
863 873
 
864 874
         if ( isset( $this->settings->settings['access_permission'] ) && ( true == $this->settings->settings['access_permission'] ) ) {
865 875
             if ( is_user_logged_in() ) {
@@ -1188,8 +1198,9 @@  discard block
 block discarded – undo
1188 1198
         }
1189 1199
         $where = "WHERE comment_type IN ('" . join("', '", array_unique( $statuses ) ) . "')";
1190 1200
 
1191
-        if ( $post_id > 0 )
1192
-            $where .= $wpdb->prepare( " AND comment_post_ID = %d", $post_id );
1201
+        if ( $post_id > 0 ) {
1202
+                    $where .= $wpdb->prepare( " AND comment_post_ID = %d", $post_id );
1203
+        }
1193 1204
 
1194 1205
         $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
1195 1206
 
@@ -1197,16 +1208,19 @@  discard block
 block discarded – undo
1197 1208
         $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed');
1198 1209
         foreach ( (array) $count as $row ) {
1199 1210
             // Don't count post-trashed toward totals
1200
-            if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] )
1201
-                $total += $row['num_comments'];
1202
-            if ( isset( $approved[$row['comment_approved']] ) )
1203
-                $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1211
+            if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1212
+                            $total += $row['num_comments'];
1213
+            }
1214
+            if ( isset( $approved[$row['comment_approved']] ) ) {
1215
+                            $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1216
+            }
1204 1217
         }
1205 1218
 
1206 1219
         $stats['total_comments'] = $total;
1207 1220
         foreach ( $approved as $key ) {
1208
-            if ( empty($stats[$key]) )
1209
-                $stats[$key] = 0;
1221
+            if ( empty($stats[$key]) ) {
1222
+                            $stats[$key] = 0;
1223
+            }
1210 1224
         }
1211 1225
 
1212 1226
         $stats = (object) $stats;
@@ -1247,8 +1261,9 @@  discard block
 block discarded – undo
1247 1261
     public function get_image_size( $image_size ) {
1248 1262
 
1249 1263
         // Only return sizes we define in settings
1250
-        if ( ! in_array( $image_size, array( 'course_archive_image', 'course_single_image', 'lesson_archive_image', 'lesson_single_image' ) ) )
1251
-            return apply_filters( 'sensei_get_image_size_' . $image_size, '' );
1264
+        if ( ! in_array( $image_size, array( 'course_archive_image', 'course_single_image', 'lesson_archive_image', 'lesson_single_image' ) ) ) {
1265
+                    return apply_filters( 'sensei_get_image_size_' . $image_size, '' );
1266
+        }
1252 1267
 
1253 1268
         if( ! isset( $this->settings->settings[ $image_size . '_width' ] ) ) {
1254 1269
             $this->settings->settings[ $image_size . '_width' ] = false;
@@ -1311,7 +1326,7 @@  discard block
 block discarded – undo
1311 1326
             require_once( 'class-sensei-modules.php');
1312 1327
             Sensei()->modules = new Sensei_Core_Modules( $this->file );
1313 1328
 
1314
-        }else{
1329
+        } else{
1315 1330
             // fallback for people still using the modules extension.
1316 1331
             global $sensei_modules;
1317 1332
             Sensei()->modules = $sensei_modules;
@@ -1358,7 +1373,7 @@  discard block
 block discarded – undo
1358 1373
 
1359 1374
             update_option('sensei_flush_rewrite_rules', '2');
1360 1375
 
1361
-        }elseif( '2' == $option ) {
1376
+        } elseif( '2' == $option ) {
1362 1377
 
1363 1378
             flush_rewrite_rules();
1364 1379
             update_option('sensei_flush_rewrite_rules', '0');
Please login to merge, or discard this patch.
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.