Test Failed
Push — master ( 914470...6135a0 )
by Stiofan
04:42
created
geodirectory-functions/custom_fields_functions.php 1 patch
Braces   +136 added lines, -94 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@  discard block
 block discarded – undo
51 51
         global $wpdb;
52 52
         $result = 0;// no rows affected
53 53
         if (!geodir_column_exist($db, $column)) {
54
-            if (!empty($db) && !empty($column))
55
-                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
54
+            if (!empty($db) && !empty($column)) {
55
+                            $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
+            }
56 57
         }
57 58
         return $result;
58 59
     }
@@ -82,10 +83,11 @@  discard block
 block discarded – undo
82 83
 
83 84
     $default_query = '';
84 85
 
85
-    if ($default == 'default')
86
-        $default_query .= " and is_admin IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query .= " and is_admin = '0' ";
86
+    if ($default == 'default') {
87
+            $default_query .= " and is_admin IN ('1') ";
88
+    } elseif ($default == 'custom') {
89
+            $default_query .= " and is_admin = '0' ";
90
+    }
89 91
 
90 92
     if ($fields_location == 'none') {
91 93
     } else{
@@ -239,10 +241,12 @@  discard block
 block discarded – undo
239 241
                 }
240 242
 
241 243
                 return $field_id;
242
-            } else
243
-                return 0;
244
-        } else
245
-            return 0;
244
+            } else {
245
+                            return 0;
246
+            }
247
+        } else {
248
+                    return 0;
249
+        }
246 250
     }
247 251
 }
248 252
 
@@ -350,7 +354,9 @@  discard block
 block discarded – undo
350 354
 
351 355
 
352 356
 
353
-            if ($post_type == '') $post_type = 'gd_place';
357
+            if ($post_type == '') {
358
+            	$post_type = 'gd_place';
359
+            }
354 360
 
355 361
 
356 362
             $detail_table = $plugin_prefix . $post_type . '_detail';
@@ -390,16 +396,17 @@  discard block
 block discarded – undo
390 396
             }
391 397
 
392 398
             $option_values = '';
393
-            if (isset($request_field['option_values']))
394
-                $option_values = $request_field['option_values'];
399
+            if (isset($request_field['option_values'])) {
400
+                            $option_values = $request_field['option_values'];
401
+            }
395 402
 
396 403
             $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
397 404
 
398 405
             $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
399 406
 
400
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
401
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
402
-            else {
407
+            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) {
408
+                            $price_pkg = implode(",", $request_field['show_on_pkg']);
409
+            } else {
403 410
                 $package_info = array();
404 411
 
405 412
                 $package_info = geodir_post_package_info($package_info, '', $post_type);
@@ -407,22 +414,29 @@  discard block
 block discarded – undo
407 414
             }
408 415
 
409 416
 
410
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
411
-                $extra_fields = $request_field['extra'];
417
+            if (isset($request_field['extra']) && !empty($request_field['extra'])) {
418
+                            $extra_fields = $request_field['extra'];
419
+            }
412 420
 
413
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
414
-                $is_default = $request_field['is_default'];
415
-            else
416
-                $is_default = '0';
421
+            if (isset($request_field['is_default']) && $request_field['is_default'] != '') {
422
+                            $is_default = $request_field['is_default'];
423
+            } else {
424
+                            $is_default = '0';
425
+            }
417 426
 
418
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
419
-                $is_admin = $request_field['is_admin'];
420
-            else
421
-                $is_admin = '0';
427
+            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') {
428
+                            $is_admin = $request_field['is_admin'];
429
+            } else {
430
+                            $is_admin = '0';
431
+            }
422 432
 
423 433
 
424
-            if ($is_active == '') $is_active = 1;
425
-            if ($is_required == '') $is_required = 0;
434
+            if ($is_active == '') {
435
+            	$is_active = 1;
436
+            }
437
+            if ($is_required == '') {
438
+            	$is_required = 0;
439
+            }
426 440
 
427 441
 
428 442
             if ($sort_order == '') {
@@ -691,7 +705,7 @@  discard block
 block discarded – undo
691 705
                                 }
692 706
                                 if($op_max){$op_size =$op_max; }
693 707
                             }
694
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
708
+                        } elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
695 709
                             if(strlen($option_values)){
696 710
                                 $op_size =  strlen($option_values);
697 711
                             }
@@ -708,11 +722,13 @@  discard block
 block discarded – undo
708 722
                             return __('Column change failed, you may have too many columns.','geodirectory');
709 723
                         }
710 724
 
711
-                        if (isset($request_field['cat_display_type']))
712
-                            $extra_fields = $request_field['cat_display_type'];
725
+                        if (isset($request_field['cat_display_type'])) {
726
+                                                    $extra_fields = $request_field['cat_display_type'];
727
+                        }
713 728
 
714
-                        if (isset($request_field['multi_display_type']))
715
-                            $extra_fields = $request_field['multi_display_type'];
729
+                        if (isset($request_field['multi_display_type'])) {
730
+                                                    $extra_fields = $request_field['multi_display_type'];
731
+                        }
716 732
 
