Passed
Push — master ( 88e772...6d383d )
by Stiofan
17:06
created
geodirectory-functions/custom_functions.php 1 patch
Braces   +64 added lines, -52 removed lines patch added patch discarded remove patch
@@ -526,13 +526,15 @@  discard block
 block discarded – undo
526 526
 
527 527
         $all_postypes = geodir_get_posttypes();
528 528
 
529
-        if (!in_array($post_type, $all_postypes))
530
-            return false;
529
+        if (!in_array($post_type, $all_postypes)) {
530
+                    return false;
531
+        }
531 532
 
532 533
         $sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array($post_type, 1, 1)));
533 534
 
534
-        if (!empty($sort_field_info))
535
-            return $sort_field_info;
535
+        if (!empty($sort_field_info)) {
536
+                    return $sort_field_info;
537
+        }
536 538
 
537 539
     }
538 540
 
@@ -554,8 +556,9 @@  discard block
 block discarded – undo
554 556
     if ($post_type != '') {
555 557
         $all_postypes = geodir_get_posttypes();
556 558
 
557
-        if (!in_array($post_type, $all_postypes))
558
-            return false;
559
+        if (!in_array($post_type, $all_postypes)) {
560
+                    return false;
561
+        }
559 562
 
560 563
         $sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array($post_type, 1)));
561 564
         /**
@@ -593,7 +596,9 @@  discard block
 block discarded – undo
593 596
 
594 597
     $sort_by = '';
595 598
 
596
-    if (isset($_REQUEST['sort_by'])) $sort_by = $_REQUEST['sort_by'];
599
+    if (isset($_REQUEST['sort_by'])) {
600
+    	$sort_by = $_REQUEST['sort_by'];
601
+    }
597 602
 
598 603
     $gd_post_type = geodir_get_current_posttype();
599 604
 
@@ -621,8 +626,9 @@  discard block
 block discarded – undo
621 626
             if ($sort->sort_asc) {
622 627
                 $key = $sort->htmlvar_name . '_asc';
623 628
                 $label = $sort->site_title;
624
-                if ($sort->asc_title)
625
-                    $label = $sort->asc_title;
629
+                if ($sort->asc_title) {
630
+                                    $label = $sort->asc_title;
631
+                }
626 632
                 ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
627 633
                 $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
628 634
             }
@@ -630,8 +636,9 @@  discard block
 block discarded – undo
630 636
             if ($sort->sort_desc) {
631 637
                 $key = $sort->htmlvar_name . '_desc';
632 638
                 $label = $sort->site_title;
633
-                if ($sort->desc_title)
634
-                    $label = $sort->desc_title;
639
+                if ($sort->desc_title) {
640
+                                    $label = $sort->desc_title;
641
+                }
635 642
                 ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
636 643
                 $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
637 644
             }
@@ -648,7 +655,10 @@  discard block
 block discarded – undo
648 655
             <select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
649 656
 
650 657
                 <option
651
-                    value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') echo 'selected="selected"';?>><?php _e('Sort By', 'geodirectory');?></option><?php
658
+                    value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') {
659
+	echo 'selected="selected"';
660
+}
661
+?>><?php _e('Sort By', 'geodirectory');?></option><?php
652 662
 
653 663
                 echo $sort_field_options;?>
654 664
 
@@ -716,8 +726,9 @@  discard block
 block discarded – undo
716 726
         $arr_detail_page_tabs = geodir_detail_page_tabs_list();
717 727
 
718 728
         $related_listing_array = array();
719
-        if (get_option('geodir_add_related_listing_posttypes'))
720
-            $related_listing_array = get_option('geodir_add_related_listing_posttypes');
729
+        if (get_option('geodir_add_related_listing_posttypes')) {
730
+                    $related_listing_array = get_option('geodir_add_related_listing_posttypes');
731
+        }
721 732
         if (in_array($post->post_type, $related_listing_array)) {
722 733
             $arr_detail_page_tabs['related_listing']['is_display'] = true;
723 734
         }
@@ -733,8 +744,9 @@  discard block
 block discarded – undo
733 744
         if (isset($_REQUEST['backandedit'])) {
734 745
             $post = (object)$gd_session->get('listing');
735 746
             $post_type = $post->listing_type;
736
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
737
-                $post_id = $_REQUEST['pid'];
747
+            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
748
+                            $post_id = $_REQUEST['pid'];
749
+            }
738 750
         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
739 751
             $post = geodir_get_post_info($_REQUEST['pid']);
740 752
             $post_type = $post->post_type;
@@ -747,25 +759,29 @@  discard block
 block discarded – undo
747 759
         if ($relate_to == 'category') {
748 760
 
749 761
             $category_taxonomy = $post_type . $relate_to;
750
-            if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '')
751
-                $category = explode(',', trim($post->{$category_taxonomy}, ','));
762
+            if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '') {
763
+                            $category = explode(',', trim($post->{$category_taxonomy}, ','));
764
+            }
752 765
 
753 766
         } elseif ($relate_to == 'tags') {
754 767
 
755 768
             $category_taxonomy = $post_type . '_' . $relate_to;
756
-            if ($post->post_tags != '')
757
-                $category = explode(',', trim($post->post_tags, ','));
769
+            if ($post->post_tags != '') {
770
+                            $category = explode(',', trim($post->post_tags, ','));
771
+            }
758 772
             $tax_field = 'name';
759 773
         }
760 774
 
761 775
         /* --- return false in invalid request --- */
