Test Failed
Push — master ( 2b0793...82eae6 )
by Stiofan
10:02
created
geodirectory-functions/custom_functions.php 1 patch
Braces   +65 added lines, -53 removed lines patch added patch discarded remove patch
@@ -525,13 +525,15 @@  discard block
 block discarded – undo
525 525
 
526 526
         $all_postypes = geodir_get_posttypes();
527 527
 
528
-        if (!in_array($post_type, $all_postypes))
529
-            return false;
528
+        if (!in_array($post_type, $all_postypes)) {
529
+                    return false;
530
+        }
530 531
 
531 532
         $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)));
532 533
 
533
-        if (!empty($sort_field_info))
534
-            return $sort_field_info;
534
+        if (!empty($sort_field_info)) {
535
+                    return $sort_field_info;
536
+        }
535 537
 
536 538
     }
537 539
 
@@ -553,8 +555,9 @@  discard block
 block discarded – undo
553 555
     if ($post_type != '') {
554 556
         $all_postypes = geodir_get_posttypes();
555 557
 
556
-        if (!in_array($post_type, $all_postypes))
557
-            return false;
558
+        if (!in_array($post_type, $all_postypes)) {
559
+                    return false;
560
+        }
558 561
 
559 562
         $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)));
560 563
         /**
@@ -592,7 +595,9 @@  discard block
 block discarded – undo
592 595
 
593 596
     $sort_by = '';
594 597
 
595
-    if (isset($_REQUEST['sort_by'])) $sort_by = $_REQUEST['sort_by'];
598
+    if (isset($_REQUEST['sort_by'])) {
599
+    	$sort_by = $_REQUEST['sort_by'];
600
+    }
596 601
 
597 602
     $gd_post_type = geodir_get_current_posttype();
598 603
 
@@ -620,8 +625,9 @@  discard block
 block discarded – undo
620 625
             if ($sort->sort_asc) {
621 626
                 $key = $sort->htmlvar_name . '_asc';
622 627
                 $label = $sort->site_title;
623
-                if ($sort->asc_title)
624
-                    $label = $sort->asc_title;
628
+                if ($sort->asc_title) {
629
+                                    $label = $sort->asc_title;
630
+                }
625 631
                 ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
626 632
                 $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
627 633
             }
@@ -629,8 +635,9 @@  discard block
 block discarded – undo
629 635
             if ($sort->sort_desc) {
630 636
                 $key = $sort->htmlvar_name . '_desc';
631 637
                 $label = $sort->site_title;
632
-                if ($sort->desc_title)
633
-                    $label = $sort->desc_title;
638
+                if ($sort->desc_title) {
639
+                                    $label = $sort->desc_title;
640
+                }
634 641
                 ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
635 642
                 $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
636 643
             }
@@ -647,7 +654,10 @@  discard block
 block discarded – undo
647 654
             <select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
648 655
 
649 656
                 <option
650
-                    value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') echo 'selected="selected"';?>><?php _e('Sort By', 'geodirectory');?></option><?php
657
+                    value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') {
658
+	echo 'selected="selected"';
659
+}
660
+?>><?php _e('Sort By', 'geodirectory');?></option><?php
651 661
 
652 662
                 echo $sort_field_options;?>
653 663
 
@@ -715,8 +725,9 @@  discard block
 block discarded – undo
715 725
         $arr_detail_page_tabs = geodir_detail_page_tabs_list();
716 726
 
717 727
         $related_listing_array = array();
718
-        if (get_option('geodir_add_related_listing_posttypes'))
719
-            $related_listing_array = get_option('geodir_add_related_listing_posttypes');
728
+        if (get_option('geodir_add_related_listing_posttypes')) {
729
+                    $related_listing_array = get_option('geodir_add_related_listing_posttypes');
730
+        }
720 731
         if (in_array($post->post_type, $related_listing_array)) {
721 732
             $arr_detail_page_tabs['related_listing']['is_display'] = true;
722 733
         }
@@ -732,8 +743,9 @@  discard block
 block discarded – undo
732 743
         if (isset($_REQUEST['backandedit'])) {
733 744
             $post = (object)$gd_session->get('listing');
734 745
             $post_type = $post->listing_type;
735
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
736
-                $post_id = $_REQUEST['pid'];
746
+            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
747
+                            $post_id = $_REQUEST['pid'];
748
+            }
737 749
         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
738 750
             $post = geodir_get_post_info($_REQUEST['pid']);
739 751
             $post_type = $post->post_type;
@@ -746,25 +758,29 @@  discard block
 block discarded – undo
746 758
         if ($relate_to == 'category') {
747 759
 
748 760
             $category_taxonomy = $post_type . $relate_to;
749
-            if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '')
750
-                $category = explode(',', trim($post->{$category_taxonomy}, ','));
761
+            if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '') {
762
+                            $category = explode(',', trim($post->{$category_taxonomy}, ','));
763
+            }
751 764
 
752 765
         } elseif ($relate_to == 'tags') {
753 766
 
754 767
             $category_taxonomy = $post_type . '_' . $relate_to;
755
-            if ($post->post_tags != '')
756
-                $category = explode(',', trim($post->post_tags, ','));
768
+            if ($post->post_tags != '') {
769
+                            $category = explode(',', trim($post->post_tags, ','));
770
+            }
757 771
             $tax_field = 'name';
758 772
         }
759 773
 
760 774
         /* --- return false in invalid request --- */