717 733
 
718 734
                         break;
@@ -726,8 +742,9 @@  discard block
 block discarded – undo
726 742
                         if($alter_result===false){
727 743
                             return __('Column change failed, you may have too many columns.','geodirectory');
728 744
                         }
729
-                        if (isset($request_field['advanced_editor']))
730
-                            $extra_fields = $request_field['advanced_editor'];
745
+                        if (isset($request_field['advanced_editor'])) {
746
+                                                    $extra_fields = $request_field['advanced_editor'];
747
+                        }
731 748
 
732 749
                         break;
733 750
 
@@ -823,8 +840,9 @@  discard block
 block discarded – undo
823 840
                 );
824 841
 
825 842
 
826
-                if ($cat_sort == '')
827
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
843
+                if ($cat_sort == '') {
844
+                                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
845
+                }
828 846
 
829 847
 
830 848
                 /**
@@ -1194,8 +1212,10 @@  discard block
 block discarded – undo
1194 1212
         }
1195 1213
 
1196 1214
         return $post_meta_info;
1197
-    else:
1198
-        return false;
1215
+    else {
1216
+    	:
1217
+        return false;
1218
+    }
1199 1219
     endif;
1200 1220
 }
1201 1221
 
@@ -1206,8 +1226,9 @@  discard block
 block discarded – undo
1206 1226
     if (is_admin()) {
1207 1227
         global $post,$gd_session;
1208 1228
 
1209
-        if (isset($_REQUEST['post']))
1210
-            $_REQUEST['pid'] = $_REQUEST['post'];
1229
+        if (isset($_REQUEST['post'])) {
1230
+                    $_REQUEST['pid'] = $_REQUEST['post'];
1231
+        }
1211 1232
     }
1212 1233
 
1213 1234
     if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
@@ -1263,8 +1284,9 @@  discard block
 block discarded – undo
1263 1284
         if (is_admin()) {
1264 1285
             global $post;
1265 1286
 
1266
-            if (isset($_REQUEST['post']))
1267
-                $_REQUEST['pid'] = $_REQUEST['post'];
1287
+            if (isset($_REQUEST['post'])) {
1288
+                            $_REQUEST['pid'] = $_REQUEST['post'];
1289
+            }
1268 1290
         }
1269 1291
 
1270 1292
         
@@ -1356,7 +1378,7 @@  discard block
 block discarded – undo
1356 1378
         $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1357 1379
     } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1358 1380
         $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1359
-    }else{
1381
+    } else{
1360 1382
         $field_icon = $cf['field_icon'];
1361 1383
     }
1362 1384
 
@@ -1428,8 +1450,9 @@  discard block
 block discarded – undo
1428 1450
                     $variables_array['post_id'] = !empty($post->ID) ? $post->ID : (!empty($post->pid) ? $post->pid : NULL);
1429 1451
                     $variables_array['label'] = __($type['site_title'], 'geodirectory');
1430 1452
                     $variables_array['value'] = '';
1431
-                    if (isset($post->{$type['htmlvar_name']}))
1432
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1453
+                    if (isset($post->{$type['htmlvar_name']})) {
1454
+                                            $variables_array['value'] = $post->{$type['htmlvar_name']};
1455
+                    }
1433 1456
                 endif;
1434 1457
 
1435 1458
 
@@ -1451,7 +1474,9 @@  discard block
 block discarded – undo
1451 1474
                      * @param string $html Custom field unfiltered HTML.
1452 1475
                      * @param array $variables_array Custom field variables array.
1453 1476
                      */
1454
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1477
+                    if ($html) {
1478
+                    	echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1479
+                    }
1455 1480
 
1456 1481
                     /**
1457 1482
                      * Called after a custom fields is output on the frontend.
@@ -1494,10 +1519,11 @@  discard block
 block discarded – undo
1494 1519
      */
1495 1520
     function geodir_default_date_format()
1496 1521
     {
1497
-        if ($format = get_option('date_format'))
1498
-            return $format;
1499
-        else
1500
-            return 'dd-mm-yy';
1522
+        if ($format = get_option('date_format')) {
1523
+                    return $format;
1524
+        } else {
1525
+                    return 'dd-mm-yy';
1526
+        }
1501 1527
     }
1502 1528
 }
1503 1529
 
@@ -1604,11 +1630,13 @@  discard block
 block discarded – undo
1604 1630
                     // Set an array containing a list of acceptable formats
1605 1631
                     //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1606 1632
 
1607
-                    if (!function_exists('wp_handle_upload'))
1608
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1633
+                    if (!function_exists('wp_handle_upload')) {
1634
+                                            require_once(ABSPATH . 'wp-admin/includes/file.php');
1635
+                    }
1609 1636
 
