Completed
Pull Request — master (#1270)
by
unknown
05:01
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
@@ -1161,7 +1164,7 @@  discard block
 block discarded – undo
1161 1164
 
1162 1165
             $order = $order_id;
1163 1166
 
1164
-        }else{
1167
+        } else{
1165 1168
 
1166 1169
             $order = new WC_Order( $order_id );
1167 1170
         }
@@ -1267,7 +1270,9 @@  discard block
 block discarded – undo
1267 1270
 
1268 1271
         global $current_user;
1269 1272
 
1270
-        if ( ! isset( $current_user ) || !$current_user->ID > 0 ) return false;
1273
+        if ( ! isset( $current_user ) || !$current_user->ID > 0 ) {
1274
+        	return false;
1275
+        }
1271 1276
 
1272 1277
         $data_update = false;
1273 1278
 
@@ -1393,7 +1398,9 @@  discard block
 block discarded – undo
1393 1398
 
1394 1399
         $order = new WC_Order( $order_id );
1395 1400
 
1396
-        if ( ! isset ( $order ) ) return '';
1401
+        if ( ! isset ( $order ) ) {
1402
+        	return '';
1403
+        }
1397 1404
 
1398 1405
         if ( $order_status == 'wc-processing' && ( $order->post_status == 'wc-on-hold' || $order->post_status == 'wc-pending' || $order->post_status == 'wc-failed' ) ) {
1399 1406
 
@@ -1488,7 +1495,7 @@  discard block
 block discarded – undo
1488 1495
 
1489 1496
             $user_access_permission = true;
1490 1497
 
1491
-        }else{
1498
+        } else{
1492 1499
 
1493 1500
             $user_access_permission = false;
1494 1501
             // do not show the WC permissions message
Please login to merge, or discard this patch.
includes/class-sensei.php 1 patch
Braces   +29 added lines, -18 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
 
@@ -562,8 +567,7 @@  discard block
 block discarded – undo
562 567
 
563 568
                     $prerequisite_complete = Sensei_Utils::user_completed_course( $course_prerequisite_id, $current_user->ID );
564 569
 
565
-                }
566
-                else {
570
+                } else {
567 571
                     $prerequisite_complete = true;
568 572
                 } // End If Statement
569 573
                 // Handles restrictions
@@ -710,7 +714,9 @@  discard block
 block discarded – undo
710 714
      */
711 715
     public function access_settings () {
712 716
 
713
-        if( sensei_all_access() ) return true;
717
+        if( sensei_all_access() ) {
718
+        	return true;
719
+        }
714 720
 
715 721
         if ( isset( $this->settings->settings['access_permission'] ) && ( true == $this->settings->settings['access_permission'] ) ) {
716 722
             if ( is_user_logged_in() ) {
@@ -763,8 +769,9 @@  discard block
 block discarded – undo
763 769
         }
764 770
         $where = "WHERE comment_type IN ('" . join("', '", array_unique( $statuses ) ) . "')";
765 771
 
766
-        if ( $post_id > 0 )
767
-            $where .= $wpdb->prepare( " AND comment_post_ID = %d", $post_id );
772
+        if ( $post_id > 0 ) {
773
+                    $where .= $wpdb->prepare( " AND comment_post_ID = %d", $post_id );
774
+        }
768 775
 
769 776
         $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
770 777
 
@@ -772,16 +779,19 @@  discard block
 block discarded – undo
772 779
         $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed');
773 780
         foreach ( (array) $count as $row ) {
774 781
             // Don't count post-trashed toward totals
775
-            if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] )
776
-                $total += $row['num_comments'];
777
-            if ( isset( $approved[$row['comment_approved']] ) )
778
-                $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
782
+            if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
783
+                            $total += $row['num_comments'];
784
+            }
785
+            if ( isset( $approved[$row['comment_approved']] ) ) {
786
+                            $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
787
+            }
779 788
         }
780 789
 
781 790
         $stats['total_comments'] = $total;
782 791
         foreach ( $approved as $key ) {
783
-            if ( empty($stats[$key]) )
784
-                $stats[$key] = 0;
792
+            if ( empty($stats[$key]) ) {
793
+                            $stats[$key] = 0;
794
+            }
785 795
         }
786 796
 
787 797
         $stats = (object) $stats;
@@ -822,8 +832,9 @@  discard block
 block discarded – undo
822 832
     public function get_image_size( $image_size ) {
823 833
 
824 834
         // Only return sizes we define in settings
825
-        if ( ! in_array( $image_size, array( 'course_archive_image', 'course_single_image', 'lesson_archive_image', 'lesson_single_image' ) ) )
826
-            return apply_filters( 'sensei_get_image_size_' . $image_size, '' );
835
+        if ( ! in_array( $image_size, array( 'course_archive_image', 'course_single_image', 'lesson_archive_image', 'lesson_single_image' ) ) ) {
836
+                    return apply_filters( 'sensei_get_image_size_' . $image_size, '' );
837
+        }
827 838
 
828 839
         if( ! isset( $this->settings->settings[ $image_size . '_width' ] ) ) {
829 840
             $this->settings->settings[ $image_size . '_width' ] = false;
@@ -886,7 +897,7 @@  discard block
 block discarded – undo
886 897
             require_once( 'class-sensei-modules.php');
887 898
             Sensei()->modules = new Sensei_Core_Modules( $this->file );
888 899
 
889
-        }else{
900
+        } else{
890 901
             // fallback for people still using the modules extension.
891 902
             global $sensei_modules;
892 903
             Sensei()->modules = $sensei_modules;
@@ -933,7 +944,7 @@  discard block
 block discarded – undo
933 944
 
934 945
             update_option('sensei_flush_rewrite_rules', '2');
935 946
 
936
-        }elseif( '2' == $option ) {
947
+        } elseif( '2' == $option ) {
937 948
 
938 949
             flush_rewrite_rules();
939 950
             update_option('sensei_flush_rewrite_rules', '0');
Please login to merge, or discard this patch.
widgets/widget-woothemes-sensei-course-component.php 1 patch
Braces   +5 added lines, -2 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 Component Widget
@@ -272,7 +275,7 @@  discard block
 block discarded – undo
272 275
 				} elseif ( 'completedcourses' == $instance['component'] ) {
273 276
 					_e( 'You have no completed courses.', 'woothemes-sensei' );
274 277
 
275
-				}else{
278
+				} else{
276 279
 
277 280
 					_e( 'You have no courses.', 'woothemes-sensei' );
278 281
 
Please login to merge, or discard this patch.