762
-        if (empty($category))
763
-            return false;
776
+        if (empty($category)) {
777
+                    return false;
778
+        }
764 779
 
765 780
         $all_postypes = geodir_get_posttypes();
766 781
 
767
-        if (!in_array($post_type, $all_postypes))
768
-            return false;
782
+        if (!in_array($post_type, $all_postypes)) {
783
+                    return false;
784
+        }
769 785
 
770 786
         /* --- return false in invalid request --- */
771 787
 
@@ -931,8 +947,9 @@  discard block
 block discarded – undo
931 947
 function geodir_get_map_default_language()
932 948
 {
933 949
     $geodir_default_map_language = get_option('geodir_default_map_language');
934
-    if (empty($geodir_default_map_language))
935
-        $geodir_default_map_language = 'en';
950
+    if (empty($geodir_default_map_language)) {
951
+            $geodir_default_map_language = 'en';
952
+    }
936 953
     /**
937 954
      * Filter default map language.
938 955
      *
@@ -1129,42 +1146,33 @@  discard block
 block discarded – undo
1129 1146
     if(geodir_is_page('home')){
1130 1147
         $gd_page = 'home';
1131 1148
         $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1132
-    }
1133
-    elseif(geodir_is_page('detail')){
1149
+    } elseif(geodir_is_page('detail')){
1134 1150
         $gd_page = 'detail';
1135 1151
         $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1136
-    }
1137
-    elseif(geodir_is_page('pt')){
1152
+    } elseif(geodir_is_page('pt')){
1138 1153
         $gd_page = 'pt';
1139 1154
         $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1140
-    }
1141
-    elseif(geodir_is_page('listing')){
1155
+    } elseif(geodir_is_page('listing')){
1142 1156
         $gd_page = 'listing';
1143 1157
         $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1144
-    }
1145
-    elseif(geodir_is_page('location')){
1158
+    } elseif(geodir_is_page('location')){
1146 1159
         $gd_page = 'location';
1147 1160
         $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1148 1161
         $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1149 1162
 
1150
-    }
1151
-    elseif(geodir_is_page('search')){
1163
+    } elseif(geodir_is_page('search')){
1152 1164
         $gd_page = 'search';
1153 1165
         $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1154
-    }
1155
-    elseif(geodir_is_page('add-listing')){
1166
+    } elseif(geodir_is_page('add-listing')){
1156 1167
         $gd_page = 'add-listing';
1157 1168
         $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1158
-    }
1159
-    elseif(geodir_is_page('author')){
1169
+    } elseif(geodir_is_page('author')){
1160 1170
         $gd_page = 'author';
1161 1171
         $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1162
-    }
1163
-    elseif(geodir_is_page('login')){
1172
+    } elseif(geodir_is_page('login')){
1164 1173
         $gd_page = 'login';
1165 1174
         $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1166
-    }
1167
-    elseif(geodir_is_page('listing-success')){
1175
+    } elseif(geodir_is_page('listing-success')){
1168 1176
         $gd_page = 'listing-success';
1169 1177
         $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1170 1178
     }
@@ -1370,8 +1378,9 @@  discard block
 block discarded – undo
1370 1378
     $tabs_array = geodir_detail_page_tabs_array();
1371 1379
     if (!empty($tabs_excluded)) {
1372 1380
         foreach ($tabs_excluded as $tab) {
1373
-            if (array_key_exists($tab, $tabs_array))
1374
-                unset($tabs_array[$tab]);
1381
+            if (array_key_exists($tab, $tabs_array)) {
1382
+                            unset($tabs_array[$tab]);
1383
+            }
1375 1384
         }
1376 1385
     }
1377 1386
     return $tabs_array;
@@ -1411,8 +1420,9 @@  discard block
 block discarded – undo
1411 1420
         $video = geodir_get_video($post->ID);
1412 1421
         $special_offers = geodir_get_special_offers($post->ID);
1413 1422
         $related_listing_array = array();
1414
-        if (get_option('geodir_add_related_listing_posttypes'))
1415
-            $related_listing_array = get_option('geodir_add_related_listing_posttypes');
1423
+        if (get_option('geodir_add_related_listing_posttypes')) {
1424
+                    $related_listing_array = get_option('geodir_add_related_listing_posttypes');
1425
+        }
1416 1426
 
1417 1427
         if (in_array($post->post_type, $related_listing_array)) {
1418 1428
             $arr_detail_page_tabs['related_listing']['is_display'] = true;
@@ -1467,11 +1477,13 @@  discard block
 block discarded – undo
1467 1477
         $video = isset($post->geodir_video) ? $post->geodir_video : '';
1468 1478
         $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1469 1479
 
1470
-        if (isset($post->post_images))
1471
-            $post->post_images = trim($post->post_images, ",");
1480
+        if (isset($post->post_images)) {
1481
+                    $post->post_images = trim($post->post_images, ",");
1482
+        }
1472 1483
 
1473
-        if (isset($post->post_images) && !empty($post->post_images))
1474
-            $post_images = explode(",", $post->post_images);
1484
+        if (isset($post->post_images) && !empty($post->post_images)) {
1485
+                    $post_images = explode(",", $post->post_images);
1486
+        }
1475 1487
 
1476 1488
         $thumb_image = '';
1477 1489
         if (!empty($post_images)) {
Please login to merge, or discard this patch.