1610
-                    if (!is_dir($geodir_uploadpath))
1611
-                        mkdir($geodir_uploadpath);
1637
+                    if (!is_dir($geodir_uploadpath)) {
1638
+                                            mkdir($geodir_uploadpath);
1639
+                    }
1612 1640
 
1613 1641
                     $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1614 1642
                     $explode_sub_dir = explode("/", $sub_dir);
@@ -1621,16 +1649,19 @@  discard block
 block discarded – undo
1621 1649
                     }
1622 1650
 
1623 1651
                     $uploaded_file = '';
1624
-                    if (file_exists($img_path))
1625
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1652
+                    if (file_exists($img_path)) {
1653
+                                            $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1654
+                    }
1626 1655
 
1627 1656
                     if ($curr_img_dir != $geodir_uploaddir) {
1628
-                        if (file_exists($img_path))
1629
-                            unlink($img_path);
1657
+                        if (file_exists($img_path)) {
1658
+                                                    unlink($img_path);
1659
+                        }
1630 1660
                     }
1631 1661
 
1632
-                    if (!empty($uploaded_file))
1633
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1662
+                    if (!empty($uploaded_file)) {
1663
+                                            $file_urls = $geodir_uploadurl . '/' . $new_name;
1664
+                    }
1634 1665
 
1635 1666
                 } else {
1636 1667
                     $file_urls = $post_image[$m];
@@ -1651,8 +1682,9 @@  discard block
 block discarded – undo
1651 1682
 
1652 1683
         geodir_save_post_meta($post_id, $field_id, $file_urls);
1653 1684
 
1654
-        if (!empty($invalid_files))
1655
-            geodir_remove_attachments($invalid_files);
1685
+        if (!empty($invalid_files)) {
1686
+                    geodir_remove_attachments($invalid_files);
1687
+        }
1656 1688
 
1657 1689
     }
1658 1690
 }
@@ -1878,8 +1910,9 @@  discard block
 block discarded – undo
1878 1910
 
1879 1911
         $all_postypes = geodir_get_posttypes();
1880 1912
 
1881
-        if (!in_array($post_type, $all_postypes))
1882
-            return false;
1913
+        if (!in_array($post_type, $all_postypes)) {
1914
+                    return false;
1915
+        }
1883 1916
 
1884 1917
         $fields = array();
1885 1918
 
@@ -1977,8 +2010,10 @@  discard block
 block discarded – undo
1977 2010
         }
1978 2011
 
1979 2012
         return $field_ids;
1980
-    else:
1981
-        return false;
2013
+    else {
2014
+    	:
2015
+        return false;
2016
+    }
1982 2017
     endif;
1983 2018
 }
1984 2019
 
@@ -2151,8 +2186,9 @@  discard block
 block discarded – undo
2151 2186
 
2152 2187
             return $field_id;
2153 2188
 
2154
-        } else
2155
-            return 0;
2189
+        } else {
2190
+                    return 0;
2191
+        }
2156 2192
 
2157 2193
     }
2158 2194
 }
@@ -2193,8 +2229,9 @@  discard block
 block discarded – undo
2193 2229
         $htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2194 2230
 
2195 2231
         $site_title = '';
2196
-        if ($site_title == '')
2197
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2232
+        if ($site_title == '') {
2233
+                    $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2234
+        }
2198 2235
 
2199 2236
         if ($site_title == '') {
2200 2237
             $fields = geodir_get_custom_sort_options($post_type);
@@ -2208,8 +2245,9 @@  discard block
 block discarded – undo
2208 2245
             }
2209 2246
         }
2210 2247
 
2211
-        if ($htmlvar_name == '')
2212
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2248
+        if ($htmlvar_name == '') {
2249
+                    $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2250
+        }
2213 2251
 
2214 2252
         $nonce = wp_create_nonce('custom_fields_' . $result_str);
2215 2253
 
@@ -2222,7 +2260,7 @@  discard block
 block discarded – undo
2222 2260
 
2223 2261
                 if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2224 2262
                     $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2225
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2263
+                } elseif(isset($cso['field_icon']) && $cso['field_icon']){
2226 2264
                     $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2227 2265
                 }
2228 2266
 
@@ -2658,7 +2696,7 @@  discard block
 block discarded – undo
2658 2696
     $dt_value = '';
2659 2697
     if (isset($field_info->data_type)) {
2660 2698
         $dt_value  = esc_attr($field_info->data_type);
2661
-    }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2699
+    } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2662 2700
         $dt_value  = $cf['defaults']['data_type'];
2663 2701
     }
2664 2702
     ?>
@@ -2690,7 +2728,7 @@  discard block
 block discarded – undo
2690 2728
     $value = '';
2691 2729
     if (isset($field_info->decimal_point)) {
2692 2730
         $value = esc_attr($field_info->decimal_point);
2693
-    }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2731
+    } elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2694 2732
         $value = $cf['defaults']['decimal_point'];
2695 2733
     }
2696 2734
     ?>
@@ -2762,11 +2800,13 @@  discard block
 block discarded – undo