761
-        if (empty($category))
762
-            return false;
775
+        if (empty($category)) {
776
+                    return false;
777
+        }
763 778
 
764 779
         $all_postypes = geodir_get_posttypes();
765 780
 
766
-        if (!in_array($post_type, $all_postypes))
767
-            return false;
781
+        if (!in_array($post_type, $all_postypes)) {
782
+                    return false;
783
+        }
768 784
 
769 785
         /* --- return false in invalid request --- */
770 786
 
@@ -929,8 +945,9 @@  discard block
 block discarded – undo
929 945
 function geodir_get_map_default_language()
930 946
 {
931 947
     $geodir_default_map_language = get_option('geodir_default_map_language');
932
-    if (empty($geodir_default_map_language))
933
-        $geodir_default_map_language = 'en';
948
+    if (empty($geodir_default_map_language)) {
949
+            $geodir_default_map_language = 'en';
950
+    }
934 951
     /**
935 952
      * Filter default map language.
936 953
      *
@@ -1127,42 +1144,33 @@  discard block
 block discarded – undo
1127 1144
     if(geodir_is_page('home')){
1128 1145
         $gd_page = 'home';
1129 1146
         $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1130
-    }
1131
-    elseif(geodir_is_page('detail')){
1147
+    } elseif(geodir_is_page('detail')){
1132 1148
         $gd_page = 'detail';
1133 1149
         $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1134
-    }
1135
-    elseif(geodir_is_page('pt')){
1150
+    } elseif(geodir_is_page('pt')){
1136 1151
         $gd_page = 'pt';
1137 1152
         $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1138
-    }
1139
-    elseif(geodir_is_page('listing')){
1153
+    } elseif(geodir_is_page('listing')){
1140 1154
         $gd_page = 'listing';
1141 1155
         $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1142
-    }
1143
-    elseif(geodir_is_page('location')){
1156
+    } elseif(geodir_is_page('location')){
1144 1157
         $gd_page = 'location';
1145 1158
         $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1146 1159
         $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1147 1160
 
1148
-    }
1149
-    elseif(geodir_is_page('search')){
1161
+    } elseif(geodir_is_page('search')){
1150 1162
         $gd_page = 'search';
1151 1163
         $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1152
-    }
1153
-    elseif(geodir_is_page('add-listing')){
1164
+    } elseif(geodir_is_page('add-listing')){
1154 1165
         $gd_page = 'add-listing';
1155 1166
         $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1156
-    }
1157
-    elseif(geodir_is_page('author')){
1167
+    } elseif(geodir_is_page('author')){
1158 1168
         $gd_page = 'author';
1159 1169
         $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1160
-    }
1161
-    elseif(geodir_is_page('login')){
1170
+    } elseif(geodir_is_page('login')){
1162 1171
         $gd_page = 'login';
1163 1172
         $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1164
-    }
1165
-    elseif(geodir_is_page('listing-success')){
1173
+    } elseif(geodir_is_page('listing-success')){
1166 1174
         $gd_page = 'listing-success';
1167 1175
         $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1168 1176
     }
@@ -1356,8 +1364,9 @@  discard block
 block discarded – undo
1356 1364
 
1357 1365
     if (!empty($tabs_excluded)) {
1358 1366
         foreach ($tabs_excluded as $tab) {
1359
-            if (array_key_exists($tab, $tabs_array))
1360
-                unset($tabs_array[$tab]);
1367
+            if (array_key_exists($tab, $tabs_array)) {
1368
+                            unset($tabs_array[$tab]);
1369
+            }
1361 1370
         }
1362 1371
     }
1363 1372
     return $tabs_array;
@@ -1396,8 +1405,9 @@  discard block
 block discarded – undo
1396 1405
         $video = geodir_get_video($post->ID);
1397 1406
         $special_offers = geodir_get_special_offers($post->ID);
1398 1407
         $related_listing_array = array();
1399
-        if (get_option('geodir_add_related_listing_posttypes'))
1400
-            $related_listing_array = get_option('geodir_add_related_listing_posttypes');
1408
+        if (get_option('geodir_add_related_listing_posttypes')) {
1409
+                    $related_listing_array = get_option('geodir_add_related_listing_posttypes');
1410
+        }
1401 1411
 
1402 1412
 
1403 1413
         $excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
@@ -1453,11 +1463,13 @@  discard block
 block discarded – undo
1453 1463
         $video = isset($post->geodir_video) ? $post->geodir_video : '';
1454 1464
         $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1455 1465
 
1456
-        if (isset($post->post_images))
1457
-            $post->post_images = trim($post->post_images, ",");
1466
+        if (isset($post->post_images)) {
1467
+                    $post->post_images = trim($post->post_images, ",");
1468
+        }
1458 1469
 
1459
-        if (isset($post->post_images) && !empty($post->post_images))
1460
-            $post_images = explode(",", $post->post_images);
1470
+        if (isset($post->post_images) && !empty($post->post_images)) {
1471
+                    $post_images = explode(",", $post->post_images);
1472
+        }
1461 1473
 
1462 1474
         $thumb_image = '';
1463 1475
         if (!empty($post_images)) {
@@ -1634,7 +1646,7 @@  discard block
 block discarded – undo
1634 1646
                                     if($video){
1635 1647
                                         echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>";
1636 1648
                                     }
1637
-                                }else{
1649
+                                } else{
1638 1650
                                     /** This action is documented in geodirectory_template_actions.php */
1639 1651
                                     echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
1640 1652
                                 }
Please login to merge, or discard this patch.