Test Failed
Push — master ( c9cfa7...621ef4 )
by Stiofan
13:38 queued 49s
created
geodirectory-functions/listing_filters.php 1 patch
Braces   +31 added lines, -20 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_session_start()
18 18
 {
19
-    if (!session_id()) session_start();
19
+    if (!session_id()) {
20
+    	session_start();
21
+    }
20 22
     global $geodir_add_location_url;
21 23
 
22 24
     $geodir_add_location_url = NULL;
@@ -86,7 +88,9 @@  discard block
 block discarded – undo
86 88
 
87 89
     if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')):
88 90
 
89
-        if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = '';
91
+        if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') {
92
+        	$_REQUEST['scat'] = '';
93
+        }
90 94
         //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = '';
91 95
 
92 96
         if (isset($_REQUEST['sdist'])) {
@@ -198,8 +202,9 @@  discard block
 block discarded – undo
198 202
         add_filter('posts_fields', 'geodir_posts_fields', 1);
199 203
         add_filter('posts_join', 'geodir_posts_join', 1);
200 204
         geodir_post_where();
201
-        if (!is_admin())
202
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
205
+        if (!is_admin()) {
206
+                    add_filter('posts_orderby', 'geodir_posts_orderby', 1);
207
+        }
203 208
 
204 209
         // advanced filter for popular post view widget
205 210
         global $wp_query;
@@ -349,8 +354,9 @@  discard block
 block discarded – undo
349 354
     $sort_by = '';
350 355
     $orderby = ' ';
351 356
 
352
-    if (get_query_var('order_by'))
353
-        $sort_by = get_query_var('order_by');
357
+    if (get_query_var('order_by')) {
358
+            $sort_by = get_query_var('order_by');
359
+    }
354 360
 
355 361
     /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
356 362
         $current_term = $wp_query->get_queried_object();
@@ -370,14 +376,16 @@  discard block
 block discarded – undo
370 376
         $orderby .= " distance,";
371 377
     }
372 378
 
373
-    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
374
-        $sort_by = esc_attr($_REQUEST['sort_by']);
379
+    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) {
380
+            $sort_by = esc_attr($_REQUEST['sort_by']);
381
+    }
375 382
 
376 383
 
377 384
     if ($sort_by == '') {
378 385
         $default_sort = geodir_get_posts_default_sort($geodir_post_type);
379
-        if (!empty($default_sort))
380
-            $sort_by = $default_sort;
386
+        if (!empty($default_sort)) {
387
+                    $sort_by = $default_sort;
388
+        }
381 389
     }
382 390
 
383 391
     /*
@@ -562,7 +570,7 @@  discard block
 block discarded – undo
562 570
                         $orderby = " (( $avg_num_votes * $avg_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating ))  / ( $avg_num_votes + " . $table . ".rating_count )  $order , ";
563 571
 
564 572
                         //$orderby = " ( " . $table . ".rating_count * " . $table . ".overall_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating )   / ( " . $table . ".rating_count + " . $table . ".rating_count )  $order , "; // seems to work mostly with no extra overheads
565
-                    }else{
573
+                    } else{
566 574
                         $orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
567 575
                     }
568 576
 
@@ -607,8 +615,9 @@  discard block
 block discarded – undo
607 615
 
608 616
             add_filter('posts_where', 'searching_filter_where', 1);
609 617
 
610
-            if ($snear != '')
611
-                add_filter('posts_where', 'searching_filter_where', 1);
618
+            if ($snear != '') {
619
+                            add_filter('posts_where', 'searching_filter_where', 1);
620
+            }
612 621
 
613 622
             add_filter('posts_orderby', 'geodir_posts_orderby', 1);
614 623
 
@@ -762,10 +771,11 @@  discard block
 block discarded – undo
762 771
 
763 772
     $where = '';
764 773
     $better_search_terms = '';
765
-    if (isset($_REQUEST['stype']))
766
-        $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
767
-    else
768
-        $post_types = 'gd_place';
774
+    if (isset($_REQUEST['stype'])) {
775
+            $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
776
+    } else {
777
+            $post_types = 'gd_place';
778
+    }
769 779
 
770 780
     if ($s != '') {
771 781
         $keywords = explode(" ", $s);
@@ -802,7 +812,7 @@  discard block
 block discarded – undo
802 812
     if($taxonomies) {
803 813
         $taxonomies = implode("','", $taxonomies);
804 814
         $taxonomies = "'" . $taxonomies . "'";
805
-    }else{$taxonomies='';}
815
+    } else{$taxonomies='';}
806 816
 
807 817
     $content_where = $terms_where = '';
808 818
     $terms_sql    = '';
@@ -943,8 +953,9 @@  discard block
 block discarded – undo
943 953
             $user_fav_posts = geodir_get_user_favourites($user_id);
944 954
             $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
945 955
             $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
946
-        } else
947
-            $where .= " AND $wpdb->posts.post_author = $user_id";
956
+        } else {
957
+                    $where .= " AND $wpdb->posts.post_author = $user_id";
958
+        }
948 959
 
949 960
         if ($user_id == (int)get_current_user_id()) {
950 961
             $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
Please login to merge, or discard this patch.