2762 2800
 
2763 2801
             <?php
2764 2802
             $selected = '';
2765
-            if (isset($field_info->extra_fields))
2766
-                $advanced_editor = unserialize($field_info->extra_fields);
2803
+            if (isset($field_info->extra_fields)) {
2804
+                            $advanced_editor = unserialize($field_info->extra_fields);
2805
+            }
2767 2806
 
2768
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2769
-                $selected = 'checked="checked"';
2807
+            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) {
2808
+                            $selected = 'checked="checked"';
2809
+            }
2770 2810
             ?>
2771 2811
 
2772 2812
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
@@ -2788,7 +2828,7 @@  discard block
 block discarded – undo
2788 2828
     $value = '';
2789 2829
     if (isset($field_info->validation_pattern)) {
2790 2830
         $value = esc_attr($field_info->validation_pattern);
2791
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2831
+    } elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2792 2832
         $value = esc_attr($cf['defaults']['validation_pattern']);
2793 2833
     }
2794 2834
     ?>
@@ -2808,7 +2848,7 @@  discard block
 block discarded – undo
2808 2848
     $value = '';
2809 2849
     if (isset($field_info->validation_msg)) {
2810 2850
         $value = esc_attr($field_info->validation_msg);
2811
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2851
+    } elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2812 2852
         $value = esc_attr($cf['defaults']['validation_msg']);
2813 2853
     }
2814 2854
     ?>
@@ -2838,8 +2878,9 @@  discard block
 block discarded – undo
2838 2878
 
2839 2879
     if (!isset($field_info->post_type)) {
2840 2880
         $post_type = sanitize_text_field($_REQUEST['listing_type']);
2841
-    } else
2842
-        $post_type = $field_info->post_type;
2881
+    } else {
2882
+            $post_type = $field_info->post_type;
2883
+    }
2843 2884
     ?>
2844 2885
     <li style="display: none;">
2845 2886
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
@@ -3113,7 +3154,7 @@  discard block
 block discarded – undo
3113 3154
     $value = '';
3114 3155
     if (isset($field_info->option_values)) {
3115 3156
         $value = esc_attr($field_info->option_values);
3116
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3157
+    } elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3117 3158
         $value = esc_attr($cf['defaults']['option_values']);
3118 3159
     }
3119 3160
 
@@ -3256,7 +3297,7 @@  discard block
 block discarded – undo
3256 3297
     $value = '';
3257 3298
     if ($extra_fields && isset($extra_fields['is_price'])) {
3258 3299
     $value = esc_attr($extra_fields['is_price']);
3259
-    }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3300
+    } elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3260 3301
     $value = esc_attr($cf['defaults']['extra_fields']['is_price']);
3261 3302
     }
3262 3303
 
@@ -3293,7 +3334,7 @@  discard block
 block discarded – undo
3293 3334
     $value = '';
3294 3335
     if ($extra_fields && isset($extra_fields['thousand_separator'])) {
3295 3336
         $value = esc_attr($extra_fields['thousand_separator']);
3296
-    }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3337
+    } elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3297 3338
         $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']);
3298 3339
     }
3299 3340
     ?>
@@ -3320,7 +3361,7 @@  discard block
 block discarded – undo
3320 3361
     $value = '';
3321 3362
     if ($extra_fields && isset($extra_fields['decimal_separator'])) {
3322 3363
         $value = esc_attr($extra_fields['decimal_separator']);
3323
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3364
+    } elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3324 3365
         $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']);
3325 3366
     }
3326 3367
     ?>
@@ -3343,7 +3384,7 @@  discard block
 block discarded – undo
3343 3384
     $value = '';
3344 3385
     if ($extra_fields && isset($extra_fields['decimal_display'])) {
3345 3386
         $value = esc_attr($extra_fields['decimal_display']);
3346
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3387
+    } elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3347 3388
         $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']);
3348 3389
     }
3349 3390
     ?>
@@ -3366,7 +3407,7 @@  discard block
 block discarded – undo
3366 3407
     $value = '';
3367 3408
     if ($extra_fields && isset($extra_fields['currency_symbol'])) {
3368 3409
         $value = esc_attr($extra_fields['currency_symbol']);
3369
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3410
+    } elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3370 3411
         $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']);
3371 3412
     }
3372 3413
     ?>
@@ -3387,7 +3428,7 @@  discard block
 block discarded – undo
3387 3428
     $value = '';
3388 3429
     if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
3389 3430
         $value = esc_attr($extra_fields['currency_symbol_placement']);
3390
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3431
+    } elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3391 3432
         $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']);
3392 3433
     }
3393 3434
     ?>
@@ -3614,8 +3655,9 @@  discard block
 block discarded – undo
3614 3655
     $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left';
3615 3656
 
3616 3657
     if($decimals>0 && $decimal_display=='if'){
3617
-        if(is_int($number) || floor( $number ) == $number)
3618
-            $decimals = 0;
3658
+        if(is_int($number) || floor( $number ) == $number) {
3659
+                    $decimals = 0;
3660
+        }
3619 3661
     }
