Completed
Push — master ( d51ce1...80c0ca )
by Dwain
05:52
created
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/class-sensei-student.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/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.