Completed
Push — master ( eccc4a...c847f3 )
by Dwain
04:57
created
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.