3620 3662
 
3621 3663
     $number = number_format($number,$decimals,$decimalpoint,$separator);
@@ -3624,7 +3666,7 @@  discard block
 block discarded – undo
3624 3666
 
3625 3667
     if($currency_symbol_placement=='left'){
3626 3668
         $number = $symbol . $number;
3627
-    }else{
3669
+    } else{
3628 3670
         $number = $number . $symbol;
3629 3671
     }
3630 3672
 
Please login to merge, or discard this patch.
geodirectory-functions/taxonomy_functions.php 1 patch
Braces   +170 added lines, -122 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
     if (get_option('geodir_show_listing_nav')) {
40 40
 
41 41
         $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
42
+        if (geodir_is_page('listing')) {
43
+                    $menu_class = 'current-menu-item';
44
+        }
44 45
 
45 46
 
46 47
         //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
                     if (in_array($post_type, $show_post_type_main_nav)) {
53 54
                         if (get_post_type_archive_link($post_type)) {
54 55
                             $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
56
+                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
57
+                                                            $menu_class = 'current-menu-item';
58
+                            }
57 59
                             /**
58 60
                              * Filter the menu li class.
59 61
                              *
@@ -130,8 +132,9 @@  discard block
 block discarded – undo
130 132
                             if (get_post_type_archive_link($post_type)) {
131 133
 
132 134
                                 $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
135
+                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
136
+                                                                    $menu_class = 'current-menu-item';
137
+                                }
135 138
 
136 139
                                 $items .= '<li class="' . $sub_li_class . '">
137 140
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
@@ -159,8 +162,9 @@  discard block
 block discarded – undo
159 162
     if (get_option('geodir_show_addlisting_nav')) {
160 163
 
161 164
         $menu_class = '';
162
-        if (geodir_is_page('add-listing'))
163
-            $menu_class = 'current-menu-item';
165
+        if (geodir_is_page('add-listing')) {
166
+                    $menu_class = 'current-menu-item';
167
+        }
164 168
 
165 169
         //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166 170
         $post_types = geodir_get_posttypes('object');
@@ -176,8 +180,9 @@  discard block
 block discarded – undo
176 180
                                 if (geodir_get_addlisting_link($post_type)) {
177 181
 
178 182
                                     $menu_class = '';
179
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
-                                        $menu_class = 'current-menu-item';
183
+                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
184
+                                                                            $menu_class = 'current-menu-item';
185
+                                    }
181 186
                                     /**
182 187
                                      * Filter the menu li class.
183 188
                                      *
@@ -261,8 +266,9 @@  discard block
 block discarded – undo
261 266
                                     if (geodir_get_addlisting_link($post_type)) {
262 267
 
263 268
                                         $menu_class = '';
264
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
-                                            $menu_class = 'current-menu-item';
269
+                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
270
+                                                                                    $menu_class = 'current-menu-item';
271
+                                        }
266 272
                                         /**
267 273
                                          * Filter the menu li class.
268 274
                                          *
@@ -319,8 +325,9 @@  discard block
 block discarded – undo
319 325
     }
320 326
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 327
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
328
+    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) {
329
+            $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
330
+    }
324 331
 
325 332
     return $menu;
326 333
 
@@ -407,17 +414,20 @@  discard block
 block discarded – undo
407 414
     $geodir_post_type = get_query_var('post_type');
408 415
 
409 416
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
410
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
411
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
412
-        elseif (isset($_REQUEST['listing_type']))
413
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
417
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
418
+                    $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
419
+        } elseif (isset($_REQUEST['listing_type'])) {
420
+                    $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
421
+        }
414 422
     }
415 423
 
416
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
417
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
424
+    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) {
425
+            $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
426
+    }
418 427
 
419
-    if (is_tax())
420
-        $geodir_post_type = geodir_get_taxonomy_posttype();
428
+    if (is_tax()) {
429
+            $geodir_post_type = geodir_get_taxonomy_posttype();
430
+    }
421 431
 
422 432
     // Retrive post type for map marker html ajax request on preview page.
423 433
     if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) {
@@ -431,8 +441,9 @@  discard block
 block discarded – undo
431 441
     $all_postypes = geodir_get_posttypes();
432 442
     $all_postypes = stripslashes_deep($all_postypes);
433 443
 
434
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
435
-        $geodir_post_type = '';
444
+    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) {
445
+            $geodir_post_type = '';
446
+    }
436 447
 
437 448
     if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
438 449
         $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
@@ -517,11 +528,12 @@  discard block
 block discarded – undo
517 528
         endswitch;
518 529
     }
519 530
 
520
-    if (!empty($post_types))
521
-        return $post_types;
522
-    else
523
-        return array();
524
-}
531
+    if (!empty($post_types)) {
532
+            return $post_types;
533
+    } else {
534
+            return array();
535
+    }
536
+    }
525 537
 
526 538
 /**
527 539
  * Get Custom Post Type info.
@@ -538,9 +550,10 @@  discard block
 block discarded – undo
538 550
     $post_types = stripslashes_deep($post_types);
539 551
     if (!empty($post_types) && $post_type != '') {
540 552
         return $post_types[$post_type];
541
-    } else
542
-        return false;
543
-}
553
+    } else {
554
+            return false;
555
+    }
556
+    }
544 557
 
545 558
 if (!function_exists('geodir_get_taxonomies')) {
546 559
     /**
@@ -564,18 +577,21 @@  discard block
 block discarded – undo
564 577
             $gd_taxonomies = array_keys($taxonomies);
565 578
 
566 579
 
567
-            if ($post_type != '')
568
-                $gd_taxonomies = array();
580
+            if ($post_type != '') {
581
+                            $gd_taxonomies = array();
582
+            }
569 583
 
570 584
             $i = 0;
571 585
             foreach ($taxonomies as $taxonomy => $args) {
572 586
 
573
-                if ($post_type != '' && $args['object_type'] == $post_type)
574
-                    $gd_taxonomies[] = $taxonomy;
587
+                if ($post_type != '' && $args['object_type'] == $post_type) {
588
+                                    $gd_taxonomies[] = $taxonomy;
589
+                }
575 590
 
576 591
                 if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
577
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
578
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
592
+                    if (array_search($taxonomy, $gd_taxonomies) !== false) {
593
+                                            unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
594
+                    }
579 595
                 }
580 596
 
581 597
             }
@@ -630,10 +646,11 @@  discard block
 block discarded – undo
630 646
                 . geodir_utf8_ucfirst($category_obj->name) . '</option>';
631 647
         }
632 648
 
633
-        if ($echo)
634
-            echo $html;
635
-        else
636
-            return $html;
649
+        if ($echo) {
650
+                    echo $html;
651
+        } else {
652
+                    return $html;
653
+        }
637 654
     }
638 655
 }
639 656
 
@@ -667,11 +684,12 @@  discard block
 block discarded – undo
667 684
 
668 685
     }
669 686
 
670
-    if (!empty($listing_slug))
671
-        return $listing_slug;
672
-    else
673
-        return false;
674
-}
687
+    if (!empty($listing_slug)) {
688
+            return $listing_slug;
689
+    } else {
690
+            return false;
691
+    }
692
+    }
675 693
 
676 694
 
677 695
 /**
@@ -702,16 +720,18 @@  discard block
 block discarded – undo
702 720
     if (!empty($taxonomies)) {
703 721
         foreach (geodir_get_posttypes() as $pt) {
704 722
             $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
705
-            if (array_intersect($taxonomies, $object_taxonomies))
706
-                $post_type[] = $pt;
723
+            if (array_intersect($taxonomies, $object_taxonomies)) {
724
+                            $post_type[] = $pt;
725
+            }
707 726
         }
708 727
     }
709 728
 
710
-    if (!empty($post_type))
711
-        return $post_type[0];
712
-    else
713
-        return false;
714
-}
729
+    if (!empty($post_type)) {
730
+            return $post_type[0];
731
+    } else {
732
+            return false;
733
+    }
734
+    }
715 735
 
716 736
 if (!function_exists('geodir_custom_taxonomy_walker')) {
717 737
     /**
@@ -767,18 +787,18 @@  discard block
 block discarded – undo
767 787
                 $checked = '';
768 788
 
769 789
                 if (in_array($cat_term->term_id, $search_terms)) {
770
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
771
-                        $checked = 'selected="selected"';
772
-                    else
773
-                        $checked = 'checked="checked"';
790
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
791
+                                            $checked = 'selected="selected"';
792
+                    } else {
793
+                                            $checked = 'checked="checked"';
794
+                    }
774 795
                 }
775 796
 
776
-                if ($cat_display == 'radio')
777
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
778
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
779
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>';
780
-
781
-                else {
797
+                if ($cat_display == 'radio') {
798
+                                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
799
+                } elseif ($cat_display == 'select' || $cat_display == 'multiselect') {
800
+                                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>';
801
+                } else {
782 802
                     $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
783 803
                 }
784 804
 
@@ -787,8 +807,9 @@  discard block
 block discarded – undo
787 807
 
788 808
             }
789 809
 
790
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
791
-                $out .= '</div>';
810
+            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
811
+                            $out .= '</div>';
812
+            }
792 813
 
793 814
             return $out;
794 815
         }
@@ -814,18 +835,21 @@  discard block
 block discarded – undo
814 835
         global $exclude_cats, $gd_session;
815 836
 
816 837
         $cat_exclude = '';
817
-        if (is_array($exclude_cats) && !empty($exclude_cats))
818
-            $cat_exclude = serialize($exclude_cats);
838
+        if (is_array($exclude_cats) && !empty($exclude_cats)) {
839
+                    $cat_exclude = serialize($exclude_cats);
840
+        }
819 841
 
820 842
         if (isset($_REQUEST['backandedit'])) {
821 843
             $post = (object)$gd_session->get('listing');
822 844
 
823
-            if (!is_array($post->post_category[$cat_taxonomy]))
824
-                $post_category = $post->post_category[$cat_taxonomy];
845
+            if (!is_array($post->post_category[$cat_taxonomy])) {
846
+                            $post_category = $post->post_category[$cat_taxonomy];
847
+            }
825 848
 
826 849
             $post_categories = $post->post_category_str;
827
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
828
-                $post_category_str = $post_categories[$cat_taxonomy];
850
+            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
851
+                            $post_category_str = $post_categories[$cat_taxonomy];
852
+            }
829 853
 
830 854
         } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
831 855
             global $post;
@@ -1016,8 +1040,9 @@  discard block
 block discarded – undo
1016 1040
         if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1017 1041
             $post_cat_str = $post_categories[$cat_taxonomy];
1018 1042
             $post_cat_array = explode("#", $post_cat_str);
1019
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1020
-                $style = "display:none;";
1043
+            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) {
1044
+                            $style = "display:none;";
1045
+            }
1021 1046
         }
1022 1047
         ?>
1023 1048
         <div class="main_cat_list" style=" <?php if (isset($style)) {
@@ -1052,7 +1077,7 @@  discard block
 block discarded – undo
1052 1077
 
1053 1078
         if(is_array( $exclude_cats)){
1054 1079
             $exclude_cats = array_map( 'intval', $exclude_cats );
1055
-        }else{
1080
+        } else{
1056 1081
             $exclude_cats = intval($exclude_cats);
1057 1082
         }
1058 1083
 
@@ -1082,7 +1107,10 @@  discard block
 block discarded – undo
1082 1107
 
1083 1108
             <div class="post_default_category">
1084 1109
                 <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1085
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1110
+                       onchange="update_listing_cat()" <?php if ($default) {
1111
+	echo ' checked="checked" ';
1112
+}
1113
+?>   />
1086 1114
         <span> 
1087 1115
         <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1088 1116
         </span>
@@ -1182,8 +1210,9 @@  discard block
 block discarded – undo
1182 1210
         $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1183 1211
 
1184 1212
         $option_selected = '';
1185
-        if (!$selected)
1186
-            $option_slected = ' selected="selected" ';
1213
+        if (!$selected) {
1214
+                    $option_slected = ' selected="selected" ';
1215
+        }
1187 1216
 
1188 1217
         echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1189 1218
 
@@ -1191,8 +1220,9 @@  discard block
 block discarded – undo
1191 1220
 
1192 1221
         foreach ($cat_terms as $cat_term) {
1193 1222
             $option_selected = '';
1194
-            if ($selected == $cat_term->term_id)
1195
-                $option_selected = ' selected="selected" ';
1223
+            if ($selected == $cat_term->term_id) {
1224
+                            $option_selected = ' selected="selected" ';
1225
+            }
1196 1226
 
1197 1227
             // Count child terms
1198 1228
             $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
@@ -1257,8 +1287,9 @@  discard block
 block discarded – undo
1257 1287
 
1258 1288
     $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1259 1289
 
1260
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1261
-        $listing_slug = 'places';
1290
+    if (!$listing_slug = get_option('geodir_listing_prefix')) {
1291
+            $listing_slug = 'places';
1292
+    }
1262 1293
 
1263 1294
     /**
1264 1295
      * Taxonomies
@@ -1570,8 +1601,9 @@  discard block
 block discarded – undo
1570 1601
                             'city_slug' => $post->city_slug
1571 1602
                         );
1572 1603
 
1573
-                    } else
1574
-                        $post_location = geodir_get_location();
1604
+                    } else {
1605
+                                            $post_location = geodir_get_location();
1606
+                    }
1575 1607
 
1576 1608
 
1577 1609
                 } else {
@@ -1600,8 +1632,9 @@  discard block
 block discarded – undo
1600 1632
                             );
1601 1633
 
1602 1634
                         }
1603
-                    } else
1604
-                        $post_location = geodir_get_location();
1635
+                    } else {
1636
+                                            $post_location = geodir_get_location();
1637
+                    }
1605 1638
                 }
1606 1639
 
1607 1640
 
@@ -1641,16 +1674,17 @@  discard block
 block discarded – undo
1641 1674
 
1642 1675
                     if(isset($_POST['post_default_category']) && $_POST['post_default_category']){
1643 1676
                         $post_terms = absint($_POST['post_default_category']);
1644
-                    }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]){
1677
+                    } elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]){
1645 1678
                         $post_terms = explode(",", trim($_POST['post_category'][$taxonomies], ","));
1646 1679
                         $post_terms = absint($post_terms[0]);
1647
-                    }elseif (isset($post->{$taxonomies})) {
1680
+                    } elseif (isset($post->{$taxonomies})) {
1648 1681
                         $post_terms = explode(",", trim($post->{$taxonomies}, ","));
1649 1682
                         $post_terms = $post_terms[0];
1650 1683
                     }
1651 1684
 
1652
-                    if (!$post_terms)
1653
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1685
+                    if (!$post_terms) {
1686
+                                            $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1687
+                    }
1654 1688
 
1655 1689
                     if (!$post_terms) {
1656 1690
                         $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
@@ -1664,8 +1698,9 @@  discard block
 block discarded – undo
1664 1698
 
1665 1699
                 $term = get_term_by('id', $post_terms, $taxonomies);
1666 1700
 
1667
-                if (!empty($term))
1668
-                    $term_request = $term->slug;
1701
+                if (!empty($term)) {
1702
+                                    $term_request = $term->slug;
1703
+                }
1669 1704
                 //$term_request = $term->slug.'/';
1670 1705
             }
1671 1706
 
@@ -1680,9 +1715,13 @@  discard block
 block discarded – undo
1680 1715
                 $request_term .= $term_request;
1681 1716
 
1682 1717
             } else {
1683
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1718
+                if (isset($location_request) && $location_request != '') {
1719
+                	$request_term = $location_request;
1720
+                }
1684 1721
 
1685
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1722
+                if (isset($term_request) && $term_request != '') {
1723
+                	$request_term .= $term_request;
1724
+                }
1686 1725
             }
1687 1726
             $request_term = trim($request_term, '/');
1688 1727
             
@@ -1691,10 +1730,11 @@  discard block
 block discarded – undo
1691 1730
                 $post_link = str_replace('%gd_taxonomy%/', '', $post_link);
1692 1731
             }
1693 1732
             
1694
-            if (!empty($request_term))
1695
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1696
-            else
1697
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1733
+            if (!empty($request_term)) {
1734
+                            $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1735
+            } else {
1736
+                            $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1737
+            }
1698 1738
             //echo $post_link ;
1699 1739
         }
1700 1740
         // temp cache the permalink
@@ -1886,11 +1926,12 @@  discard block
 block discarded – undo
1886 1926
     
1887 1927
     $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name;
1888 1928
     
1889
-    if ($echo)
1890
-        echo $label;
1891
-    else
1892
-        return $label;
1893
-}
1929
+    if ($echo) {
1930
+            echo $label;
1931
+    } else {
1932
+            return $label;
1933
+    }
1934
+    }
1894 1935
 
1895 1936
 /**
1896 1937
  * Print or Get post type plural label.
@@ -1906,18 +1947,20 @@  discard block
 block discarded – undo
1906 1947
 function get_post_type_plural_label($post_type, $echo = false, $translate = false) {
1907 1948
     $all_postypes = geodir_get_posttypes();
1908 1949
 
1909
-    if (!in_array($post_type, $all_postypes))
1910
-        return false;
1950
+    if (!in_array($post_type, $all_postypes)) {
1951
+            return false;
1952
+    }
1911 1953
 
1912 1954
     $obj_post_type = get_post_type_object($post_type);
1913 1955
     
1914 1956
     $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name;
1915 1957
     
1916
-    if ($echo)
1917
-        echo $label;
1918
-    else
1919
-        return $label;
1920
-}
1958
+    if ($echo) {
1959
+            echo $label;
1960
+    } else {
1961
+            return $label;
1962
+    }
1963
+    }
1921 1964
 
1922 1965
 /**
1923 1966
  * Checks whether a term exists or not.
@@ -1940,19 +1983,22 @@  discard block
 block discarded – undo
1940 1983
     $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1941 1984
 
1942 1985
     if (is_int($term)) {
1943
-        if (0 == $term)
1944
-            return 0;
1986
+        if (0 == $term) {
1987
+                    return 0;
1988
+        }
1945 1989
         $where = 't.term_id = %d';
1946
-        if (!empty($taxonomy))
1947
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1948
-        else
1949
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1990
+        if (!empty($taxonomy)) {
1991
+                    return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1992
+        } else {
1993
+                    return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1994
+        }
1950 1995
     }
1951 1996
 
1952 1997
     $term = trim(wp_unslash($term));
1953 1998
 
1954
-    if ('' === $slug = sanitize_title($term))
1955
-        return 0;
1999
+    if ('' === $slug = sanitize_title($term)) {
2000
+            return 0;
2001
+    }
1956 2002
 
1957 2003
     $where = 't.slug = %s';
1958 2004
 
@@ -1969,14 +2015,16 @@  discard block
 block discarded – undo
1969 2015
         $where_fields[] = $taxonomy;
1970 2016
 
1971 2017
 
1972
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1973
-            return $result;
2018
+        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) {
2019
+                    return $result;
2020
+        }
1974 2021
 
1975 2022
         return false;
1976 2023
     }
1977 2024
 
1978
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1979
-        return $result;
2025
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) {
2026
+            return $result;
2027
+    }
1980 2028
 
1981 2029
     return false;
1982 2030
 }
Please login to merge, or discard this patch.