Test Failed
Pull Request — master (#283)
by Kiran
07:36
created
geodirectory-functions/custom_fields_input_functions.php 3 patches
Braces   +191 added lines, -68 removed lines patch added patch discarded remove patch
@@ -86,26 +86,31 @@  discard block
 block discarded – undo
86 86
         $value = geodir_get_cf_value($cf);
87 87
         $type = $cf['type'];
88 88
         //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
89
+        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91 90
 
92 91
         //validation
93 92
         if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94 93
             $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
94
+        } else{$validation='';}
96 95
 
97 96
         // validation message
98 97
         if(isset($cf['validation_msg']) && $cf['validation_msg']){
99 98
             $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
99
+        } else{$validation_msg='';}
101 100
         ?>
102 101
 
103 102
         <div id="<?php echo $cf['name'];?>_row"
104
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
103
+             class="<?php if ($cf['is_required']) {
104
+	echo 'required_field';
105
+}
106
+?> geodir_form_row clearfix gd-fieldset-details">
105 107
             <label>
106 108
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107 109
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
110
+                <?php if ($cf['is_required']) {
111
+	echo '<span>*</span>';
112
+}
113
+?>
109 114
             </label>
110 115
             <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
111 116
                    value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
@@ -160,11 +165,17 @@  discard block
 block discarded – undo
160 165
         }?>
161 166
 
162 167
         <div id="<?php echo $cf['name'];?>_row"
163
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
168
+             class="<?php if ($cf['is_required']) {
169
+	echo 'required_field';
170
+}
171
+?> geodir_form_row clearfix gd-fieldset-details">
164 172
             <label>
165 173
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166 174
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
175
+                <?php if ($cf['is_required']) {
176
+	echo '<span>*</span>';
177
+}
178
+?>
168 179
             </label>
169 180
             <input field_type="<?php echo $cf['type'];?>" name="<?php  $cf['name'];?>" id="<?php echo $cf['name'];?>"
170 181
                    value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
@@ -220,11 +231,17 @@  discard block
 block discarded – undo
220 231
         }?>
221 232
 
222 233
         <div id="<?php echo $cf['name'];?>_row"
223
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
234
+             class="<?php if ($cf['is_required']) {
235
+	echo 'required_field';
236
+}
237
+?> geodir_form_row clearfix gd-fieldset-details">
224 238
             <label>
225 239
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226 240
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
241
+                <?php if ($cf['is_required']) {
242
+	echo '<span>*</span>';
243
+}
244
+?>
228 245
             </label>
229 246
             <input field_type="<?php echo $cf['type'];?>" name="<?php  $cf['name'];?>" id="<?php echo $cf['name'];?>"
230 247
                    value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
@@ -280,11 +297,17 @@  discard block
 block discarded – undo
280 297
         }?>
281 298
 
282 299
         <div id="<?php echo $cf['name'];?>_row"
283
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
300
+             class="<?php if ($cf['is_required']) {
301
+	echo 'required_field';
302
+}
303
+?> geodir_form_row clearfix gd-fieldset-details">
284 304
             <label>
285 305
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286 306
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
307
+                <?php if ($cf['is_required']) {
308
+	echo '<span>*</span>';
309
+}
310
+?>
288 311
             </label>
289 312
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
290 313
                    value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
@@ -339,11 +362,17 @@  discard block
 block discarded – undo
339 362
 
340 363
         ?>
341 364
         <div id="<?php echo $cf['name'];?>_row"
342
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
365
+             class="<?php if ($cf['is_required']) {
366
+	echo 'required_field';
367
+}
368
+?> geodir_form_row clearfix gd-fieldset-details">
343 369
             <label>
344 370
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345 371
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
372
+                <?php if ($cf['is_required']) {
373
+	echo '<span>*</span>';
374
+}
375
+?>
347 376
             </label>
348 377
             <?php if ($cf['option_values']) {
349 378
                 $option_values = geodir_string_values_to_options($cf['option_values'], true);
@@ -410,11 +439,17 @@  discard block
 block discarded – undo
410 439
         }?>
411 440
 
412 441
         <div id="<?php echo $cf['name'];?>_row"
413
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
442
+             class="<?php if ($cf['is_required']) {
443
+	echo 'required_field';
444
+}
445
+?> geodir_form_row clearfix gd-fieldset-details">
414 446
             <label>
415 447
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
416 448
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
417
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
449
+                <?php if ($cf['is_required']) {
450
+	echo '<span>*</span>';
451
+}
452
+?>
418 453
             </label>
419 454
             <?php if ($value != '1') {
420 455
                 $value = '0';
@@ -474,11 +509,17 @@  discard block
 block discarded – undo
474 509
         ?>
475 510
 
476 511
         <div id="<?php echo $cf['name'];?>_row"
477
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
512
+             class="<?php if ($cf['is_required']) {
513
+	echo 'required_field';
514
+}
515
+?> geodir_form_row clearfix gd-fieldset-details">
478 516
             <label>
479 517
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
480 518
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
481
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
519
+                <?php if ($cf['is_required']) {
520
+	echo '<span>*</span>';
521
+}
522
+?>
482 523
             </label><?php
483 524
 
484 525
 
@@ -546,11 +587,17 @@  discard block
 block discarded – undo
546 587
 
547 588
         ?>
548 589
         <div id="<?php echo $cf['name'];?>_row"
549
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
590
+             class="<?php if ($cf['is_required']) {
591
+	echo 'required_field';
592
+}
593
+?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
550 594
             <label>
551 595
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
552 596
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
553
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
597
+                <?php if ($cf['is_required']) {
598
+	echo '<span>*</span>';
599
+}
600
+?>
554 601
             </label>
555 602
             <?php
556 603
             $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
@@ -627,11 +674,17 @@  discard block
 block discarded – undo
627 674
         }
628 675
         ?>
629 676
         <div id="<?php echo $cf['name']; ?>_row"
630
-             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
677
+             class="<?php if ($cf['is_required']) {
678
+	echo 'required_field';
679
+}
680
+?> geodir_form_row clearfix gd-fieldset-details">
631 681
             <label>
632 682
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
633 683
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
634
-                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
684
+                <?php if ($cf['is_required']) {
685
+	echo '<span>*</span>';
686
+}
687
+?>
635 688
             </label>
636 689
             <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/>
637 690
             <?php if ($multi_display == 'select') { ?>
@@ -738,11 +791,17 @@  discard block
 block discarded – undo
738 791
         ?>
739 792
 
740 793
         <div id="<?php echo $cf['name']; ?>_row"
741
-             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
794
+             class="<?php if ($cf['is_required']) {
795
+	echo 'required_field';
796
+}
797
+?> geodir_form_row clearfix gd-fieldset-details">
742 798
             <label>
743 799
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
744 800
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
745
-                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
801
+                <?php if ($cf['is_required']) {
802
+	echo '<span>*</span>';
803
+}
804
+?>
746 805
             </label>
747 806
 
748 807
             <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
@@ -802,8 +861,9 @@  discard block
 block discarded – undo
802 861
         $extra_fields = unserialize($cf['extra_fields']);
803 862
         $name = $cf['name'];
804 863
 
805
-        if ($extra_fields['date_format'] == '')
806
-            $extra_fields['date_format'] = 'yy-mm-dd';
864
+        if ($extra_fields['date_format'] == '') {
865
+                    $extra_fields['date_format'] = 'yy-mm-dd';
866
+        }
807 867
 
808 868
         $date_format = $extra_fields['date_format'];
809 869
         $jquery_date_format  = $date_format;
@@ -817,7 +877,7 @@  discard block
 block discarded – undo
817 877
             $replace = array('d','j','l','m','n','F','Y');//PHP date format
818 878
 
819 879
             $date_format = str_replace($search, $replace, $date_format);
820
-        }else{
880
+        } else{
821 881
             $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
822 882
         }
823 883
 
@@ -851,12 +911,18 @@  discard block
 block discarded – undo
851 911
 
852 912
         </script>
853 913
         <div id="<?php echo $name;?>_row"
854
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
914
+             class="<?php if ($cf['is_required']) {
915
+	echo 'required_field';
916
+}
917
+?> geodir_form_row clearfix gd-fieldset-details">
855 918
             <label>
856 919
 
857 920
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
858 921
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
859
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
922
+                <?php if ($cf['is_required']) {
923
+	echo '<span>*</span>';
924
+}
925
+?>
860 926
             </label>
861 927
 
862 928
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -910,8 +976,9 @@  discard block
 block discarded – undo
910 976
 
911 977
         $name = $cf['name'];
912 978
 
913
-        if ($value != '')
914
-            $value = date('H:i', strtotime($value));
979
+        if ($value != '') {
980
+                    $value = date('H:i', strtotime($value));
981
+        }
915 982
         ?>
916 983
         <script type="text/javascript">
917 984
             jQuery(document).ready(function () {
@@ -924,12 +991,18 @@  discard block
 block discarded – undo
924 991
             });
925 992
         </script>
926 993
         <div id="<?php echo $name;?>_row"
927
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
994
+             class="<?php if ($cf['is_required']) {
995
+	echo 'required_field';
996
+}
997
+?> geodir_form_row clearfix gd-fieldset-details">
928 998
             <label>
929 999
 
930 1000
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
931 1001
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
932
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
1002
+                <?php if ($cf['is_required']) {
1003
+	echo '<span>*</span>';
1004
+}
1005
+?>
933 1006
             </label>
934 1007
             <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
935 1008
                    id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
@@ -1021,17 +1094,27 @@  discard block
 block discarded – undo
1021 1094
         }
1022 1095
 
1023 1096
         $location = geodir_get_default_location();
1024
-        if (empty($city)) $city = isset($location->city) ? $location->city : '';
1025
-        if (empty($region)) $region = isset($location->region) ? $location->region : '';
1026
-        if (empty($country)) $country = isset($location->country) ? $location->country : '';
1097
+        if (empty($city)) {
1098
+        	$city = isset($location->city) ? $location->city : '';
1099
+        }
1100
+        if (empty($region)) {
1101
+        	$region = isset($location->region) ? $location->region : '';
1102
+        }
1103
+        if (empty($country)) {
1104
+        	$country = isset($location->country) ? $location->country : '';
1105
+        }
1027 1106
 
1028 1107
         $lat_lng_blank = false;
1029 1108
         if (empty($lat) && empty($lng)) {
1030 1109
             $lat_lng_blank = true;
1031 1110
         }
1032 1111
 
1033
-        if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1034
-        if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1112
+        if (empty($lat)) {
1113
+        	$lat = isset($location->city_latitude) ? $location->city_latitude : '';
1114
+        }
1115
+        if (empty($lng)) {
1116
+        	$lng = isset($location->city_longitude) ? $location->city_longitude : '';
1117
+        }
1035 1118
 
1036 1119
         /**
1037 1120
          * Filter the default latitude.
@@ -1055,10 +1138,16 @@  discard block
 block discarded – undo
1055 1138
         ?>
1056 1139
 
1057 1140
         <div id="geodir_<?php echo $prefix . 'address';?>_row"
1058
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1141
+             class="<?php if ($is_required) {
1142
+	echo 'required_field';
1143
+}
1144
+?> geodir_form_row clearfix gd-fieldset-details">
1059 1145
             <label>
1060 1146
                 <?php _e($address_title, 'geodirectory'); ?>
1061
-                <?php if ($is_required) echo '<span>*</span>';?>
1147
+                <?php if ($is_required) {
1148
+	echo '<span>*</span>';
1149
+}
1150
+?>
1062 1151
             </label>
1063 1152
             <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"
1064 1153
                    id="<?php echo $prefix . 'address';?>" class="geodir_textfield"
@@ -1119,10 +1208,16 @@  discard block
 block discarded – undo
1119 1208
             /* show lat lng */
1120 1209
             $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1121 1210
             <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1122
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1211
+                 class="<?php if ($is_required) {
1212
+	echo 'required_field';
1213
+}
1214
+?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1123 1215
                 <label>
1124 1216
                     <?php echo PLACE_ADDRESS_LAT; ?>
1125
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1217
+                    <?php if ($is_required) {
1218
+	echo '<span>*</span>';
1219
+}
1220
+?>
1126 1221
                 </label>
1127 1222
                 <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1128 1223
                        id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
@@ -1134,10 +1229,16 @@  discard block
 block discarded – undo
1134 1229
             </div>
1135 1230
 
1136 1231
             <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1137
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1232
+                 class="<?php if ($is_required) {
1233
+	echo 'required_field';
1234
+}
1235
+?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1138 1236
                 <label>
1139 1237
                     <?php echo PLACE_ADDRESS_LNG; ?>
1140
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1238
+                    <?php if ($is_required) {
1239
+	echo '<span>*</span>';
1240
+}
1241
+?>
1141 1242
                 </label>
1142 1243
                 <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1143 1244
                        id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
@@ -1241,11 +1342,17 @@  discard block
 block discarded – undo
1241 1342
             $value = '';
1242 1343
         } ?>
1243 1344
         <div id="<?php echo $name;?>_row"
1244
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1345
+             class="<?php if ($is_required) {
1346
+	echo 'required_field';
1347
+}
1348
+?> geodir_form_row clearfix gd-fieldset-details">
1245 1349
             <label>
1246 1350
                 <?php $site_title = __($site_title, 'geodirectory');
1247 1351
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1248
-                <?php if ($is_required) echo '<span>*</span>';?>
1352
+                <?php if ($is_required) {
1353
+	echo '<span>*</span>';
1354
+}
1355
+?>
1249 1356
             </label>
1250 1357
 
1251 1358
             <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
@@ -1279,8 +1386,9 @@  discard block
 block discarded – undo
1279 1386
                     $post_cat = implode(",", $post_cat[$name]);
1280 1387
 
1281 1388
                 } else {
1282
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1283
-                        $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1389
+                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1390
+                                            $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1391
+                    }
1284 1392
                 }
1285 1393
 
1286 1394
 
@@ -1318,21 +1426,24 @@  discard block
 block discarded – undo
1318 1426
 
1319 1427
                         $cat_display == '';
1320 1428
                         $multiple = '';
1321
-                        if ($cat_display == 'multiselect')
1322
-                            $multiple = 'multiple="multiple"';
1429
+                        if ($cat_display == 'multiselect') {
1430
+                                                    $multiple = 'multiple="multiple"';
1431
+                        }
1323 1432
 
1324 1433
                         echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1325 1434
 
1326 1435
 
1327
-                        if ($cat_display == 'select')
1328
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1436
+                        if ($cat_display == 'select') {
1437
+                                                    echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1438
+                        }
1329 1439
 
1330 1440
                     }
1331 1441
 
1332 1442
                     echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1333 1443
 
1334
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
1335
-                        echo '</select>';
1444
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
1445
+                                            echo '</select>';
1446
+                    }
1336 1447
 
1337 1448
                 } else {
1338 1449
 
@@ -1404,18 +1515,23 @@  discard block
 block discarded – undo
1404 1515
 
1405 1516
             $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1406 1517
 
1407
-        } else
1408
-            $file_value = '';
1518
+        } else {
1519
+                    $file_value = '';
1520
+        }
1409 1521
 
1410
-        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1411
-            $file_multiple = true; // allow multiple files upload
1412
-        else
1413
-            $file_multiple = false;
1522
+        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) {
1523
+                    $file_multiple = true;
1524
+        }
1525
+        // allow multiple files upload
1526
+        else {
1527
+                    $file_multiple = false;
1528
+        }
1414 1529
 
1415
-        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1416
-            $file_image_limit = $extra_fields['image_limit'];
1417
-        else
1418
-            $file_image_limit = 1;
1530
+        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) {
1531
+                    $file_image_limit = $extra_fields['image_limit'];
1532
+        } else {
1533
+                    $file_image_limit = 1;
1534
+        }
1419 1535
 
1420 1536
         $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1421 1537
 
@@ -1423,8 +1539,9 @@  discard block
 block discarded – undo
1423 1539
 
1424 1540
         if (!empty($file_value)) {
1425 1541
             $curImages = explode(',', $file_value);
1426
-            if (!empty($curImages))
1427
-                $file_totImg = count($curImages);
1542
+            if (!empty($curImages)) {
1543
+                            $file_totImg = count($curImages);
1544
+            }
1428 1545
         }
1429 1546
 
1430 1547
         $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
@@ -1439,12 +1556,18 @@  discard block
 block discarded – undo
1439 1556
         ?>
1440 1557
 
1441 1558
         <div id="<?php echo $name;?>_row"
1442
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1559
+             class="<?php if ($is_required) {
1560
+	echo 'required_field';
1561
+}
1562
+?> geodir_form_row clearfix gd-fieldset-details">
1443 1563
 
1444 1564
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1445 1565
                 <label
1446 1566
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1447
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1567
+                    echo $site_title; ?><?php if ($is_required) {
1568
+                    	echo '<span>*</span>';
1569
+                    }
1570
+                    ?></label>
1448 1571
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1449 1572
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1450 1573
                        value="<?php echo esc_attr($file_value); ?>"/>
Please login to merge, or discard this patch.
Spacing   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
  *
18 18
  * @return string The html to output for the custom field.
19 19
  */
20
-function geodir_cfi_fieldset($html,$cf){
20
+function geodir_cfi_fieldset($html, $cf) {
21 21
 
22 22
     $html_var = $cf['htmlvar_name'];
23 23
 
24 24
     // Check if there is a custom field specific filter.
25
-    if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
25
+    if (has_filter("geodir_custom_field_input_fieldset_{$html_var}")) {
26 26
         /**
27 27
          * Filter the fieldset html by individual custom field.
28 28
          *
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
          * @param array $cf The custom field array.
31 31
          * @since 1.6.6
32 32
          */
33
-        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
33
+        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}", $html, $cf);
34 34
     }
35 35
 
36 36
     // If no html then we run the standard output.
37
-    if(empty($html)) {
37
+    if (empty($html)) {
38 38
 
39 39
         ob_start(); // Start  buffering;
40 40
         ?>
41 41
         <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row"
42 42
             gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo $cf['site_title']; ?>
43
-            <?php if ( $cf['desc'] != '' ) {
44
-                echo '<small>( ' . $cf['desc'] . ' )</small>';
43
+            <?php if ($cf['desc'] != '') {
44
+                echo '<small>( '.$cf['desc'].' )</small>';
45 45
             } ?></h5>
46 46
         <?php
47 47
         $html = ob_get_clean();
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     return $html;
51 51
 }
52
-add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2);
52
+add_filter('geodir_custom_field_input_fieldset', 'geodir_cfi_fieldset', 10, 2);
53 53
 
54 54
 
55 55
 
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @return string The html to output for the custom field.
64 64
  */
65
-function geodir_cfi_text($html,$cf){
65
+function geodir_cfi_text($html, $cf) {
66 66
 
67 67
     $html_var = $cf['htmlvar_name'];
68 68
 
69 69
     // Check if there is a custom field specific filter.
70
-    if(has_filter("geodir_custom_field_input_text_{$html_var}")){
70
+    if (has_filter("geodir_custom_field_input_text_{$html_var}")) {
71 71
         /**
72 72
          * Filter the text html by individual custom field.
73 73
          *
@@ -75,41 +75,41 @@  discard block
 block discarded – undo
75 75
          * @param array $cf The custom field array.
76 76
          * @since 1.6.6
77 77
          */
78
-        $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
78
+        $html = apply_filters("geodir_custom_field_input_text_{$html_var}", $html, $cf);
79 79
     }
80 80
 
81 81
     // If no html then we run the standard output.
82
-    if(empty($html)) {
82
+    if (empty($html)) {
83 83
 
84 84
         ob_start(); // Start  buffering;
85 85
 
86 86
         $value = geodir_get_cf_value($cf);
87 87
         $type = $cf['type'];
88 88
         //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
89
+        if (isset($cf['data_type']) && $cf['data_type'] == 'INT') {$type = 'number'; }
90
+        elseif (isset($cf['data_type']) && $cf['data_type'] == 'FLOAT') {$type = 'float'; }
91 91
 
92 92
         //validation
93
-        if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
93
+        if (isset($cf['validation_pattern']) && $cf['validation_pattern']) {
94 94
             $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
95
+        } else {$validation = ''; }
96 96
 
97 97
         // validation message
98
-        if(isset($cf['validation_msg']) && $cf['validation_msg']){
98
+        if (isset($cf['validation_msg']) && $cf['validation_msg']) {
99 99
             $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
100
+        } else {$validation_msg = ''; }
101 101
         ?>
102 102
 
103
-        <div id="<?php echo $cf['name'];?>_row"
104
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
103
+        <div id="<?php echo $cf['name']; ?>_row"
104
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
105 105
             <label>
106 106
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107 107
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
108
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
109 109
             </label>
110
-            <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
111
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
112
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
110
+            <input field_type="<?php echo $type; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
111
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="<?php echo $type; ?>" class="geodir_textfield" <?php echo $validation; echo $validation_msg; ?> />
112
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
113 113
             <?php if ($cf['is_required']) { ?>
114 114
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
115 115
             <?php } ?>
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
     return $html;
123 123
 }
124
-add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2);
124
+add_filter('geodir_custom_field_input_text', 'geodir_cfi_text', 10, 2);
125 125
 
126 126
 
127 127
 /**
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return string The html to output for the custom field.
135 135
  */
136
-function geodir_cfi_email($html,$cf){
136
+function geodir_cfi_email($html, $cf) {
137 137
 
138 138
     $html_var = $cf['htmlvar_name'];
139 139
 
140 140
     // Check if there is a custom field specific filter.
141
-    if(has_filter("geodir_custom_field_input_email_{$html_var}")){
141
+    if (has_filter("geodir_custom_field_input_email_{$html_var}")) {
142 142
         /**
143 143
          * Filter the email html by individual custom field.
144 144
          *
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
          * @param array $cf The custom field array.
147 147
          * @since 1.6.6
148 148
          */
149
-        $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
149
+        $html = apply_filters("geodir_custom_field_input_email_{$html_var}", $html, $cf);
150 150
     }
151 151
 
152 152
     // If no html then we run the standard output.
153
-    if(empty($html)) {
153
+    if (empty($html)) {
154 154
 
155 155
         ob_start(); // Start  buffering;
156 156
         $value = geodir_get_cf_value($cf);
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
             $value = '';
160 160
         }?>
161 161
 
162
-        <div id="<?php echo $cf['name'];?>_row"
163
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
162
+        <div id="<?php echo $cf['name']; ?>_row"
163
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
164 164
             <label>
165 165
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166 166
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
167
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
168 168
             </label>
169
-            <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
170
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
171
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
169
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php  echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
170
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="email" class="geodir_textfield"/>
171
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
172 172
             <?php if ($cf['is_required']) { ?>
173 173
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
174 174
             <?php } ?>
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
     return $html;
182 182
 }
183
-add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2);
183
+add_filter('geodir_custom_field_input_email', 'geodir_cfi_email', 10, 2);
184 184
 
185 185
 
186 186
 
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @return string The html to output for the custom field.
195 195
  */
196
-function geodir_cfi_phone($html,$cf){
196
+function geodir_cfi_phone($html, $cf) {
197 197
 
198 198
     $html_var = $cf['htmlvar_name'];
199 199
 
200 200
     // Check if there is a custom field specific filter.
201
-    if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
201
+    if (has_filter("geodir_custom_field_input_phone_{$html_var}")) {
202 202
         /**
203 203
          * Filter the phone html by individual custom field.
204 204
          *
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
          * @param array $cf The custom field array.
207 207
          * @since 1.6.6
208 208
          */
209
-        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
209
+        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}", $html, $cf);
210 210
     }
211 211
 
212 212
     // If no html then we run the standard output.
213
-    if(empty($html)) {
213
+    if (empty($html)) {
214 214
 
215 215
         ob_start(); // Start  buffering;
216 216
         $value = geodir_get_cf_value($cf);
@@ -219,16 +219,16 @@  discard block
 block discarded – undo
219 219
             $value = '';
220 220
         }?>
221 221
 
222
-        <div id="<?php echo $cf['name'];?>_row"
223
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
222
+        <div id="<?php echo $cf['name']; ?>_row"
223
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
224 224
             <label>
225 225
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226 226
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
227
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
228 228
             </label>
229
-            <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
230
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
231
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
229
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php  echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
230
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="tel" class="geodir_textfield"/>
231
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
232 232
             <?php if ($cf['is_required']) { ?>
233 233
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
234 234
             <?php } ?>
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
     return $html;
242 242
 }
243
-add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2);
243
+add_filter('geodir_custom_field_input_phone', 'geodir_cfi_phone', 10, 2);
244 244
 
245 245
 
246 246
 
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return string The html to output for the custom field.
255 255
  */
256
-function geodir_cfi_url($html,$cf){
256
+function geodir_cfi_url($html, $cf) {
257 257
 
258 258
     $html_var = $cf['htmlvar_name'];
259 259
 
260 260
     // Check if there is a custom field specific filter.
261
-    if(has_filter("geodir_custom_field_input_url_{$html_var}")){
261
+    if (has_filter("geodir_custom_field_input_url_{$html_var}")) {
262 262
         /**
263 263
          * Filter the url html by individual custom field.
264 264
          *
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
          * @param array $cf The custom field array.
267 267
          * @since 1.6.6
268 268
          */
269
-        $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
269
+        $html = apply_filters("geodir_custom_field_input_url_{$html_var}", $html, $cf);
270 270
     }
271 271
 
272 272
     // If no html then we run the standard output.
273
-    if(empty($html)) {
273
+    if (empty($html)) {
274 274
 
275 275
         ob_start(); // Start  buffering;
276 276
         $value = geodir_get_cf_value($cf);
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
             $value = '';
280 280
         }?>
281 281
 
282
-        <div id="<?php echo $cf['name'];?>_row"
283
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
282
+        <div id="<?php echo $cf['name']; ?>_row"
283
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
284 284
             <label>
285 285
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286 286
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
287
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
288 288
             </label>
289
-            <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
290
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
289
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
290
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="url" class="geodir_textfield"
291 291
                    oninvalid="setCustomValidity('<?php _e('Please enter a valid URL including http://', 'geodirectory'); ?>')"
292 292
                    onchange="try{setCustomValidity('')}catch(e){}"
293 293
             />
294
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
294
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
295 295
             <?php if ($cf['is_required']) { ?>
296 296
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
297 297
             <?php } ?>
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
     return $html;
305 305
 }
306
-add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2);
306
+add_filter('geodir_custom_field_input_url', 'geodir_cfi_url', 10, 2);
307 307
 
308 308
 
309 309
 /**
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
  *
316 316
  * @return string The html to output for the custom field.
317 317
  */
318
-function geodir_cfi_radio($html,$cf){
318
+function geodir_cfi_radio($html, $cf) {
319 319
 
320 320
     $html_var = $cf['htmlvar_name'];
321 321
 
322 322
     // Check if there is a custom field specific filter.
323
-    if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
323
+    if (has_filter("geodir_custom_field_input_radio_{$html_var}")) {
324 324
         /**
325 325
          * Filter the radio html by individual custom field.
326 326
          *
@@ -328,22 +328,22 @@  discard block
 block discarded – undo
328 328
          * @param array $cf The custom field array.
329 329
          * @since 1.6.6
330 330
          */
331
-        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
331
+        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}", $html, $cf);
332 332
     }
333 333
 
334 334
     // If no html then we run the standard output.
335
-    if(empty($html)) {
335
+    if (empty($html)) {
336 336
 
337 337
         ob_start(); // Start  buffering;
338 338
         $value = geodir_get_cf_value($cf);
339 339
 
340 340
         ?>
341
-        <div id="<?php echo $cf['name'];?>_row"
342
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
341
+        <div id="<?php echo $cf['name']; ?>_row"
342
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
343 343
             <label>
344 344
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345 345
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
346
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
347 347
             </label>
348 348
             <?php if ($cf['option_values']) {
349 349
                 $option_values = geodir_string_values_to_options($cf['option_values'], true);
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
                     foreach ($option_values as $option_value) {
353 353
                         if (empty($option_value['optgroup'])) {
354 354
                             ?>
355
-                            <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span>
355
+                            <span class="gd-radios"><input name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" <?php checked($value, $option_value['value']); ?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="radio" /><?php echo $option_value['label']; ?></span>
356 356
                             <?php
357 357
                         }
358 358
                     }
359 359
                 }
360 360
             }
361 361
             ?>
362
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
362
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
363 363
             <?php if ($cf['is_required']) { ?>
364 364
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
365 365
             <?php } ?>
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 
372 372
     return $html;
373 373
 }
374
-add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2);
374
+add_filter('geodir_custom_field_input_radio', 'geodir_cfi_radio', 10, 2);
375 375
 
376 376
 
377 377
 /**
@@ -383,12 +383,12 @@  discard block
 block discarded – undo
383 383
  *
384 384
  * @return string The html to output for the custom field.
385 385
  */
386
-function geodir_cfi_checkbox($html,$cf){
386
+function geodir_cfi_checkbox($html, $cf) {
387 387
 
388 388
     $html_var = $cf['htmlvar_name'];
389 389
 
390 390
     // Check if there is a custom field specific filter.
391
-    if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
391
+    if (has_filter("geodir_custom_field_input_checkbox_{$html_var}")) {
392 392
         /**
393 393
          * Filter the checkbox html by individual custom field.
394 394
          *
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
          * @param array $cf The custom field array.
397 397
          * @since 1.6.6
398 398
          */
399
-        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
399
+        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}", $html, $cf);
400 400
     }
401 401
 
402 402
     // If no html then we run the standard output.
403
-    if(empty($html)) {
403
+    if (empty($html)) {
404 404
 
405 405
         ob_start(); // Start  buffering;
406 406
         $value = geodir_get_cf_value($cf);
@@ -409,22 +409,22 @@  discard block
 block discarded – undo
409 409
             $value = '';
410 410
         }?>
411 411
 
412
-        <div id="<?php echo $cf['name'];?>_row"
413
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
412
+        <div id="<?php echo $cf['name']; ?>_row"
413
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
414 414
             <label>
415 415
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
416 416
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
417
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
417
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
418 418
             </label>
419 419
             <?php if ($value != '1') {
420 420
                 $value = '0';
421 421
             }?>
422
-            <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/>
422
+            <input type="hidden" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" value="<?php echo esc_attr($value); ?>"/>
423 423
             <input  <?php if ($value == '1') {
424 424
                 echo 'checked="checked"';
425
-            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
426
-                 onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/>
427
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
425
+            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="checkbox"
426
+                 onchange="if(this.checked){jQuery('#<?php echo $cf['name']; ?>').val('1');} else{ jQuery('#<?php echo $cf['name']; ?>').val('0');}"/>
427
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
428 428
             <?php if ($cf['is_required']) { ?>
429 429
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
430 430
             <?php } ?>
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 
437 437
     return $html;
438 438
 }
439
-add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2);
439
+add_filter('geodir_custom_field_input_checkbox', 'geodir_cfi_checkbox', 10, 2);
440 440
 
441 441
 
442 442
 /**
@@ -448,12 +448,12 @@  discard block
 block discarded – undo
448 448
  *
449 449
  * @return string The html to output for the custom field.
450 450
  */
451
-function geodir_cfi_textarea($html,$cf){
451
+function geodir_cfi_textarea($html, $cf) {
452 452
 
453 453
     $html_var = $cf['htmlvar_name'];
454 454
 
455 455
     // Check if there is a custom field specific filter.
456
-    if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
456
+    if (has_filter("geodir_custom_field_input_textarea_{$html_var}")) {
457 457
         /**
458 458
          * Filter the textarea html by individual custom field.
459 459
          *
@@ -461,11 +461,11 @@  discard block
 block discarded – undo
461 461
          * @param array $cf The custom field array.
462 462
          * @since 1.6.6
463 463
          */
464
-        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
464
+        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}", $html, $cf);
465 465
     }
466 466
 
467 467
     // If no html then we run the standard output.
468
-    if(empty($html)) {
468
+    if (empty($html)) {
469 469
 
470 470
         ob_start(); // Start  buffering;
471 471
         $value = geodir_get_cf_value($cf);
@@ -473,32 +473,32 @@  discard block
 block discarded – undo
473 473
         $extra_fields = unserialize($cf['extra_fields']);
474 474
         ?>
475 475
 
476
-        <div id="<?php echo $cf['name'];?>_row"
477
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
476
+        <div id="<?php echo $cf['name']; ?>_row"
477
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
478 478
             <label>
479 479
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
480 480
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
481
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
481
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
482 482
             </label><?php
483 483
 
484 484
 
485 485
             if (is_array($extra_fields) && in_array('1', $extra_fields)) {
486 486
 
487
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
487
+                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
488 488
 
489
-            <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor">
489
+            <div class="editor" field_id="<?php echo $cf['name']; ?>" field_type="editor">
490 490
                 <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?>
491 491
                 </div><?php
492 492
 
493 493
             } else {
494 494
 
495
-                ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
496
-                            id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php
495
+                ?><textarea field_type="<?php echo $cf['type']; ?>" class="geodir_textarea" name="<?php echo $cf['name']; ?>"
496
+                            id="<?php echo $cf['name']; ?>"><?php echo stripslashes($value); ?></textarea><?php
497 497
 
498 498
             }?>
499 499
 
500 500
 
501
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
501
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
502 502
             <?php if ($cf['is_required']) { ?>
503 503
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
504 504
             <?php } ?>
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 
511 511
     return $html;
512 512
 }
513
-add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2);
513
+add_filter('geodir_custom_field_input_textarea', 'geodir_cfi_textarea', 10, 2);
514 514
 
515 515
 
516 516
 /**
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
  *
523 523
  * @return string The html to output for the custom field.
524 524
  */
525
-function geodir_cfi_select($html,$cf){
525
+function geodir_cfi_select($html, $cf) {
526 526
 
527 527
     $html_var = $cf['htmlvar_name'];
528 528
 
529 529
     // Check if there is a custom field specific filter.
530
-    if(has_filter("geodir_custom_field_input_select_{$html_var}")){
530
+    if (has_filter("geodir_custom_field_input_select_{$html_var}")) {
531 531
         /**
532 532
          * Filter the select html by individual custom field.
533 533
          *
@@ -535,22 +535,22 @@  discard block
 block discarded – undo
535 535
          * @param array $cf The custom field array.
536 536
          * @since 1.6.6
537 537
          */
538
-        $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
538
+        $html = apply_filters("geodir_custom_field_input_select_{$html_var}", $html, $cf);
539 539
     }
540 540
 
541 541
     // If no html then we run the standard output.
542
-    if(empty($html)) {
542
+    if (empty($html)) {
543 543
 
544 544
         ob_start(); // Start  buffering;
545 545
         $value = geodir_get_cf_value($cf);
546 546
 
547 547
         ?>
548
-        <div id="<?php echo $cf['name'];?>_row"
549
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
548
+        <div id="<?php echo $cf['name']; ?>_row"
549
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
550 550
             <label>
551 551
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
552 552
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
553
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
553
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
554 554
             </label>
555 555
             <?php
556 556
             $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
@@ -560,22 +560,22 @@  discard block
 block discarded – undo
560 560
                     if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
561 561
                         $option_label = isset($option_row['label']) ? $option_row['label'] : '';
562 562
 
563
-                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
563
+                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';
564 564
                     } else {
565 565
                         $option_label = isset($option_row['label']) ? $option_row['label'] : '';
566 566
                         $option_value = isset($option_row['value']) ? $option_row['value'] : '';
567 567
                         $selected = $option_value == $value ? 'selected="selected"' : '';
568 568
 
569
-                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
569
+                        $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';
570 570
                     }
571 571
                 }
572 572
             }
573 573
             ?>
574
-            <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
574
+            <select field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
575 575
                     class="geodir_textfield textfield_x chosen_select"
576
-                    data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
577
-                    option-ajaxchosen="false"><?php echo $select_options;?></select>
578
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
576
+                    data-placeholder="<?php echo __('Choose', 'geodirectory').' '.$site_title.'&hellip;'; ?>"
577
+                    option-ajaxchosen="false"><?php echo $select_options; ?></select>
578
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
579 579
             <?php if ($cf['is_required']) { ?>
580 580
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
581 581
             <?php } ?>
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 
588 588
     return $html;
589 589
 }
590
-add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2);
590
+add_filter('geodir_custom_field_input_select', 'geodir_cfi_select', 10, 2);
591 591
 
592 592
 
593 593
 /**
@@ -599,12 +599,12 @@  discard block
 block discarded – undo
599 599
  *
600 600
  * @return string The html to output for the custom field.
601 601
  */
602
-function geodir_cfi_multiselect($html,$cf){
602
+function geodir_cfi_multiselect($html, $cf) {
603 603
 
604 604
     $html_var = $cf['htmlvar_name'];
605 605
 
606 606
     // Check if there is a custom field specific filter.
607
-    if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
607
+    if (has_filter("geodir_custom_field_input_multiselect_{$html_var}")) {
608 608
         /**
609 609
          * Filter the multiselect html by individual custom field.
610 610
          *
@@ -612,11 +612,11 @@  discard block
 block discarded – undo
612 612
          * @param array $cf The custom field array.
613 613
          * @since 1.6.6
614 614
          */
615
-        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
615
+        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}", $html, $cf);
616 616
     }
617 617
 
618 618
     // If no html then we run the standard output.
619
-    if(empty($html)) {
619
+    if (empty($html)) {
620 620
 
621 621
         ob_start(); // Start  buffering;
622 622
         $value = geodir_get_cf_value($cf);
@@ -653,9 +653,9 @@  discard block
 block discarded – undo
653 653
                                 $option_label = isset($option_row['label']) ? $option_row['label'] : '';
654 654
 
655 655
                                 if ($multi_display == 'select') {
656
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
656
+                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';
657 657
                                 } else {
658
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
658
+                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>'.$option_label.'</li>' : '';
659 659
                                 }
660 660
                             } else {
661 661
                                 $option_label = isset($option_row['label']) ? $option_row['label'] : '';
@@ -680,9 +680,9 @@  discard block
 block discarded – undo
680 680
                                 }
681 681
 
682 682
                                 if ($multi_display == 'select') {
683
-                                    $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
683
+                                    $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';
684 684
                                 } else {
685
-                                    $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
685
+                                    $select_options .= '<li><input name="'.$cf['name'].'[]" '.$checked.' value="'.esc_attr($option_value).'" class="gd-'.$multi_display.'" field_type="'.$multi_display.'" type="'.$multi_display.'" />&nbsp;'.$option_label.' </li>';
686 686
                                 }
687 687
                             }
688 688
                         }
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 
703 703
     return $html;
704 704
 }
705
-add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2);
705
+add_filter('geodir_custom_field_input_multiselect', 'geodir_cfi_multiselect', 10, 2);
706 706
 
707 707
 
708 708
 /**
@@ -714,12 +714,12 @@  discard block
 block discarded – undo
714 714
  *
715 715
  * @return string The html to output for the custom field.
716 716
  */
717
-function geodir_cfi_html($html,$cf){
717
+function geodir_cfi_html($html, $cf) {
718 718
 
719 719
     $html_var = $cf['htmlvar_name'];
720 720
 
721 721
     // Check if there is a custom field specific filter.
722
-    if(has_filter("geodir_custom_field_input_html_{$html_var}")){
722
+    if (has_filter("geodir_custom_field_input_html_{$html_var}")) {
723 723
         /**
724 724
          * Filter the html html by individual custom field.
725 725
          *
@@ -727,11 +727,11 @@  discard block
 block discarded – undo
727 727
          * @param array $cf The custom field array.
728 728
          * @since 1.6.6
729 729
          */
730
-        $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
730
+        $html = apply_filters("geodir_custom_field_input_html_{$html_var}", $html, $cf);
731 731
     }
732 732
 
733 733
     // If no html then we run the standard output.
734
-    if(empty($html)) {
734
+    if (empty($html)) {
735 735
 
736 736
         ob_start(); // Start  buffering;
737 737
         $value = geodir_get_cf_value($cf);
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 
765 765
     return $html;
766 766
 }
767
-add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2);
767
+add_filter('geodir_custom_field_input_html', 'geodir_cfi_html', 10, 2);
768 768
 
769 769
 
770 770
 
@@ -777,12 +777,12 @@  discard block
 block discarded – undo
777 777
  *
778 778
  * @return string The html to output for the custom field.
779 779
  */
780
-function geodir_cfi_datepicker($html,$cf){
780
+function geodir_cfi_datepicker($html, $cf) {
781 781
 
782 782
     $html_var = $cf['htmlvar_name'];
783 783
 
784 784
     // Check if there is a custom field specific filter.
785
-    if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
785
+    if (has_filter("geodir_custom_field_input_datepicker_{$html_var}")) {
786 786
         /**
787 787
          * Filter the datepicker html by individual custom field.
788 788
          *
@@ -790,11 +790,11 @@  discard block
 block discarded – undo
790 790
          * @param array $cf The custom field array.
791 791
          * @since 1.6.6
792 792
          */
793
-        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
793
+        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}", $html, $cf);
794 794
     }
795 795
 
796 796
     // If no html then we run the standard output.
797
-    if(empty($html)) {
797
+    if (empty($html)) {
798 798
 
799 799
         ob_start(); // Start  buffering;
800 800
         $value = geodir_get_cf_value($cf);
@@ -806,23 +806,23 @@  discard block
 block discarded – undo
806 806
             $extra_fields['date_format'] = 'yy-mm-dd';
807 807
 
808 808
         $date_format = $extra_fields['date_format'];
809
-        $jquery_date_format  = $date_format;
809
+        $jquery_date_format = $date_format;
810 810
 
811 811
 
812 812
         // check if we need to change the format or not
813 813
         $date_format_len = strlen(str_replace(' ', '', $date_format));
814
-        if($date_format_len>5){// if greater then 5 then it's the old style format.
814
+        if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
815 815
 
816
-            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
817
-            $replace = array('d','j','l','m','n','F','Y');//PHP date format
816
+            $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
817
+            $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
818 818
 
819 819
             $date_format = str_replace($search, $replace, $date_format);
820
-        }else{
821
-            $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
820
+        } else {
821
+            $jquery_date_format = geodir_date_format_php_to_jqueryui($jquery_date_format);
822 822
         }
823 823
 
824
-        if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
825
-        if($value && !isset($_REQUEST['backandedit'])) {
824
+        if ($value == '0000-00-00') {$value = ''; }//if date not set, then mark it empty
825
+        if ($value && !isset($_REQUEST['backandedit'])) {
826 826
             //$time = strtotime($value);
827 827
             //$value = date_i18n($date_format, $time);
828 828
         }
@@ -833,37 +833,37 @@  discard block
 block discarded – undo
833 833
 
834 834
             jQuery(function () {
835 835
 
836
-                jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php
836
+                jQuery("#<?php echo $cf['name']; ?>").datepicker({changeMonth: true, changeYear: true <?php
837 837
                     /**
838 838
                      * Used to add extra option to datepicker per custom field.
839 839
                      *
840 840
                      * @since 1.5.7
841 841
                      * @param string $name The custom field name.
842 842
                      */
843
-                    echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
843
+                    echo apply_filters("gd_datepicker_extra_{$name}", ''); ?>});
844 844
 
845
-                jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
845
+                jQuery("#<?php echo $name; ?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format; ?>');
846 846
 
847
-                <?php if(!empty($value)){?>
848
-                jQuery("#<?php echo $name;?>").datepicker("setDate", '<?php echo $value;?>');
847
+                <?php if (!empty($value)) {?>
848
+                jQuery("#<?php echo $name; ?>").datepicker("setDate", '<?php echo $value; ?>');
849 849
                 <?php } ?>
850 850
 
851 851
             });
852 852
 
853 853
         </script>
854
-        <div id="<?php echo $name;?>_row"
855
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
854
+        <div id="<?php echo $name; ?>_row"
855
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
856 856
             <label>
857 857
 
858 858
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
859 859
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
860
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
860
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
861 861
             </label>
862 862
 
863
-            <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
864
-                   value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
863
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
864
+                   value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
865 865
 
866
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
866
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
867 867
             <?php if ($cf['is_required']) { ?>
868 868
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
869 869
             <?php } ?>
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 
876 876
     return $html;
877 877
 }
878
-add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2);
878
+add_filter('geodir_custom_field_input_datepicker', 'geodir_cfi_datepicker', 10, 2);
879 879
 
880 880
 
881 881
 /**
@@ -887,12 +887,12 @@  discard block
 block discarded – undo
887 887
  *
888 888
  * @return string The html to output for the custom field.
889 889
  */
890
-function geodir_cfi_time($html,$cf){
890
+function geodir_cfi_time($html, $cf) {
891 891
 
892 892
     $html_var = $cf['htmlvar_name'];
893 893
 
894 894
     // Check if there is a custom field specific filter.
895
-    if(has_filter("geodir_custom_field_input_time_{$html_var}")){
895
+    if (has_filter("geodir_custom_field_input_time_{$html_var}")) {
896 896
         /**
897 897
          * Filter the time html by individual custom field.
898 898
          *
@@ -900,11 +900,11 @@  discard block
 block discarded – undo
900 900
          * @param array $cf The custom field array.
901 901
          * @since 1.6.6
902 902
          */
903
-        $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
903
+        $html = apply_filters("geodir_custom_field_input_time_{$html_var}", $html, $cf);
904 904
     }
905 905
 
906 906
     // If no html then we run the standard output.
907
-    if(empty($html)) {
907
+    if (empty($html)) {
908 908
 
909 909
         ob_start(); // Start  buffering;
910 910
         $value = geodir_get_cf_value($cf);
@@ -917,25 +917,25 @@  discard block
 block discarded – undo
917 917
         <script type="text/javascript">
918 918
             jQuery(document).ready(function () {
919 919
 
920
-                jQuery('#<?php echo $name;?>').timepicker({
920
+                jQuery('#<?php echo $name; ?>').timepicker({
921 921
                     showPeriod: true,
922 922
                     showLeadingZero: true,
923 923
                     showPeriod: true,
924 924
                 });
925 925
             });
926 926
         </script>
927
-        <div id="<?php echo $name;?>_row"
928
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
927
+        <div id="<?php echo $name; ?>_row"
928
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
929 929
             <label>
930 930
 
931 931
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
932 932
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
933
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
933
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
934 934
             </label>
935
-            <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
936
-                   id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
935
+            <input readonly="readonly" field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>"
936
+                   id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
937 937
 
938
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
938
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
939 939
             <?php if ($cf['is_required']) { ?>
940 940
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
941 941
             <?php } ?>
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 
947 947
     return $html;
948 948
 }
949
-add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2);
949
+add_filter('geodir_custom_field_input_time', 'geodir_cfi_time', 10, 2);
950 950
 
951 951
 
952 952
 /**
@@ -958,12 +958,12 @@  discard block
 block discarded – undo
958 958
  *
959 959
  * @return string The html to output for the custom field.
960 960
  */
961
-function geodir_cfi_address($html,$cf){
961
+function geodir_cfi_address($html, $cf) {
962 962
 
963 963
     $html_var = $cf['htmlvar_name'];
964 964
 
965 965
     // Check if there is a custom field specific filter.
966
-    if(has_filter("geodir_custom_field_input_address_{$html_var}")){
966
+    if (has_filter("geodir_custom_field_input_address_{$html_var}")) {
967 967
         /**
968 968
          * Filter the address html by individual custom field.
969 969
          *
@@ -971,11 +971,11 @@  discard block
 block discarded – undo
971 971
          * @param array $cf The custom field array.
972 972
          * @since 1.6.6
973 973
          */
974
-        $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
974
+        $html = apply_filters("geodir_custom_field_input_address_{$html_var}", $html, $cf);
975 975
     }
976 976
 
977 977
     // If no html then we run the standard output.
978
-    if(empty($html)) {
978
+    if (empty($html)) {
979 979
 
980 980
         global $gd_session;
981 981
         ob_start(); // Start  buffering;
@@ -988,12 +988,12 @@  discard block
 block discarded – undo
988 988
         $site_title = $cf['site_title'];
989 989
         $is_admin = $cf['is_admin'];
990 990
         $extra_fields = unserialize($cf['extra_fields']);
991
-        $prefix = $name . '_';
991
+        $prefix = $name.'_';
992 992
 
993
-        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
994
-        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
993
+        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix.' address');
994
+        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix.' zip/post code ');
995 995
         ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
996
-        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
996
+        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix.' mapview');
997 997
 
998 998
         $address = '';
999 999
         $zip = '';
@@ -1004,21 +1004,21 @@  discard block
 block discarded – undo
1004 1004
 
1005 1005
         if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1006 1006
             $post = $gd_ses_listing;
1007
-            $address = $post[$prefix . 'address'];
1008
-            $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1009
-            $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1010
-            $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1011
-            $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1012
-            $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1007
+            $address = $post[$prefix.'address'];
1008
+            $zip = isset($post[$prefix.'zip']) ? $post[$prefix.'zip'] : '';
1009
+            $lat = isset($post[$prefix.'latitude']) ? $post[$prefix.'latitude'] : '';
1010
+            $lng = isset($post[$prefix.'longitude']) ? $post[$prefix.'longitude'] : '';
1011
+            $mapview = isset($post[$prefix.'mapview']) ? $post[$prefix.'mapview'] : '';
1012
+            $mapzoom = isset($post[$prefix.'mapzoom']) ? $post[$prefix.'mapzoom'] : '';
1013 1013
         } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1014
-            $post_info = (array)$post_info;
1015
-
1016
-            $address = $post_info[$prefix . 'address'];
1017
-            $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1018
-            $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1019
-            $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1020
-            $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1021
-            $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1014
+            $post_info = (array) $post_info;
1015
+
1016
+            $address = $post_info[$prefix.'address'];
1017
+            $zip = isset($post_info[$prefix.'zip']) ? $post_info[$prefix.'zip'] : '';
1018
+            $lat = isset($post_info[$prefix.'latitude']) ? $post_info[$prefix.'latitude'] : '';
1019
+            $lng = isset($post_info[$prefix.'longitude']) ? $post_info[$prefix.'longitude'] : '';
1020
+            $mapview = isset($post_info[$prefix.'mapview']) ? $post_info[$prefix.'mapview'] : '';
1021
+            $mapzoom = isset($post_info[$prefix.'mapzoom']) ? $post_info[$prefix.'mapzoom'] : '';
1022 1022
         }
1023 1023
 
1024 1024
         $location = geodir_get_default_location();
@@ -1055,16 +1055,16 @@  discard block
 block discarded – undo
1055 1055
 
1056 1056
         ?>
1057 1057
 
1058
-        <div id="geodir_<?php echo $prefix . 'address';?>_row"
1059
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1058
+        <div id="geodir_<?php echo $prefix.'address'; ?>_row"
1059
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1060 1060
             <label>
1061 1061
                 <?php _e($address_title, 'geodirectory'); ?>
1062
-                <?php if ($is_required) echo '<span>*</span>';?>
1062
+                <?php if ($is_required) echo '<span>*</span>'; ?>
1063 1063
             </label>
1064
-            <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"
1065
-                   id="<?php echo $prefix . 'address';?>" class="geodir_textfield"
1064
+            <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'address'; ?>"
1065
+                   id="<?php echo $prefix.'address'; ?>" class="geodir_textfield"
1066 1066
                    value="<?php echo esc_attr(stripslashes($address)); ?>"/>
1067
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1067
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1068 1068
             <?php if ($is_required) { ?>
1069 1069
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1070 1070
             <?php } ?>
@@ -1084,14 +1084,14 @@  discard block
 block discarded – undo
1084 1084
 
1085 1085
         if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1086 1086
 
1087
-            <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1087
+            <div id="geodir_<?php echo $prefix.'zip'; ?>_row"
1088 1088
                  class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details">
1089 1089
                 <label>
1090 1090
                     <?php _e($zip_title, 'geodirectory'); ?>
1091 1091
                     <?php /*if($is_required) echo '<span>*</span>';*/ ?>
1092 1092
                 </label>
1093
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'zip'; ?>"
1094
-                       id="<?php echo $prefix . 'zip'; ?>" class="geodir_textfield autofill"
1093
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'zip'; ?>"
1094
+                       id="<?php echo $prefix.'zip'; ?>" class="geodir_textfield autofill"
1095 1095
                        value="<?php echo esc_attr(stripslashes($zip)); ?>"/>
1096 1096
                 <?php /*if($is_required) {?>
1097 1097
 					<span class="geodir_message_error"><?php echo _e($required_msg,'geodirectory');?></span>
@@ -1101,14 +1101,14 @@  discard block
 block discarded – undo
1101 1101
 
1102 1102
         <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?>
1103 1103
 
1104
-            <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1104
+            <div id="geodir_<?php echo $prefix.'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1105 1105
                 <?php
1106 1106
                 /**
1107 1107
                  * Contains add listing page map functions.
1108 1108
                  *
1109 1109
                  * @since 1.0.0
1110 1110
                  */
1111
-                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1111
+                include(geodir_plugin_path()."/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1112 1112
                 if ($lat_lng_blank) {
1113 1113
                     $lat = '';
1114 1114
                     $lng = '';
@@ -1119,14 +1119,14 @@  discard block
 block discarded – undo
1119 1119
             <?php
1120 1120
             /* show lat lng */
1121 1121
             $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1122
-            <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1122
+            <div id="geodir_<?php echo $prefix.'latitude'; ?>_row"
1123 1123
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1124 1124
                 <label>
1125 1125
                     <?php echo PLACE_ADDRESS_LAT; ?>
1126 1126
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1127 1127
                 </label>
1128
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1129
-                       id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
1128
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'latitude'; ?>"
1129
+                       id="<?php echo $prefix.'latitude'; ?>" class="geodir_textfield"
1130 1130
                        value="<?php echo esc_attr(stripslashes($lat)); ?>" size="25"/>
1131 1131
                 <span class="geodir_message_note"><?php echo GET_LATITUDE_MSG; ?></span>
1132 1132
                 <?php if ($is_required) { ?>
@@ -1134,14 +1134,14 @@  discard block
 block discarded – undo
1134 1134
                 <?php } ?>
1135 1135
             </div>
1136 1136
 
1137
-            <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1137
+            <div id="geodir_<?php echo $prefix.'longitude'; ?>_row"
1138 1138
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1139 1139
                 <label>
1140 1140
                     <?php echo PLACE_ADDRESS_LNG; ?>
1141 1141
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1142 1142
                 </label>
1143
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1144
-                       id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
1143
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'longitude'; ?>"
1144
+                       id="<?php echo $prefix.'longitude'; ?>" class="geodir_textfield"
1145 1145
                        value="<?php echo esc_attr(stripslashes($lng)); ?>" size="25"/>
1146 1146
                 <span class="geodir_message_note"><?php echo GET_LOGNGITUDE_MSG; ?></span>
1147 1147
                 <?php if ($is_required) { ?>
@@ -1151,32 +1151,32 @@  discard block
 block discarded – undo
1151 1151
         <?php } ?>
1152 1152
 
1153 1153
         <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?>
1154
-            <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1154
+            <div id="geodir_<?php echo $prefix.'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1155 1155
                 <label><?php _e($mapview_title, 'geodirectory'); ?></label>
1156 1156
 
1157 1157
 
1158 1158
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1159 1159
                                                             class="gd-checkbox"
1160
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1161
-                                                            id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1160
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1161
+                                                            id="<?php echo $prefix.'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1162 1162
                             echo 'checked="checked"';
1163 1163
                         } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1164 1164
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1165 1165
                                                              class="gd-checkbox"
1166
-                                                             name="<?php echo $prefix . 'mapview'; ?>"
1166
+                                                             name="<?php echo $prefix.'mapview'; ?>"
1167 1167
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1168 1168
                             echo 'checked="checked"';
1169 1169
                         } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1170 1170
 
1171 1171
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1172 1172
                                                             class="gd-checkbox"
1173
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1173
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1174 1174
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1175 1175
                             echo 'checked="checked"';
1176 1176
                         } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1177 1177
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1178 1178
                                                             class="gd-checkbox"
1179
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1179
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1180 1180
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1181 1181
                             echo 'checked="checked"';
1182 1182
                         } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
         <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1189 1189
             <input type="hidden" value="<?php if (isset($mapzoom)) {
1190 1190
                 echo esc_attr($mapzoom);
1191
-            } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1191
+            } ?>" name="<?php echo $prefix.'mapzoom'; ?>" id="<?php echo $prefix.'mapzoom'; ?>"/>
1192 1192
         <?php }
1193 1193
 
1194 1194
         $html = ob_get_clean();
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 
1197 1197
     return $html;
1198 1198
 }
1199
-add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2);
1199
+add_filter('geodir_custom_field_input_address', 'geodir_cfi_address', 10, 2);
1200 1200
 
1201 1201
 
1202 1202
 
@@ -1209,12 +1209,12 @@  discard block
 block discarded – undo
1209 1209
  *
1210 1210
  * @return string The html to output for the custom field.
1211 1211
  */
1212
-function geodir_cfi_taxonomy($html,$cf){
1212
+function geodir_cfi_taxonomy($html, $cf) {
1213 1213
 
1214 1214
     $html_var = $cf['htmlvar_name'];
1215 1215
 
1216 1216
     // Check if there is a custom field specific filter.
1217
-    if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1217
+    if (has_filter("geodir_custom_field_input_taxonomy_{$html_var}")) {
1218 1218
         /**
1219 1219
          * Filter the taxonomy html by individual custom field.
1220 1220
          *
@@ -1222,11 +1222,11 @@  discard block
 block discarded – undo
1222 1222
          * @param array $cf The custom field array.
1223 1223
          * @since 1.6.6
1224 1224
          */
1225
-        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1225
+        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}", $html, $cf);
1226 1226
     }
1227 1227
 
1228 1228
     // If no html then we run the standard output.
1229
-    if(empty($html)) {
1229
+    if (empty($html)) {
1230 1230
 
1231 1231
         ob_start(); // Start  buffering;
1232 1232
         $value = geodir_get_cf_value($cf);
@@ -1241,15 +1241,15 @@  discard block
 block discarded – undo
1241 1241
         if ($value == $cf['default']) {
1242 1242
             $value = '';
1243 1243
         } ?>
1244
-        <div id="<?php echo $name;?>_row"
1245
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1244
+        <div id="<?php echo $name; ?>_row"
1245
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1246 1246
             <label>
1247 1247
                 <?php $site_title = __($site_title, 'geodirectory');
1248 1248
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1249
-                <?php if ($is_required) echo '<span>*</span>';?>
1249
+                <?php if ($is_required) echo '<span>*</span>'; ?>
1250 1250
             </label>
1251 1251
 
1252
-            <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1252
+            <div id="<?php echo $name; ?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1253 1253
                 <?php
1254 1254
                 global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1255 1255
 
@@ -1261,7 +1261,7 @@  discard block
 block discarded – undo
1261 1261
 
1262 1262
                     $package_info = array();
1263 1263
 
1264
-                    $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1264
+                    $package_info = (array) geodir_post_package_info($package_info, $post, $post_type);
1265 1265
 
1266 1266
                     if (!empty($package_info)) {
1267 1267
 
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
 
1291 1291
                     $catadd_limit = $wpdb->get_var(
1292 1292
                         $wpdb->prepare(
1293
-                            "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1293
+                            "SELECT cat_limit FROM ".GEODIR_PRICE_TABLE." WHERE pid = %d",
1294 1294
                             array($package_id)
1295 1295
                         )
1296 1296
                     );
@@ -1306,13 +1306,13 @@  discard block
 block discarded – undo
1306 1306
                     $required_limit_msg = '';
1307 1307
                     if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1308 1308
 
1309
-                        $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1309
+                        $required_limit_msg = __('Only select', 'geodirectory').' '.$catadd_limit.__(' categories for this package.', 'geodirectory');
1310 1310
 
1311 1311
                     } else {
1312 1312
                         $required_limit_msg = $required_msg;
1313 1313
                     }
1314 1314
 
1315
-                    echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1315
+                    echo '<input type="hidden" cat_limit="'.$catadd_limit.'" id="cat_limit" value="'.esc_attr($required_limit_msg).'" name="cat_limit['.$name.']"  />';
1316 1316
 
1317 1317
 
1318 1318
                     if ($cat_display == 'select' || $cat_display == 'multiselect') {
@@ -1322,11 +1322,11 @@  discard block
 block discarded – undo
1322 1322
                         if ($cat_display == 'multiselect')
1323 1323
                             $multiple = 'multiple="multiple"';
1324 1324
 
1325
-                        echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1325
+                        echo '<select id="'.$name.'" '.$multiple.' type="'.$name.'" name="post_category['.$name.'][]" alt="'.$name.'" field_type="'.$cat_display.'" class="geodir_textfield textfield_x chosen_select" data-placeholder="'.__('Select Category', 'geodirectory').'">';
1326 1326
 
1327 1327
 
1328 1328
                         if ($cat_display == 'select')
1329
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1329
+                            echo '<option value="">'.__('Select Category', 'geodirectory').'</option>';
1330 1330
 
1331 1331
                     }
1332 1332
 
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
                 ?>
1345 1345
             </div>
1346 1346
 
1347
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1347
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1348 1348
             <?php if ($is_required) { ?>
1349 1349
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1350 1350
             <?php } ?>
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
 
1357 1357
     return $html;
1358 1358
 }
1359
-add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2);
1359
+add_filter('geodir_custom_field_input_taxonomy', 'geodir_cfi_taxonomy', 10, 2);
1360 1360
 
1361 1361
 
1362 1362
 /**
@@ -1368,12 +1368,12 @@  discard block
 block discarded – undo
1368 1368
  *
1369 1369
  * @return string The html to output for the custom field.
1370 1370
  */
1371
-function geodir_cfi_file($html,$cf){
1371
+function geodir_cfi_file($html, $cf) {
1372 1372
 
1373 1373
     $html_var = $cf['htmlvar_name'];
1374 1374
 
1375 1375
     // Check if there is a custom field specific filter.
1376
-    if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1376
+    if (has_filter("geodir_custom_field_input_file_{$html_var}")) {
1377 1377
         /**
1378 1378
          * Filter the file html by individual custom field.
1379 1379
          *
@@ -1381,11 +1381,11 @@  discard block
 block discarded – undo
1381 1381
          * @param array $cf The custom field array.
1382 1382
          * @since 1.6.6
1383 1383
          */
1384
-        $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1384
+        $html = apply_filters("geodir_custom_field_input_file_{$html_var}", $html, $cf);
1385 1385
     }
1386 1386
 
1387 1387
     // If no html then we run the standard output.
1388
-    if(empty($html)) {
1388
+    if (empty($html)) {
1389 1389
 
1390 1390
         ob_start(); // Start  buffering;
1391 1391
         $value = geodir_get_cf_value($cf);
@@ -1428,8 +1428,8 @@  discard block
 block discarded – undo
1428 1428
                 $file_totImg = count($curImages);
1429 1429
         }
1430 1430
 
1431
-        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1432
-        $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1431
+        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? implode(",", $extra_fields['gd_file_types']) : '';
1432
+        $display_file_types = $allowed_file_types != '' ? '.'.implode(", .", $extra_fields['gd_file_types']) : '';
1433 1433
 
1434 1434
         ?>
1435 1435
         <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
@@ -1439,13 +1439,13 @@  discard block
 block discarded – undo
1439 1439
 			</h5>   <?php */
1440 1440
         ?>
1441 1441
 
1442
-        <div id="<?php echo $name;?>_row"
1443
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1442
+        <div id="<?php echo $name; ?>_row"
1443
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1444 1444
 
1445 1445
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1446 1446
                 <label
1447 1447
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1448
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1448
+                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>'; ?></label>
1449 1449
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1450 1450
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1451 1451
                        value="<?php echo esc_attr($file_value); ?>"/>
@@ -1453,7 +1453,7 @@  discard block
 block discarded – undo
1453 1453
                        id="<?php echo $file_id; ?>image_limit" value="<?php echo $file_image_limit; ?>"/>
1454 1454
                 <?php if ($allowed_file_types != '') { ?>
1455 1455
                     <input type="hidden" name="<?php echo $file_id; ?>_allowed_types"
1456
-                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types);?>"/>
1456
+                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types); ?>"/>
1457 1457
                 <?php } ?>
1458 1458
                 <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
1459 1459
                        value="<?php if (isset($file_totImg)) {
@@ -1469,10 +1469,10 @@  discard block
 block discarded – undo
1469 1469
                         <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
1470 1470
                         ?>
1471 1471
                         <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
1472
-                               value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
1472
+                               value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory')); ?>"
1473 1473
                                class="geodir_button" style="margin-top:10px;"/>
1474 1474
                             <span class="ajaxnonceplu"
1475
-                                  id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?>"></span>
1475
+                                  id="ajaxnonceplu<?php echo wp_create_nonce($file_id.'pluploadan'); ?>"></span>
1476 1476
                         <?php if ($file_width && $file_height): ?>
1477 1477
                             <span class="plupload-resize"></span>
1478 1478
                             <span class="plupload-width" id="plupload-width<?php echo $file_width; ?>"></span>
@@ -1492,7 +1492,7 @@  discard block
 block discarded – undo
1492 1492
 
1493 1493
                 </div>
1494 1494
             </div>
1495
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?> <?php echo ( $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : '' );?></span>
1495
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo ($display_file_types != '' ? __('Allowed file types:', 'geodirectory').' '.$display_file_types : ''); ?></span>
1496 1496
             <?php if ($is_required) { ?>
1497 1497
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1498 1498
             <?php } ?>
@@ -1505,4 +1505,4 @@  discard block
 block discarded – undo
1505 1505
 
1506 1506
     return $html;
1507 1507
 }
1508
-add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2);
1509 1508
\ No newline at end of file
1509
+add_filter('geodir_custom_field_input_file', 'geodir_cfi_file', 10, 2);
1510 1510
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +705 added lines, -705 removed lines patch added patch discarded remove patch
@@ -19,35 +19,35 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_cfi_fieldset($html,$cf){
21 21
 
22
-    $html_var = $cf['htmlvar_name'];
23
-
24
-    // Check if there is a custom field specific filter.
25
-    if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
26
-        /**
27
-         * Filter the fieldset html by individual custom field.
28
-         *
29
-         * @param string $html The html to filter.
30
-         * @param array $cf The custom field array.
31
-         * @since 1.6.6
32
-         */
33
-        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
34
-    }
35
-
36
-    // If no html then we run the standard output.
37
-    if(empty($html)) {
38
-
39
-        ob_start(); // Start  buffering;
40
-        ?>
22
+	$html_var = $cf['htmlvar_name'];
23
+
24
+	// Check if there is a custom field specific filter.
25
+	if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
26
+		/**
27
+		 * Filter the fieldset html by individual custom field.
28
+		 *
29
+		 * @param string $html The html to filter.
30
+		 * @param array $cf The custom field array.
31
+		 * @since 1.6.6
32
+		 */
33
+		$html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
34
+	}
35
+
36
+	// If no html then we run the standard output.
37
+	if(empty($html)) {
38
+
39
+		ob_start(); // Start  buffering;
40
+		?>
41 41
         <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row"
42 42
             gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo $cf['site_title']; ?>
43 43
             <?php if ( $cf['desc'] != '' ) {
44
-                echo '<small>( ' . $cf['desc'] . ' )</small>';
45
-            } ?></h5>
44
+				echo '<small>( ' . $cf['desc'] . ' )</small>';
45
+			} ?></h5>
46 46
         <?php
47
-        $html = ob_get_clean();
48
-    }
47
+		$html = ob_get_clean();
48
+	}
49 49
 
50
-    return $html;
50
+	return $html;
51 51
 }
52 52
 add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2);
53 53
 
@@ -64,47 +64,47 @@  discard block
 block discarded – undo
64 64
  */
65 65
 function geodir_cfi_text($html,$cf){
66 66
 
67
-    $html_var = $cf['htmlvar_name'];
68
-
69
-    // Check if there is a custom field specific filter.
70
-    if(has_filter("geodir_custom_field_input_text_{$html_var}")){
71
-        /**
72
-         * Filter the text html by individual custom field.
73
-         *
74
-         * @param string $html The html to filter.
75
-         * @param array $cf The custom field array.
76
-         * @since 1.6.6
77
-         */
78
-        $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
79
-    }
80
-
81
-    // If no html then we run the standard output.
82
-    if(empty($html)) {
83
-
84
-        ob_start(); // Start  buffering;
85
-
86
-        $value = geodir_get_cf_value($cf);
87
-        $type = $cf['type'];
88
-        //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91
-
92
-        //validation
93
-        if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94
-            $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
96
-
97
-        // validation message
98
-        if(isset($cf['validation_msg']) && $cf['validation_msg']){
99
-            $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
101
-        ?>
67
+	$html_var = $cf['htmlvar_name'];
68
+
69
+	// Check if there is a custom field specific filter.
70
+	if(has_filter("geodir_custom_field_input_text_{$html_var}")){
71
+		/**
72
+		 * Filter the text html by individual custom field.
73
+		 *
74
+		 * @param string $html The html to filter.
75
+		 * @param array $cf The custom field array.
76
+		 * @since 1.6.6
77
+		 */
78
+		$html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
79
+	}
80
+
81
+	// If no html then we run the standard output.
82
+	if(empty($html)) {
83
+
84
+		ob_start(); // Start  buffering;
85
+
86
+		$value = geodir_get_cf_value($cf);
87
+		$type = $cf['type'];
88
+		//number and float validation $validation_pattern
89
+		if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
+		elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91
+
92
+		//validation
93
+		if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94
+			$validation = 'pattern="'.$cf['validation_pattern'].'"';
95
+		}else{$validation='';}
96
+
97
+		// validation message
98
+		if(isset($cf['validation_msg']) && $cf['validation_msg']){
99
+			$validation_msg = 'title="'.$cf['validation_msg'].'"';
100
+		}else{$validation_msg='';}
101
+		?>
102 102
 
103 103
         <div id="<?php echo $cf['name'];?>_row"
104 104
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
105 105
             <label>
106 106
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
107
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108 108
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
109 109
             </label>
110 110
             <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
         </div>
117 117
 
118 118
         <?php
119
-        $html = ob_get_clean();
120
-    }
119
+		$html = ob_get_clean();
120
+	}
121 121
 
122
-    return $html;
122
+	return $html;
123 123
 }
124 124
 add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2);
125 125
 
@@ -135,35 +135,35 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function geodir_cfi_email($html,$cf){
137 137
 
138
-    $html_var = $cf['htmlvar_name'];
138
+	$html_var = $cf['htmlvar_name'];
139 139
 
140
-    // Check if there is a custom field specific filter.
141
-    if(has_filter("geodir_custom_field_input_email_{$html_var}")){
142
-        /**
143
-         * Filter the email html by individual custom field.
144
-         *
145
-         * @param string $html The html to filter.
146
-         * @param array $cf The custom field array.
147
-         * @since 1.6.6
148
-         */
149
-        $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
150
-    }
140
+	// Check if there is a custom field specific filter.
141
+	if(has_filter("geodir_custom_field_input_email_{$html_var}")){
142
+		/**
143
+		 * Filter the email html by individual custom field.
144
+		 *
145
+		 * @param string $html The html to filter.
146
+		 * @param array $cf The custom field array.
147
+		 * @since 1.6.6
148
+		 */
149
+		$html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
150
+	}
151 151
 
152
-    // If no html then we run the standard output.
153
-    if(empty($html)) {
152
+	// If no html then we run the standard output.
153
+	if(empty($html)) {
154 154
 
155
-        ob_start(); // Start  buffering;
156
-        $value = geodir_get_cf_value($cf);
155
+		ob_start(); // Start  buffering;
156
+		$value = geodir_get_cf_value($cf);
157 157
 
158
-        if ($value == $cf['default']) {
159
-            $value = '';
160
-        }?>
158
+		if ($value == $cf['default']) {
159
+			$value = '';
160
+		}?>
161 161
 
162 162
         <div id="<?php echo $cf['name'];?>_row"
163 163
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
164 164
             <label>
165 165
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
166
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167 167
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
168 168
             </label>
169 169
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
         </div>
176 176
 
177 177
         <?php
178
-        $html = ob_get_clean();
179
-    }
178
+		$html = ob_get_clean();
179
+	}
180 180
 
181
-    return $html;
181
+	return $html;
182 182
 }
183 183
 add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2);
184 184
 
@@ -195,35 +195,35 @@  discard block
 block discarded – undo
195 195
  */
196 196
 function geodir_cfi_phone($html,$cf){
197 197
 
198
-    $html_var = $cf['htmlvar_name'];
198
+	$html_var = $cf['htmlvar_name'];
199 199
 
200
-    // Check if there is a custom field specific filter.
201
-    if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
202
-        /**
203
-         * Filter the phone html by individual custom field.
204
-         *
205
-         * @param string $html The html to filter.
206
-         * @param array $cf The custom field array.
207
-         * @since 1.6.6
208
-         */
209
-        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
210
-    }
200
+	// Check if there is a custom field specific filter.
201
+	if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
202
+		/**
203
+		 * Filter the phone html by individual custom field.
204
+		 *
205
+		 * @param string $html The html to filter.
206
+		 * @param array $cf The custom field array.
207
+		 * @since 1.6.6
208
+		 */
209
+		$html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
210
+	}
211 211
 
212
-    // If no html then we run the standard output.
213
-    if(empty($html)) {
212
+	// If no html then we run the standard output.
213
+	if(empty($html)) {
214 214
 
215
-        ob_start(); // Start  buffering;
216
-        $value = geodir_get_cf_value($cf);
215
+		ob_start(); // Start  buffering;
216
+		$value = geodir_get_cf_value($cf);
217 217
 
218
-        if ($value == $cf['default']) {
219
-            $value = '';
220
-        }?>
218
+		if ($value == $cf['default']) {
219
+			$value = '';
220
+		}?>
221 221
 
222 222
         <div id="<?php echo $cf['name'];?>_row"
223 223
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
224 224
             <label>
225 225
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
226
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227 227
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
228 228
             </label>
229 229
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
         </div>
236 236
 
237 237
         <?php
238
-        $html = ob_get_clean();
239
-    }
238
+		$html = ob_get_clean();
239
+	}
240 240
 
241
-    return $html;
241
+	return $html;
242 242
 }
243 243
 add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2);
244 244
 
@@ -255,35 +255,35 @@  discard block
 block discarded – undo
255 255
  */
256 256
 function geodir_cfi_url($html,$cf){
257 257
 
258
-    $html_var = $cf['htmlvar_name'];
258
+	$html_var = $cf['htmlvar_name'];
259 259
 
260
-    // Check if there is a custom field specific filter.
261
-    if(has_filter("geodir_custom_field_input_url_{$html_var}")){
262
-        /**
263
-         * Filter the url html by individual custom field.
264
-         *
265
-         * @param string $html The html to filter.
266
-         * @param array $cf The custom field array.
267
-         * @since 1.6.6
268
-         */
269
-        $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
270
-    }
260
+	// Check if there is a custom field specific filter.
261
+	if(has_filter("geodir_custom_field_input_url_{$html_var}")){
262
+		/**
263
+		 * Filter the url html by individual custom field.
264
+		 *
265
+		 * @param string $html The html to filter.
266
+		 * @param array $cf The custom field array.
267
+		 * @since 1.6.6
268
+		 */
269
+		$html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
270
+	}
271 271
 
272
-    // If no html then we run the standard output.
273
-    if(empty($html)) {
272
+	// If no html then we run the standard output.
273
+	if(empty($html)) {
274 274
 
275
-        ob_start(); // Start  buffering;
276
-        $value = geodir_get_cf_value($cf);
275
+		ob_start(); // Start  buffering;
276
+		$value = geodir_get_cf_value($cf);
277 277
 
278
-        if ($value == $cf['default']) {
279
-            $value = '';
280
-        }?>
278
+		if ($value == $cf['default']) {
279
+			$value = '';
280
+		}?>
281 281
 
282 282
         <div id="<?php echo $cf['name'];?>_row"
283 283
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
284 284
             <label>
285 285
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
286
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287 287
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
288 288
             </label>
289 289
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
         </div>
299 299
 
300 300
         <?php
301
-        $html = ob_get_clean();
302
-    }
301
+		$html = ob_get_clean();
302
+	}
303 303
 
304
-    return $html;
304
+	return $html;
305 305
 }
306 306
 add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2);
307 307
 
@@ -317,48 +317,48 @@  discard block
 block discarded – undo
317 317
  */
318 318
 function geodir_cfi_radio($html,$cf){
319 319
 
320
-    $html_var = $cf['htmlvar_name'];
320
+	$html_var = $cf['htmlvar_name'];
321 321
 
322
-    // Check if there is a custom field specific filter.
323
-    if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
324
-        /**
325
-         * Filter the radio html by individual custom field.
326
-         *
327
-         * @param string $html The html to filter.
328
-         * @param array $cf The custom field array.
329
-         * @since 1.6.6
330
-         */
331
-        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
332
-    }
322
+	// Check if there is a custom field specific filter.
323
+	if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
324
+		/**
325
+		 * Filter the radio html by individual custom field.
326
+		 *
327
+		 * @param string $html The html to filter.
328
+		 * @param array $cf The custom field array.
329
+		 * @since 1.6.6
330
+		 */
331
+		$html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
332
+	}
333 333
 
334
-    // If no html then we run the standard output.
335
-    if(empty($html)) {
334
+	// If no html then we run the standard output.
335
+	if(empty($html)) {
336 336
 
337
-        ob_start(); // Start  buffering;
338
-        $value = geodir_get_cf_value($cf);
337
+		ob_start(); // Start  buffering;
338
+		$value = geodir_get_cf_value($cf);
339 339
 
340
-        ?>
340
+		?>
341 341
         <div id="<?php echo $cf['name'];?>_row"
342 342
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
343 343
             <label>
344 344
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
345
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346 346
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
347 347
             </label>
348 348
             <?php if ($cf['option_values']) {
349
-                $option_values = geodir_string_values_to_options($cf['option_values'], true);
349
+				$option_values = geodir_string_values_to_options($cf['option_values'], true);
350 350
 
351
-                if (!empty($option_values)) {
352
-                    foreach ($option_values as $option_value) {
353
-                        if (empty($option_value['optgroup'])) {
354
-                            ?>
351
+				if (!empty($option_values)) {
352
+					foreach ($option_values as $option_value) {
353
+						if (empty($option_value['optgroup'])) {
354
+							?>
355 355
                             <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span>
356 356
                             <?php
357
-                        }
358
-                    }
359
-                }
360
-            }
361
-            ?>
357
+						}
358
+					}
359
+				}
360
+			}
361
+			?>
362 362
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
363 363
             <?php if ($cf['is_required']) { ?>
364 364
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
         </div>
367 367
 
368 368
         <?php
369
-        $html = ob_get_clean();
370
-    }
369
+		$html = ob_get_clean();
370
+	}
371 371
 
372
-    return $html;
372
+	return $html;
373 373
 }
374 374
 add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2);
375 375
 
@@ -385,46 +385,46 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function geodir_cfi_checkbox($html,$cf){
387 387
 
388
-    $html_var = $cf['htmlvar_name'];
388
+	$html_var = $cf['htmlvar_name'];
389 389
 
390
-    // Check if there is a custom field specific filter.
391
-    if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
392
-        /**
393
-         * Filter the checkbox html by individual custom field.
394
-         *
395
-         * @param string $html The html to filter.
396
-         * @param array $cf The custom field array.
397
-         * @since 1.6.6
398
-         */
399
-        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
400
-    }
390
+	// Check if there is a custom field specific filter.
391
+	if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
392
+		/**
393
+		 * Filter the checkbox html by individual custom field.
394
+		 *
395
+		 * @param string $html The html to filter.
396
+		 * @param array $cf The custom field array.
397
+		 * @since 1.6.6
398
+		 */
399
+		$html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
400
+	}
401 401
 
402
-    // If no html then we run the standard output.
403
-    if(empty($html)) {
402
+	// If no html then we run the standard output.
403
+	if(empty($html)) {
404 404
 
405
-        ob_start(); // Start  buffering;
406
-        $value = geodir_get_cf_value($cf);
405
+		ob_start(); // Start  buffering;
406
+		$value = geodir_get_cf_value($cf);
407 407
 
408 408
 
409
-        if ($value == '' && $cf['default']) {
410
-            $value = '1';
411
-        }
412
-        ?>
409
+		if ($value == '' && $cf['default']) {
410
+			$value = '1';
411
+		}
412
+		?>
413 413
 
414 414
         <div id="<?php echo $cf['name'];?>_row"
415 415
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
416 416
             <label>
417 417
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
418
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
418
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
419 419
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
420 420
             </label>
421 421
             <?php if ($value != '1') {
422
-                $value = '0';
423
-            }?>
422
+				$value = '0';
423
+			}?>
424 424
             <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/>
425 425
             <input  <?php if ($value == '1') {
426
-                echo 'checked="checked"';
427
-            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
426
+				echo 'checked="checked"';
427
+			}?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
428 428
                  onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/>
429 429
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
430 430
             <?php if ($cf['is_required']) { ?>
@@ -433,10 +433,10 @@  discard block
 block discarded – undo
433 433
         </div>
434 434
 
435 435
         <?php
436
-        $html = ob_get_clean();
437
-    }
436
+		$html = ob_get_clean();
437
+	}
438 438
 
439
-    return $html;
439
+	return $html;
440 440
 }
441 441
 add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2);
442 442
 
@@ -452,52 +452,52 @@  discard block
 block discarded – undo
452 452
  */
453 453
 function geodir_cfi_textarea($html,$cf){
454 454
 
455
-    $html_var = $cf['htmlvar_name'];
455
+	$html_var = $cf['htmlvar_name'];
456 456
 
457
-    // Check if there is a custom field specific filter.
458
-    if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
459
-        /**
460
-         * Filter the textarea html by individual custom field.
461
-         *
462
-         * @param string $html The html to filter.
463
-         * @param array $cf The custom field array.
464
-         * @since 1.6.6
465
-         */
466
-        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
467
-    }
457
+	// Check if there is a custom field specific filter.
458
+	if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
459
+		/**
460
+		 * Filter the textarea html by individual custom field.
461
+		 *
462
+		 * @param string $html The html to filter.
463
+		 * @param array $cf The custom field array.
464
+		 * @since 1.6.6
465
+		 */
466
+		$html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
467
+	}
468 468
 
469
-    // If no html then we run the standard output.
470
-    if(empty($html)) {
469
+	// If no html then we run the standard output.
470
+	if(empty($html)) {
471 471
 
472
-        ob_start(); // Start  buffering;
473
-        $value = geodir_get_cf_value($cf);
472
+		ob_start(); // Start  buffering;
473
+		$value = geodir_get_cf_value($cf);
474 474
 
475
-        $extra_fields = unserialize($cf['extra_fields']);
476
-        ?>
475
+		$extra_fields = unserialize($cf['extra_fields']);
476
+		?>
477 477
 
478 478
         <div id="<?php echo $cf['name'];?>_row"
479 479
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
480 480
             <label>
481 481
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
482
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
482
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
483 483
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
484 484
             </label><?php
485 485
 
486 486
 
487
-            if (is_array($extra_fields) && in_array('1', $extra_fields)) {
487
+			if (is_array($extra_fields) && in_array('1', $extra_fields)) {
488 488
 
489
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
489
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
490 490
 
491 491
             <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor">
492 492
                 <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?>
493 493
                 </div><?php
494 494
 
495
-            } else {
495
+			} else {
496 496
 
497
-                ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
497
+				?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
498 498
                             id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php
499 499
 
500
-            }?>
500
+			}?>
501 501
 
502 502
 
503 503
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
@@ -507,10 +507,10 @@  discard block
 block discarded – undo
507 507
         </div>
508 508
 
509 509
         <?php
510
-        $html = ob_get_clean();
511
-    }
510
+		$html = ob_get_clean();
511
+	}
512 512
 
513
-    return $html;
513
+	return $html;
514 514
 }
515 515
 add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2);
516 516
 
@@ -526,53 +526,53 @@  discard block
 block discarded – undo
526 526
  */
527 527
 function geodir_cfi_select($html,$cf){
528 528
 
529
-    $html_var = $cf['htmlvar_name'];
529
+	$html_var = $cf['htmlvar_name'];
530 530
 
531
-    // Check if there is a custom field specific filter.
532
-    if(has_filter("geodir_custom_field_input_select_{$html_var}")){
533
-        /**
534
-         * Filter the select html by individual custom field.
535
-         *
536
-         * @param string $html The html to filter.
537
-         * @param array $cf The custom field array.
538
-         * @since 1.6.6
539
-         */
540
-        $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
541
-    }
531
+	// Check if there is a custom field specific filter.
532
+	if(has_filter("geodir_custom_field_input_select_{$html_var}")){
533
+		/**
534
+		 * Filter the select html by individual custom field.
535
+		 *
536
+		 * @param string $html The html to filter.
537
+		 * @param array $cf The custom field array.
538
+		 * @since 1.6.6
539
+		 */
540
+		$html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
541
+	}
542 542
 
543
-    // If no html then we run the standard output.
544
-    if(empty($html)) {
543
+	// If no html then we run the standard output.
544
+	if(empty($html)) {
545 545
 
546
-        ob_start(); // Start  buffering;
547
-        $value = geodir_get_cf_value($cf);
546
+		ob_start(); // Start  buffering;
547
+		$value = geodir_get_cf_value($cf);
548 548
 
549
-        ?>
549
+		?>
550 550
         <div id="<?php echo $cf['name'];?>_row"
551 551
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
552 552
             <label>
553 553
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
554
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
554
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
555 555
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
556 556
             </label>
557 557
             <?php
558
-            $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
559
-            $select_options = '';
560
-            if (!empty($option_values_arr)) {
561
-                foreach ($option_values_arr as $option_row) {
562
-                    if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
563
-                        $option_label = isset($option_row['label']) ? $option_row['label'] : '';
564
-
565
-                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
566
-                    } else {
567
-                        $option_label = isset($option_row['label']) ? $option_row['label'] : '';
568
-                        $option_value = isset($option_row['value']) ? $option_row['value'] : '';
569
-                        $selected = $option_value == $value ? 'selected="selected"' : '';
570
-
571
-                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
572
-                    }
573
-                }
574
-            }
575
-            ?>
558
+			$option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
559
+			$select_options = '';
560
+			if (!empty($option_values_arr)) {
561
+				foreach ($option_values_arr as $option_row) {
562
+					if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
563
+						$option_label = isset($option_row['label']) ? $option_row['label'] : '';
564
+
565
+						$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
566
+					} else {
567
+						$option_label = isset($option_row['label']) ? $option_row['label'] : '';
568
+						$option_value = isset($option_row['value']) ? $option_row['value'] : '';
569
+						$selected = $option_value == $value ? 'selected="selected"' : '';
570
+
571
+						$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
572
+					}
573
+				}
574
+			}
575
+			?>
576 576
             <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
577 577
                     class="geodir_textfield textfield_x chosen_select"
578 578
                     data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
@@ -584,10 +584,10 @@  discard block
 block discarded – undo
584 584
         </div>
585 585
 
586 586
         <?php
587
-        $html = ob_get_clean();
588
-    }
587
+		$html = ob_get_clean();
588
+	}
589 589
 
590
-    return $html;
590
+	return $html;
591 591
 }
592 592
 add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2);
593 593
 
@@ -603,36 +603,36 @@  discard block
 block discarded – undo
603 603
  */
604 604
 function geodir_cfi_multiselect($html,$cf){
605 605
 
606
-    $html_var = $cf['htmlvar_name'];
607
-
608
-    // Check if there is a custom field specific filter.
609
-    if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
610
-        /**
611
-         * Filter the multiselect html by individual custom field.
612
-         *
613
-         * @param string $html The html to filter.
614
-         * @param array $cf The custom field array.
615
-         * @since 1.6.6
616
-         */
617
-        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
618
-    }
619
-
620
-    // If no html then we run the standard output.
621
-    if(empty($html)) {
622
-
623
-        ob_start(); // Start  buffering;
624
-        $value = geodir_get_cf_value($cf);
625
-
626
-        $multi_display = 'select';
627
-        if (!empty($cf['extra_fields'])) {
628
-            $multi_display = unserialize($cf['extra_fields']);
629
-        }
630
-        ?>
606
+	$html_var = $cf['htmlvar_name'];
607
+
608
+	// Check if there is a custom field specific filter.
609
+	if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
610
+		/**
611
+		 * Filter the multiselect html by individual custom field.
612
+		 *
613
+		 * @param string $html The html to filter.
614
+		 * @param array $cf The custom field array.
615
+		 * @since 1.6.6
616
+		 */
617
+		$html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
618
+	}
619
+
620
+	// If no html then we run the standard output.
621
+	if(empty($html)) {
622
+
623
+		ob_start(); // Start  buffering;
624
+		$value = geodir_get_cf_value($cf);
625
+
626
+		$multi_display = 'select';
627
+		if (!empty($cf['extra_fields'])) {
628
+			$multi_display = unserialize($cf['extra_fields']);
629
+		}
630
+		?>
631 631
         <div id="<?php echo $cf['name']; ?>_row"
632 632
              class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
633 633
             <label>
634 634
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
635
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
635
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
636 636
                 <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
637 637
             </label>
638 638
             <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/>
@@ -643,55 +643,55 @@  discard block
 block discarded – undo
643 643
                         data-placeholder="<?php _e('Select', 'geodirectory'); ?>"
644 644
                         option-ajaxchosen="false">
645 645
                     <?php
646
-                    } else {
647
-                        echo '<ul class="gd_multi_choice">';
648
-                    }
649
-
650
-                    $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
651
-                    $select_options = '';
652
-                    if (!empty($option_values_arr)) {
653
-                        foreach ($option_values_arr as $option_row) {
654
-                            if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
655
-                                $option_label = isset($option_row['label']) ? $option_row['label'] : '';
656
-
657
-                                if ($multi_display == 'select') {
658
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
659
-                                } else {
660
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
661
-                                }
662
-                            } else {
663
-                                $option_label = isset($option_row['label']) ? $option_row['label'] : '';
664
-                                $option_value = isset($option_row['value']) ? $option_row['value'] : '';
665
-                                $selected = $option_value == $value ? 'selected="selected"' : '';
666
-                                $selected = '';
667
-                                $checked = '';
668
-
669
-                                if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
670
-                                    if (!is_array($value)) {
671
-                                        $value_array = explode(',', $value);
672
-                                    } else {
673
-                                        $value_array = $value;
674
-                                    }
675
-
676
-                                    if (is_array($value_array)) {
677
-                                        if (in_array($option_value, $value_array)) {
678
-                                            $selected = 'selected="selected"';
679
-                                            $checked = 'checked="checked"';
680
-                                        }
681
-                                    }
682
-                                }
683
-
684
-                                if ($multi_display == 'select') {
685
-                                    $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
686
-                                } else {
687
-                                    $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
688
-                                }
689
-                            }
690
-                        }
691
-                    }
692
-                    echo $select_options;
693
-
694
-                    if ($multi_display == 'select') { ?></select></div>
646
+					} else {
647
+						echo '<ul class="gd_multi_choice">';
648
+					}
649
+
650
+					$option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
651
+					$select_options = '';
652
+					if (!empty($option_values_arr)) {
653
+						foreach ($option_values_arr as $option_row) {
654
+							if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
655
+								$option_label = isset($option_row['label']) ? $option_row['label'] : '';
656
+
657
+								if ($multi_display == 'select') {
658
+									$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
659
+								} else {
660
+									$select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
661
+								}
662
+							} else {
663
+								$option_label = isset($option_row['label']) ? $option_row['label'] : '';
664
+								$option_value = isset($option_row['value']) ? $option_row['value'] : '';
665
+								$selected = $option_value == $value ? 'selected="selected"' : '';
666
+								$selected = '';
667
+								$checked = '';
668
+
669
+								if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
670
+									if (!is_array($value)) {
671
+										$value_array = explode(',', $value);
672
+									} else {
673
+										$value_array = $value;
674
+									}
675
+
676
+									if (is_array($value_array)) {
677
+										if (in_array($option_value, $value_array)) {
678
+											$selected = 'selected="selected"';
679
+											$checked = 'checked="checked"';
680
+										}
681
+									}
682
+								}
683
+
684
+								if ($multi_display == 'select') {
685
+									$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
686
+								} else {
687
+									$select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
688
+								}
689
+							}
690
+						}
691
+					}
692
+					echo $select_options;
693
+
694
+					if ($multi_display == 'select') { ?></select></div>
695 695
         <?php } else { ?></ul><?php } ?>
696 696
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
697 697
             <?php if ($cf['is_required']) { ?>
@@ -699,10 +699,10 @@  discard block
 block discarded – undo
699 699
             <?php } ?>
700 700
         </div>
701 701
         <?php
702
-        $html = ob_get_clean();
703
-    }
702
+		$html = ob_get_clean();
703
+	}
704 704
 
705
-    return $html;
705
+	return $html;
706 706
 }
707 707
 add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2);
708 708
 
@@ -718,32 +718,32 @@  discard block
 block discarded – undo
718 718
  */
719 719
 function geodir_cfi_html($html,$cf){
720 720
 
721
-    $html_var = $cf['htmlvar_name'];
721
+	$html_var = $cf['htmlvar_name'];
722 722
 
723
-    // Check if there is a custom field specific filter.
724
-    if(has_filter("geodir_custom_field_input_html_{$html_var}")){
725
-        /**
726
-         * Filter the html html by individual custom field.
727
-         *
728
-         * @param string $html The html to filter.
729
-         * @param array $cf The custom field array.
730
-         * @since 1.6.6
731
-         */
732
-        $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
733
-    }
723
+	// Check if there is a custom field specific filter.
724
+	if(has_filter("geodir_custom_field_input_html_{$html_var}")){
725
+		/**
726
+		 * Filter the html html by individual custom field.
727
+		 *
728
+		 * @param string $html The html to filter.
729
+		 * @param array $cf The custom field array.
730
+		 * @since 1.6.6
731
+		 */
732
+		$html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
733
+	}
734 734
 
735
-    // If no html then we run the standard output.
736
-    if(empty($html)) {
735
+	// If no html then we run the standard output.
736
+	if(empty($html)) {
737 737
 
738
-        ob_start(); // Start  buffering;
739
-        $value = geodir_get_cf_value($cf);
740
-        ?>
738
+		ob_start(); // Start  buffering;
739
+		$value = geodir_get_cf_value($cf);
740
+		?>
741 741
 
742 742
         <div id="<?php echo $cf['name']; ?>_row"
743 743
              class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
744 744
             <label>
745 745
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
746
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
746
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
747 747
                 <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
748 748
             </label>
749 749
 
@@ -761,10 +761,10 @@  discard block
 block discarded – undo
761 761
         </div>
762 762
 
763 763
         <?php
764
-        $html = ob_get_clean();
765
-    }
764
+		$html = ob_get_clean();
765
+	}
766 766
 
767
-    return $html;
767
+	return $html;
768 768
 }
769 769
 add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2);
770 770
 
@@ -781,68 +781,68 @@  discard block
 block discarded – undo
781 781
  */
782 782
 function geodir_cfi_datepicker($html,$cf){
783 783
 
784
-    $html_var = $cf['htmlvar_name'];
784
+	$html_var = $cf['htmlvar_name'];
785 785
 
786
-    // Check if there is a custom field specific filter.
787
-    if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
788
-        /**
789
-         * Filter the datepicker html by individual custom field.
790
-         *
791
-         * @param string $html The html to filter.
792
-         * @param array $cf The custom field array.
793
-         * @since 1.6.6
794
-         */
795
-        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
796
-    }
786
+	// Check if there is a custom field specific filter.
787
+	if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
788
+		/**
789
+		 * Filter the datepicker html by individual custom field.
790
+		 *
791
+		 * @param string $html The html to filter.
792
+		 * @param array $cf The custom field array.
793
+		 * @since 1.6.6
794
+		 */
795
+		$html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
796
+	}
797 797
 
798
-    // If no html then we run the standard output.
799
-    if(empty($html)) {
798
+	// If no html then we run the standard output.
799
+	if(empty($html)) {
800 800
 
801
-        ob_start(); // Start  buffering;
802
-        $value = geodir_get_cf_value($cf);
801
+		ob_start(); // Start  buffering;
802
+		$value = geodir_get_cf_value($cf);
803 803
 
804
-        $extra_fields = unserialize($cf['extra_fields']);
805
-        $name = $cf['name'];
804
+		$extra_fields = unserialize($cf['extra_fields']);
805
+		$name = $cf['name'];
806 806
 
807
-        if ($extra_fields['date_format'] == '')
808
-            $extra_fields['date_format'] = 'yy-mm-dd';
807
+		if ($extra_fields['date_format'] == '')
808
+			$extra_fields['date_format'] = 'yy-mm-dd';
809 809
 
810
-        $date_format = $extra_fields['date_format'];
811
-        $jquery_date_format  = $date_format;
810
+		$date_format = $extra_fields['date_format'];
811
+		$jquery_date_format  = $date_format;
812 812
 
813 813
 
814
-        // check if we need to change the format or not
815
-        $date_format_len = strlen(str_replace(' ', '', $date_format));
816
-        if($date_format_len>5){// if greater then 5 then it's the old style format.
814
+		// check if we need to change the format or not
815
+		$date_format_len = strlen(str_replace(' ', '', $date_format));
816
+		if($date_format_len>5){// if greater then 5 then it's the old style format.
817 817
 
818
-            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
819
-            $replace = array('d','j','l','m','n','F','Y');//PHP date format
818
+			$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
819
+			$replace = array('d','j','l','m','n','F','Y');//PHP date format
820 820
 
821
-            $date_format = str_replace($search, $replace, $date_format);
822
-        }else{
823
-            $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
824
-        }
821
+			$date_format = str_replace($search, $replace, $date_format);
822
+		}else{
823
+			$jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
824
+		}
825 825
 
826
-        if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
827
-        if($value && !isset($_REQUEST['backandedit'])) {
828
-            //$time = strtotime($value);
829
-            //$value = date_i18n($date_format, $time);
830
-        }
831
-        $value = geodir_date($value, 'Y-m-d', $date_format);
826
+		if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
827
+		if($value && !isset($_REQUEST['backandedit'])) {
828
+			//$time = strtotime($value);
829
+			//$value = date_i18n($date_format, $time);
830
+		}
831
+		$value = geodir_date($value, 'Y-m-d', $date_format);
832 832
 
833
-        ?>
833
+		?>
834 834
         <script type="text/javascript">
835 835
 
836 836
             jQuery(function () {
837 837
 
838 838
                 jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php
839
-                    /**
840
-                     * Used to add extra option to datepicker per custom field.
841
-                     *
842
-                     * @since 1.5.7
843
-                     * @param string $name The custom field name.
844
-                     */
845
-                    echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
839
+					/**
840
+					 * Used to add extra option to datepicker per custom field.
841
+					 *
842
+					 * @since 1.5.7
843
+					 * @param string $name The custom field name.
844
+					 */
845
+					echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
846 846
 
847 847
                 jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
848 848
 
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
             <label>
859 859
 
860 860
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
861
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
861
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
862 862
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
863 863
             </label>
864 864
 
@@ -872,10 +872,10 @@  discard block
 block discarded – undo
872 872
         </div>
873 873
 
874 874
         <?php
875
-        $html = ob_get_clean();
876
-    }
875
+		$html = ob_get_clean();
876
+	}
877 877
 
878
-    return $html;
878
+	return $html;
879 879
 }
880 880
 add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2);
881 881
 
@@ -891,31 +891,31 @@  discard block
 block discarded – undo
891 891
  */
892 892
 function geodir_cfi_time($html,$cf){
893 893
 
894
-    $html_var = $cf['htmlvar_name'];
894
+	$html_var = $cf['htmlvar_name'];
895 895
 
896
-    // Check if there is a custom field specific filter.
897
-    if(has_filter("geodir_custom_field_input_time_{$html_var}")){
898
-        /**
899
-         * Filter the time html by individual custom field.
900
-         *
901
-         * @param string $html The html to filter.
902
-         * @param array $cf The custom field array.
903
-         * @since 1.6.6
904
-         */
905
-        $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
906
-    }
896
+	// Check if there is a custom field specific filter.
897
+	if(has_filter("geodir_custom_field_input_time_{$html_var}")){
898
+		/**
899
+		 * Filter the time html by individual custom field.
900
+		 *
901
+		 * @param string $html The html to filter.
902
+		 * @param array $cf The custom field array.
903
+		 * @since 1.6.6
904
+		 */
905
+		$html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
906
+	}
907 907
 
908
-    // If no html then we run the standard output.
909
-    if(empty($html)) {
908
+	// If no html then we run the standard output.
909
+	if(empty($html)) {
910 910
 
911
-        ob_start(); // Start  buffering;
912
-        $value = geodir_get_cf_value($cf);
911
+		ob_start(); // Start  buffering;
912
+		$value = geodir_get_cf_value($cf);
913 913
 
914
-        $name = $cf['name'];
914
+		$name = $cf['name'];
915 915
 
916
-        if ($value != '')
917
-            $value = date('H:i', strtotime($value));
918
-        ?>
916
+		if ($value != '')
917
+			$value = date('H:i', strtotime($value));
918
+		?>
919 919
         <script type="text/javascript">
920 920
             jQuery(document).ready(function () {
921 921
 
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
             <label>
932 932
 
933 933
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
934
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
934
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
935 935
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
936 936
             </label>
937 937
             <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
@@ -943,10 +943,10 @@  discard block
 block discarded – undo
943 943
             <?php } ?>
944 944
         </div>
945 945
         <?php
946
-        $html = ob_get_clean();
947
-    }
946
+		$html = ob_get_clean();
947
+	}
948 948
 
949
-    return $html;
949
+	return $html;
950 950
 }
951 951
 add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2);
952 952
 
@@ -962,100 +962,100 @@  discard block
 block discarded – undo
962 962
  */
963 963
 function geodir_cfi_address($html,$cf){
964 964
 
965
-    $html_var = $cf['htmlvar_name'];
966
-
967
-    // Check if there is a custom field specific filter.
968
-    if(has_filter("geodir_custom_field_input_address_{$html_var}")){
969
-        /**
970
-         * Filter the address html by individual custom field.
971
-         *
972
-         * @param string $html The html to filter.
973
-         * @param array $cf The custom field array.
974
-         * @since 1.6.6
975
-         */
976
-        $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
977
-    }
978
-
979
-    // If no html then we run the standard output.
980
-    if(empty($html)) {
981
-
982
-        global $gd_session;
983
-        ob_start(); // Start  buffering;
984
-        $value = geodir_get_cf_value($cf);
985
-        $name = $cf['name'];
986
-        $type = $cf['type'];
987
-        $admin_desc = $cf['desc'];
988
-        $is_required = $cf['is_required'];
989
-        $required_msg = $cf['required_msg'];
990
-        $site_title = $cf['site_title'];
991
-        $is_admin = $cf['is_admin'];
992
-        $extra_fields = unserialize($cf['extra_fields']);
993
-        $prefix = $name . '_';
994
-
995
-        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
996
-        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
997
-        ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
998
-        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
999
-
1000
-        $address = '';
1001
-        $zip = '';
1002
-        $mapview = '';
1003
-        $mapzoom = '';
1004
-        $lat = '';
1005
-        $lng = '';
1006
-
1007
-        if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1008
-            $post = $gd_ses_listing;
1009
-            $address = $post[$prefix . 'address'];
1010
-            $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1011
-            $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1012
-            $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1013
-            $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1014
-            $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1015
-        } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1016
-            $post_info = (array)$post_info;
1017
-
1018
-            $address = $post_info[$prefix . 'address'];
1019
-            $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1020
-            $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1021
-            $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1022
-            $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1023
-            $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1024
-        }
1025
-
1026
-        $location = geodir_get_default_location();
1027
-        if (empty($city)) $city = isset($location->city) ? $location->city : '';
1028
-        if (empty($region)) $region = isset($location->region) ? $location->region : '';
1029
-        if (empty($country)) $country = isset($location->country) ? $location->country : '';
1030
-
1031
-        $lat_lng_blank = false;
1032
-        if (empty($lat) && empty($lng)) {
1033
-            $lat_lng_blank = true;
1034
-        }
1035
-
1036
-        if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1037
-        if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1038
-
1039
-        /**
1040
-         * Filter the default latitude.
1041
-         *
1042
-         * @since 1.0.0
1043
-         *
1044
-         * @param float $lat Default latitude.
1045
-         * @param bool $is_admin For admin use only?.
1046
-         */
1047
-        $lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1048
-        /**
1049
-         * Filter the default longitude.
1050
-         *
1051
-         * @since 1.0.0
1052
-         *
1053
-         * @param float $lat Default longitude.
1054
-         * @param bool $is_admin For admin use only?.
1055
-         */
1056
-        $lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1057
-
1058
-        ?>
965
+	$html_var = $cf['htmlvar_name'];
966
+
967
+	// Check if there is a custom field specific filter.
968
+	if(has_filter("geodir_custom_field_input_address_{$html_var}")){
969
+		/**
970
+		 * Filter the address html by individual custom field.
971
+		 *
972
+		 * @param string $html The html to filter.
973
+		 * @param array $cf The custom field array.
974
+		 * @since 1.6.6
975
+		 */
976
+		$html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
977
+	}
978
+
979
+	// If no html then we run the standard output.
980
+	if(empty($html)) {
981
+
982
+		global $gd_session;
983
+		ob_start(); // Start  buffering;
984
+		$value = geodir_get_cf_value($cf);
985
+		$name = $cf['name'];
986
+		$type = $cf['type'];
987
+		$admin_desc = $cf['desc'];
988
+		$is_required = $cf['is_required'];
989
+		$required_msg = $cf['required_msg'];
990
+		$site_title = $cf['site_title'];
991
+		$is_admin = $cf['is_admin'];
992
+		$extra_fields = unserialize($cf['extra_fields']);
993
+		$prefix = $name . '_';
994
+
995
+		($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
996
+		($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
997
+		($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
998
+		($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
999
+
1000
+		$address = '';
1001
+		$zip = '';
1002
+		$mapview = '';
1003
+		$mapzoom = '';
1004
+		$lat = '';
1005
+		$lng = '';
1006
+
1007
+		if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1008
+			$post = $gd_ses_listing;
1009
+			$address = $post[$prefix . 'address'];
1010
+			$zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1011
+			$lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1012
+			$lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1013
+			$mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1014
+			$mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1015
+		} else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1016
+			$post_info = (array)$post_info;
1017
+
1018
+			$address = $post_info[$prefix . 'address'];
1019
+			$zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1020
+			$lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1021
+			$lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1022
+			$mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1023
+			$mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1024
+		}
1025
+
1026
+		$location = geodir_get_default_location();
1027
+		if (empty($city)) $city = isset($location->city) ? $location->city : '';
1028
+		if (empty($region)) $region = isset($location->region) ? $location->region : '';
1029
+		if (empty($country)) $country = isset($location->country) ? $location->country : '';
1030
+
1031
+		$lat_lng_blank = false;
1032
+		if (empty($lat) && empty($lng)) {
1033
+			$lat_lng_blank = true;
1034
+		}
1035
+
1036
+		if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1037
+		if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1038
+
1039
+		/**
1040
+		 * Filter the default latitude.
1041
+		 *
1042
+		 * @since 1.0.0
1043
+		 *
1044
+		 * @param float $lat Default latitude.
1045
+		 * @param bool $is_admin For admin use only?.
1046
+		 */
1047
+		$lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1048
+		/**
1049
+		 * Filter the default longitude.
1050
+		 *
1051
+		 * @since 1.0.0
1052
+		 *
1053
+		 * @param float $lat Default longitude.
1054
+		 * @param bool $is_admin For admin use only?.
1055
+		 */
1056
+		$lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1057
+
1058
+		?>
1059 1059
 
1060 1060
         <div id="geodir_<?php echo $prefix . 'address';?>_row"
1061 1061
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
@@ -1074,17 +1074,17 @@  discard block
 block discarded – undo
1074 1074
 
1075 1075
 
1076 1076
         <?php
1077
-        /**
1078
-         * Called after the address input on the add listings.
1079
-         *
1080
-         * This is used by the location manage to add further locations info etc.
1081
-         *
1082
-         * @since 1.0.0
1083
-         * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}.
1084
-         */
1085
-        do_action('geodir_address_extra_listing_fields', $cf);
1086
-
1087
-        if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1077
+		/**
1078
+		 * Called after the address input on the add listings.
1079
+		 *
1080
+		 * This is used by the location manage to add further locations info etc.
1081
+		 *
1082
+		 * @since 1.0.0
1083
+		 * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}.
1084
+		 */
1085
+		do_action('geodir_address_extra_listing_fields', $cf);
1086
+
1087
+		if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1088 1088
 
1089 1089
             <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1090 1090
                  class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details">
@@ -1105,22 +1105,22 @@  discard block
 block discarded – undo
1105 1105
 
1106 1106
             <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1107 1107
                 <?php
1108
-                /**
1109
-                 * Contains add listing page map functions.
1110
-                 *
1111
-                 * @since 1.0.0
1112
-                 */
1113
-                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1114
-                if ($lat_lng_blank) {
1115
-                    $lat = '';
1116
-                    $lng = '';
1117
-                }
1118
-                ?>
1108
+				/**
1109
+				 * Contains add listing page map functions.
1110
+				 *
1111
+				 * @since 1.0.0
1112
+				 */
1113
+				include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1114
+				if ($lat_lng_blank) {
1115
+					$lat = '';
1116
+					$lng = '';
1117
+				}
1118
+				?>
1119 1119
                 <span class="geodir_message_note"><?php echo GET_MAP_MSG; ?></span>
1120 1120
             </div>
1121 1121
             <?php
1122
-            /* show lat lng */
1123
-            $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1122
+			/* show lat lng */
1123
+			$style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1124 1124
             <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1125 1125
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1126 1126
                 <label>
@@ -1161,27 +1161,27 @@  discard block
 block discarded – undo
1161 1161
                                                             class="gd-checkbox"
1162 1162
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1163 1163
                                                             id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1164
-                            echo 'checked="checked"';
1165
-                        } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1164
+							echo 'checked="checked"';
1165
+						} ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1166 1166
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1167 1167
                                                              class="gd-checkbox"
1168 1168
                                                              name="<?php echo $prefix . 'mapview'; ?>"
1169 1169
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1170
-                            echo 'checked="checked"';
1171
-                        } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1170
+							echo 'checked="checked"';
1171
+						} ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1172 1172
 
1173 1173
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1174 1174
                                                             class="gd-checkbox"
1175 1175
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1176 1176
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1177
-                            echo 'checked="checked"';
1178
-                        } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1177
+							echo 'checked="checked"';
1178
+						} ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1179 1179
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1180 1180
                                                             class="gd-checkbox"
1181 1181
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1182 1182
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1183
-                            echo 'checked="checked"';
1184
-                        } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1183
+							echo 'checked="checked"';
1184
+						} ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1185 1185
 
1186 1186
 
1187 1187
             </div>
@@ -1189,14 +1189,14 @@  discard block
 block discarded – undo
1189 1189
 
1190 1190
         <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1191 1191
             <input type="hidden" value="<?php if (isset($mapzoom)) {
1192
-                echo esc_attr($mapzoom);
1193
-            } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1192
+				echo esc_attr($mapzoom);
1193
+			} ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1194 1194
         <?php }
1195 1195
 
1196
-        $html = ob_get_clean();
1197
-    }
1196
+		$html = ob_get_clean();
1197
+	}
1198 1198
 
1199
-    return $html;
1199
+	return $html;
1200 1200
 }
1201 1201
 add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2);
1202 1202
 
@@ -1213,137 +1213,137 @@  discard block
 block discarded – undo
1213 1213
  */
1214 1214
 function geodir_cfi_taxonomy($html,$cf){
1215 1215
 
1216
-    $html_var = $cf['htmlvar_name'];
1217
-
1218
-    // Check if there is a custom field specific filter.
1219
-    if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1220
-        /**
1221
-         * Filter the taxonomy html by individual custom field.
1222
-         *
1223
-         * @param string $html The html to filter.
1224
-         * @param array $cf The custom field array.
1225
-         * @since 1.6.6
1226
-         */
1227
-        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1228
-    }
1229
-
1230
-    // If no html then we run the standard output.
1231
-    if(empty($html)) {
1232
-
1233
-        ob_start(); // Start  buffering;
1234
-        $value = geodir_get_cf_value($cf);
1235
-
1236
-        $name = $cf['name'];
1237
-        $site_title = $cf['site_title'];
1238
-        $admin_desc = $cf['desc'];
1239
-        $is_required = $cf['is_required'];
1240
-        $is_admin = $cf['is_admin'];
1241
-        $required_msg = $cf['required_msg'];
1242
-
1243
-        if ($value == $cf['default']) {
1244
-            $value = '';
1245
-        } ?>
1216
+	$html_var = $cf['htmlvar_name'];
1217
+
1218
+	// Check if there is a custom field specific filter.
1219
+	if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1220
+		/**
1221
+		 * Filter the taxonomy html by individual custom field.
1222
+		 *
1223
+		 * @param string $html The html to filter.
1224
+		 * @param array $cf The custom field array.
1225
+		 * @since 1.6.6
1226
+		 */
1227
+		$html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1228
+	}
1229
+
1230
+	// If no html then we run the standard output.
1231
+	if(empty($html)) {
1232
+
1233
+		ob_start(); // Start  buffering;
1234
+		$value = geodir_get_cf_value($cf);
1235
+
1236
+		$name = $cf['name'];
1237
+		$site_title = $cf['site_title'];
1238
+		$admin_desc = $cf['desc'];
1239
+		$is_required = $cf['is_required'];
1240
+		$is_admin = $cf['is_admin'];
1241
+		$required_msg = $cf['required_msg'];
1242
+
1243
+		if ($value == $cf['default']) {
1244
+			$value = '';
1245
+		} ?>
1246 1246
         <div id="<?php echo $name;?>_row"
1247 1247
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1248 1248
             <label>
1249 1249
                 <?php $site_title = __($site_title, 'geodirectory');
1250
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1250
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1251 1251
                 <?php if ($is_required) echo '<span>*</span>';?>
1252 1252
             </label>
1253 1253
 
1254 1254
             <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1255 1255
                 <?php
1256
-                global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1256
+				global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1257 1257
 
1258
-                $exclude_cats = array();
1258
+				$exclude_cats = array();
1259 1259
 
1260
-                if ($is_admin == '1') {
1260
+				if ($is_admin == '1') {
1261 1261
 
1262
-                    $post_type = get_post_type();
1262
+					$post_type = get_post_type();
1263 1263
 
1264
-                    $package_info = array();
1264
+					$package_info = array();
1265 1265
 
1266
-                    $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1266
+					$package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1267 1267
 
1268
-                    if (!empty($package_info)) {
1268
+					if (!empty($package_info)) {
1269 1269
 
1270
-                        if (isset($package_info['cat']) && $package_info['cat'] != '') {
1270
+						if (isset($package_info['cat']) && $package_info['cat'] != '') {
1271 1271
 
1272
-                            $exclude_cats = explode(',', $package_info['cat']);
1272
+							$exclude_cats = explode(',', $package_info['cat']);
1273 1273
 
1274
-                        }
1275
-                    }
1276
-                }
1274
+						}
1275
+					}
1276
+				}
1277 1277
 
1278
-                $cat_display = unserialize($cf['extra_fields']);
1278
+				$cat_display = unserialize($cf['extra_fields']);
1279 1279
 
1280
-                if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
1280
+				if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
1281 1281
 
1282
-                    $post_cat = implode(",", $post_cat[$name]);
1282
+					$post_cat = implode(",", $post_cat[$name]);
1283 1283
 
1284
-                } else {
1285
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1286
-                        $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1287
-                }
1284
+				} else {
1285
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1286
+						$post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1287
+				}
1288 1288
 
1289 1289
 
1290
-                global $geodir_addon_list;
1291
-                if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1290
+				global $geodir_addon_list;
1291
+				if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1292 1292
 
1293
-                    $catadd_limit = $wpdb->get_var(
1294
-                        $wpdb->prepare(
1295
-                            "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1296
-                            array($package_id)
1297
-                        )
1298
-                    );
1293
+					$catadd_limit = $wpdb->get_var(
1294
+						$wpdb->prepare(
1295
+							"SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1296
+							array($package_id)
1297
+						)
1298
+					);
1299 1299
 
1300 1300
 
1301
-                } else {
1302
-                    $catadd_limit = 0;
1303
-                }
1301
+				} else {
1302
+					$catadd_limit = 0;
1303
+				}
1304 1304
 
1305 1305
 
1306
-                if ($cat_display != '' && $cat_display != 'ajax_chained') {
1306
+				if ($cat_display != '' && $cat_display != 'ajax_chained') {
1307 1307
 
1308
-                    $required_limit_msg = '';
1309
-                    if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1308
+					$required_limit_msg = '';
1309
+					if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1310 1310
 
1311
-                        $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1311
+						$required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1312 1312
 
1313
-                    } else {
1314
-                        $required_limit_msg = $required_msg;
1315
-                    }
1313
+					} else {
1314
+						$required_limit_msg = $required_msg;
1315
+					}
1316 1316
 
1317
-                    echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1317
+					echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1318 1318
 
1319 1319
 
1320
-                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
1320
+					if ($cat_display == 'select' || $cat_display == 'multiselect') {
1321 1321
 
1322
-                        $cat_display == '';
1323
-                        $multiple = '';
1324
-                        if ($cat_display == 'multiselect')
1325
-                            $multiple = 'multiple="multiple"';
1322
+						$cat_display == '';
1323
+						$multiple = '';
1324
+						if ($cat_display == 'multiselect')
1325
+							$multiple = 'multiple="multiple"';
1326 1326
 
1327
-                        echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1327
+						echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1328 1328
 
1329 1329
 
1330
-                        if ($cat_display == 'select')
1331
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1330
+						if ($cat_display == 'select')
1331
+							echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1332 1332
 
1333
-                    }
1333
+					}
1334 1334
 
1335
-                    echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1335
+					echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1336 1336
 
1337
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
1338
-                        echo '</select>';
1337
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
1338
+						echo '</select>';
1339 1339
 
1340
-                } else {
1340
+				} else {
1341 1341
 
1342
-                    echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
1342
+					echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
1343 1343
 
1344
-                }
1344
+				}
1345 1345
 
1346
-                ?>
1346
+				?>
1347 1347
             </div>
1348 1348
 
1349 1349
             <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
@@ -1353,10 +1353,10 @@  discard block
 block discarded – undo
1353 1353
         </div>
1354 1354
 
1355 1355
         <?php
1356
-        $html = ob_get_clean();
1357
-    }
1356
+		$html = ob_get_clean();
1357
+	}
1358 1358
 
1359
-    return $html;
1359
+	return $html;
1360 1360
 }
1361 1361
 add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2);
1362 1362
 
@@ -1372,74 +1372,74 @@  discard block
 block discarded – undo
1372 1372
  */
1373 1373
 function geodir_cfi_file($html,$cf){
1374 1374
 
1375
-    $html_var = $cf['htmlvar_name'];
1375
+	$html_var = $cf['htmlvar_name'];
1376 1376
 
1377
-    // Check if there is a custom field specific filter.
1378
-    if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1379
-        /**
1380
-         * Filter the file html by individual custom field.
1381
-         *
1382
-         * @param string $html The html to filter.
1383
-         * @param array $cf The custom field array.
1384
-         * @since 1.6.6
1385
-         */
1386
-        $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1387
-    }
1377
+	// Check if there is a custom field specific filter.
1378
+	if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1379
+		/**
1380
+		 * Filter the file html by individual custom field.
1381
+		 *
1382
+		 * @param string $html The html to filter.
1383
+		 * @param array $cf The custom field array.
1384
+		 * @since 1.6.6
1385
+		 */
1386
+		$html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1387
+	}
1388 1388
 
1389
-    // If no html then we run the standard output.
1390
-    if(empty($html)) {
1389
+	// If no html then we run the standard output.
1390
+	if(empty($html)) {
1391 1391
 
1392
-        ob_start(); // Start  buffering;
1393
-        $value = geodir_get_cf_value($cf);
1392
+		ob_start(); // Start  buffering;
1393
+		$value = geodir_get_cf_value($cf);
1394 1394
 
1395
-        $name = $cf['name'];
1396
-        $site_title = $cf['site_title'];
1397
-        $admin_desc = $cf['desc'];
1398
-        $is_required = $cf['is_required'];
1399
-        $required_msg = $cf['required_msg'];
1400
-        $extra_fields = unserialize($cf['extra_fields']);
1395
+		$name = $cf['name'];
1396
+		$site_title = $cf['site_title'];
1397
+		$admin_desc = $cf['desc'];
1398
+		$is_required = $cf['is_required'];
1399
+		$required_msg = $cf['required_msg'];
1400
+		$extra_fields = unserialize($cf['extra_fields']);
1401 1401
 
1402 1402
 
1403
-        // adjust values here
1404
-        $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
1403
+		// adjust values here
1404
+		$file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
1405 1405
 
1406
-        if ($value != '') {
1406
+		if ($value != '') {
1407 1407
 
1408
-            $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1408
+			$file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1409 1409
 
1410
-        } else
1411
-            $file_value = '';
1410
+		} else
1411
+			$file_value = '';
1412 1412
 
1413
-        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1414
-            $file_multiple = true; // allow multiple files upload
1415
-        else
1416
-            $file_multiple = false;
1413
+		if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1414
+			$file_multiple = true; // allow multiple files upload
1415
+		else
1416
+			$file_multiple = false;
1417 1417
 
1418
-        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1419
-            $file_image_limit = $extra_fields['image_limit'];
1420
-        else
1421
-            $file_image_limit = 1;
1418
+		if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1419
+			$file_image_limit = $extra_fields['image_limit'];
1420
+		else
1421
+			$file_image_limit = 1;
1422 1422
 
1423
-        $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1423
+		$file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1424 1424
 
1425
-        $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1425
+		$file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1426 1426
 
1427
-        if (!empty($file_value)) {
1428
-            $curImages = explode(',', $file_value);
1429
-            if (!empty($curImages))
1430
-                $file_totImg = count($curImages);
1431
-        }
1427
+		if (!empty($file_value)) {
1428
+			$curImages = explode(',', $file_value);
1429
+			if (!empty($curImages))
1430
+				$file_totImg = count($curImages);
1431
+		}
1432 1432
 
1433
-        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1434
-        $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1433
+		$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1434
+		$display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1435 1435
 
1436
-        ?>
1436
+		?>
1437 1437
         <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
1438 1438
 				 <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?>
1439 1439
 				 <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?>
1440 1440
 				 <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?>
1441 1441
 			</h5>   <?php */
1442
-        ?>
1442
+		?>
1443 1443
 
1444 1444
         <div id="<?php echo $name;?>_row"
1445 1445
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
@@ -1447,7 +1447,7 @@  discard block
 block discarded – undo
1447 1447
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1448 1448
                 <label
1449 1449
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1450
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1450
+					echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1451 1451
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1452 1452
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1453 1453
                        value="<?php echo esc_attr($file_value); ?>"/>
@@ -1459,17 +1459,17 @@  discard block
 block discarded – undo
1459 1459
                 <?php } ?>
1460 1460
                 <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
1461 1461
                        value="<?php if (isset($file_totImg)) {
1462
-                           echo esc_attr($file_totImg);
1463
-                       } else {
1464
-                           echo '0';
1465
-                       } ?>"/>
1462
+						   echo esc_attr($file_totImg);
1463
+					   } else {
1464
+						   echo '0';
1465
+					   } ?>"/>
1466 1466
 
1467 1467
                 <div style="float:left; width:55%;">
1468 1468
                     <div
1469 1469
                         class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
1470 1470
                         id="<?php echo $file_id; ?>plupload-upload-ui" style="float:left; width:30%;">
1471 1471
                         <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
1472
-                        ?>
1472
+						?>
1473 1473
                         <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
1474 1474
                                value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
1475 1475
                                class="geodir_button" style="margin-top:10px;"/>
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
                         style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;">
1489 1489
                     </div>
1490 1490
                     <?php /*?><span id="upload-msg" ><?php _e('Please drag &amp; drop the images to rearrange the order');?></span><?php */
1491
-                    ?>
1491
+					?>
1492 1492
 
1493 1493
                     <span id="<?php echo $file_id; ?>upload-error" style="display:none"></span>
1494 1494
 
@@ -1502,9 +1502,9 @@  discard block
 block discarded – undo
1502 1502
 
1503 1503
 
1504 1504
         <?php
1505
-        $html = ob_get_clean();
1506
-    }
1505
+		$html = ob_get_clean();
1506
+	}
1507 1507
 
1508
-    return $html;
1508
+	return $html;
1509 1509
 }
1510 1510
 add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2);
1511 1511
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_functions.php 4 patches
Doc Comments   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1345,6 +1345,9 @@  discard block
 block discarded – undo
1345 1345
 }
1346 1346
 
1347 1347
 
1348
+/**
1349
+ * @return string
1350
+ */
1348 1351
 function geodir_field_icon_proccess($cf){
1349 1352
 
1350 1353
 
@@ -1738,7 +1741,7 @@  discard block
 block discarded – undo
1738 1741
  * @global object $wpdb WordPress Database object.
1739 1742
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1740 1743
  * @param int $post_id The post ID.
1741
- * @return mixed Returns video.
1744
+ * @return string Returns video.
1742 1745
  */
1743 1746
 function geodir_get_video($post_id)
1744 1747
 {
@@ -1764,7 +1767,7 @@  discard block
 block discarded – undo
1764 1767
  * @global object $wpdb WordPress Database object.
1765 1768
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1766 1769
  * @param int $post_id The post ID.
1767
- * @return mixed Returns special offers.
1770
+ * @return string Returns special offers.
1768 1771
  */
1769 1772
 function geodir_get_special_offers($post_id)
1770 1773
 {
@@ -1788,7 +1791,7 @@  discard block
 block discarded – undo
1788 1791
      *
1789 1792
      * @since 1.0.0
1790 1793
      * @package GeoDirectory
1791
-     * @return mixed|void Returns max upload file size.
1794
+     * @return string|null Returns max upload file size.
1792 1795
      */
1793 1796
     function geodir_max_upload_size()
1794 1797
     {
@@ -2157,7 +2160,6 @@  discard block
 block discarded – undo
2157 2160
      * @param string $field_type The form field type.
2158 2161
      * @param object|int $result_str The custom field results object or row id.
2159 2162
      * @param string $field_ins_upd When set to "submit" displays form.
2160
-     * @param bool $default when set to true field will be for admin use only.
2161 2163
      */
2162 2164
     function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2163 2165
     {
Please login to merge, or discard this patch.
Indentation   +2133 added lines, -2133 removed lines patch added patch discarded remove patch
@@ -10,52 +10,52 @@  discard block
 block discarded – undo
10 10
 global $wpdb, $table_prefix;
11 11
 
12 12
 if (!function_exists('geodir_column_exist')) {
13
-    /**
14
-     * Check table column exist or not.
15
-     *
16
-     * @since 1.0.0
17
-     * @package GeoDirectory
18
-     * @global object $wpdb WordPress Database object.
19
-     * @param string $db The table name.
20
-     * @param string $column The column name.
21
-     * @return bool If column exists returns true. Otherwise false.
22
-     */
23
-    function geodir_column_exist($db, $column)
24
-    {
25
-        global $wpdb;
26
-        $exists = false;
27
-        $columns = $wpdb->get_col("show columns from $db");
28
-        foreach ($columns as $c) {
29
-            if ($c == $column) {
30
-                $exists = true;
31
-                break;
32
-            }
33
-        }
34
-        return $exists;
35
-    }
13
+	/**
14
+	 * Check table column exist or not.
15
+	 *
16
+	 * @since 1.0.0
17
+	 * @package GeoDirectory
18
+	 * @global object $wpdb WordPress Database object.
19
+	 * @param string $db The table name.
20
+	 * @param string $column The column name.
21
+	 * @return bool If column exists returns true. Otherwise false.
22
+	 */
23
+	function geodir_column_exist($db, $column)
24
+	{
25
+		global $wpdb;
26
+		$exists = false;
27
+		$columns = $wpdb->get_col("show columns from $db");
28
+		foreach ($columns as $c) {
29
+			if ($c == $column) {
30
+				$exists = true;
31
+				break;
32
+			}
33
+		}
34
+		return $exists;
35
+	}
36 36
 }
37 37
 
38 38
 if (!function_exists('geodir_add_column_if_not_exist')) {
39
-    /**
40
-     * Add column if table column not exist.
41
-     *
42
-     * @since 1.0.0
43
-     * @package GeoDirectory
44
-     * @global object $wpdb WordPress Database object.
45
-     * @param string $db The table name.
46
-     * @param string $column The column name.
47
-     * @param string $column_attr The column attributes.
48
-     */
49
-    function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50
-    {
51
-        global $wpdb;
52
-        $result = 0;// no rows affected
53
-        if (!geodir_column_exist($db, $column)) {
54
-            if (!empty($db) && !empty($column))
55
-                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
-        }
57
-        return $result;
58
-    }
39
+	/**
40
+	 * Add column if table column not exist.
41
+	 *
42
+	 * @since 1.0.0
43
+	 * @package GeoDirectory
44
+	 * @global object $wpdb WordPress Database object.
45
+	 * @param string $db The table name.
46
+	 * @param string $column The column name.
47
+	 * @param string $column_attr The column attributes.
48
+	 */
49
+	function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50
+	{
51
+		global $wpdb;
52
+		$result = 0;// no rows affected
53
+		if (!geodir_column_exist($db, $column)) {
54
+			if (!empty($db) && !empty($column))
55
+				$result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
+		}
57
+		return $result;
58
+	}
59 59
 }
60 60
 
61 61
 /**
@@ -72,705 +72,705 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function geodir_post_custom_fields($package_id = '', $default = 'all', $post_type = 'gd_place', $fields_location = 'none')
74 74
 {
75
-    global $wpdb, $geodir_post_custom_fields_cache;
76
-
77
-    $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
78
-
79
-    if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80
-        return $geodir_post_custom_fields_cache[$cache_stored];
81
-    }
82
-
83
-    $default_query = '';
84
-
85
-    if ($default == 'default')
86
-        $default_query .= " and is_admin IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query .= " and is_admin = '0' ";
89
-
90
-    if ($fields_location == 'none') {
91
-    } else{
92
-        $fields_location = esc_sql( $fields_location );
93
-        $default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
94
-    }
95
-
96
-    $post_meta_info = $wpdb->get_results(
97
-        $wpdb->prepare(
98
-            "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99
-            array($post_type)
100
-        )
101
-    );
102
-
103
-
104
-    $return_arr = array();
105
-    if ($post_meta_info) {
106
-
107
-        foreach ($post_meta_info as $post_meta_info_obj) {
108
-
109
-            $custom_fields = array(
110
-                "name" => $post_meta_info_obj->htmlvar_name,
111
-                "label" => $post_meta_info_obj->clabels,
112
-                "default" => $post_meta_info_obj->default_value,
113
-                "type" => $post_meta_info_obj->field_type,
114
-                "desc" => $post_meta_info_obj->admin_desc);
115
-
116
-            if ($post_meta_info_obj->field_type) {
117
-                $options = explode(',', $post_meta_info_obj->option_values);
118
-                $custom_fields["options"] = $options;
119
-            }
120
-
121
-            foreach ($post_meta_info_obj as $key => $val) {
122
-                $custom_fields[$key] = $val;
123
-            }
124
-
125
-            $pricearr = array();
126
-            $pricearr = explode(',', $post_meta_info_obj->packages);
127
-
128
-            if ($package_id != '' && in_array($package_id, $pricearr)) {
129
-                $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
130
-            } elseif ($package_id == '') {
131
-                $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
132
-            }
133
-        }
134
-    }
135
-    $geodir_post_custom_fields_cache[$cache_stored] = $return_arr;
136
-
137
-    if (has_filter('geodir_filter_geodir_post_custom_fields')) {
138
-        /**
139
-         * Filter the post custom fields array.
140
-         *
141
-         * @since 1.0.0
142
-         *
143
-         * @param array $return_arr Post custom fields array.
144
-         * @param int|string $package_id The package ID.
145
-         * @param string $post_type Optional. The wordpress post type.
146
-         * @param string $fields_location Optional. Where exactly are you going to place this custom fields?.
147
-         */
148
-        $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
149
-    }
150
-
151
-    return $return_arr;
75
+	global $wpdb, $geodir_post_custom_fields_cache;
76
+
77
+	$cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
78
+
79
+	if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80
+		return $geodir_post_custom_fields_cache[$cache_stored];
81
+	}
82
+
83
+	$default_query = '';
84
+
85
+	if ($default == 'default')
86
+		$default_query .= " and is_admin IN ('1') ";
87
+	elseif ($default == 'custom')
88
+		$default_query .= " and is_admin = '0' ";
89
+
90
+	if ($fields_location == 'none') {
91
+	} else{
92
+		$fields_location = esc_sql( $fields_location );
93
+		$default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
94
+	}
95
+
96
+	$post_meta_info = $wpdb->get_results(
97
+		$wpdb->prepare(
98
+			"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99
+			array($post_type)
100
+		)
101
+	);
102
+
103
+
104
+	$return_arr = array();
105
+	if ($post_meta_info) {
106
+
107
+		foreach ($post_meta_info as $post_meta_info_obj) {
108
+
109
+			$custom_fields = array(
110
+				"name" => $post_meta_info_obj->htmlvar_name,
111
+				"label" => $post_meta_info_obj->clabels,
112
+				"default" => $post_meta_info_obj->default_value,
113
+				"type" => $post_meta_info_obj->field_type,
114
+				"desc" => $post_meta_info_obj->admin_desc);
115
+
116
+			if ($post_meta_info_obj->field_type) {
117
+				$options = explode(',', $post_meta_info_obj->option_values);
118
+				$custom_fields["options"] = $options;
119
+			}
120
+
121
+			foreach ($post_meta_info_obj as $key => $val) {
122
+				$custom_fields[$key] = $val;
123
+			}
124
+
125
+			$pricearr = array();
126
+			$pricearr = explode(',', $post_meta_info_obj->packages);
127
+
128
+			if ($package_id != '' && in_array($package_id, $pricearr)) {
129
+				$return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
130
+			} elseif ($package_id == '') {
131
+				$return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
132
+			}
133
+		}
134
+	}
135
+	$geodir_post_custom_fields_cache[$cache_stored] = $return_arr;
136
+
137
+	if (has_filter('geodir_filter_geodir_post_custom_fields')) {
138
+		/**
139
+		 * Filter the post custom fields array.
140
+		 *
141
+		 * @since 1.0.0
142
+		 *
143
+		 * @param array $return_arr Post custom fields array.
144
+		 * @param int|string $package_id The package ID.
145
+		 * @param string $post_type Optional. The wordpress post type.
146
+		 * @param string $fields_location Optional. Where exactly are you going to place this custom fields?.
147
+		 */
148
+		$return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
149
+	}
150
+
151
+	return $return_arr;
152 152
 }
153 153
 
154
-    /**
155
-     * Adds admin html for custom fields.
156
-     *
157
-     * @since 1.0.0
158
-     * @package GeoDirectory
159
-     * @global object $wpdb WordPress Database object.
160
-     * @param string $field_type The form field type.
161
-     * @param object|int $result_str The custom field results object or row id.
162
-     * @param string $field_ins_upd When set to "submit" displays form.
163
-     * @param string $field_type_key The key of the custom field.
164
-     */
165
-    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
166
-    {
167
-        global $wpdb;
168
-        $cf = $result_str;
169
-        if (!is_object($cf)) {
170
-
171
-            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
172
-
173
-        } else {
174
-            $field_info = $cf;
175
-            $result_str = $cf->id;
176
-        }
177
-        /**
178
-         * Contains custom field html.
179
-         *
180
-         * @since 1.0.0
181
-         */
182
-        include('custom_field_html.php');
183
-
184
-    }
154
+	/**
155
+	 * Adds admin html for custom fields.
156
+	 *
157
+	 * @since 1.0.0
158
+	 * @package GeoDirectory
159
+	 * @global object $wpdb WordPress Database object.
160
+	 * @param string $field_type The form field type.
161
+	 * @param object|int $result_str The custom field results object or row id.
162
+	 * @param string $field_ins_upd When set to "submit" displays form.
163
+	 * @param string $field_type_key The key of the custom field.
164
+	 */
165
+	function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
166
+	{
167
+		global $wpdb;
168
+		$cf = $result_str;
169
+		if (!is_object($cf)) {
170
+
171
+			$field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
172
+
173
+		} else {
174
+			$field_info = $cf;
175
+			$result_str = $cf->id;
176
+		}
177
+		/**
178
+		 * Contains custom field html.
179
+		 *
180
+		 * @since 1.0.0
181
+		 */
182
+		include('custom_field_html.php');
183
+
184
+	}
185 185
 
186 186
 
187 187
 if (!function_exists('geodir_custom_field_delete')) {
188
-    /**
189
-     * Delete custom field using field id.
190
-     *
191
-     * @since 1.0.0
192
-     * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
193
-     * @package GeoDirectory
194
-     * @global object $wpdb WordPress Database object.
195
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
196
-     * @param string $field_id The custom field ID.
197
-     * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
198
-     */
199
-    function geodir_custom_field_delete($field_id = '') {
200
-        global $wpdb, $plugin_prefix;
201
-
202
-        if ($field_id != '') {
203
-            $cf = trim($field_id, '_');
204
-
205
-            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
-                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
207
-
208
-                $post_type = $field->post_type;
209
-                $htmlvar_name = $field->htmlvar_name;
210
-
211
-                if ($post_type != '' && $htmlvar_name != '') {
212
-                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
213
-                }
214
-
215
-                /**
216
-                 * Called after a custom field is deleted.
217
-                 *
218
-                 * @since 1.0.0
219
-                 * @param string $cf The fields ID.
220
-                 * @param string $field->htmlvar_name The html variable name for the field.
221
-                 * @param string $post_type The post type the field belongs to.
222
-                 */
223
-                do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224
-
225
-                if ($field->field_type == 'address') {
226
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
235
-                } else {
236
-                    if ($field->field_type != 'fieldset') {
237
-                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
238
-                    }
239
-                }
240
-
241
-                return $field_id;
242
-            } else
243
-                return 0;
244
-        } else
245
-            return 0;
246
-    }
188
+	/**
189
+	 * Delete custom field using field id.
190
+	 *
191
+	 * @since 1.0.0
192
+	 * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
193
+	 * @package GeoDirectory
194
+	 * @global object $wpdb WordPress Database object.
195
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
196
+	 * @param string $field_id The custom field ID.
197
+	 * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
198
+	 */
199
+	function geodir_custom_field_delete($field_id = '') {
200
+		global $wpdb, $plugin_prefix;
201
+
202
+		if ($field_id != '') {
203
+			$cf = trim($field_id, '_');
204
+
205
+			if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
+				$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
207
+
208
+				$post_type = $field->post_type;
209
+				$htmlvar_name = $field->htmlvar_name;
210
+
211
+				if ($post_type != '' && $htmlvar_name != '') {
212
+					$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
213
+				}
214
+
215
+				/**
216
+				 * Called after a custom field is deleted.
217
+				 *
218
+				 * @since 1.0.0
219
+				 * @param string $cf The fields ID.
220
+				 * @param string $field->htmlvar_name The html variable name for the field.
221
+				 * @param string $post_type The post type the field belongs to.
222
+				 */
223
+				do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224
+
225
+				if ($field->field_type == 'address') {
226
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
235
+				} else {
236
+					if ($field->field_type != 'fieldset') {
237
+						$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
238
+					}
239
+				}
240
+
241
+				return $field_id;
242
+			} else
243
+				return 0;
244
+		} else
245
+			return 0;
246
+	}
247 247
 }
248 248
 
249 249
 if (!function_exists('geodir_custom_field_save')) {
250
-    /**
251
-     * Save or Update custom fields into the database.
252
-     *
253
-     * @since 1.0.0
254
-     * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
255
-     * @package GeoDirectory
256
-     * @global object $wpdb WordPress Database object.
257
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
258
-     * @param array $request_field {
259
-     *    Attributes of the request field array.
260
-     *
261
-     *    @type string $action Ajax Action name. Default "geodir_ajax_action".
262
-     *    @type string $manage_field_type Field type Default "custom_fields".
263
-     *    @type string $create_field Create field Default "true".
264
-     *    @type string $field_ins_upd Field ins upd Default "submit".
265
-     *    @type string $_wpnonce WP nonce value.
266
-     *    @type string $listing_type Listing type Example "gd_place".
267
-     *    @type string $field_type Field type Example "radio".
268
-     *    @type string $field_id Field id Example "12".
269
-     *    @type string $data_type Data type Example "VARCHAR".
270
-     *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
271
-     *    @type array $show_on_pkg Package list to display this field.
272
-     *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
273
-     *    @type string $site_title Section title which you wish to display in frontend.
274
-     *    @type string $admin_desc Section description which will appear in frontend.
275
-     *    @type string $htmlvar_name Html variable name. This should be a unique name.
276
-     *    @type string $clabels Section Title which will appear in backend.
277
-     *    @type string $default_value The default value (for "link" this will be used as the link text).
278
-     *    @type string $sort_order The display order of this field in backend. e.g. 5.
279
-     *    @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.
280
-     *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
281
-     *    @type string $is_required Use "1" to set field as required.
282
-     *    @type string $required_msg Enter text for error message if field required and have not full fill requirment.
283
-     *    @type string $show_on_listing Want to show this on listing page?.
284
-     *    @type string $show_in What locations to show the custom field in.
285
-     *    @type string $show_on_detail Want to show this in More Info tab on detail page?.
286
-     *    @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes.
287
-     *    @type string $option_values Option Values should be separated by comma.
288
-     *    @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.
289
-     *    @type string $css_class Enter custom css class for field custom style.
290
-     *
291
-     * }
292
-     * @param bool $default Not yet implemented.
293
-     * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
-     */
295
-    function geodir_custom_field_save($request_field = array(), $default = false)
296
-    {
297
-
298
-        global $wpdb, $plugin_prefix;
299
-
300
-        $old_html_variable = '';
301
-
302
-        $data_type = trim($request_field['data_type']);
303
-
304
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
305
-
306
-        // some servers fail if a POST value is VARCHAR so we change it.
307
-        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
308
-            $request_field['data_type'] = 'VARCHAR';
309
-        }
310
-
311
-        $cf = trim($result_str, '_');
312
-
313
-
314
-        /*-------- check dublicate validation --------*/
315
-
316
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
317
-        $post_type = $request_field['listing_type'];
318
-
319
-        if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
320
-            $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
321
-        }
322
-
323
-        $check_html_variable = $wpdb->get_var(
324
-            $wpdb->prepare(
325
-                "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
326
-                array($cf, $cehhtmlvar_name, $post_type)
327
-            )
328
-        );
329
-
330
-
331
-        if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
332
-
333
-            if ($cf != '') {
334
-
335
-                $post_meta_info = $wpdb->get_row(
336
-                    $wpdb->prepare(
337
-                        "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
338
-                        array($cf)
339
-                    )
340
-                );
341
-
342
-            }
343
-
344
-            if (!empty($post_meta_info)) {
345
-                $post_val = $post_meta_info;
346
-                $old_html_variable = $post_val->htmlvar_name;
347
-
348
-            }
349
-
350
-
351
-
352
-            if ($post_type == '') $post_type = 'gd_place';
353
-
354
-
355
-            $detail_table = $plugin_prefix . $post_type . '_detail';
356
-
357
-            $admin_title = $request_field['admin_title'];
358
-            $site_title = $request_field['site_title'];
359
-            $data_type = $request_field['data_type'];
360
-            $field_type = $request_field['field_type'];
361
-            $field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type;
362
-            $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
363
-            $admin_desc = $request_field['admin_desc'];
364
-            $clabels = $request_field['clabels'];
365
-            $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
366
-            $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
367
-            $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
368
-            $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
369
-            $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
370
-            $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
371
-            $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
372
-            $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
373
-            $show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
374
-            $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
375
-            $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
376
-            $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
377
-            $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
378
-            $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
379
-            $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
380
-            $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
250
+	/**
251
+	 * Save or Update custom fields into the database.
252
+	 *
253
+	 * @since 1.0.0
254
+	 * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
255
+	 * @package GeoDirectory
256
+	 * @global object $wpdb WordPress Database object.
257
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
258
+	 * @param array $request_field {
259
+	 *    Attributes of the request field array.
260
+	 *
261
+	 *    @type string $action Ajax Action name. Default "geodir_ajax_action".
262
+	 *    @type string $manage_field_type Field type Default "custom_fields".
263
+	 *    @type string $create_field Create field Default "true".
264
+	 *    @type string $field_ins_upd Field ins upd Default "submit".
265
+	 *    @type string $_wpnonce WP nonce value.
266
+	 *    @type string $listing_type Listing type Example "gd_place".
267
+	 *    @type string $field_type Field type Example "radio".
268
+	 *    @type string $field_id Field id Example "12".
269
+	 *    @type string $data_type Data type Example "VARCHAR".
270
+	 *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
271
+	 *    @type array $show_on_pkg Package list to display this field.
272
+	 *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
273
+	 *    @type string $site_title Section title which you wish to display in frontend.
274
+	 *    @type string $admin_desc Section description which will appear in frontend.
275
+	 *    @type string $htmlvar_name Html variable name. This should be a unique name.
276
+	 *    @type string $clabels Section Title which will appear in backend.
277
+	 *    @type string $default_value The default value (for "link" this will be used as the link text).
278
+	 *    @type string $sort_order The display order of this field in backend. e.g. 5.
279
+	 *    @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.
280
+	 *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
281
+	 *    @type string $is_required Use "1" to set field as required.
282
+	 *    @type string $required_msg Enter text for error message if field required and have not full fill requirment.
283
+	 *    @type string $show_on_listing Want to show this on listing page?.
284
+	 *    @type string $show_in What locations to show the custom field in.
285
+	 *    @type string $show_on_detail Want to show this in More Info tab on detail page?.
286
+	 *    @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes.
287
+	 *    @type string $option_values Option Values should be separated by comma.
288
+	 *    @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.
289
+	 *    @type string $css_class Enter custom css class for field custom style.
290
+	 *
291
+	 * }
292
+	 * @param bool $default Not yet implemented.
293
+	 * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
+	 */
295
+	function geodir_custom_field_save($request_field = array(), $default = false)
296
+	{
297
+
298
+		global $wpdb, $plugin_prefix;
299
+
300
+		$old_html_variable = '';
301
+
302
+		$data_type = trim($request_field['data_type']);
303
+
304
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
305
+
306
+		// some servers fail if a POST value is VARCHAR so we change it.
307
+		if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
308
+			$request_field['data_type'] = 'VARCHAR';
309
+		}
310
+
311
+		$cf = trim($result_str, '_');
312
+
313
+
314
+		/*-------- check dublicate validation --------*/
315
+
316
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
317
+		$post_type = $request_field['listing_type'];
318
+
319
+		if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
320
+			$cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
321
+		}
322
+
323
+		$check_html_variable = $wpdb->get_var(
324
+			$wpdb->prepare(
325
+				"select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
326
+				array($cf, $cehhtmlvar_name, $post_type)
327
+			)
328
+		);
329
+
330
+
331
+		if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
332
+
333
+			if ($cf != '') {
334
+
335
+				$post_meta_info = $wpdb->get_row(
336
+					$wpdb->prepare(
337
+						"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
338
+						array($cf)
339
+					)
340
+				);
341
+
342
+			}
343
+
344
+			if (!empty($post_meta_info)) {
345
+				$post_val = $post_meta_info;
346
+				$old_html_variable = $post_val->htmlvar_name;
347
+
348
+			}
349
+
350
+
351
+
352
+			if ($post_type == '') $post_type = 'gd_place';
353
+
354
+
355
+			$detail_table = $plugin_prefix . $post_type . '_detail';
356
+
357
+			$admin_title = $request_field['admin_title'];
358
+			$site_title = $request_field['site_title'];
359
+			$data_type = $request_field['data_type'];
360
+			$field_type = $request_field['field_type'];
361
+			$field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type;
362
+			$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
363
+			$admin_desc = $request_field['admin_desc'];
364
+			$clabels = $request_field['clabels'];
365
+			$default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
366
+			$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
367
+			$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
368
+			$is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
369
+			$required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
370
+			$css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
371
+			$field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
372
+			$show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
373
+			$show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
374
+			$show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
375
+			$show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
376
+			$decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
377
+			$decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
378
+			$validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
379
+			$validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
380
+			$for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
381 381
 
382 382
             
383
-            if(is_array($show_in)){
384
-                $show_in = implode(",", $request_field['show_in']);
385
-            }
383
+			if(is_array($show_in)){
384
+				$show_in = implode(",", $request_field['show_in']);
385
+			}
386 386
             
387
-            if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
-                $htmlvar_name = 'geodir_' . $htmlvar_name;
389
-            }
387
+			if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
+				$htmlvar_name = 'geodir_' . $htmlvar_name;
389
+			}
390 390
 
391
-            $option_values = '';
392
-            if (isset($request_field['option_values']))
393
-                $option_values = $request_field['option_values'];
391
+			$option_values = '';
392
+			if (isset($request_field['option_values']))
393
+				$option_values = $request_field['option_values'];
394 394
 
395
-            $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
395
+			$cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
396 396
 
397
-            $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
397
+			$cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
398 398
 
399
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
401
-            else {
402
-                $package_info = array();
399
+			if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
+				$price_pkg = implode(",", $request_field['show_on_pkg']);
401
+			else {
402
+				$package_info = array();
403 403
 
404
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
405
-                $price_pkg = !empty($package_info->pid) ? $package_info->pid : '';
406
-            }
404
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
405
+				$price_pkg = !empty($package_info->pid) ? $package_info->pid : '';
406
+			}
407 407
 
408 408
 
409
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
410
-                $extra_fields = $request_field['extra'];
409
+			if (isset($request_field['extra']) && !empty($request_field['extra']))
410
+				$extra_fields = $request_field['extra'];
411 411
 
412
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
413
-                $is_default = $request_field['is_default'];
414
-            else
415
-                $is_default = '0';
412
+			if (isset($request_field['is_default']) && $request_field['is_default'] != '')
413
+				$is_default = $request_field['is_default'];
414
+			else
415
+				$is_default = '0';
416 416
 
417
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
418
-                $is_admin = $request_field['is_admin'];
419
-            else
420
-                $is_admin = '0';
417
+			if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
418
+				$is_admin = $request_field['is_admin'];
419
+			else
420
+				$is_admin = '0';
421 421
 
422 422
 
423
-            if ($is_active == '') $is_active = 1;
424
-            if ($is_required == '') $is_required = 0;
423
+			if ($is_active == '') $is_active = 1;
424
+			if ($is_required == '') $is_required = 0;
425 425
 
426 426
 
427
-            if ($sort_order == '') {
427
+			if ($sort_order == '') {
428 428
 
429
-                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
429
+				$last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
430 430
 
431
-                $sort_order = (int)$last_order + 1;
432
-            }
431
+				$sort_order = (int)$last_order + 1;
432
+			}
433 433
 
434
-            $default_value_add = '';
434
+			$default_value_add = '';
435 435
 
436 436
 
437
-            if (!empty($post_meta_info)) {
438
-                switch ($field_type):
437
+			if (!empty($post_meta_info)) {
438
+				switch ($field_type):
439 439
 
440
-                    case 'address':
440
+					case 'address':
441 441
 
442
-                        if ($htmlvar_name != '') {
443
-                            $prefix = $htmlvar_name . '_';
444
-                        }
445
-                        $old_prefix = $old_html_variable . '_';
442
+						if ($htmlvar_name != '') {
443
+							$prefix = $htmlvar_name . '_';
444
+						}
445
+						$old_prefix = $old_html_variable . '_';
446 446
 
447 447
 
448
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
448
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
449 449
 
450
-                        if ($default_value != '') {
451
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
452
-                        }
450
+						if ($default_value != '') {
451
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
452
+						}
453 453
 
454
-                        $wpdb->query($meta_field_add);
454
+						$wpdb->query($meta_field_add);
455 455
 
456
-                        if ($extra_fields != '') {
456
+						if ($extra_fields != '') {
457 457
 
458
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
458
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
459 459
 
460
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
461
-                                if ($is_column) {
462
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
460
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
461
+								if ($is_column) {
462
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
463 463
 
464
-                                    if ($default_value != '') {
465
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
466
-                                    }
464
+									if ($default_value != '') {
465
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
466
+									}
467 467
 
468
-                                    $wpdb->query($meta_field_add);
469
-                                } else {
468
+									$wpdb->query($meta_field_add);
469
+								} else {
470 470
 
471
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
472
-                                    if ($default_value != '') {
473
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
474
-                                    }
475
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
471
+									$meta_field_add = "VARCHAR( 50 ) NULL";
472
+									if ($default_value != '') {
473
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
474
+									}
475
+									geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
476 476
 
477
-                                }
477
+								}
478 478
 
479 479
 
480
-                            }
480
+							}
481 481
 
482 482
 
483
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
483
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
484 484
 
485
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
485
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
486 486
 
487
-                                if ($is_column) {
488
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
487
+								if ($is_column) {
488
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
489 489
 
490
-                                    if ($default_value != '') {
491
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
492
-                                    }
490
+									if ($default_value != '') {
491
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
492
+									}
493 493
 
494
-                                    $wpdb->query($meta_field_add);
495
-                                } else {
496
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
497
-                                    if ($default_value != '') {
498
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
499
-                                    }
494
+									$wpdb->query($meta_field_add);
495
+								} else {
496
+									$meta_field_add = "VARCHAR( 50 ) NULL";
497
+									if ($default_value != '') {
498
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
499
+									}
500 500
 
501
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
502
-                                }
501
+									geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
502
+								}
503 503
 
504
-                            }
505
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
504
+							}
505
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
506 506
 
507
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
507
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
508 508
 
509
-                                if ($is_column) {
509
+								if ($is_column) {
510 510
 
511
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
511
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
512 512
 
513
-                                    if ($default_value != '') {
514
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
515
-                                    }
513
+									if ($default_value != '') {
514
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
515
+									}
516 516
 
517
-                                    $wpdb->query($meta_field_add);
518
-                                } else {
517
+									$wpdb->query($meta_field_add);
518
+								} else {
519 519
 
520
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
521
-                                    if ($default_value != '') {
522
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
523
-                                    }
520
+									$meta_field_add = "VARCHAR( 50 ) NULL";
521
+									if ($default_value != '') {
522
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
523
+									}
524 524
 
525
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
525
+									geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
526 526
 
527
-                                }
527
+								}
528 528
 
529
-                            }
530
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
529
+							}
530
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
531 531
 
532
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
532
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
533 533
 
534
-                                if ($is_column) {
534
+								if ($is_column) {
535 535
 
536
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
536
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
537 537
 
538
-                                    if ($default_value != '') {
539
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
540
-                                    }
538
+									if ($default_value != '') {
539
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
540
+									}
541 541
 
542
-                                    $wpdb->query($meta_field_add);
543
-                                } else {
542
+									$wpdb->query($meta_field_add);
543
+								} else {
544 544
 
545
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
546
-                                    if ($default_value != '') {
547
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
548
-                                    }
545
+									$meta_field_add = "VARCHAR( 50 ) NULL";
546
+									if ($default_value != '') {
547
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
548
+									}
549 549
 
550
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
550
+									geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
551 551
 
552
-                                }
552
+								}
553 553
 
554
-                            }
555
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
554
+							}
555
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
556 556
 
557
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
558
-                                if ($is_column) {
557
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
558
+								if ($is_column) {
559 559
 
560
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
560
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
561 561
 
562
-                                    if ($default_value != '') {
563
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
564
-                                    }
562
+									if ($default_value != '') {
563
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
564
+									}
565 565
 
566
-                                    $wpdb->query($meta_field_add);
567
-                                } else {
566
+									$wpdb->query($meta_field_add);
567
+								} else {
568 568
 
569
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
570
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
571
-                                    if ($default_value != '') {
572
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
573
-                                    }
569
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
570
+									$meta_field_add = "VARCHAR( 20 ) NULL";
571
+									if ($default_value != '') {
572
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
573
+									}
574 574
 
575
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
575
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
576 576
 
577
-                                }
577
+								}
578 578
 
579 579
 
580
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
580
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
581 581
 
582
-                                if ($is_column) {
583
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
582
+								if ($is_column) {
583
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
584 584
 
585
-                                    if ($default_value != '') {
586
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
587
-                                    }
585
+									if ($default_value != '') {
586
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
587
+									}
588 588
 
589
-                                    $wpdb->query($meta_field_add);
590
-                                } else {
589
+									$wpdb->query($meta_field_add);
590
+								} else {
591 591
 
592
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
593
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
594
-                                    if ($default_value != '') {
595
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
596
-                                    }
592
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
593
+									$meta_field_add = "VARCHAR( 20 ) NULL";
594
+									if ($default_value != '') {
595
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
596
+									}
597 597
 
598
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
599
-                                }
598
+									geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
599
+								}
600 600
 
601
-                            }
602
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
601
+							}
602
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
603 603
 
604
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
604
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
605 605
 
606
-                                if ($is_column) {
607
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
606
+								if ($is_column) {
607
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
608 608
 
609
-                                    if ($default_value != '') {
610
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
611
-                                    }
609
+									if ($default_value != '') {
610
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
611
+									}
612 612
 
613
-                                    $wpdb->query($meta_field_add);
614
-                                } else {
613
+									$wpdb->query($meta_field_add);
614
+								} else {
615 615
 
616
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
616
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
617 617
 
618
-                                    $meta_field_add = "VARCHAR( 15 ) NULL";
619
-                                    if ($default_value != '') {
620
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
621
-                                    }
618
+									$meta_field_add = "VARCHAR( 15 ) NULL";
619
+									if ($default_value != '') {
620
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
621
+									}
622 622
 
623
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
624
-                                }
623
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
624
+								}
625 625
 
626 626
 
627
-                            }
628
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
627
+							}
628
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
629 629
 
630
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
631
-                                if ($is_column) {
632
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
630
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
631
+								if ($is_column) {
632
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
633 633
 
634
-                                    if ($default_value != '') {
635
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
636
-                                    }
634
+									if ($default_value != '') {
635
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
636
+									}
637 637
 
638
-                                    $wpdb->query($meta_field_add);
638
+									$wpdb->query($meta_field_add);
639 639
 
640
-                                } else {
640
+								} else {
641 641
 
642
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
642
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
643 643
 
644
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
645
-                                    if ($default_value != '') {
646
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
647
-                                    }
644
+									$meta_field_add = "VARCHAR( 3 ) NULL";
645
+									if ($default_value != '') {
646
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
647
+									}
648 648
 
649
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
650
-                                }
649
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
650
+								}
651 651
 
652
-                            }
653
-                            // show lat lng
654
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
655
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
652
+							}
653
+							// show lat lng
654
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
655
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
656 656
 
657
-                                if ($is_column) {
658
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
659
-                                    $meta_field_add .= " DEFAULT '1'";
657
+								if ($is_column) {
658
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
659
+									$meta_field_add .= " DEFAULT '1'";
660 660
 
661
-                                    $wpdb->query($meta_field_add);
662
-                                } else {
663
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
661
+									$wpdb->query($meta_field_add);
662
+								} else {
663
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
664 664
 
665
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
666
-                                    $meta_field_add .= " DEFAULT '1'";
665
+									$meta_field_add = "VARCHAR( 3 ) NULL";
666
+									$meta_field_add .= " DEFAULT '1'";
667 667
 
668
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
669
-                                }
668
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
669
+								}
670 670
 
671
-                            }
672
-                        }// end extra
671
+							}
672
+						}// end extra
673 673
 
674
-                        break;
674
+						break;
675 675
 
676
-                    case 'checkbox':
677
-                    case 'multiselect':
678
-                    case 'select':
679
-                    case 'taxonomy':
676
+					case 'checkbox':
677
+					case 'multiselect':
678
+					case 'select':
679
+					case 'taxonomy':
680 680
 
681
-                        $op_size = '500';
681
+						$op_size = '500';
682 682
 
683
-                        // only make the field as big as it needs to be.
684
-                        if(isset($option_values) && $option_values && $field_type=='select'){
685
-                            $option_values_arr = explode(',',$option_values);
686
-                            if(is_array($option_values_arr)){
687
-                                $op_max = 0;
688
-                                foreach($option_values_arr as $op_val){
689
-                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
690
-                                }
691
-                                if($op_max){$op_size =$op_max; }
692
-                            }
693
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694
-                            if(strlen($option_values)){
695
-                                $op_size =  strlen($option_values);
696
-                            }
697
-                        }
683
+						// only make the field as big as it needs to be.
684
+						if(isset($option_values) && $option_values && $field_type=='select'){
685
+							$option_values_arr = explode(',',$option_values);
686
+							if(is_array($option_values_arr)){
687
+								$op_max = 0;
688
+								foreach($option_values_arr as $op_val){
689
+									if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
690
+								}
691
+								if($op_max){$op_size =$op_max; }
692
+							}
693
+						}elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694
+							if(strlen($option_values)){
695
+								$op_size =  strlen($option_values);
696
+							}
697
+						}
698 698
 
699
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
699
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
700 700
 
701
-                        if ($default_value != '') {
702
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
703
-                        }
701
+						if ($default_value != '') {
702
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
703
+						}
704 704
 
705
-                        $alter_result = $wpdb->query($meta_field_add);
706
-                        if($alter_result===false){
707
-                            return __('Column change failed, you may have too many columns.','geodirectory');
708
-                        }
705
+						$alter_result = $wpdb->query($meta_field_add);
706
+						if($alter_result===false){
707
+							return __('Column change failed, you may have too many columns.','geodirectory');
708
+						}
709 709
 
710
-                        if (isset($request_field['cat_display_type']))
711
-                            $extra_fields = $request_field['cat_display_type'];
710
+						if (isset($request_field['cat_display_type']))
711
+							$extra_fields = $request_field['cat_display_type'];
712 712
 
713
-                        if (isset($request_field['multi_display_type']))
714
-                            $extra_fields = $request_field['multi_display_type'];
713
+						if (isset($request_field['multi_display_type']))
714
+							$extra_fields = $request_field['multi_display_type'];
715 715
 
716 716
 
717
-                        break;
717
+						break;
718 718
 
719
-                    case 'textarea':
720
-                    case 'html':
721
-                    case 'url':
722
-                    case 'file':
719
+					case 'textarea':
720
+					case 'html':
721
+					case 'url':
722
+					case 'file':
723 723
 
724
-                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
725
-                        if($alter_result===false){
726
-                            return __('Column change failed, you may have too many columns.','geodirectory');
727
-                        }
728
-                        if (isset($request_field['advanced_editor']))
729
-                            $extra_fields = $request_field['advanced_editor'];
730
-
731
-                        break;
724
+						$alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
725
+						if($alter_result===false){
726
+							return __('Column change failed, you may have too many columns.','geodirectory');
727
+						}
728
+						if (isset($request_field['advanced_editor']))
729
+							$extra_fields = $request_field['advanced_editor'];
730
+
731
+						break;
732 732
 
733
-                    case 'fieldset':
734
-                        // Nothig happend for fieldset
735
-                        break;
733
+					case 'fieldset':
734
+						// Nothig happend for fieldset
735
+						break;
736 736
 
737
-                    default:
738
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
739
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
740
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
741
-                            } else {
742
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
743
-                            }
744
-
745
-                            if (is_numeric($default_value) && $default_value != '') {
746
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
747
-                            }
748
-                        } else {
749
-                            $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
750
-                            if ($default_value != '') {
751
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
752
-                            }
753
-                        }
754
-
755
-                        $alter_result = $wpdb->query($default_value_add);
756
-                        if($alter_result===false){
757
-                            return __('Column change failed, you may have too many columns.','geodirectory');
758
-                        }
759
-                        break;
760
-                endswitch;
761
-
762
-                $extra_field_query = '';
763
-                if (!empty($extra_fields)) {
764
-                    $extra_field_query = serialize($extra_fields);
765
-                }
766
-
767
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
768
-
769
-                $wpdb->query(
770
-
771
-                    $wpdb->prepare(
772
-
773
-                        "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
737
+					default:
738
+						if ($data_type != 'VARCHAR' && $data_type != '') {
739
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
740
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
741
+							} else {
742
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
743
+							}
744
+
745
+							if (is_numeric($default_value) && $default_value != '') {
746
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
747
+							}
748
+						} else {
749
+							$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
750
+							if ($default_value != '') {
751
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
752
+							}
753
+						}
754
+
755
+						$alter_result = $wpdb->query($default_value_add);
756
+						if($alter_result===false){
757
+							return __('Column change failed, you may have too many columns.','geodirectory');
758
+						}
759
+						break;
760
+				endswitch;
761
+
762
+				$extra_field_query = '';
763
+				if (!empty($extra_fields)) {
764
+					$extra_field_query = serialize($extra_fields);
765
+				}
766
+
767
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
768
+
769
+				$wpdb->query(
770
+
771
+					$wpdb->prepare(
772
+
773
+						"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
774 774
 					post_type = %s,
775 775
 					admin_title = %s,
776 776
 					site_title = %s,
@@ -804,308 +804,308 @@  discard block
 block discarded – undo
804 804
 					for_admin_use = %s
805 805
 					where id = %d",
806 806
 
807
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
808
-                    )
807
+						array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
808
+					)
809 809
 
810
-                );
810
+				);
811 811
 
812
-                $lastid = trim($cf);
812
+				$lastid = trim($cf);
813 813
 
814 814
 
815
-                $wpdb->query(
816
-                    $wpdb->prepare(
817
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
815
+				$wpdb->query(
816
+					$wpdb->prepare(
817
+						"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
818 818
 					 	site_title=%s
819 819
 					where post_type = %s and htmlvar_name = %s",
820
-                        array($site_title, $post_type, $htmlvar_name)
821
-                    )
822
-                );
823
-
824
-
825
-                if ($cat_sort == '')
826
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827
-
828
-
829
-                /**
830
-                 * Called after all custom fields are saved for a post.
831
-                 *
832
-                 * @since 1.0.0
833
-                 * @param int $lastid The post ID.
834
-                 */
835
-                do_action('geodir_after_custom_fields_updated', $lastid);
836
-
837
-            } else {
838
-
839
-                switch ($field_type):
840
-
841
-                    case 'address':
842
-
843
-                        $data_type = '';
844
-
845
-                        if ($htmlvar_name != '') {
846
-                            $prefix = $htmlvar_name . '_';
847
-                        }
848
-                        $old_prefix = $old_html_variable;
849
-
850
-                        //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
851
-
852
-                        $meta_field_add = "VARCHAR( 254 ) NULL";
853
-                        if ($default_value != '') {
854
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
855
-                        }
856
-
857
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
858
-                        //$wpdb->query($meta_field_add);
859
-
860
-
861
-                        if (!empty($extra_fields)) {
820
+						array($site_title, $post_type, $htmlvar_name)
821
+					)
822
+				);
823
+
824
+
825
+				if ($cat_sort == '')
826
+					$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827
+
828
+
829
+				/**
830
+				 * Called after all custom fields are saved for a post.
831
+				 *
832
+				 * @since 1.0.0
833
+				 * @param int $lastid The post ID.
834
+				 */
835
+				do_action('geodir_after_custom_fields_updated', $lastid);
836
+
837
+			} else {
838
+
839
+				switch ($field_type):
840
+
841
+					case 'address':
842
+
843
+						$data_type = '';
844
+
845
+						if ($htmlvar_name != '') {
846
+							$prefix = $htmlvar_name . '_';
847
+						}
848
+						$old_prefix = $old_html_variable;
849
+
850
+						//$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
851
+
852
+						$meta_field_add = "VARCHAR( 254 ) NULL";
853
+						if ($default_value != '') {
854
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
855
+						}
856
+
857
+						geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
858
+						//$wpdb->query($meta_field_add);
859
+
860
+
861
+						if (!empty($extra_fields)) {
862 862
 
863
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
864
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
865
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
866
-                                if ($default_value != '') {
867
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
868
-                                }
869
-
870
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
871
-                                //$wpdb->query($meta_field_add);
872
-                            }
873
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
874
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
875
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
876
-                                if ($default_value != '') {
877
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
878
-                                }
879
-
880
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
881
-                                //$wpdb->query($meta_field_add);
882
-                            }
883
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
884
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
885
-
886
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
887
-                                if ($default_value != '') {
888
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
889
-                                }
890
-
891
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
892
-                                //$wpdb->query($meta_field_add);
893
-                            }
894
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
895
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
896
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
897
-                                if ($default_value != '') {
898
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
899
-                                }
900
-
901
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
902
-                                //$wpdb->query($meta_field_add);
903
-                            }
904
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
905
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
906
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
907
-                                if ($default_value != '') {
908
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
909
-                                }
910
-
911
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
912
-                                //$wpdb->query($meta_field_add);
913
-
914
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
915
-
916
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
917
-                                if ($default_value != '') {
918
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
919
-                                }
920
-
921
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
922
-
923
-                                //$wpdb->query($meta_field_add);
924
-                            }
925
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
926
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
927
-
928
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
929
-                                if ($default_value != '') {
930
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
931
-                                }
932
-
933
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
934
-
935
-                                //$wpdb->query($meta_field_add);
936
-                            }
937
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
938
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
939
-
940
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
941
-                                if ($default_value != '') {
942
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
943
-                                }
944
-
945
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
946
-
947
-                                //$wpdb->query($meta_field_add);
948
-                            }
949
-                            // show lat lng
950
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
951
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
952
-
953
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
954
-                                $meta_field_add .= " DEFAULT '1'";
955
-
956
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
957
-                                //$wpdb->query($meta_field_add);
958
-                            }
959
-                        }
960
-
961
-                        break;
962
-
963
-                    case 'checkbox':
964
-                        $data_type = 'TINYINT';
965
-
966
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
967
-                        if ((int)$default_value === 1) {
968
-                            $meta_field_add .= " DEFAULT '1'";
969
-                        }
970
-
971
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
972
-                        if ($add_result === false) {
973
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
974
-                        }
975
-                        break;
976
-                    case 'multiselect':
977
-                    case 'select':
978
-                        $data_type = 'VARCHAR';
979
-                        $op_size = '500';
980
-
981
-                        // only make the field as big as it needs to be.
982
-                        if (isset($option_values) && $option_values && $field_type == 'select') {
983
-                            $option_values_arr = explode(',', $option_values);
984
-
985
-                            if (is_array($option_values_arr)) {
986
-                                $op_max = 0;
987
-
988
-                                foreach ($option_values_arr as $op_val) {
989
-                                    if (strlen($op_val) && strlen($op_val) > $op_max) {
990
-                                        $op_max = strlen($op_val);
991
-                                    }
992
-                                }
993
-
994
-                                if ($op_max) {
995
-                                    $op_size = $op_max;
996
-                                }
997
-                            }
998
-                        } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
999
-                            if (strlen($option_values)) {
1000
-                                $op_size =  strlen($option_values);
1001
-                            }
1002
-
1003
-                            if (isset($request_field['multi_display_type'])) {
1004
-                                $extra_fields = $request_field['multi_display_type'];
1005
-                            }
1006
-                        }
1007
-
1008
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1009
-                        if ($default_value != '') {
1010
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1011
-                        }
1012
-
1013
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1014
-                        if ($add_result === false) {
1015
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1016
-                        }
1017
-                        break;
1018
-                    case 'textarea':
1019
-                    case 'html':
1020
-                    case 'url':
1021
-                    case 'file':
1022
-
1023
-                        $data_type = 'TEXT';
1024
-
1025
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1026
-
1027
-                        $meta_field_add = $data_type . " NULL ";
1028
-                        /*if($default_value != '')
863
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
864
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
865
+								$meta_field_add = "VARCHAR( 30 ) NULL";
866
+								if ($default_value != '') {
867
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
868
+								}
869
+
870
+								geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
871
+								//$wpdb->query($meta_field_add);
872
+							}
873
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
874
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
875
+								$meta_field_add = "VARCHAR( 30 ) NULL";
876
+								if ($default_value != '') {
877
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
878
+								}
879
+
880
+								geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
881
+								//$wpdb->query($meta_field_add);
882
+							}
883
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
884
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
885
+
886
+								$meta_field_add = "VARCHAR( 30 ) NULL";
887
+								if ($default_value != '') {
888
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
889
+								}
890
+
891
+								geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
892
+								//$wpdb->query($meta_field_add);
893
+							}
894
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
895
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
896
+								$meta_field_add = "VARCHAR( 15 ) NULL";
897
+								if ($default_value != '') {
898
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
899
+								}
900
+
901
+								geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
902
+								//$wpdb->query($meta_field_add);
903
+							}
904
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
905
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
906
+								$meta_field_add = "VARCHAR( 20 ) NULL";
907
+								if ($default_value != '') {
908
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
909
+								}
910
+
911
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
912
+								//$wpdb->query($meta_field_add);
913
+
914
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
915
+
916
+								$meta_field_add = "VARCHAR( 20 ) NULL";
917
+								if ($default_value != '') {
918
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
919
+								}
920
+
921
+								geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
922
+
923
+								//$wpdb->query($meta_field_add);
924
+							}
925
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
926
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
927
+
928
+								$meta_field_add = "VARCHAR( 15 ) NULL";
929
+								if ($default_value != '') {
930
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
931
+								}
932
+
933
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
934
+
935
+								//$wpdb->query($meta_field_add);
936
+							}
937
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
938
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
939
+
940
+								$meta_field_add = "VARCHAR( 3 ) NULL";
941
+								if ($default_value != '') {
942
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
943
+								}
944
+
945
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
946
+
947
+								//$wpdb->query($meta_field_add);
948
+							}
949
+							// show lat lng
950
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
951
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
952
+
953
+								$meta_field_add = "VARCHAR( 3 ) NULL";
954
+								$meta_field_add .= " DEFAULT '1'";
955
+
956
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
957
+								//$wpdb->query($meta_field_add);
958
+							}
959
+						}
960
+
961
+						break;
962
+
963
+					case 'checkbox':
964
+						$data_type = 'TINYINT';
965
+
966
+						$meta_field_add = $data_type . "( 1 ) NOT NULL ";
967
+						if ((int)$default_value === 1) {
968
+							$meta_field_add .= " DEFAULT '1'";
969
+						}
970
+
971
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
972
+						if ($add_result === false) {
973
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
974
+						}
975
+						break;
976
+					case 'multiselect':
977
+					case 'select':
978
+						$data_type = 'VARCHAR';
979
+						$op_size = '500';
980
+
981
+						// only make the field as big as it needs to be.
982
+						if (isset($option_values) && $option_values && $field_type == 'select') {
983
+							$option_values_arr = explode(',', $option_values);
984
+
985
+							if (is_array($option_values_arr)) {
986
+								$op_max = 0;
987
+
988
+								foreach ($option_values_arr as $op_val) {
989
+									if (strlen($op_val) && strlen($op_val) > $op_max) {
990
+										$op_max = strlen($op_val);
991
+									}
992
+								}
993
+
994
+								if ($op_max) {
995
+									$op_size = $op_max;
996
+								}
997
+							}
998
+						} elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
999
+							if (strlen($option_values)) {
1000
+								$op_size =  strlen($option_values);
1001
+							}
1002
+
1003
+							if (isset($request_field['multi_display_type'])) {
1004
+								$extra_fields = $request_field['multi_display_type'];
1005
+							}
1006
+						}
1007
+
1008
+						$meta_field_add = $data_type . "( $op_size ) NULL ";
1009
+						if ($default_value != '') {
1010
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
1011
+						}
1012
+
1013
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1014
+						if ($add_result === false) {
1015
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1016
+						}
1017
+						break;
1018
+					case 'textarea':
1019
+					case 'html':
1020
+					case 'url':
1021
+					case 'file':
1022
+
1023
+						$data_type = 'TEXT';
1024
+
1025
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1026
+
1027
+						$meta_field_add = $data_type . " NULL ";
1028
+						/*if($default_value != '')
1029 1029
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1030 1030
 
1031
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1032
-                        if ($add_result === false) {
1033
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1034
-                        }
1031
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1032
+						if ($add_result === false) {
1033
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1034
+						}
1035 1035
 
1036
-                        break;
1036
+						break;
1037 1037
 
1038
-                    case 'datepicker':
1038
+					case 'datepicker':
1039 1039
 
1040
-                        $data_type = 'DATE';
1040
+						$data_type = 'DATE';
1041 1041
 
1042
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1042
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1043 1043
 
1044
-                        $meta_field_add = $data_type . " NULL ";
1044
+						$meta_field_add = $data_type . " NULL ";
1045 1045
 
1046
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1047
-                        if ($add_result === false) {
1048
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1049
-                        }
1046
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1047
+						if ($add_result === false) {
1048
+							return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1049
+						}
1050 1050
 
1051
-                        break;
1051
+						break;
1052 1052
 
1053
-                    case 'time':
1053
+					case 'time':
1054 1054
 
1055
-                        $data_type = 'TIME';
1055
+						$data_type = 'TIME';
1056 1056
 
1057
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1057
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1058 1058
 
1059
-                        $meta_field_add = $data_type . " NULL ";
1059
+						$meta_field_add = $data_type . " NULL ";
1060 1060
 
1061
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1062
-                        if ($add_result === false) {
1063
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1064
-                        }
1061
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1062
+						if ($add_result === false) {
1063
+							return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1064
+						}
1065 1065
 
1066
-                        break;
1066
+						break;
1067 1067
 
1068
-                    default:
1068
+					default:
1069 1069
 
1070
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
1071
-                            $meta_field_add = $data_type . " NULL ";
1070
+						if ($data_type != 'VARCHAR' && $data_type != '') {
1071
+							$meta_field_add = $data_type . " NULL ";
1072 1072
 
1073
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
1074
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1075
-                            }
1073
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
1074
+								$meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1075
+							}
1076 1076
 
1077
-                            if (is_numeric($default_value) && $default_value != '') {
1078
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1079
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1080
-                            }
1081
-                        } else {
1082
-                            $meta_field_add = " VARCHAR( 254 ) NULL ";
1077
+							if (is_numeric($default_value) && $default_value != '') {
1078
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1079
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1080
+							}
1081
+						} else {
1082
+							$meta_field_add = " VARCHAR( 254 ) NULL ";
1083 1083
 
1084
-                            if ($default_value != '') {
1085
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1086
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1087
-                            }
1088
-                        }
1084
+							if ($default_value != '') {
1085
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1086
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1087
+							}
1088
+						}
1089 1089
 
1090
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1091
-                        if ($add_result === false) {
1092
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1093
-                        }
1094
-                        break;
1095
-                endswitch;
1090
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1091
+						if ($add_result === false) {
1092
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1093
+						}
1094
+						break;
1095
+				endswitch;
1096 1096
 
1097
-                $extra_field_query = '';
1098
-                if (!empty($extra_fields)) {
1099
-                    $extra_field_query = serialize($extra_fields);
1100
-                }
1097
+				$extra_field_query = '';
1098
+				if (!empty($extra_fields)) {
1099
+					$extra_field_query = serialize($extra_fields);
1100
+				}
1101 1101
 
1102
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1102
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1103 1103
 
1104
-                $wpdb->query(
1104
+				$wpdb->query(
1105 1105
 
1106
-                    $wpdb->prepare(
1106
+					$wpdb->prepare(
1107 1107
 
1108
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1108
+						"insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1109 1109
 					post_type = %s,
1110 1110
 					admin_title = %s,
1111 1111
 					site_title = %s,
@@ -1138,26 +1138,26 @@  discard block
 block discarded – undo
1138 1138
 					validation_msg = %s,
1139 1139
 					for_admin_use = %s ",
1140 1140
 
1141
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1141
+						array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1142 1142
 
1143
-                    )
1143
+					)
1144 1144
 
1145
-                );
1145
+				);
1146 1146
 
1147
-                $lastid = $wpdb->insert_id;
1147
+				$lastid = $wpdb->insert_id;
1148 1148
 
1149
-                $lastid = trim($lastid);
1149
+				$lastid = trim($lastid);
1150 1150
 
1151
-            }
1151
+			}
1152 1152
 
1153
-            return (int)$lastid;
1153
+			return (int)$lastid;
1154 1154
 
1155 1155
 
1156
-        } else {
1157
-            return 'HTML Variable Name should be a unique name';
1158
-        }
1156
+		} else {
1157
+			return 'HTML Variable Name should be a unique name';
1158
+		}
1159 1159
 
1160
-    }
1160
+	}
1161 1161
 }
1162 1162
 
1163 1163
 /**
@@ -1172,54 +1172,54 @@  discard block
 block discarded – undo
1172 1172
 function godir_set_field_order($field_ids = array())
1173 1173
 {
1174 1174
 
1175
-    global $wpdb;
1175
+	global $wpdb;
1176 1176
 
1177
-    $count = 0;
1178
-    if (!empty($field_ids)):
1179
-        $post_meta_info = false;
1180
-        foreach ($field_ids as $id) {
1177
+	$count = 0;
1178
+	if (!empty($field_ids)):
1179
+		$post_meta_info = false;
1180
+		foreach ($field_ids as $id) {
1181 1181
 
1182
-            $cf = trim($id, '_');
1182
+			$cf = trim($id, '_');
1183 1183
 
1184
-            $post_meta_info = $wpdb->query(
1185
-                $wpdb->prepare(
1186
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1184
+			$post_meta_info = $wpdb->query(
1185
+				$wpdb->prepare(
1186
+					"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1187 1187
 															sort_order=%d 
1188 1188
 															where id= %d",
1189
-                    array($count, $cf)
1190
-                )
1191
-            );
1192
-            $count++;
1193
-        }
1194
-
1195
-        return $post_meta_info;
1196
-    else:
1197
-        return false;
1198
-    endif;
1189
+					array($count, $cf)
1190
+				)
1191
+			);
1192
+			$count++;
1193
+		}
1194
+
1195
+		return $post_meta_info;
1196
+	else:
1197
+		return false;
1198
+	endif;
1199 1199
 }
1200 1200
 
1201 1201
 
1202 1202
 function geodir_get_cf_value($cf){
1203
-    global $gd_session;
1204
-    $value = '';
1205
-    if (is_admin()) {
1206
-        global $post,$gd_session;
1207
-
1208
-        if (isset($_REQUEST['post']))
1209
-            $_REQUEST['pid'] = $_REQUEST['post'];
1210
-    }
1211
-
1212
-    if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1213
-        $post = $gd_ses_listing;
1214
-        $value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1215
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1216
-        $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1217
-    } else {
1218
-        if ($value == '') {
1219
-            $value = $cf['default'];
1220
-        }
1221
-    }
1222
-    return $value;
1203
+	global $gd_session;
1204
+	$value = '';
1205
+	if (is_admin()) {
1206
+		global $post,$gd_session;
1207
+
1208
+		if (isset($_REQUEST['post']))
1209
+			$_REQUEST['pid'] = $_REQUEST['post'];
1210
+	}
1211
+
1212
+	if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1213
+		$post = $gd_ses_listing;
1214
+		$value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1215
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1216
+		$value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1217
+	} else {
1218
+		if ($value == '') {
1219
+			$value = $cf['default'];
1220
+		}
1221
+	}
1222
+	return $value;
1223 1223
 }
1224 1224
 
1225 1225
 /**
@@ -1238,411 +1238,411 @@  discard block
 block discarded – undo
1238 1238
  * @param string $post_type Optional. The wordpress post type.
1239 1239
  */
1240 1240
 function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
1241
-    global $is_default, $mapzoom, $gd_session;
1241
+	global $is_default, $mapzoom, $gd_session;
1242 1242
 
1243
-    $listing_type = $post_type;
1243
+	$listing_type = $post_type;
1244 1244
 
1245
-    $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1245
+	$custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1246 1246
 
1247
-    foreach ($custom_fields as $key => $val) {
1248
-        $val = stripslashes_deep($val); // strip slashes from labels
1249
-        $name = $val['name'];
1250
-        $type = $val['type'];
1251
-        $is_default = $val['is_default'];
1247
+	foreach ($custom_fields as $key => $val) {
1248
+		$val = stripslashes_deep($val); // strip slashes from labels
1249
+		$name = $val['name'];
1250
+		$type = $val['type'];
1251
+		$is_default = $val['is_default'];
1252 1252
 
1253
-        /* field available to site admin only for edit */
1254
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1255
-        if ($for_admin_use && !is_super_admin()) {
1256
-            continue;
1257
-        }
1253
+		/* field available to site admin only for edit */
1254
+		$for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1255
+		if ($for_admin_use && !is_super_admin()) {
1256
+			continue;
1257
+		}
1258 1258
 
1259
-        if (is_admin()) {
1260
-            global $post;
1259
+		if (is_admin()) {
1260
+			global $post;
1261 1261
 
1262
-            if (isset($_REQUEST['post']))
1263
-                $_REQUEST['pid'] = $_REQUEST['post'];
1264
-        }
1262
+			if (isset($_REQUEST['post']))
1263
+				$_REQUEST['pid'] = $_REQUEST['post'];
1264
+		}
1265 1265
 
1266 1266
         
1267 1267
 
1268
-        /**
1269
-         * Called before the custom fields info is output for submitting a post.
1270
-         *
1271
-         * Used dynamic hook type geodir_before_custom_form_field_$name.
1272
-         *
1273
-         * @since 1.0.0
1274
-         * @param string $listing_type The post post type.
1275
-         * @param int $package_id The price package ID for the post.
1276
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1277
-         * @see 'geodir_after_custom_form_field_$name'
1278
-         */
1279
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1280
-
1281
-
1282
-        $custom_field = $val;
1283
-        $html ='';
1284
-        /**
1285
-         * Filter the output for custom fields.
1286
-         *
1287
-         * Here we can remove or add new functions depending on the field type.
1288
-         *
1289
-         * @param string $html The html to be filtered (blank).
1290
-         * @param array $custom_field The custom field array values.
1291
-         */
1292
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1293
-
1294
-
1295
-
1296
-        /**
1297
-         * Called after the custom fields info is output for submitting a post.
1298
-         *
1299
-         * Used dynamic hook type geodir_after_custom_form_field_$name.
1300
-         *
1301
-         * @since 1.0.0
1302
-         * @param string $listing_type The post post type.
1303
-         * @param int $package_id The price package ID for the post.
1304
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1305
-         * @see 'geodir_before_custom_form_field_$name'
1306
-         */
1307
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1308
-
1309
-    }
1268
+		/**
1269
+		 * Called before the custom fields info is output for submitting a post.
1270
+		 *
1271
+		 * Used dynamic hook type geodir_before_custom_form_field_$name.
1272
+		 *
1273
+		 * @since 1.0.0
1274
+		 * @param string $listing_type The post post type.
1275
+		 * @param int $package_id The price package ID for the post.
1276
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1277
+		 * @see 'geodir_after_custom_form_field_$name'
1278
+		 */
1279
+		do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1280
+
1281
+
1282
+		$custom_field = $val;
1283
+		$html ='';
1284
+		/**
1285
+		 * Filter the output for custom fields.
1286
+		 *
1287
+		 * Here we can remove or add new functions depending on the field type.
1288
+		 *
1289
+		 * @param string $html The html to be filtered (blank).
1290
+		 * @param array $custom_field The custom field array values.
1291
+		 */
1292
+		echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1293
+
1294
+
1295
+
1296
+		/**
1297
+		 * Called after the custom fields info is output for submitting a post.
1298
+		 *
1299
+		 * Used dynamic hook type geodir_after_custom_form_field_$name.
1300
+		 *
1301
+		 * @since 1.0.0
1302
+		 * @param string $listing_type The post post type.
1303
+		 * @param int $package_id The price package ID for the post.
1304
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1305
+		 * @see 'geodir_before_custom_form_field_$name'
1306
+		 */
1307
+		do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1308
+
1309
+	}
1310 1310
 
1311 1311
 }
1312 1312
 
1313 1313
 
1314 1314
 if (!function_exists('geodir_get_field_infoby')) {
1315
-    /**
1316
-     * Get custom field using key and value.
1317
-     *
1318
-     * @since 1.0.0
1319
-     * @package GeoDirectory
1320
-     * @global object $wpdb WordPress Database object.
1321
-     * @param string $key The key you want to look for.
1322
-     * @param string $value The value of the key you want to look for.
1323
-     * @param string $geodir_post_type The post type.
1324
-     * @return bool|mixed Returns field info when available. otherwise returns false.
1325
-     */
1326
-    function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1327
-    {
1328
-
1329
-        global $wpdb;
1330
-
1331
-        $filter = $wpdb->get_row(
1332
-            $wpdb->prepare(
1333
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1334
-                array($geodir_post_type)
1335
-            )
1336
-        );
1337
-
1338
-        if ($filter) {
1339
-            return $filter;
1340
-        } else {
1341
-            return false;
1342
-        }
1343
-
1344
-    }
1315
+	/**
1316
+	 * Get custom field using key and value.
1317
+	 *
1318
+	 * @since 1.0.0
1319
+	 * @package GeoDirectory
1320
+	 * @global object $wpdb WordPress Database object.
1321
+	 * @param string $key The key you want to look for.
1322
+	 * @param string $value The value of the key you want to look for.
1323
+	 * @param string $geodir_post_type The post type.
1324
+	 * @return bool|mixed Returns field info when available. otherwise returns false.
1325
+	 */
1326
+	function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1327
+	{
1328
+
1329
+		global $wpdb;
1330
+
1331
+		$filter = $wpdb->get_row(
1332
+			$wpdb->prepare(
1333
+				"SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1334
+				array($geodir_post_type)
1335
+			)
1336
+		);
1337
+
1338
+		if ($filter) {
1339
+			return $filter;
1340
+		} else {
1341
+			return false;
1342
+		}
1343
+
1344
+	}
1345 1345
 }
1346 1346
 
1347 1347
 
1348 1348
 function geodir_field_icon_proccess($cf){
1349 1349
 
1350 1350
 
1351
-    if (strpos($cf['field_icon'], 'http') !== false) {
1352
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353
-    } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
-    }else{
1356
-        $field_icon = $cf['field_icon'];
1357
-    }
1351
+	if (strpos($cf['field_icon'], 'http') !== false) {
1352
+		$field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353
+	} elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354
+		$field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
+	}else{
1356
+		$field_icon = $cf['field_icon'];
1357
+	}
1358 1358
 
1359
-    return $field_icon;
1359
+	return $field_icon;
1360 1360
 }
1361 1361
 
1362 1362
 if (!function_exists('geodir_show_listing_info')) {
1363
-    /**
1364
-     * Show listing info depending on field location.
1365
-     *
1366
-     * @since 1.0.0
1367
-     * @since 1.5.7 Custom fields option values added to db translation.
1368
-     *              Changes to display url fields title.
1369
-     * @package GeoDirectory
1370
-     * @global object $wpdb WordPress Database object.
1371
-     * @global object $post The current post object.
1372
-     * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1373
-     *
1374
-     * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1375
-     * @return string Returns listing info html.
1376
-     */
1377
-    function geodir_show_listing_info($fields_location = '') {
1378
-        global $post, $preview, $wpdb, $send_to_friend;
1379
-
1380
-        $package_info = array();
1381
-
1382
-        $package_info = geodir_post_package_info($package_info, $post);
1383
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
1384
-        $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1385
-        $send_to_friend = false;
1386
-
1387
-        ob_start();
1388
-        $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1389
-
1390
-        if (!empty($fields_info)) {
1391
-            $post = stripslashes_deep($post); // strip slashes
1363
+	/**
1364
+	 * Show listing info depending on field location.
1365
+	 *
1366
+	 * @since 1.0.0
1367
+	 * @since 1.5.7 Custom fields option values added to db translation.
1368
+	 *              Changes to display url fields title.
1369
+	 * @package GeoDirectory
1370
+	 * @global object $wpdb WordPress Database object.
1371
+	 * @global object $post The current post object.
1372
+	 * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1373
+	 *
1374
+	 * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1375
+	 * @return string Returns listing info html.
1376
+	 */
1377
+	function geodir_show_listing_info($fields_location = '') {
1378
+		global $post, $preview, $wpdb, $send_to_friend;
1379
+
1380
+		$package_info = array();
1381
+
1382
+		$package_info = geodir_post_package_info($package_info, $post);
1383
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
1384
+		$p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1385
+		$send_to_friend = false;
1386
+
1387
+		ob_start();
1388
+		$fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1389
+
1390
+		if (!empty($fields_info)) {
1391
+			$post = stripslashes_deep($post); // strip slashes
1392 1392
             
1393
-            //echo '<div class="geodir-company_info field-group">';
1394
-            global $field_set_start;
1395
-            $field_set_start = 0;
1393
+			//echo '<div class="geodir-company_info field-group">';
1394
+			global $field_set_start;
1395
+			$field_set_start = 0;
1396 1396
 
1397 1397
 
1398 1398
 
1399
-            foreach ($fields_info as $type) {
1400
-                $type = stripslashes_deep($type); // strip slashes
1401
-                $html = '';
1402
-                $field_icon = geodir_field_icon_proccess($type);
1403
-                $filed_type = $type['type'];
1404
-                $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1405
-                if($html_var=='post'){$html_var='post_address';}
1399
+			foreach ($fields_info as $type) {
1400
+				$type = stripslashes_deep($type); // strip slashes
1401
+				$html = '';
1402
+				$field_icon = geodir_field_icon_proccess($type);
1403
+				$filed_type = $type['type'];
1404
+				$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1405
+				if($html_var=='post'){$html_var='post_address';}
1406 1406
 
1407
-                /**
1408
-                 * Filter the output for custom fields.
1409
-                 *
1410
-                 * Here we can remove or add new functions depending on the field type.
1411
-                 *
1412
-                 * @param string $html The html to be filtered (blank).
1413
-                 * @param string $fields_location The location the field is to be show.
1414
-                 * @param array $type The array of field values.
1415
-                 */
1416
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1407
+				/**
1408
+				 * Filter the output for custom fields.
1409
+				 *
1410
+				 * Here we can remove or add new functions depending on the field type.
1411
+				 *
1412
+				 * @param string $html The html to be filtered (blank).
1413
+				 * @param string $fields_location The location the field is to be show.
1414
+				 * @param array $type The array of field values.
1415
+				 */
1416
+				$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1417 1417
 
1418
-                $variables_array = array();
1418
+				$variables_array = array();
1419 1419
 
1420 1420
 //                if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
1421 1421
 //                    continue;
1422 1422
 //                }
1423 1423
 
1424
-                if ($type['type'] != 'fieldset'):
1425
-                    $variables_array['post_id'] = $post->ID;
1426
-                    $variables_array['label'] = __($type['site_title'], 'geodirectory');
1427
-                    $variables_array['value'] = '';
1428
-                    if (isset($post->{$type['htmlvar_name']}))
1429
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1430
-                endif;
1424
+				if ($type['type'] != 'fieldset'):
1425
+					$variables_array['post_id'] = $post->ID;
1426
+					$variables_array['label'] = __($type['site_title'], 'geodirectory');
1427
+					$variables_array['value'] = '';
1428
+					if (isset($post->{$type['htmlvar_name']}))
1429
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
1430
+				endif;
1431 1431
 
1432 1432
 
1433
-                if ($html):
1433
+				if ($html):
1434 1434
 
1435
-                    /**
1436
-                     * Called before a custom fields is output on the frontend.
1437
-                     *
1438
-                     * @since 1.0.0
1439
-                     * @param string $html_var The HTML variable name for the field.
1440
-                     */
1441
-                    do_action("geodir_before_show_{$html_var}");
1442
-                    /**
1443
-                     * Filter custom field output.
1444
-                     *
1445
-                     * @since 1.0.0
1446
-                     *
1447
-                     * @param string $html_var The HTML variable name for the field.
1448
-                     * @param string $html Custom field unfiltered HTML.
1449
-                     * @param array $variables_array Custom field variables array.
1450
-                     */
1451
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1435
+					/**
1436
+					 * Called before a custom fields is output on the frontend.
1437
+					 *
1438
+					 * @since 1.0.0
1439
+					 * @param string $html_var The HTML variable name for the field.
1440
+					 */
1441
+					do_action("geodir_before_show_{$html_var}");
1442
+					/**
1443
+					 * Filter custom field output.
1444
+					 *
1445
+					 * @since 1.0.0
1446
+					 *
1447
+					 * @param string $html_var The HTML variable name for the field.
1448
+					 * @param string $html Custom field unfiltered HTML.
1449
+					 * @param array $variables_array Custom field variables array.
1450
+					 */
1451
+					if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1452 1452
 
1453
-                    /**
1454
-                     * Called after a custom fields is output on the frontend.
1455
-                     *
1456
-                     * @since 1.0.0
1457
-                     * @param string $html_var The HTML variable name for the field.
1458
-                     */
1459
-                    do_action("geodir_after_show_{$html_var}");
1453
+					/**
1454
+					 * Called after a custom fields is output on the frontend.
1455
+					 *
1456
+					 * @since 1.0.0
1457
+					 * @param string $html_var The HTML variable name for the field.
1458
+					 */
1459
+					do_action("geodir_after_show_{$html_var}");
1460 1460
 
1461
-                endif;
1461
+				endif;
1462 1462
 
1463
-            }
1463
+			}
1464 1464
 
1465
-            //echo '</div>';
1465
+			//echo '</div>';
1466 1466
 
1467
-        }
1467
+		}
1468 1468
 
1469 1469
 
1470
-        return $html = ob_get_clean();
1470
+		return $html = ob_get_clean();
1471 1471
 
1472
-    }
1472
+	}
1473 1473
 }
1474 1474
 
1475 1475
 if (!function_exists('geodir_default_date_format')) {
1476
-    /**
1477
-     * Returns default date format.
1478
-     *
1479
-     * @since 1.0.0
1480
-     * @package GeoDirectory
1481
-     * @return mixed|string|void Returns default date format.
1482
-     */
1483
-    function geodir_default_date_format()
1484
-    {
1485
-        if ($format = get_option('date_format'))
1486
-            return $format;
1487
-        else
1488
-            return 'dd-mm-yy';
1489
-    }
1476
+	/**
1477
+	 * Returns default date format.
1478
+	 *
1479
+	 * @since 1.0.0
1480
+	 * @package GeoDirectory
1481
+	 * @return mixed|string|void Returns default date format.
1482
+	 */
1483
+	function geodir_default_date_format()
1484
+	{
1485
+		if ($format = get_option('date_format'))
1486
+			return $format;
1487
+		else
1488
+			return 'dd-mm-yy';
1489
+	}
1490 1490
 }
1491 1491
 
1492 1492
 if (!function_exists('geodir_get_formated_date')) {
1493
-    /**
1494
-     * Returns formatted date.
1495
-     *
1496
-     * @since 1.0.0
1497
-     * @package GeoDirectory
1498
-     * @param string $date Date string to convert.
1499
-     * @return bool|int|string Returns formatted date.
1500
-     */
1501
-    function geodir_get_formated_date($date)
1502
-    {
1503
-        return mysql2date(get_option('date_format'), $date);
1504
-    }
1493
+	/**
1494
+	 * Returns formatted date.
1495
+	 *
1496
+	 * @since 1.0.0
1497
+	 * @package GeoDirectory
1498
+	 * @param string $date Date string to convert.
1499
+	 * @return bool|int|string Returns formatted date.
1500
+	 */
1501
+	function geodir_get_formated_date($date)
1502
+	{
1503
+		return mysql2date(get_option('date_format'), $date);
1504
+	}
1505 1505
 }
1506 1506
 
1507 1507
 if (!function_exists('geodir_get_formated_time')) {
1508
-    /**
1509
-     * Returns formatted time.
1510
-     *
1511
-     * @since 1.0.0
1512
-     * @package GeoDirectory
1513
-     * @param string $time Time string to convert.
1514
-     * @return bool|int|string Returns formatted time.
1515
-     */
1516
-    function geodir_get_formated_time($time)
1517
-    {
1518
-        return mysql2date(get_option('time_format'), $time, $translate = true);
1519
-    }
1508
+	/**
1509
+	 * Returns formatted time.
1510
+	 *
1511
+	 * @since 1.0.0
1512
+	 * @package GeoDirectory
1513
+	 * @param string $time Time string to convert.
1514
+	 * @return bool|int|string Returns formatted time.
1515
+	 */
1516
+	function geodir_get_formated_time($time)
1517
+	{
1518
+		return mysql2date(get_option('time_format'), $time, $translate = true);
1519
+	}
1520 1520
 }
1521 1521
 
1522 1522
 
1523 1523
 if (!function_exists('geodir_save_post_file_fields')) {
1524
-    /**
1525
-     * Save post file fields
1526
-     *
1527
-     * @since 1.0.0
1528
-     * @since 1.4.7 Added `$extra_fields` parameter.
1529
-     * @package GeoDirectory
1530
-     * @global object $wpdb WordPress Database object.
1531
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1532
-     * @global object $current_user Current user object.
1533
-     * @param int $post_id
1534
-     * @param string $field_id
1535
-     * @param array $post_image
1536
-     * @param array $extra_fields Array of extra fields.
1537
-     */
1538
-    function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1539
-    {
1524
+	/**
1525
+	 * Save post file fields
1526
+	 *
1527
+	 * @since 1.0.0
1528
+	 * @since 1.4.7 Added `$extra_fields` parameter.
1529
+	 * @package GeoDirectory
1530
+	 * @global object $wpdb WordPress Database object.
1531
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1532
+	 * @global object $current_user Current user object.
1533
+	 * @param int $post_id
1534
+	 * @param string $field_id
1535
+	 * @param array $post_image
1536
+	 * @param array $extra_fields Array of extra fields.
1537
+	 */
1538
+	function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1539
+	{
1540 1540
 
1541
-        global $wpdb, $plugin_prefix, $current_user;
1541
+		global $wpdb, $plugin_prefix, $current_user;
1542 1542
 
1543
-        $post_type = get_post_type($post_id);
1544
-        //echo $field_id; exit;
1545
-        $table = $plugin_prefix . $post_type . '_detail';
1543
+		$post_type = get_post_type($post_id);
1544
+		//echo $field_id; exit;
1545
+		$table = $plugin_prefix . $post_type . '_detail';
1546 1546
 
1547
-        $postcurr_images = array();
1548
-        $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1549
-        $file_urls = '';
1547
+		$postcurr_images = array();
1548
+		$postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1549
+		$file_urls = '';
1550 1550
 
1551
-        if (!empty($post_image)) {
1551
+		if (!empty($post_image)) {
1552 1552
 
1553
-            $invalid_files = array();
1553
+			$invalid_files = array();
1554 1554
 
1555
-            //Get and remove all old images of post from database to set by new order
1556
-            $geodir_uploaddir = '';
1557
-            $uploads = wp_upload_dir();
1558
-            $uploads_dir = $uploads['path'];
1555
+			//Get and remove all old images of post from database to set by new order
1556
+			$geodir_uploaddir = '';
1557
+			$uploads = wp_upload_dir();
1558
+			$uploads_dir = $uploads['path'];
1559 1559
 
1560
-            $geodir_uploadpath = $uploads['path'];
1561
-            $geodir_uploadurl = $uploads['url'];
1562
-            $sub_dir = $uploads['subdir'];
1560
+			$geodir_uploadpath = $uploads['path'];
1561
+			$geodir_uploadurl = $uploads['url'];
1562
+			$sub_dir = $uploads['subdir'];
1563 1563
 
1564
-            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1564
+			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1565 1565
 
1566
-            for ($m = 0; $m < count($post_image); $m++) {
1566
+			for ($m = 0; $m < count($post_image); $m++) {
1567 1567
 
1568
-                /* --------- start ------- */
1568
+				/* --------- start ------- */
1569 1569
 
1570
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1570
+				if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1571 1571
 
1572 1572
 
1573
-                    $curr_img_url = $post_image[$m];
1574
-                    $image_name_arr = explode('/', $curr_img_url);
1575
-                    $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1576
-                    $filename = end($image_name_arr);
1577
-                    $img_name_arr = explode('.', $filename);
1573
+					$curr_img_url = $post_image[$m];
1574
+					$image_name_arr = explode('/', $curr_img_url);
1575
+					$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1576
+					$filename = end($image_name_arr);
1577
+					$img_name_arr = explode('.', $filename);
1578 1578
 
1579
-                    $arr_file_type = wp_check_filetype($filename);
1579
+					$arr_file_type = wp_check_filetype($filename);
1580 1580
 
1581
-                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1582
-                        continue;
1583
-                    }
1581
+					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1582
+						continue;
1583
+					}
1584 1584
 
1585
-                    $uploaded_file_type = $arr_file_type['type'];
1586
-                    $uploaded_file_ext = $arr_file_type['ext'];
1585
+					$uploaded_file_type = $arr_file_type['type'];
1586
+					$uploaded_file_ext = $arr_file_type['ext'];
1587 1587
 
1588
-                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1589
-                        continue; // Invalid file type.
1590
-                    }
1588
+					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1589
+						continue; // Invalid file type.
1590
+					}
1591 1591
 
1592
-                    // Set an array containing a list of acceptable formats
1593
-                    //$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');
1592
+					// Set an array containing a list of acceptable formats
1593
+					//$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');
1594 1594
 
1595
-                    if (!function_exists('wp_handle_upload'))
1596
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1595
+					if (!function_exists('wp_handle_upload'))
1596
+						require_once(ABSPATH . 'wp-admin/includes/file.php');
1597 1597
 
1598
-                    if (!is_dir($geodir_uploadpath))
1599
-                        mkdir($geodir_uploadpath);
1598
+					if (!is_dir($geodir_uploadpath))
1599
+						mkdir($geodir_uploadpath);
1600 1600
 
1601
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1602
-                    $explode_sub_dir = explode("/", $sub_dir);
1603
-                    if ($curr_img_dir == end($explode_sub_dir)) {
1604
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1605
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1606
-                    } else {
1607
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1608
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1609
-                    }
1601
+					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1602
+					$explode_sub_dir = explode("/", $sub_dir);
1603
+					if ($curr_img_dir == end($explode_sub_dir)) {
1604
+						$img_path = $geodir_uploadpath . '/' . $filename;
1605
+						$img_url = $geodir_uploadurl . '/' . $filename;
1606
+					} else {
1607
+						$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1608
+						$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1609
+					}
1610 1610
 
1611
-                    $uploaded_file = '';
1612
-                    if (file_exists($img_path))
1613
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1611
+					$uploaded_file = '';
1612
+					if (file_exists($img_path))
1613
+						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1614 1614
 
1615
-                    if ($curr_img_dir != $geodir_uploaddir) {
1616
-                        if (file_exists($img_path))
1617
-                            unlink($img_path);
1618
-                    }
1615
+					if ($curr_img_dir != $geodir_uploaddir) {
1616
+						if (file_exists($img_path))
1617
+							unlink($img_path);
1618
+					}
1619 1619
 
1620
-                    if (!empty($uploaded_file))
1621
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1620
+					if (!empty($uploaded_file))
1621
+						$file_urls = $geodir_uploadurl . '/' . $new_name;
1622 1622
 
1623
-                } else {
1624
-                    $file_urls = $post_image[$m];
1625
-                }
1626
-            }
1623
+				} else {
1624
+					$file_urls = $post_image[$m];
1625
+				}
1626
+			}
1627 1627
 
1628 1628
 
1629
-        }
1629
+		}
1630 1630
 
1631
-        //Remove all old attachments and temp images
1632
-        if (!empty($postcurr_images)) {
1631
+		//Remove all old attachments and temp images
1632
+		if (!empty($postcurr_images)) {
1633 1633
 
1634
-            if ($file_urls != $postcurr_images) {
1635
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1636
-                $invalid_files = (object)$invalid_files;
1637
-            }
1638
-        }
1634
+			if ($file_urls != $postcurr_images) {
1635
+				$invalid_files[] = (object)array('src' => $postcurr_images);
1636
+				$invalid_files = (object)$invalid_files;
1637
+			}
1638
+		}
1639 1639
 
1640
-        geodir_save_post_meta($post_id, $field_id, $file_urls);
1640
+		geodir_save_post_meta($post_id, $field_id, $file_urls);
1641 1641
 
1642
-        if (!empty($invalid_files))
1643
-            geodir_remove_attachments($invalid_files);
1642
+		if (!empty($invalid_files))
1643
+			geodir_remove_attachments($invalid_files);
1644 1644
 
1645
-    }
1645
+	}
1646 1646
 }
1647 1647
 
1648 1648
 
@@ -1657,76 +1657,76 @@  discard block
 block discarded – undo
1657 1657
  */
1658 1658
 function geodir_custom_upload_mimes($existing_mimes = array())
1659 1659
 {
1660
-    $existing_mimes['wif'] = 'text/plain';
1661
-    $existing_mimes['jpg|jpeg'] = 'image/jpeg';
1662
-    $existing_mimes['gif'] = 'image/gif';
1663
-    $existing_mimes['png'] = 'image/png';
1664
-    $existing_mimes['pdf'] = 'application/pdf';
1665
-    $existing_mimes['txt'] = 'text/text';
1666
-    $existing_mimes['csv'] = 'application/octet-stream';
1667
-    $existing_mimes['doc'] = 'application/msword';
1668
-    $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1669
-    $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1670
-    $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1671
-    return $existing_mimes;
1660
+	$existing_mimes['wif'] = 'text/plain';
1661
+	$existing_mimes['jpg|jpeg'] = 'image/jpeg';
1662
+	$existing_mimes['gif'] = 'image/gif';
1663
+	$existing_mimes['png'] = 'image/png';
1664
+	$existing_mimes['pdf'] = 'application/pdf';
1665
+	$existing_mimes['txt'] = 'text/text';
1666
+	$existing_mimes['csv'] = 'application/octet-stream';
1667
+	$existing_mimes['doc'] = 'application/msword';
1668
+	$existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1669
+	$existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1670
+	$existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1671
+	return $existing_mimes;
1672 1672
 }
1673 1673
 
1674 1674
 if (!function_exists('geodir_plupload_action')) {
1675 1675
 
1676
-    /**
1677
-     * Get upload directory path details
1678
-     *
1679
-     * @since 1.0.0
1680
-     * @package GeoDirectory
1681
-     * @global object $current_user Current user object.
1682
-     * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1683
-     * @return mixed Returns upload directory details as an array.
1684
-     */
1685
-    function geodir_upload_dir($upload)
1686
-    {
1687
-        global $current_user;
1688
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1689
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1690
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1691
-        return $upload;
1692
-    }
1693
-
1694
-    /**
1695
-     * Handles place file and image upload.
1696
-     *
1697
-     * @since 1.0.0
1698
-     * @package GeoDirectory
1699
-     */
1700
-    function geodir_plupload_action()
1701
-    {
1702
-        // check ajax noonce
1703
-        $imgid = $_POST["imgid"];
1704
-
1705
-        check_ajax_referer($imgid . 'pluploadan');
1706
-
1707
-        // handle custom file uploaddir
1708
-        add_filter('upload_dir', 'geodir_upload_dir');
1709
-
1710
-        // change file orinetation if needed
1711
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1712
-
1713
-        // handle file upload
1714
-        $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1715
-        // remove handle custom file uploaddir
1716
-        remove_filter('upload_dir', 'geodir_upload_dir');
1717
-
1718
-        if(!isset($status['url']) && isset($status['error'])){
1719
-            print_r($status);
1720
-        }
1721
-
1722
-        // send the uploaded file url in response
1723
-        if (isset($status['url'])) {
1724
-            echo $status['url'];
1725
-        } else {
1726
-            echo 'x';
1727
-        }
1728
-        exit;
1729
-    }
1676
+	/**
1677
+	 * Get upload directory path details
1678
+	 *
1679
+	 * @since 1.0.0
1680
+	 * @package GeoDirectory
1681
+	 * @global object $current_user Current user object.
1682
+	 * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1683
+	 * @return mixed Returns upload directory details as an array.
1684
+	 */
1685
+	function geodir_upload_dir($upload)
1686
+	{
1687
+		global $current_user;
1688
+		$upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1689
+		$upload['path'] = $upload['basedir'] . $upload['subdir'];
1690
+		$upload['url'] = $upload['baseurl'] . $upload['subdir'];
1691
+		return $upload;
1692
+	}
1693
+
1694
+	/**
1695
+	 * Handles place file and image upload.
1696
+	 *
1697
+	 * @since 1.0.0
1698
+	 * @package GeoDirectory
1699
+	 */
1700
+	function geodir_plupload_action()
1701
+	{
1702
+		// check ajax noonce
1703
+		$imgid = $_POST["imgid"];
1704
+
1705
+		check_ajax_referer($imgid . 'pluploadan');
1706
+
1707
+		// handle custom file uploaddir
1708
+		add_filter('upload_dir', 'geodir_upload_dir');
1709
+
1710
+		// change file orinetation if needed
1711
+		$fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1712
+
1713
+		// handle file upload
1714
+		$status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1715
+		// remove handle custom file uploaddir
1716
+		remove_filter('upload_dir', 'geodir_upload_dir');
1717
+
1718
+		if(!isset($status['url']) && isset($status['error'])){
1719
+			print_r($status);
1720
+		}
1721
+
1722
+		// send the uploaded file url in response
1723
+		if (isset($status['url'])) {
1724
+			echo $status['url'];
1725
+		} else {
1726
+			echo 'x';
1727
+		}
1728
+		exit;
1729
+	}
1730 1730
 }
1731 1731
 
1732 1732
 /**
@@ -1741,17 +1741,17 @@  discard block
 block discarded – undo
1741 1741
  */
1742 1742
 function geodir_get_video($post_id)
1743 1743
 {
1744
-    global $wpdb, $plugin_prefix;
1744
+	global $wpdb, $plugin_prefix;
1745 1745
 
1746
-    $post_type = get_post_type($post_id);
1746
+	$post_type = get_post_type($post_id);
1747 1747
 
1748
-    $table = $plugin_prefix . $post_type . '_detail';
1748
+	$table = $plugin_prefix . $post_type . '_detail';
1749 1749
 
1750
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1750
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1751 1751
 
1752
-    if ($results) {
1753
-        return $results[0]->geodir_video;
1754
-    }
1752
+	if ($results) {
1753
+		return $results[0]->geodir_video;
1754
+	}
1755 1755
 
1756 1756
 }
1757 1757
 
@@ -1767,40 +1767,40 @@  discard block
 block discarded – undo
1767 1767
  */
1768 1768
 function geodir_get_special_offers($post_id)
1769 1769
 {
1770
-    global $wpdb, $plugin_prefix;
1770
+	global $wpdb, $plugin_prefix;
1771 1771
 
1772
-    $post_type = get_post_type($post_id);
1772
+	$post_type = get_post_type($post_id);
1773 1773
 
1774
-    $table = $plugin_prefix . $post_type . '_detail';
1774
+	$table = $plugin_prefix . $post_type . '_detail';
1775 1775
 
1776
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1776
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1777 1777
 
1778
-    if ($results) {
1779
-        return $results[0]->geodir_special_offers;
1780
-    }
1778
+	if ($results) {
1779
+		return $results[0]->geodir_special_offers;
1780
+	}
1781 1781
 
1782 1782
 }
1783 1783
 
1784 1784
 if (!function_exists('geodir_max_upload_size')) {
1785
-    /**
1786
-     * Get max upload file size
1787
-     *
1788
-     * @since 1.0.0
1789
-     * @package GeoDirectory
1790
-     * @return mixed|void Returns max upload file size.
1791
-     */
1792
-    function geodir_max_upload_size()
1793
-    {
1794
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1795
-
1796
-        if ($max_filesize > 0 && $max_filesize < 1) {
1797
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1798
-        } else {
1799
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1800
-        }
1801
-        /** Filter documented in geodirectory-functions/general_functions.php **/
1802
-        return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1803
-    }
1785
+	/**
1786
+	 * Get max upload file size
1787
+	 *
1788
+	 * @since 1.0.0
1789
+	 * @package GeoDirectory
1790
+	 * @return mixed|void Returns max upload file size.
1791
+	 */
1792
+	function geodir_max_upload_size()
1793
+	{
1794
+		$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1795
+
1796
+		if ($max_filesize > 0 && $max_filesize < 1) {
1797
+			$max_filesize = (int)($max_filesize * 1024) . 'kb';
1798
+		} else {
1799
+			$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1800
+		}
1801
+		/** Filter documented in geodirectory-functions/general_functions.php **/
1802
+		return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1803
+	}
1804 1804
 }
1805 1805
 
1806 1806
 
@@ -1818,33 +1818,33 @@  discard block
 block discarded – undo
1818 1818
  */
1819 1819
 function geodir_add_custom_sort_options($fields, $post_type)
1820 1820
 {
1821
-    global $wpdb;
1821
+	global $wpdb;
1822 1822
 
1823
-    if ($post_type != '') {
1823
+	if ($post_type != '') {
1824 1824
 
1825
-        $all_postypes = geodir_get_posttypes();
1825
+		$all_postypes = geodir_get_posttypes();
1826 1826
 
1827
-        if (in_array($post_type, $all_postypes)) {
1827
+		if (in_array($post_type, $all_postypes)) {
1828 1828
 
1829
-            $custom_fields = $wpdb->get_results(
1830
-                $wpdb->prepare(
1831
-                    "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1832
-                    array($post_type)
1833
-                ), 'ARRAY_A'
1834
-            );
1829
+			$custom_fields = $wpdb->get_results(
1830
+				$wpdb->prepare(
1831
+					"select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1832
+					array($post_type)
1833
+				), 'ARRAY_A'
1834
+			);
1835 1835
 
1836
-            if (!empty($custom_fields)) {
1836
+			if (!empty($custom_fields)) {
1837 1837
 
1838
-                foreach ($custom_fields as $val) {
1839
-                    $fields[] = $val;
1840
-                }
1841
-            }
1838
+				foreach ($custom_fields as $val) {
1839
+					$fields[] = $val;
1840
+				}
1841
+			}
1842 1842
 
1843
-        }
1843
+		}
1844 1844
 
1845
-    }
1845
+	}
1846 1846
 
1847
-    return $fields;
1847
+	return $fields;
1848 1848
 }
1849 1849
 
1850 1850
 
@@ -1860,76 +1860,76 @@  discard block
 block discarded – undo
1860 1860
 function geodir_get_custom_sort_options($post_type = '')
1861 1861
 {
1862 1862
 
1863
-    global $wpdb;
1864
-
1865
-    if ($post_type != '') {
1866
-
1867
-        $all_postypes = geodir_get_posttypes();
1868
-
1869
-        if (!in_array($post_type, $all_postypes))
1870
-            return false;
1871
-
1872
-        $fields = array();
1873
-
1874
-        $fields[] = array(
1875
-            'post_type' => $post_type,
1876
-            'data_type' => '',
1877
-            'field_type' => 'random',
1878
-            'site_title' => 'Random',
1879
-            'htmlvar_name' => 'post_title',
1880
-            'field_icon' =>  'fa fa-random',
1881
-            'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1882
-        );
1883
-
1884
-        $fields[] = array(
1885
-            'post_type' => $post_type,
1886
-            'data_type' => '',
1887
-            'field_type' => 'datetime',
1888
-            'site_title' => __('Add date', 'geodirectory'),
1889
-            'htmlvar_name' => 'post_date',
1890
-            'field_icon' =>  'fa fa-calendar',
1891
-            'description' =>  __('Sort by date added', 'geodirectory')
1892
-        );
1893
-        $fields[] = array(
1894
-            'post_type' => $post_type,
1895
-            'data_type' => '',
1896
-            'field_type' => 'bigint',
1897
-            'site_title' => __('Review', 'geodirectory'),
1898
-            'htmlvar_name' => 'comment_count',
1899
-            'field_icon' =>  'fa fa-commenting-o',
1900
-            'description' =>  __('Sort by the number of reviews', 'geodirectory')
1901
-        );
1902
-        $fields[] = array(
1903
-            'post_type' => $post_type,
1904
-            'data_type' => '',
1905
-            'field_type' => 'float',
1906
-            'site_title' => __('Rating', 'geodirectory'),
1907
-            'htmlvar_name' => 'overall_rating',
1908
-            'field_icon' =>  'fa fa-star-o',
1909
-            'description' =>  __('Sort by the overall rating value', 'geodirectory')
1910
-        );
1911
-        $fields[] = array(
1912
-            'post_type' => $post_type,
1913
-            'data_type' => '',
1914
-            'field_type' => 'text',
1915
-            'site_title' => __('Title', 'geodirectory'),
1916
-            'htmlvar_name' => 'post_title',
1917
-            'field_icon' =>  'fa fa-sort-alpha-desc',
1918
-            'description' =>  __('Sort alphabetically by title', 'geodirectory')
1919
-        );
1920
-
1921
-        /**
1922
-         * Hook to add custom sort options.
1923
-         *
1924
-         * @since 1.0.0
1925
-         * @param array $fields Unmodified sort options array.
1926
-         * @param string $post_type Post type.
1927
-         */
1928
-        return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1929
-
1930
-    }
1931
-
1932
-    return false;
1863
+	global $wpdb;
1864
+
1865
+	if ($post_type != '') {
1866
+
1867
+		$all_postypes = geodir_get_posttypes();
1868
+
1869
+		if (!in_array($post_type, $all_postypes))
1870
+			return false;
1871
+
1872
+		$fields = array();
1873
+
1874
+		$fields[] = array(
1875
+			'post_type' => $post_type,
1876
+			'data_type' => '',
1877
+			'field_type' => 'random',
1878
+			'site_title' => 'Random',
1879
+			'htmlvar_name' => 'post_title',
1880
+			'field_icon' =>  'fa fa-random',
1881
+			'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1882
+		);
1883
+
1884
+		$fields[] = array(
1885
+			'post_type' => $post_type,
1886
+			'data_type' => '',
1887
+			'field_type' => 'datetime',
1888
+			'site_title' => __('Add date', 'geodirectory'),
1889
+			'htmlvar_name' => 'post_date',
1890
+			'field_icon' =>  'fa fa-calendar',
1891
+			'description' =>  __('Sort by date added', 'geodirectory')
1892
+		);
1893
+		$fields[] = array(
1894
+			'post_type' => $post_type,
1895
+			'data_type' => '',
1896
+			'field_type' => 'bigint',
1897
+			'site_title' => __('Review', 'geodirectory'),
1898
+			'htmlvar_name' => 'comment_count',
1899
+			'field_icon' =>  'fa fa-commenting-o',
1900
+			'description' =>  __('Sort by the number of reviews', 'geodirectory')
1901
+		);
1902
+		$fields[] = array(
1903
+			'post_type' => $post_type,
1904
+			'data_type' => '',
1905
+			'field_type' => 'float',
1906
+			'site_title' => __('Rating', 'geodirectory'),
1907
+			'htmlvar_name' => 'overall_rating',
1908
+			'field_icon' =>  'fa fa-star-o',
1909
+			'description' =>  __('Sort by the overall rating value', 'geodirectory')
1910
+		);
1911
+		$fields[] = array(
1912
+			'post_type' => $post_type,
1913
+			'data_type' => '',
1914
+			'field_type' => 'text',
1915
+			'site_title' => __('Title', 'geodirectory'),
1916
+			'htmlvar_name' => 'post_title',
1917
+			'field_icon' =>  'fa fa-sort-alpha-desc',
1918
+			'description' =>  __('Sort alphabetically by title', 'geodirectory')
1919
+		);
1920
+
1921
+		/**
1922
+		 * Hook to add custom sort options.
1923
+		 *
1924
+		 * @since 1.0.0
1925
+		 * @param array $fields Unmodified sort options array.
1926
+		 * @param string $post_type Post type.
1927
+		 */
1928
+		return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1929
+
1930
+	}
1931
+
1932
+	return false;
1933 1933
 }
1934 1934
 
1935 1935
 
@@ -1945,117 +1945,117 @@  discard block
 block discarded – undo
1945 1945
 function godir_set_sort_field_order($field_ids = array())
1946 1946
 {
1947 1947
 
1948
-    global $wpdb;
1948
+	global $wpdb;
1949 1949
 
1950
-    $count = 0;
1951
-    if (!empty($field_ids)):
1952
-        foreach ($field_ids as $id) {
1950
+	$count = 0;
1951
+	if (!empty($field_ids)):
1952
+		foreach ($field_ids as $id) {
1953 1953
 
1954
-            $cf = trim($id, '_');
1954
+			$cf = trim($id, '_');
1955 1955
 
1956
-            $post_meta_info = $wpdb->query(
1957
-                $wpdb->prepare(
1958
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1956
+			$post_meta_info = $wpdb->query(
1957
+				$wpdb->prepare(
1958
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1959 1959
 															sort_order=%d 
1960 1960
 															where id= %d",
1961
-                    array($count, $cf)
1962
-                )
1963
-            );
1964
-            $count++;
1965
-        }
1966
-
1967
-        return $field_ids;
1968
-    else:
1969
-        return false;
1970
-    endif;
1961
+					array($count, $cf)
1962
+				)
1963
+			);
1964
+			$count++;
1965
+		}
1966
+
1967
+		return $field_ids;
1968
+	else:
1969
+		return false;
1970
+	endif;
1971 1971
 }
1972 1972
 
1973 1973
 
1974 1974
 if (!function_exists('geodir_custom_sort_field_save')) {
1975
-    /**
1976
-     * Save or Update custom sort fields into the database.
1977
-     *
1978
-     * @since 1.0.0
1979
-     * @package GeoDirectory
1980
-     * @global object $wpdb WordPress Database object.
1981
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1982
-     * @param array $request_field {
1983
-     *    Attributes of the Request field.
1984
-     *
1985
-     *    @type string $action Ajax action name.
1986
-     *    @type string $manage_field_type Manage field type Default "sorting_options".
1987
-     *    @type string $create_field Do you want to create this field?.
1988
-     *    @type string $field_ins_upd Field created or updated?.
1989
-     *    @type string $_wpnonce Nonce value.
1990
-     *    @type string $listing_type The Post type.
1991
-     *    @type string $field_type Field Type.
1992
-     *    @type string $field_id Field ID.
1993
-     *    @type string $data_type Data Type.
1994
-     *    @type string $htmlvar_name HTML variable name.
1995
-     *    @type string $site_title Section title which you wish to display in frontend.
1996
-     *    @type string $is_default Is this default sorting?.
1997
-     *    @type string $is_active If not active then the field will not be displayed anywhere.
1998
-     *    @type string $sort_order Sort Order.
1999
-     *
2000
-     * }
2001
-     * @param bool $default Not yet implemented.
2002
-     * @return int Returns the last affected db table row id.
2003
-     */
2004
-    function geodir_custom_sort_field_save($request_field = array(), $default = false)
2005
-    {
2006
-
2007
-        global $wpdb, $plugin_prefix;
2008
-
2009
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2010
-
2011
-        $cf = trim($result_str, '_');
2012
-
2013
-        /*-------- check dublicate validation --------*/
2014
-
2015
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2016
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2017
-
2018
-        $post_type = $request_field['listing_type'];
2019
-        $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2020
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2021
-        $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2022
-        $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2023
-        $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2024
-        $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2025
-        $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2026
-        $asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2027
-        $desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2028
-        $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2029
-        $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2030
-
2031
-        $default_order = '';
2032
-        if ($is_default != '') {
2033
-            $default_order = $is_default;
2034
-            $is_default = '1';
2035
-        }
2036
-
2037
-
2038
-        $check_html_variable = $wpdb->get_var(
2039
-            $wpdb->prepare(
2040
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2041
-                array($cehhtmlvar_name, $post_type, $field_type)
2042
-            )
2043
-        );
2044
-
2045
-        if ($is_default == 1) {
2046
-
2047
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2048
-
2049
-        }
2050
-
2051
-
2052
-        if (!$check_html_variable) {
2053
-
2054
-            $wpdb->query(
2055
-
2056
-                $wpdb->prepare(
2057
-
2058
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1975
+	/**
1976
+	 * Save or Update custom sort fields into the database.
1977
+	 *
1978
+	 * @since 1.0.0
1979
+	 * @package GeoDirectory
1980
+	 * @global object $wpdb WordPress Database object.
1981
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1982
+	 * @param array $request_field {
1983
+	 *    Attributes of the Request field.
1984
+	 *
1985
+	 *    @type string $action Ajax action name.
1986
+	 *    @type string $manage_field_type Manage field type Default "sorting_options".
1987
+	 *    @type string $create_field Do you want to create this field?.
1988
+	 *    @type string $field_ins_upd Field created or updated?.
1989
+	 *    @type string $_wpnonce Nonce value.
1990
+	 *    @type string $listing_type The Post type.
1991
+	 *    @type string $field_type Field Type.
1992
+	 *    @type string $field_id Field ID.
1993
+	 *    @type string $data_type Data Type.
1994
+	 *    @type string $htmlvar_name HTML variable name.
1995
+	 *    @type string $site_title Section title which you wish to display in frontend.
1996
+	 *    @type string $is_default Is this default sorting?.
1997
+	 *    @type string $is_active If not active then the field will not be displayed anywhere.
1998
+	 *    @type string $sort_order Sort Order.
1999
+	 *
2000
+	 * }
2001
+	 * @param bool $default Not yet implemented.
2002
+	 * @return int Returns the last affected db table row id.
2003
+	 */
2004
+	function geodir_custom_sort_field_save($request_field = array(), $default = false)
2005
+	{
2006
+
2007
+		global $wpdb, $plugin_prefix;
2008
+
2009
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2010
+
2011
+		$cf = trim($result_str, '_');
2012
+
2013
+		/*-------- check dublicate validation --------*/
2014
+
2015
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2016
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2017
+
2018
+		$post_type = $request_field['listing_type'];
2019
+		$data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2020
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2021
+		$site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2022
+		$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2023
+		$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2024
+		$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2025
+		$is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2026
+		$asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2027
+		$desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2028
+		$asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2029
+		$desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2030
+
2031
+		$default_order = '';
2032
+		if ($is_default != '') {
2033
+			$default_order = $is_default;
2034
+			$is_default = '1';
2035
+		}
2036
+
2037
+
2038
+		$check_html_variable = $wpdb->get_var(
2039
+			$wpdb->prepare(
2040
+				"select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2041
+				array($cehhtmlvar_name, $post_type, $field_type)
2042
+			)
2043
+		);
2044
+
2045
+		if ($is_default == 1) {
2046
+
2047
+			$wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2048
+
2049
+		}
2050
+
2051
+
2052
+		if (!$check_html_variable) {
2053
+
2054
+			$wpdb->query(
2055
+
2056
+				$wpdb->prepare(
2057
+
2058
+					"insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2059 2059
 				post_type = %s,
2060 2060
 				data_type = %s,
2061 2061
 				field_type = %s,
@@ -2070,23 +2070,23 @@  discard block
 block discarded – undo
2070 2070
 				asc_title = %s,
2071 2071
 				desc_title = %s",
2072 2072
 
2073
-                    array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title)
2074
-                )
2073
+					array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title)
2074
+				)
2075 2075
 
2076
-            );
2076
+			);
2077 2077
 
2078 2078
 
2079
-            $lastid = $wpdb->insert_id;
2079
+			$lastid = $wpdb->insert_id;
2080 2080
 
2081
-            $lastid = trim($lastid);
2081
+			$lastid = trim($lastid);
2082 2082
 
2083
-        } else {
2083
+		} else {
2084 2084
 
2085
-            $wpdb->query(
2085
+			$wpdb->query(
2086 2086
 
2087
-                $wpdb->prepare(
2087
+				$wpdb->prepare(
2088 2088
 
2089
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2089
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2090 2090
 				post_type = %s,
2091 2091
 				data_type = %s,
2092 2092
 				field_type = %s,
@@ -2102,123 +2102,123 @@  discard block
 block discarded – undo
2102 2102
 				desc_title = %s
2103 2103
 				where id = %d",
2104 2104
 
2105
-                    array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf)
2106
-                )
2105
+					array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf)
2106
+				)
2107 2107
 
2108
-            );
2108
+			);
2109 2109
 
2110
-            $lastid = trim($cf);
2110
+			$lastid = trim($cf);
2111 2111
 
2112
-        }
2112
+		}
2113 2113
 
2114 2114
 
2115
-        return (int)$lastid;
2115
+		return (int)$lastid;
2116 2116
 
2117
-    }
2117
+	}
2118 2118
 }
2119 2119
 
2120 2120
 
2121 2121
 if (!function_exists('geodir_custom_sort_field_delete')) {
2122
-    /**
2123
-     * Delete a custom sort field using field id.
2124
-     * @since 1.0.0
2125
-     * @package GeoDirectory
2126
-     * @global object $wpdb WordPress Database object.
2127
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2128
-     * @param string $field_id The field ID.
2129
-     * @return int|string Returns field id when successful deletion, else returns 0.
2130
-     */
2131
-    function geodir_custom_sort_field_delete($field_id = '')
2132
-    {
2133
-
2134
-        global $wpdb, $plugin_prefix;
2135
-        if ($field_id != '') {
2136
-            $cf = trim($field_id, '_');
2137
-
2138
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2139
-
2140
-            return $field_id;
2141
-
2142
-        } else
2143
-            return 0;
2144
-
2145
-    }
2122
+	/**
2123
+	 * Delete a custom sort field using field id.
2124
+	 * @since 1.0.0
2125
+	 * @package GeoDirectory
2126
+	 * @global object $wpdb WordPress Database object.
2127
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2128
+	 * @param string $field_id The field ID.
2129
+	 * @return int|string Returns field id when successful deletion, else returns 0.
2130
+	 */
2131
+	function geodir_custom_sort_field_delete($field_id = '')
2132
+	{
2133
+
2134
+		global $wpdb, $plugin_prefix;
2135
+		if ($field_id != '') {
2136
+			$cf = trim($field_id, '_');
2137
+
2138
+			$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2139
+
2140
+			return $field_id;
2141
+
2142
+		} else
2143
+			return 0;
2144
+
2145
+	}
2146 2146
 }
2147 2147
 
2148 2148
 
2149 2149
 if (!function_exists('geodir_custom_sort_field_adminhtml')) {
2150
-    /**
2151
-     * Custom sort field admin html.
2152
-     *
2153
-     * @since 1.0.0
2154
-     * @package GeoDirectory
2155
-     * @global object $wpdb WordPress Database object.
2156
-     * @param string $field_type The form field type.
2157
-     * @param object|int $result_str The custom field results object or row id.
2158
-     * @param string $field_ins_upd When set to "submit" displays form.
2159
-     * @param bool $default when set to true field will be for admin use only.
2160
-     */
2161
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2162
-    {
2163
-        global $wpdb;
2164
-        $cf = $result_str;
2165
-        if (!is_object($cf)) {
2166
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2167
-        } else {
2168
-            $field_info = $cf;
2169
-            $result_str = $cf->id;
2170
-        }
2171
-
2172
-        $field_info = stripslashes_deep($field_info); // strip slashes
2173
-
2174
-        if (!isset($field_info->post_type)) {
2175
-            $post_type = sanitize_text_field($_REQUEST['listing_type']);
2176
-        } else {
2177
-            $post_type = $field_info->post_type;
2178
-        }
2179
-
2180
-
2181
-        $htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2182
-
2183
-        $site_title = '';
2184
-        if ($site_title == '')
2185
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2186
-
2187
-        if ($site_title == '') {
2188
-            $fields = geodir_get_custom_sort_options($post_type);
2189
-
2190
-            foreach ($fields as $val) {
2191
-                $val = stripslashes_deep($val); // strip slashes
2192
-
2193
-                if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2194
-                    $site_title = isset($val['site_title']) ? $val['site_title'] : '';
2195
-                }
2196
-            }
2197
-        }
2198
-
2199
-        if ($htmlvar_name == '')
2200
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2201
-
2202
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2203
-
2204
-        $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2205
-        $cso_arr = geodir_get_custom_sort_options($post_type);
2206
-
2207
-        $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2208
-        foreach($cso_arr as $cso){
2209
-            if($cur_field_type==$cso['field_type']){
2210
-
2211
-                if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2212
-                    $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2213
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2214
-                    $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2215
-                }
2216
-
2217
-            }
2218
-        }
2219
-
2220
-        $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2221
-        ?>
2150
+	/**
2151
+	 * Custom sort field admin html.
2152
+	 *
2153
+	 * @since 1.0.0
2154
+	 * @package GeoDirectory
2155
+	 * @global object $wpdb WordPress Database object.
2156
+	 * @param string $field_type The form field type.
2157
+	 * @param object|int $result_str The custom field results object or row id.
2158
+	 * @param string $field_ins_upd When set to "submit" displays form.
2159
+	 * @param bool $default when set to true field will be for admin use only.
2160
+	 */
2161
+	function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2162
+	{
2163
+		global $wpdb;
2164
+		$cf = $result_str;
2165
+		if (!is_object($cf)) {
2166
+			$field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2167
+		} else {
2168
+			$field_info = $cf;
2169
+			$result_str = $cf->id;
2170
+		}
2171
+
2172
+		$field_info = stripslashes_deep($field_info); // strip slashes
2173
+
2174
+		if (!isset($field_info->post_type)) {
2175
+			$post_type = sanitize_text_field($_REQUEST['listing_type']);
2176
+		} else {
2177
+			$post_type = $field_info->post_type;
2178
+		}
2179
+
2180
+
2181
+		$htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2182
+
2183
+		$site_title = '';
2184
+		if ($site_title == '')
2185
+			$site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2186
+
2187
+		if ($site_title == '') {
2188
+			$fields = geodir_get_custom_sort_options($post_type);
2189
+
2190
+			foreach ($fields as $val) {
2191
+				$val = stripslashes_deep($val); // strip slashes
2192
+
2193
+				if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2194
+					$site_title = isset($val['site_title']) ? $val['site_title'] : '';
2195
+				}
2196
+			}
2197
+		}
2198
+
2199
+		if ($htmlvar_name == '')
2200
+			$htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2201
+
2202
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
2203
+
2204
+		$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2205
+		$cso_arr = geodir_get_custom_sort_options($post_type);
2206
+
2207
+		$cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2208
+		foreach($cso_arr as $cso){
2209
+			if($cur_field_type==$cso['field_type']){
2210
+
2211
+				if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2212
+					$field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2213
+				}elseif(isset($cso['field_icon']) && $cso['field_icon']){
2214
+					$field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2215
+				}
2216
+
2217
+			}
2218
+		}
2219
+
2220
+		$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2221
+		?>
2222 2222
 
2223 2223
         <li class="text" id="licontainer_<?php echo $result_str;?>">
2224 2224
             <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
@@ -2227,7 +2227,7 @@  discard block
 block discarded – undo
2227 2227
                  ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2228 2228
                 <?php
2229 2229
 
2230
-                ?>
2230
+				?>
2231 2231
 
2232 2232
                 <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2233 2233
                      onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
@@ -2242,17 +2242,17 @@  discard block
 block discarded – undo
2242 2242
 
2243 2243
             <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2244 2244
                  style="display:<?php if ($field_ins_upd == 'submit') {
2245
-                     echo 'block;';
2246
-                 } else {
2247
-                     echo 'none;';
2248
-                 } ?>">
2245
+					 echo 'block;';
2246
+				 } else {
2247
+					 echo 'none;';
2248
+				 } ?>">
2249 2249
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2250 2250
                 <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2251 2251
                 <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2252 2252
                 <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2253 2253
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2254
-                    echo $field_info->data_type;
2255
-                }?>"/>
2254
+					echo $field_info->data_type;
2255
+				}?>"/>
2256 2256
                 <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2257 2257
 
2258 2258
 
@@ -2275,14 +2275,14 @@  discard block
 block discarded – undo
2275 2275
 
2276 2276
                                 <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled"  value="1"
2277 2277
                                     <?php if ($value == '1') {
2278
-                                        echo 'checked';
2279
-                                    } ?>/>
2278
+										echo 'checked';
2279
+									} ?>/>
2280 2280
                                 <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2281 2281
 
2282 2282
                                 <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0"
2283 2283
                                     <?php if ($value == '0' || !$value) {
2284
-                                        echo 'checked';
2285
-                                    } ?>/>
2284
+										echo 'checked';
2285
+									} ?>/>
2286 2286
                                 <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2287 2287
 
2288 2288
                             </div>
@@ -2319,8 +2319,8 @@  discard block
 block discarded – undo
2319 2319
 
2320 2320
                                 <input type="radio" name="is_default"
2321 2321
                                        value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2322
-                                    echo 'checked="checked"';
2323
-                                } ?>/>
2322
+									echo 'checked="checked"';
2323
+								} ?>/>
2324 2324
                             </div>
2325 2325
 
2326 2326
                         </li>
@@ -2340,14 +2340,14 @@  discard block
 block discarded – undo
2340 2340
 
2341 2341
                                 <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled"  value="1"
2342 2342
                                     <?php if ($value == '1') {
2343
-                                        echo 'checked';
2344
-                                    } ?>/>
2343
+										echo 'checked';
2344
+									} ?>/>
2345 2345
                                 <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2346 2346
 
2347 2347
                                 <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0"
2348 2348
                                     <?php if ($value == '0' || !$value) {
2349
-                                        echo 'checked';
2350
-                                    } ?>/>
2349
+										echo 'checked';
2350
+									} ?>/>
2351 2351
                                 <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2352 2352
 
2353 2353
                             </div>
@@ -2383,8 +2383,8 @@  discard block
 block discarded – undo
2383 2383
 
2384 2384
                                 <input type="radio" name="is_default"
2385 2385
                                        value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2386
-                                    echo 'checked="checked"';
2387
-                                } ?>/>
2386
+									echo 'checked="checked"';
2387
+								} ?>/>
2388 2388
                             </div>
2389 2389
 
2390 2390
                         </li>
@@ -2426,8 +2426,8 @@  discard block
 block discarded – undo
2426 2426
 
2427 2427
                                 <input type="checkbox" name="is_default"
2428 2428
                                        value="<?php echo $field_type; ?>"  <?php if (isset($value) && $value == '1') {
2429
-                                    echo 'checked="checked"';
2430
-                                } ?>/>
2429
+									echo 'checked="checked"';
2430
+								} ?>/>
2431 2431
                             </div>
2432 2432
 
2433 2433
 
@@ -2450,14 +2450,14 @@  discard block
 block discarded – undo
2450 2450
 
2451 2451
                             <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
2452 2452
                                 <?php if ($value == '1') {
2453
-                                    echo 'checked';
2454
-                                } ?>/>
2453
+									echo 'checked';
2454
+								} ?>/>
2455 2455
                             <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2456 2456
 
2457 2457
                             <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
2458 2458
                                 <?php if ($value == '0' || !$value) {
2459
-                                    echo 'checked';
2460
-                                } ?>/>
2459
+									echo 'checked';
2460
+								} ?>/>
2461 2461
                             <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2462 2462
 
2463 2463
                         </div>
@@ -2467,8 +2467,8 @@  discard block
 block discarded – undo
2467 2467
 
2468 2468
                     <input type="hidden" readonly="readonly" name="sort_order" id="sort_order"
2469 2469
                                                 value="<?php if (isset($field_info->sort_order)) {
2470
-                                                    echo esc_attr($field_info->sort_order);
2471
-                                                }?>" size="50"/>
2470
+													echo esc_attr($field_info->sort_order);
2471
+												}?>" size="50"/>
2472 2472
 
2473 2473
 
2474 2474
 
@@ -2492,38 +2492,38 @@  discard block
 block discarded – undo
2492 2492
             </form>
2493 2493
         </li> <?php
2494 2494
 
2495
-    }
2495
+	}
2496 2496
 }
2497 2497
 
2498 2498
 if (!function_exists('check_field_visibility')) {
2499
-    /**
2500
-     * Check field visibility as per price package.
2501
-     *
2502
-     * @since 1.0.0
2503
-     * @package GeoDirectory
2504
-     * @global object $wpdb WordPress Database object.
2505
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
2506
-     * @param int|string $package_id The package ID.
2507
-     * @param string $field_name The field name.
2508
-     * @param string $post_type Optional. The wordpress post type.
2509
-     * @return bool Returns true when field visible, otherwise false.
2510
-     */
2511
-    function check_field_visibility($package_id, $field_name, $post_type)
2512
-    {
2513
-        global $wpdb, $geodir_addon_list;
2514
-        if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2515
-            return true;
2516
-        }
2517
-        if (!$package_id || !$field_name || !$post_type) {
2518
-            return true;
2519
-        }
2520
-        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
2521
-
2522
-        if ($wpdb->get_var($sql)) {
2523
-            return true;
2524
-        }
2525
-        return false;
2526
-    }
2499
+	/**
2500
+	 * Check field visibility as per price package.
2501
+	 *
2502
+	 * @since 1.0.0
2503
+	 * @package GeoDirectory
2504
+	 * @global object $wpdb WordPress Database object.
2505
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
2506
+	 * @param int|string $package_id The package ID.
2507
+	 * @param string $field_name The field name.
2508
+	 * @param string $post_type Optional. The wordpress post type.
2509
+	 * @return bool Returns true when field visible, otherwise false.
2510
+	 */
2511
+	function check_field_visibility($package_id, $field_name, $post_type)
2512
+	{
2513
+		global $wpdb, $geodir_addon_list;
2514
+		if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2515
+			return true;
2516
+		}
2517
+		if (!$package_id || !$field_name || !$post_type) {
2518
+			return true;
2519
+		}
2520
+		$sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
2521
+
2522
+		if ($wpdb->get_var($sql)) {
2523
+			return true;
2524
+		}
2525
+		return false;
2526
+	}
2527 2527
 }
2528 2528
 
2529 2529
 /**
@@ -2538,43 +2538,43 @@  discard block
 block discarded – undo
2538 2538
  */
2539 2539
 function geodir_string_to_options($input = '', $translated = false)
2540 2540
 {
2541
-    $return = array();
2542
-    if ($input != '') {
2543
-        $input = trim($input);
2544
-        $input = rtrim($input, ",");
2545
-        $input = ltrim($input, ",");
2546
-        $input = trim($input);
2547
-    }
2548
-
2549
-    $input_arr = explode(',', $input);
2550
-
2551
-    if (!empty($input_arr)) {
2552
-        foreach ($input_arr as $input_str) {
2553
-            $input_str = trim($input_str);
2554
-
2555
-            if (strpos($input_str, "/") !== false) {
2556
-                $input_str = explode("/", $input_str, 2);
2557
-                $label = trim($input_str[0]);
2558
-                if ($translated && $label != '') {
2559
-                    $label = __($label, 'geodirectory');
2560
-                }
2561
-                $label = ucfirst($label);
2562
-                $value = trim($input_str[1]);
2563
-            } else {
2564
-                if ($translated && $input_str != '') {
2565
-                    $input_str = __($input_str, 'geodirectory');
2566
-                }
2567
-                $label = ucfirst($input_str);
2568
-                $value = $input_str;
2569
-            }
2570
-
2571
-            if ($label != '') {
2572
-                $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2573
-            }
2574
-        }
2575
-    }
2576
-
2577
-    return $return;
2541
+	$return = array();
2542
+	if ($input != '') {
2543
+		$input = trim($input);
2544
+		$input = rtrim($input, ",");
2545
+		$input = ltrim($input, ",");
2546
+		$input = trim($input);
2547
+	}
2548
+
2549
+	$input_arr = explode(',', $input);
2550
+
2551
+	if (!empty($input_arr)) {
2552
+		foreach ($input_arr as $input_str) {
2553
+			$input_str = trim($input_str);
2554
+
2555
+			if (strpos($input_str, "/") !== false) {
2556
+				$input_str = explode("/", $input_str, 2);
2557
+				$label = trim($input_str[0]);
2558
+				if ($translated && $label != '') {
2559
+					$label = __($label, 'geodirectory');
2560
+				}
2561
+				$label = ucfirst($label);
2562
+				$value = trim($input_str[1]);
2563
+			} else {
2564
+				if ($translated && $input_str != '') {
2565
+					$input_str = __($input_str, 'geodirectory');
2566
+				}
2567
+				$label = ucfirst($input_str);
2568
+				$value = $input_str;
2569
+			}
2570
+
2571
+			if ($label != '') {
2572
+				$return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2573
+			}
2574
+		}
2575
+	}
2576
+
2577
+	return $return;
2578 2578
 }
2579 2579
 
2580 2580
 /**
@@ -2589,59 +2589,59 @@  discard block
 block discarded – undo
2589 2589
  */
2590 2590
 function geodir_string_values_to_options($option_values = '', $translated = false)
2591 2591
 {
2592
-    $options = array();
2593
-    if ($option_values == '') {
2594
-        return NULL;
2595
-    }
2596
-
2597
-    if (strpos($option_values, "{/optgroup}") !== false) {
2598
-        $option_values_arr = explode("{/optgroup}", $option_values);
2599
-
2600
-        foreach ($option_values_arr as $optgroup) {
2601
-            if (strpos($optgroup, "{optgroup}") !== false) {
2602
-                $optgroup_arr = explode("{optgroup}", $optgroup);
2603
-
2604
-                $count = 0;
2605
-                foreach ($optgroup_arr as $optgroup_str) {
2606
-                    $count++;
2607
-                    $optgroup_str = trim($optgroup_str);
2608
-
2609
-                    $optgroup_label = '';
2610
-                    if (strpos($optgroup_str, "|") !== false) {
2611
-                        $optgroup_str_arr = explode("|", $optgroup_str, 2);
2612
-                        $optgroup_label = trim($optgroup_str_arr[0]);
2613
-                        if ($translated && $optgroup_label != '') {
2614
-                            $optgroup_label = __($optgroup_label, 'geodirectory');
2615
-                        }
2616
-                        $optgroup_label = ucfirst($optgroup_label);
2617
-                        $optgroup_str = $optgroup_str_arr[1];
2618
-                    }
2619
-
2620
-                    $optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2621
-
2622
-                    if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2623
-                        $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2624
-                        $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2625
-                        $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2626
-                    }
2627
-                    $options = array_merge($options, $optgroup3);
2628
-                }
2629
-            } else {
2630
-                $optgroup1 = geodir_string_to_options($optgroup, $translated);
2631
-                $options = array_merge($options, $optgroup1);
2632
-            }
2633
-        }
2634
-    } else {
2635
-        $options = geodir_string_to_options($option_values, $translated);
2636
-    }
2637
-
2638
-    return $options;
2592
+	$options = array();
2593
+	if ($option_values == '') {
2594
+		return NULL;
2595
+	}
2596
+
2597
+	if (strpos($option_values, "{/optgroup}") !== false) {
2598
+		$option_values_arr = explode("{/optgroup}", $option_values);
2599
+
2600
+		foreach ($option_values_arr as $optgroup) {
2601
+			if (strpos($optgroup, "{optgroup}") !== false) {
2602
+				$optgroup_arr = explode("{optgroup}", $optgroup);
2603
+
2604
+				$count = 0;
2605
+				foreach ($optgroup_arr as $optgroup_str) {
2606
+					$count++;
2607
+					$optgroup_str = trim($optgroup_str);
2608
+
2609
+					$optgroup_label = '';
2610
+					if (strpos($optgroup_str, "|") !== false) {
2611
+						$optgroup_str_arr = explode("|", $optgroup_str, 2);
2612
+						$optgroup_label = trim($optgroup_str_arr[0]);
2613
+						if ($translated && $optgroup_label != '') {
2614
+							$optgroup_label = __($optgroup_label, 'geodirectory');
2615
+						}
2616
+						$optgroup_label = ucfirst($optgroup_label);
2617
+						$optgroup_str = $optgroup_str_arr[1];
2618
+					}
2619
+
2620
+					$optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2621
+
2622
+					if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2623
+						$optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2624
+						$optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2625
+						$optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2626
+					}
2627
+					$options = array_merge($options, $optgroup3);
2628
+				}
2629
+			} else {
2630
+				$optgroup1 = geodir_string_to_options($optgroup, $translated);
2631
+				$options = array_merge($options, $optgroup1);
2632
+			}
2633
+		}
2634
+	} else {
2635
+		$options = geodir_string_to_options($option_values, $translated);
2636
+	}
2637
+
2638
+	return $options;
2639 2639
 }
2640 2640
 
2641 2641
 
2642 2642
 function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2643
-    ob_start();
2644
-    ?>
2643
+	ob_start();
2644
+	?>
2645 2645
     <li>
2646 2646
         <label for="data_type""><?php _e('Field Data Type ? :', 'geodirectory'); ?></label>
2647 2647
         <div class="gd-cf-input-wrap">
@@ -2650,16 +2650,16 @@  discard block
 block discarded – undo
2650 2650
                     onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');">
2651 2651
                 <option
2652 2652
                     value="XVARCHAR" <?php if (isset($field_info->data_type) && $field_info->data_type == 'VARCHAR') {
2653
-                    echo 'selected="selected"';
2654
-                } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2653
+					echo 'selected="selected"';
2654
+				} ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2655 2655
                 <option
2656 2656
                     value="INT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'INT') {
2657
-                    echo 'selected="selected"';
2658
-                } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2657
+					echo 'selected="selected"';
2658
+				} ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2659 2659
                 <option
2660 2660
                     value="FLOAT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'FLOAT') {
2661
-                    echo 'selected="selected"';
2662
-                } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2661
+					echo 'selected="selected"';
2662
+				} ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2663 2663
             </select>
2664 2664
             <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
2665 2665
 
@@ -2672,8 +2672,8 @@  discard block
 block discarded – undo
2672 2672
             <select name="decimal_point" id="decimal_point">
2673 2673
                 <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
2674 2674
                 <?php for ($i = 1; $i <= 10; $i++) {
2675
-                    $decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';
2676
-                    $selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>
2675
+					$decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';
2676
+					$selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>
2677 2677
                     <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
2678 2678
                 <?php } ?>
2679 2679
             </select>
@@ -2682,8 +2682,8 @@  discard block
 block discarded – undo
2682 2682
     </li>
2683 2683
 <?php
2684 2684
 
2685
-    $output = ob_get_clean();
2686
-    return $output;
2685
+	$output = ob_get_clean();
2686
+	return $output;
2687 2687
 }
2688 2688
 add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2689 2689
 
@@ -2721,9 +2721,9 @@  discard block
 block discarded – undo
2721 2721
 
2722 2722
 
2723 2723
 function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2724
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2725
-    ob_start();
2726
-    ?>
2724
+	if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2725
+	ob_start();
2726
+	?>
2727 2727
     <li>
2728 2728
         <label for="advanced_editor" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show advanced editor :', 'geodirectory'); ?>
2729 2729
             <div class="gdcf-tooltip">
@@ -2734,13 +2734,13 @@  discard block
 block discarded – undo
2734 2734
         <div class="gd-cf-input-wrap">
2735 2735
 
2736 2736
             <?php
2737
-            $selected = '';
2738
-            if (isset($field_info->extra_fields))
2739
-                $advanced_editor = unserialize($field_info->extra_fields);
2737
+			$selected = '';
2738
+			if (isset($field_info->extra_fields))
2739
+				$advanced_editor = unserialize($field_info->extra_fields);
2740 2740
 
2741
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2742
-                $selected = 'checked="checked"';
2743
-            ?>
2741
+			if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2742
+				$selected = 'checked="checked"';
2743
+			?>
2744 2744
 
2745 2745
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
2746 2746
                    value="1" <?php echo $selected; ?>/>
@@ -2749,22 +2749,22 @@  discard block
 block discarded – undo
2749 2749
     </li>
2750 2750
     <?php
2751 2751
 
2752
-    $output = ob_get_clean();
2753
-    return $output;
2752
+	$output = ob_get_clean();
2753
+	return $output;
2754 2754
 }
2755 2755
 add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2756 2756
 
2757 2757
 
2758 2758
 function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2759
-    ob_start();
2760
-
2761
-    $value = '';
2762
-    if (isset($field_info->validation_pattern)) {
2763
-        $value = esc_attr($field_info->validation_pattern);
2764
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2765
-        $value = esc_attr($cf['defaults']['validation_pattern']);
2766
-    }
2767
-    ?>
2759
+	ob_start();
2760
+
2761
+	$value = '';
2762
+	if (isset($field_info->validation_pattern)) {
2763
+		$value = esc_attr($field_info->validation_pattern);
2764
+	}elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2765
+		$value = esc_attr($cf['defaults']['validation_pattern']);
2766
+	}
2767
+	?>
2768 2768
     <li>
2769 2769
         <label for="validation_pattern" class="gd-cf-tooltip-wrap">
2770 2770
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Pattern:', 'geodirectory'); ?>
@@ -2778,13 +2778,13 @@  discard block
 block discarded – undo
2778 2778
         </div>
2779 2779
     </li>
2780 2780
     <?php
2781
-    $value = '';
2782
-    if (isset($field_info->validation_msg)) {
2783
-        $value = esc_attr($field_info->validation_msg);
2784
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2785
-        $value = esc_attr($cf['defaults']['validation_msg']);
2786
-    }
2787
-    ?>
2781
+	$value = '';
2782
+	if (isset($field_info->validation_msg)) {
2783
+		$value = esc_attr($field_info->validation_msg);
2784
+	}elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2785
+		$value = esc_attr($cf['defaults']['validation_msg']);
2786
+	}
2787
+	?>
2788 2788
     <li>
2789 2789
         <label for="validation_msg" class="gd-cf-tooltip-wrap">
2790 2790
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Message:', 'geodirectory'); ?>
@@ -2799,21 +2799,21 @@  discard block
 block discarded – undo
2799 2799
     </li>
2800 2800
     <?php
2801 2801
 
2802
-    $output = ob_get_clean();
2803
-    return $output;
2802
+	$output = ob_get_clean();
2803
+	return $output;
2804 2804
 }
2805 2805
 add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2806 2806
 
2807 2807
 
2808 2808
 function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2809
-    ob_start();
2810
-    global $post_type;
2811
-
2812
-    if (!isset($field_info->post_type)) {
2813
-        $post_type = sanitize_text_field($_REQUEST['listing_type']);
2814
-    } else
2815
-        $post_type = $field_info->post_type;
2816
-    ?>
2809
+	ob_start();
2810
+	global $post_type;
2811
+
2812
+	if (!isset($field_info->post_type)) {
2813
+		$post_type = sanitize_text_field($_REQUEST['listing_type']);
2814
+	} else
2815
+		$post_type = $field_info->post_type;
2816
+	?>
2817 2817
     <li style="display: none;">
2818 2818
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
2819 2819
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Select taxonomy:', 'geodirectory'); ?>
@@ -2824,15 +2824,15 @@  discard block
 block discarded – undo
2824 2824
         <div class="gd-cf-input-wrap">
2825 2825
             <select name="htmlvar_name" id="htmlvar_name">
2826 2826
                 <?php
2827
-                $gd_taxonomy = geodir_get_taxonomies($post_type);
2827
+				$gd_taxonomy = geodir_get_taxonomies($post_type);
2828 2828
 
2829
-                foreach ($gd_taxonomy as $gd_tax) {
2830
-                    ?>
2829
+				foreach ($gd_taxonomy as $gd_tax) {
2830
+					?>
2831 2831
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2832
-                        echo 'selected="selected"';
2833
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2834
-                }
2835
-                ?>
2832
+						echo 'selected="selected"';
2833
+					}?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2834
+				}
2835
+				?>
2836 2836
             </select>
2837 2837
         </div>
2838 2838
     </li>
@@ -2848,49 +2848,49 @@  discard block
 block discarded – undo
2848 2848
 
2849 2849
             <select name="cat_display_type" id="cat_display_type">
2850 2850
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2851
-                    echo 'selected="selected"';
2852
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2851
+					echo 'selected="selected"';
2852
+				}?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2853 2853
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2854
-                    echo 'selected="selected"';
2855
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2854
+					echo 'selected="selected"';
2855
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
2856 2856
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2857
-                    echo 'selected="selected"';
2858
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2857
+					echo 'selected="selected"';
2858
+				}?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2859 2859
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2860
-                    echo 'selected="selected"';
2861
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2860
+					echo 'selected="selected"';
2861
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2862 2862
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2863
-                    echo 'selected="selected"';
2864
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2863
+					echo 'selected="selected"';
2864
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2865 2865
             </select>
2866 2866
         </div>
2867 2867
     </li>
2868 2868
     <?php
2869 2869
 
2870
-    $output = ob_get_clean();
2871
-    return $output;
2870
+	$output = ob_get_clean();
2871
+	return $output;
2872 2872
 }
2873 2873
 add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2874 2874
 
2875 2875
 
2876 2876
 function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2877 2877
 
2878
-    ob_start();
2879
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2880
-        $address = unserialize($field_info->extra_fields);
2881
-    }
2878
+	ob_start();
2879
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2880
+		$address = unserialize($field_info->extra_fields);
2881
+	}
2882 2882
 
2883
-    $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2884
-    ?>
2883
+	$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2884
+	?>
2885 2885
     <?php
2886
-    /**
2887
-     * Called on the add custom fields settings page before the address field is output.
2888
-     *
2889
-     * @since 1.0.0
2890
-     * @param array $address The address settings array.
2891
-     * @param object $field_info Extra fields info.
2892
-     */
2893
-    do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2886
+	/**
2887
+	 * Called on the add custom fields settings page before the address field is output.
2888
+	 *
2889
+	 * @since 1.0.0
2890
+	 * @param array $address The address settings array.
2891
+	 * @param object $field_info Extra fields info.
2892
+	 */
2893
+	do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2894 2894
 
2895 2895
     <li>
2896 2896
         <label for="show_zip" class="gd-cf-tooltip-wrap">
@@ -2903,14 +2903,14 @@  discard block
 block discarded – undo
2903 2903
 
2904 2904
             <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2905 2905
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2906
-                    echo 'checked';
2907
-                } ?>/>
2906
+					echo 'checked';
2907
+				} ?>/>
2908 2908
             <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2909 2909
 
2910 2910
             <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2911 2911
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2912
-                    echo 'checked';
2913
-                } ?>/>
2912
+					echo 'checked';
2913
+				} ?>/>
2914 2914
             <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2915 2915
 
2916 2916
 
@@ -2927,8 +2927,8 @@  discard block
 block discarded – undo
2927 2927
         <div class="gd-cf-input-wrap">
2928 2928
             <input type="text" name="extra[zip_lable]" id="zip_lable"
2929 2929
                    value="<?php if (isset($address['zip_lable'])) {
2930
-                       echo esc_attr($address['zip_lable']);
2931
-                   }?>"/>
2930
+					   echo esc_attr($address['zip_lable']);
2931
+				   }?>"/>
2932 2932
         </div>
2933 2933
     </li>
2934 2934
 
@@ -2945,8 +2945,8 @@  discard block
 block discarded – undo
2945 2945
         <div class="gd-cf-input-wrap">
2946 2946
             <input type="text" name="extra[map_lable]" id="map_lable"
2947 2947
                    value="<?php if (isset($address['map_lable'])) {
2948
-                       echo esc_attr($address['map_lable']);
2949
-                   }?>"/>
2948
+					   echo esc_attr($address['map_lable']);
2949
+				   }?>"/>
2950 2950
         </div>
2951 2951
     </li>
2952 2952
 
@@ -2961,14 +2961,14 @@  discard block
 block discarded – undo
2961 2961
 
2962 2962
             <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2963 2963
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
2964
-                    echo 'checked';
2965
-                } ?>/>
2964
+					echo 'checked';
2965
+				} ?>/>
2966 2966
             <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2967 2967
 
2968 2968
             <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2969 2969
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
2970
-                    echo 'checked';
2971
-                } ?>/>
2970
+					echo 'checked';
2971
+				} ?>/>
2972 2972
             <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2973 2973
 
2974 2974
         </div>
@@ -2985,14 +2985,14 @@  discard block
 block discarded – undo
2985 2985
 
2986 2986
             <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
2987 2987
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
2988
-                    echo 'checked';
2989
-                } ?>/>
2988
+					echo 'checked';
2989
+				} ?>/>
2990 2990
             <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2991 2991
 
2992 2992
             <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
2993 2993
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
2994
-                    echo 'checked';
2995
-                } ?>/>
2994
+					echo 'checked';
2995
+				} ?>/>
2996 2996
             <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2997 2997
 
2998 2998
         </div>
@@ -3009,8 +3009,8 @@  discard block
 block discarded – undo
3009 3009
         <div class="gd-cf-input-wrap">
3010 3010
             <input type="text" name="extra[mapview_lable]" id="mapview_lable"
3011 3011
                    value="<?php if (isset($address['mapview_lable'])) {
3012
-                       echo esc_attr($address['mapview_lable']);
3013
-                   }?>"/>
3012
+					   echo esc_attr($address['mapview_lable']);
3013
+				   }?>"/>
3014 3014
         </div>
3015 3015
     </li>
3016 3016
     <li>
@@ -3024,29 +3024,29 @@  discard block
 block discarded – undo
3024 3024
 
3025 3025
             <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3026 3026
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
3027
-                    echo 'checked';
3028
-                } ?>/>
3027
+					echo 'checked';
3028
+				} ?>/>
3029 3029
             <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3030 3030
 
3031 3031
             <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3032 3032
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
3033
-                    echo 'checked';
3034
-                } ?>/>
3033
+					echo 'checked';
3034
+				} ?>/>
3035 3035
             <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3036 3036
 
3037 3037
         </div>
3038 3038
     </li>
3039 3039
     <?php
3040 3040
 
3041
-    $html = ob_get_clean();
3042
-    return $output.$html;
3041
+	$html = ob_get_clean();
3042
+	return $output.$html;
3043 3043
 }
3044 3044
 add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
3045 3045
 
3046 3046
 
3047 3047
 function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
3048
-    ob_start();
3049
-    ?>
3048
+	ob_start();
3049
+	?>
3050 3050
     <li>
3051 3051
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
3052 3052
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
@@ -3058,14 +3058,14 @@  discard block
 block discarded – undo
3058 3058
 
3059 3059
             <select name="multi_display_type" id="multi_display_type">
3060 3060
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
3061
-                    echo 'selected="selected"';
3062
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
3061
+					echo 'selected="selected"';
3062
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
3063 3063
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
3064
-                    echo 'selected="selected"';
3065
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3064
+					echo 'selected="selected"';
3065
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3066 3066
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
3067
-                    echo 'selected="selected"';
3068
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3067
+					echo 'selected="selected"';
3068
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3069 3069
             </select>
3070 3070
 
3071 3071
             <br/>
@@ -3073,25 +3073,25 @@  discard block
 block discarded – undo
3073 3073
     </li>
3074 3074
     <?php
3075 3075
 
3076
-    $html = ob_get_clean();
3077
-    return $output.$html;
3076
+	$html = ob_get_clean();
3077
+	return $output.$html;
3078 3078
 }
3079 3079
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
3080 3080
 
3081 3081
 
3082 3082
 function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
3083 3083
 
3084
-    ob_start();
3084
+	ob_start();
3085 3085
 
3086
-    $value = '';
3087
-    if (isset($field_info->option_values)) {
3088
-        $value = esc_attr($field_info->option_values);
3089
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3090
-        $value = esc_attr($cf['defaults']['option_values']);
3091
-    }
3086
+	$value = '';
3087
+	if (isset($field_info->option_values)) {
3088
+		$value = esc_attr($field_info->option_values);
3089
+	}elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3090
+		$value = esc_attr($cf['defaults']['option_values']);
3091
+	}
3092 3092
 
3093
-    $field_type = isset($field_info->field_type) ? $field_info->field_type : '';
3094
-    ?>
3093
+	$field_type = isset($field_info->field_type) ? $field_info->field_type : '';
3094
+	?>
3095 3095
     <li>
3096 3096
         <label for="option_values" class="gd-cf-tooltip-wrap">
3097 3097
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
@@ -3118,8 +3118,8 @@  discard block
 block discarded – undo
3118 3118
     </li>
3119 3119
     <?php
3120 3120
 
3121
-    $html = ob_get_clean();
3122
-    return $output.$html;
3121
+	$html = ob_get_clean();
3122
+	return $output.$html;
3123 3123
 }
3124 3124
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
3125 3125
 add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
@@ -3127,12 +3127,12 @@  discard block
 block discarded – undo
3127 3127
 
3128 3128
 
3129 3129
 function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
3130
-    ob_start();
3131
-    $extra = array();
3132
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3133
-        $extra = unserialize($field_info->extra_fields);
3134
-    }
3135
-    ?>
3130
+	ob_start();
3131
+	$extra = array();
3132
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3133
+		$extra = unserialize($field_info->extra_fields);
3134
+	}
3135
+	?>
3136 3136
     <li>
3137 3137
         <label for="date_format" class="gd-cf-tooltip-wrap">
3138 3138
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
@@ -3142,52 +3142,52 @@  discard block
 block discarded – undo
3142 3142
         </label>
3143 3143
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
3144 3144
             <?php
3145
-            $date_formats = array(
3146
-                'm/d/Y',
3147
-                'd/m/Y',
3148
-                'Y/m/d',
3149
-                'm-d-Y',
3150
-                'd-m-Y',
3151
-                'Y-m-d',
3152
-                'F j, Y',
3153
-            );
3154
-            /**
3155
-             * Filter the custom field date format options.
3156
-             *
3157
-             * @since 1.6.5
3158
-             * @param array $date_formats The PHP date format array.
3159
-             */
3160
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
3161
-            ?>
3145
+			$date_formats = array(
3146
+				'm/d/Y',
3147
+				'd/m/Y',
3148
+				'Y/m/d',
3149
+				'm-d-Y',
3150
+				'd-m-Y',
3151
+				'Y-m-d',
3152
+				'F j, Y',
3153
+			);
3154
+			/**
3155
+			 * Filter the custom field date format options.
3156
+			 *
3157
+			 * @since 1.6.5
3158
+			 * @param array $date_formats The PHP date format array.
3159
+			 */
3160
+			$date_formats = apply_filters('geodir_date_formats',$date_formats);
3161
+			?>
3162 3162
             <select name="extra[date_format]" id="date_format">
3163 3163
                 <?php
3164
-                foreach($date_formats as $format){
3165
-                    $selected = '';
3166
-                    if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3167
-                        $selected = "selected='selected'";
3168
-                    }
3169
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3170
-                }
3171
-                ?>
3164
+				foreach($date_formats as $format){
3165
+					$selected = '';
3166
+					if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3167
+						$selected = "selected='selected'";
3168
+					}
3169
+					echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3170
+				}
3171
+				?>
3172 3172
             </select>
3173 3173
 
3174 3174
         </div>
3175 3175
     </li>
3176 3176
     <?php
3177 3177
 
3178
-    $html = ob_get_clean();
3179
-    return $output.$html;
3178
+	$html = ob_get_clean();
3179
+	return $output.$html;
3180 3180
 }
3181 3181
 add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3182 3182
 
3183 3183
 
3184 3184
 function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3185
-    ob_start();
3186
-    $allowed_file_types = geodir_allowed_mime_types();
3185
+	ob_start();
3186
+	$allowed_file_types = geodir_allowed_mime_types();
3187 3187
 
3188
-    $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3189
-    $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3190
-    ?>
3188
+	$extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3189
+	$gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3190
+	?>
3191 3191
     <li>
3192 3192
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3193 3193
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
@@ -3210,182 +3210,182 @@  discard block
 block discarded – undo
3210 3210
     </li>
3211 3211
     <?php
3212 3212
 
3213
-    $html = ob_get_clean();
3214
-    return $output.$html;
3213
+	$html = ob_get_clean();
3214
+	return $output.$html;
3215 3215
 }
3216 3216
 add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3217 3217
 
3218 3218
 function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
3219
-    $fields = array();
3220
-    $package = ($package_id=='') ? '' : array($package_id);
3221
-
3222
-    $fields[] = array('listing_type' => $post_type,
3223
-                      'data_type' => 'VARCHAR',
3224
-                      'field_type' => 'taxonomy',
3225
-                      'admin_title' => __('Category', 'geodirectory'),
3226
-                      'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
3227
-                      'site_title' => __('Category', 'geodirectory'),
3228
-                      'htmlvar_name' => $post_type.'category',
3229
-                      'default_value' => '',
3230
-                      'is_default' => '1',
3231
-                      'is_admin' => '1',
3232
-                      'is_required' => '1',
3233
-                      'show_in'   =>  '[detail]',
3234
-                      'show_on_pkg' => $package,
3235
-                      'clabels' => __('Category', 'geodirectory'));
3236
-
3237
-    $fields[] = array('listing_type' => $post_type,
3238
-                      'data_type' => 'VARCHAR',
3239
-                      'field_type' => 'address',
3240
-                      'admin_title' => __('Address', 'geodirectory'),
3241
-                      'admin_desc' => ADDRESS_MSG,
3242
-                      'site_title' => __('Address', 'geodirectory'),
3243
-                      'htmlvar_name' => 'post',
3244
-                      'default_value' => '',
3245
-                      'option_values' => '',
3246
-                      'is_default' => '1',
3247
-                      'is_admin' => '1',
3248
-                      'is_required' => '1',
3249
-                      'show_in'   =>  '[detail],[mapbubble]',
3250
-                      'show_on_pkg' => $package,
3251
-                      'required_msg' => __('Address fields are required', 'geodirectory'),
3252
-                      'clabels' => __('Address', 'geodirectory'),
3253
-                      'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
3254
-                                       'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
3255
-                                       'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
3256
-                                       'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
3257
-                                       'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
3258
-                                       'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
3259
-                                       'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
3260
-                                       'show_latlng' => 1));
3261
-
3262
-    $fields[] = array('listing_type' => $post_type,
3263
-                      'data_type' => 'VARCHAR',
3264
-                      'field_type' => 'text',
3265
-                      'admin_title' => __('Time', 'geodirectory'),
3266
-                      'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
3267
-                      'site_title' => __('Time', 'geodirectory'),
3268
-                      'htmlvar_name' => 'timing',
3269
-                      'default_value' => '',
3270
-                      'option_values' => '',
3271
-                      'is_default' => '1',
3272
-                      'is_admin' => '1',
3273
-                      'show_in' =>  '[detail],[mapbubble]',
3274
-                      'show_on_pkg' => $package,
3275
-                      'clabels' => __('Time', 'geodirectory'));
3276
-
3277
-    $fields[] = array('listing_type' => $post_type,
3278
-                      'data_type' => 'VARCHAR',
3279
-                      'field_type' => 'phone',
3280
-                      'admin_title' => __('Phone', 'geodirectory'),
3281
-                      'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
3282
-                      'site_title' => __('Phone', 'geodirectory'),
3283
-                      'htmlvar_name' => 'contact',
3284
-                      'default_value' => '',
3285
-                      'option_values' => '',
3286
-                      'is_default' => '1',
3287
-                      'is_admin' => '1',
3288
-                      'show_in' =>  '[detail],[mapbubble]',
3289
-                      'show_on_pkg' => $package,
3290
-                      'clabels' => __('Phone', 'geodirectory'));
3291
-
3292
-    $fields[] = array('listing_type' => $post_type,
3293
-                      'data_type' => 'VARCHAR',
3294
-                      'field_type' => 'email',
3295
-                      'admin_title' => __('Email', 'geodirectory'),
3296
-                      'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
3297
-                      'site_title' => __('Email', 'geodirectory'),
3298
-                      'htmlvar_name' => 'email',
3299
-                      'default_value' => '',
3300
-                      'option_values' => '',
3301
-                      'is_default' => '1',
3302
-                      'is_admin' => '1',
3303
-                      'show_in' => '[detail]',
3304
-                      'show_on_pkg' => $package,
3305
-                      'clabels' => __('Email', 'geodirectory'));
3306
-
3307
-    $fields[] = array('listing_type' => $post_type,
3308
-                      'data_type' => 'VARCHAR',
3309
-                      'field_type' => 'url',
3310
-                      'admin_title' => __('Website', 'geodirectory'),
3311
-                      'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
3312
-                      'site_title' => __('Website', 'geodirectory'),
3313
-                      'htmlvar_name' => 'website',
3314
-                      'default_value' => '',
3315
-                      'option_values' => '',
3316
-                      'is_default' => '1',
3317
-                      'is_admin' => '1',
3318
-                      'show_in' => '[detail]',
3319
-                      'show_on_pkg' => $package,
3320
-                      'clabels' => __('Website', 'geodirectory'));
3321
-
3322
-    $fields[] = array('listing_type' => $post_type,
3323
-                      'data_type' => 'VARCHAR',
3324
-                      'field_type' => 'url',
3325
-                      'admin_title' => __('Twitter', 'geodirectory'),
3326
-                      'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
3327
-                      'site_title' => __('Twitter', 'geodirectory'),
3328
-                      'htmlvar_name' => 'twitter',
3329
-                      'default_value' => '',
3330
-                      'option_values' => '',
3331
-                      'is_default' => '1',
3332
-                      'is_admin' => '1',
3333
-                      'show_in' => '[detail]',
3334
-                      'show_on_pkg' => $package,
3335
-                      'clabels' => __('Twitter', 'geodirectory'));
3336
-
3337
-    $fields[] = array('listing_type' => $post_type,
3338
-                      'data_type' => 'VARCHAR',
3339
-                      'field_type' => 'url',
3340
-                      'admin_title' => __('Facebook', 'geodirectory'),
3341
-                      'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
3342
-                      'site_title' => __('Facebook', 'geodirectory'),
3343
-                      'htmlvar_name' => 'facebook',
3344
-                      'default_value' => '',
3345
-                      'option_values' => '',
3346
-                      'is_default' => '1',
3347
-                      'is_admin' => '1',
3348
-                      'show_in' => '[detail]',
3349
-                      'show_on_pkg' => $package,
3350
-                      'clabels' => __('Facebook', 'geodirectory'));
3351
-
3352
-    $fields[] = array('listing_type' => $post_type,
3353
-                      'data_type' => 'TEXT',
3354
-                      'field_type' => 'textarea',
3355
-                      'admin_title' => __('Video', 'geodirectory'),
3356
-                      'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
3357
-                      'site_title' => __('Video', 'geodirectory'),
3358
-                      'htmlvar_name' => 'video',
3359
-                      'default_value' => '',
3360
-                      'option_values' => '',
3361
-                      'is_default' => '0',
3362
-                      'is_admin' => '1',
3363
-                      'show_in' => '[owntab]',
3364
-                      'show_on_pkg' => $package,
3365
-                      'clabels' => __('Video', 'geodirectory'));
3366
-
3367
-    $fields[] = array('listing_type' => $post_type,
3368
-                      'data_type' => 'TEXT',
3369
-                      'field_type' => 'textarea',
3370
-                      'admin_title' => __('Special Offers', 'geodirectory'),
3371
-                      'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
3372
-                      'site_title' => __('Special Offers', 'geodirectory'),
3373
-                      'htmlvar_name' => 'special_offers',
3374
-                      'default_value' => '',
3375
-                      'option_values' => '',
3376
-                      'is_default' => '0',
3377
-                      'is_admin' => '1',
3378
-                      'show_in' => '[owntab]',
3379
-                      'show_on_pkg' => $package,
3380
-                      'clabels' => __('Special Offers', 'geodirectory'));
3381
-
3382
-    /**
3383
-     * Filter the array of default custom fields DB table data.
3384
-     *
3385
-     * @since 1.6.6
3386
-     * @param string $fields The default custom fields as an array.
3387
-     */
3388
-    $fields = apply_filters('geodir_default_custom_fields', $fields);
3389
-
3390
-    return  $fields;
3219
+	$fields = array();
3220
+	$package = ($package_id=='') ? '' : array($package_id);
3221
+
3222
+	$fields[] = array('listing_type' => $post_type,
3223
+					  'data_type' => 'VARCHAR',
3224
+					  'field_type' => 'taxonomy',
3225
+					  'admin_title' => __('Category', 'geodirectory'),
3226
+					  'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
3227
+					  'site_title' => __('Category', 'geodirectory'),
3228
+					  'htmlvar_name' => $post_type.'category',
3229
+					  'default_value' => '',
3230
+					  'is_default' => '1',
3231
+					  'is_admin' => '1',
3232
+					  'is_required' => '1',
3233
+					  'show_in'   =>  '[detail]',
3234
+					  'show_on_pkg' => $package,
3235
+					  'clabels' => __('Category', 'geodirectory'));
3236
+
3237
+	$fields[] = array('listing_type' => $post_type,
3238
+					  'data_type' => 'VARCHAR',
3239
+					  'field_type' => 'address',
3240
+					  'admin_title' => __('Address', 'geodirectory'),
3241
+					  'admin_desc' => ADDRESS_MSG,
3242
+					  'site_title' => __('Address', 'geodirectory'),
3243
+					  'htmlvar_name' => 'post',
3244
+					  'default_value' => '',
3245
+					  'option_values' => '',
3246
+					  'is_default' => '1',
3247
+					  'is_admin' => '1',
3248
+					  'is_required' => '1',
3249
+					  'show_in'   =>  '[detail],[mapbubble]',
3250
+					  'show_on_pkg' => $package,
3251
+					  'required_msg' => __('Address fields are required', 'geodirectory'),
3252
+					  'clabels' => __('Address', 'geodirectory'),
3253
+					  'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
3254
+									   'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
3255
+									   'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
3256
+									   'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
3257
+									   'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
3258
+									   'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
3259
+									   'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
3260
+									   'show_latlng' => 1));
3261
+
3262
+	$fields[] = array('listing_type' => $post_type,
3263
+					  'data_type' => 'VARCHAR',
3264
+					  'field_type' => 'text',
3265
+					  'admin_title' => __('Time', 'geodirectory'),
3266
+					  'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
3267
+					  'site_title' => __('Time', 'geodirectory'),
3268
+					  'htmlvar_name' => 'timing',
3269
+					  'default_value' => '',
3270
+					  'option_values' => '',
3271
+					  'is_default' => '1',
3272
+					  'is_admin' => '1',
3273
+					  'show_in' =>  '[detail],[mapbubble]',
3274
+					  'show_on_pkg' => $package,
3275
+					  'clabels' => __('Time', 'geodirectory'));
3276
+
3277
+	$fields[] = array('listing_type' => $post_type,
3278
+					  'data_type' => 'VARCHAR',
3279
+					  'field_type' => 'phone',
3280
+					  'admin_title' => __('Phone', 'geodirectory'),
3281
+					  'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
3282
+					  'site_title' => __('Phone', 'geodirectory'),
3283
+					  'htmlvar_name' => 'contact',
3284
+					  'default_value' => '',
3285
+					  'option_values' => '',
3286
+					  'is_default' => '1',
3287
+					  'is_admin' => '1',
3288
+					  'show_in' =>  '[detail],[mapbubble]',
3289
+					  'show_on_pkg' => $package,
3290
+					  'clabels' => __('Phone', 'geodirectory'));
3291
+
3292
+	$fields[] = array('listing_type' => $post_type,
3293
+					  'data_type' => 'VARCHAR',
3294
+					  'field_type' => 'email',
3295
+					  'admin_title' => __('Email', 'geodirectory'),
3296
+					  'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
3297
+					  'site_title' => __('Email', 'geodirectory'),
3298
+					  'htmlvar_name' => 'email',
3299
+					  'default_value' => '',
3300
+					  'option_values' => '',
3301
+					  'is_default' => '1',
3302
+					  'is_admin' => '1',
3303
+					  'show_in' => '[detail]',
3304
+					  'show_on_pkg' => $package,
3305
+					  'clabels' => __('Email', 'geodirectory'));
3306
+
3307
+	$fields[] = array('listing_type' => $post_type,
3308
+					  'data_type' => 'VARCHAR',
3309
+					  'field_type' => 'url',
3310
+					  'admin_title' => __('Website', 'geodirectory'),
3311
+					  'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
3312
+					  'site_title' => __('Website', 'geodirectory'),
3313
+					  'htmlvar_name' => 'website',
3314
+					  'default_value' => '',
3315
+					  'option_values' => '',
3316
+					  'is_default' => '1',
3317
+					  'is_admin' => '1',
3318
+					  'show_in' => '[detail]',
3319
+					  'show_on_pkg' => $package,
3320
+					  'clabels' => __('Website', 'geodirectory'));
3321
+
3322
+	$fields[] = array('listing_type' => $post_type,
3323
+					  'data_type' => 'VARCHAR',
3324
+					  'field_type' => 'url',
3325
+					  'admin_title' => __('Twitter', 'geodirectory'),
3326
+					  'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
3327
+					  'site_title' => __('Twitter', 'geodirectory'),
3328
+					  'htmlvar_name' => 'twitter',
3329
+					  'default_value' => '',
3330
+					  'option_values' => '',
3331
+					  'is_default' => '1',
3332
+					  'is_admin' => '1',
3333
+					  'show_in' => '[detail]',
3334
+					  'show_on_pkg' => $package,
3335
+					  'clabels' => __('Twitter', 'geodirectory'));
3336
+
3337
+	$fields[] = array('listing_type' => $post_type,
3338
+					  'data_type' => 'VARCHAR',
3339
+					  'field_type' => 'url',
3340
+					  'admin_title' => __('Facebook', 'geodirectory'),
3341
+					  'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
3342
+					  'site_title' => __('Facebook', 'geodirectory'),
3343
+					  'htmlvar_name' => 'facebook',
3344
+					  'default_value' => '',
3345
+					  'option_values' => '',
3346
+					  'is_default' => '1',
3347
+					  'is_admin' => '1',
3348
+					  'show_in' => '[detail]',
3349
+					  'show_on_pkg' => $package,
3350
+					  'clabels' => __('Facebook', 'geodirectory'));
3351
+
3352
+	$fields[] = array('listing_type' => $post_type,
3353
+					  'data_type' => 'TEXT',
3354
+					  'field_type' => 'textarea',
3355
+					  'admin_title' => __('Video', 'geodirectory'),
3356
+					  'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
3357
+					  'site_title' => __('Video', 'geodirectory'),
3358
+					  'htmlvar_name' => 'video',
3359
+					  'default_value' => '',
3360
+					  'option_values' => '',
3361
+					  'is_default' => '0',
3362
+					  'is_admin' => '1',
3363
+					  'show_in' => '[owntab]',
3364
+					  'show_on_pkg' => $package,
3365
+					  'clabels' => __('Video', 'geodirectory'));
3366
+
3367
+	$fields[] = array('listing_type' => $post_type,
3368
+					  'data_type' => 'TEXT',
3369
+					  'field_type' => 'textarea',
3370
+					  'admin_title' => __('Special Offers', 'geodirectory'),
3371
+					  'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
3372
+					  'site_title' => __('Special Offers', 'geodirectory'),
3373
+					  'htmlvar_name' => 'special_offers',
3374
+					  'default_value' => '',
3375
+					  'option_values' => '',
3376
+					  'is_default' => '0',
3377
+					  'is_admin' => '1',
3378
+					  'show_in' => '[owntab]',
3379
+					  'show_on_pkg' => $package,
3380
+					  'clabels' => __('Special Offers', 'geodirectory'));
3381
+
3382
+	/**
3383
+	 * Filter the array of default custom fields DB table data.
3384
+	 *
3385
+	 * @since 1.6.6
3386
+	 * @param string $fields The default custom fields as an array.
3387
+	 */
3388
+	$fields = apply_filters('geodir_default_custom_fields', $fields);
3389
+
3390
+	return  $fields;
3391 3391
 }
3392 3392
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +352 added lines, -352 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50 50
     {
51 51
         global $wpdb;
52
-        $result = 0;// no rows affected
52
+        $result = 0; // no rows affected
53 53
         if (!geodir_column_exist($db, $column)) {
54 54
             if (!empty($db) && !empty($column))
55 55
                 $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 {
75 75
     global $wpdb, $geodir_post_custom_fields_cache;
76 76
 
77
-    $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
77
+    $cache_stored = $post_type.'_'.$package_id.'_'.$default.'_'.$fields_location;
78 78
 
79 79
     if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80 80
         return $geodir_post_custom_fields_cache[$cache_stored];
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
         $default_query .= " and is_admin = '0' ";
89 89
 
90 90
     if ($fields_location == 'none') {
91
-    } else{
92
-        $fields_location = esc_sql( $fields_location );
91
+    } else {
92
+        $fields_location = esc_sql($fields_location);
93 93
         $default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
94 94
     }
95 95
 
96 96
     $post_meta_info = $wpdb->get_results(
97 97
         $wpdb->prepare(
98
-            "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
98
+            "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99 99
             array($post_type)
100 100
         )
101 101
     );
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
      * @param string $field_ins_upd When set to "submit" displays form.
163 163
      * @param string $field_type_key The key of the custom field.
164 164
      */
165
-    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
165
+    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '')
166 166
     {
167 167
         global $wpdb;
168 168
         $cf = $result_str;
169 169
         if (!is_object($cf)) {
170 170
 
171
-            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
171
+            $field_info = $wpdb->get_row($wpdb->prepare("select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)));
172 172
 
173 173
         } else {
174 174
             $field_info = $cf;
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
         if ($field_id != '') {
203 203
             $cf = trim($field_id, '_');
204 204
 
205
-            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
-                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
205
+            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)))) {
206
+                $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d ", array($cf)));
207 207
 
208 208
                 $post_type = $field->post_type;
209 209
                 $htmlvar_name = $field->htmlvar_name;
210 210
 
211 211
                 if ($post_type != '' && $htmlvar_name != '') {
212
-                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
212
+                    $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
213 213
                 }
214 214
 
215 215
                 /**
@@ -223,18 +223,18 @@  discard block
 block discarded – undo
223 223
                 do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224 224
 
225 225
                 if ($field->field_type == 'address') {
226
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
226
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_address`");
227
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_city`");
228
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_region`");
229
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_country`");
230
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_zip`");
231
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_latitude`");
232
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_longitude`");
233
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapview`");
234
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapzoom`");
235 235
                 } else {
236 236
                     if ($field->field_type != 'fieldset') {
237
-                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
237
+                        $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."`");
238 238
                     }
239 239
                 }
240 240
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
         $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
305 305
 
306 306
         // some servers fail if a POST value is VARCHAR so we change it.
307
-        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
307
+        if (isset($request_field['data_type']) && $request_field['data_type'] == 'XVARCHAR') {
308 308
             $request_field['data_type'] = 'VARCHAR';
309 309
         }
310 310
 
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
         $post_type = $request_field['listing_type'];
318 318
 
319 319
         if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
320
-            $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
320
+            $cehhtmlvar_name = 'geodir_'.$cehhtmlvar_name;
321 321
         }
322 322
 
323 323
         $check_html_variable = $wpdb->get_var(
324 324
             $wpdb->prepare(
325
-                "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
325
+                "select htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where id <> %d and htmlvar_name = %s and post_type = %s ",
326 326
                 array($cf, $cehhtmlvar_name, $post_type)
327 327
             )
328 328
         );
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 
335 335
                 $post_meta_info = $wpdb->get_row(
336 336
                     $wpdb->prepare(
337
-                        "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
337
+                        "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id = %d",
338 338
                         array($cf)
339 339
                     )
340 340
                 );
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
             if ($post_type == '') $post_type = 'gd_place';
353 353
 
354 354
 
355
-            $detail_table = $plugin_prefix . $post_type . '_detail';
355
+            $detail_table = $plugin_prefix.$post_type.'_detail';
356 356
 
357 357
             $admin_title = $request_field['admin_title'];
358 358
             $site_title = $request_field['site_title'];
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
             $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
381 381
 
382 382
             
383
-            if(is_array($show_in)){
383
+            if (is_array($show_in)) {
384 384
                 $show_in = implode(",", $request_field['show_in']);
385 385
             }
386 386
             
387 387
             if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
-                $htmlvar_name = 'geodir_' . $htmlvar_name;
388
+                $htmlvar_name = 'geodir_'.$htmlvar_name;
389 389
             }
390 390
 
391 391
             $option_values = '';
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 
427 427
             if ($sort_order == '') {
428 428
 
429
-                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
429
+                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM ".GEODIR_CUSTOM_FIELDS_TABLE);
430 430
 
431
-                $sort_order = (int)$last_order + 1;
431
+                $sort_order = (int) $last_order + 1;
432 432
             }
433 433
 
434 434
             $default_value_add = '';
@@ -440,15 +440,15 @@  discard block
 block discarded – undo
440 440
                     case 'address':
441 441
 
442 442
                         if ($htmlvar_name != '') {
443
-                            $prefix = $htmlvar_name . '_';
443
+                            $prefix = $htmlvar_name.'_';
444 444
                         }
445
-                        $old_prefix = $old_html_variable . '_';
445
+                        $old_prefix = $old_html_variable.'_';
446 446
 
447 447
 
448
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
448
+                        $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."address` `".$prefix."address` VARCHAR( 254 ) NULL";
449 449
 
450 450
                         if ($default_value != '') {
451
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
451
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
452 452
                         }
453 453
 
454 454
                         $wpdb->query($meta_field_add);
@@ -457,12 +457,12 @@  discard block
 block discarded – undo
457 457
 
458 458
                             if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
459 459
 
460
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
460
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."city'");
461 461
                                 if ($is_column) {
462
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
462
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."city` `".$prefix."city` VARCHAR( 50 ) NULL";
463 463
 
464 464
                                     if ($default_value != '') {
465
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
465
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
466 466
                                     }
467 467
 
468 468
                                     $wpdb->query($meta_field_add);
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
 
471 471
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
472 472
                                     if ($default_value != '') {
473
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
473
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
474 474
                                     }
475
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
475
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add);
476 476
 
477 477
                                 }
478 478
 
@@ -482,36 +482,36 @@  discard block
 block discarded – undo
482 482
 
483 483
                             if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
484 484
 
485
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
485
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."region'");
486 486
 
487 487
                                 if ($is_column) {
488
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
488
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."region` `".$prefix."region` VARCHAR( 50 ) NULL";
489 489
 
490 490
                                     if ($default_value != '') {
491
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
491
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
492 492
                                     }
493 493
 
494 494
                                     $wpdb->query($meta_field_add);
495 495
                                 } else {
496 496
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
497 497
                                     if ($default_value != '') {
498
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
498
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
499 499
                                     }
500 500
 
501
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
501
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add);
502 502
                                 }
503 503
 
504 504
                             }
505 505
                             if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
506 506
 
507
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
507
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."country'");
508 508
 
509 509
                                 if ($is_column) {
510 510
 
511
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
511
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."country` `".$prefix."country` VARCHAR( 50 ) NULL";
512 512
 
513 513
                                     if ($default_value != '') {
514
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
514
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
515 515
                                     }
516 516
 
517 517
                                     $wpdb->query($meta_field_add);
@@ -519,24 +519,24 @@  discard block
 block discarded – undo
519 519
 
520 520
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
521 521
                                     if ($default_value != '') {
522
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
522
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
523 523
                                     }
524 524
 
525
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
525
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add);
526 526
 
527 527
                                 }
528 528
 
529 529
                             }
530 530
                             if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
531 531
 
532
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
532
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."zip'");
533 533
 
534 534
                                 if ($is_column) {
535 535
 
536
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
536
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."zip` `".$prefix."zip` VARCHAR( 50 ) NULL";
537 537
 
538 538
                                     if ($default_value != '') {
539
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
539
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
540 540
                                     }
541 541
 
542 542
                                     $wpdb->query($meta_field_add);
@@ -544,128 +544,128 @@  discard block
 block discarded – undo
544 544
 
545 545
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
546 546
                                     if ($default_value != '') {
547
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
547
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
548 548
                                     }
549 549
 
550
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
550
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add);
551 551
 
552 552
                                 }
553 553
 
554 554
                             }
555 555
                             if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
556 556
 
557
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
557
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latitude'");
558 558
                                 if ($is_column) {
559 559
 
560
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
560
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latitude` `".$prefix."latitude` VARCHAR( 20 ) NULL";
561 561
 
562 562
                                     if ($default_value != '') {
563
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
563
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
564 564
                                     }
565 565
 
566 566
                                     $wpdb->query($meta_field_add);
567 567
                                 } else {
568 568
 
569
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
569
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL";
570 570
                                     $meta_field_add = "VARCHAR( 20 ) NULL";
571 571
                                     if ($default_value != '') {
572
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
572
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
573 573
                                     }
574 574
 
575
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
575
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add);
576 576
 
577 577
                                 }
578 578
 
579 579
 
580
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
580
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."longitude'");
581 581
 
582 582
                                 if ($is_column) {
583
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
583
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."longitude` `".$prefix."longitude` VARCHAR( 20 ) NULL";
584 584
 
585 585
                                     if ($default_value != '') {
586
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
586
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
587 587
                                     }
588 588
 
589 589
                                     $wpdb->query($meta_field_add);
590 590
                                 } else {
591 591
 
592
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
592
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL";
593 593
                                     $meta_field_add = "VARCHAR( 20 ) NULL";
594 594
                                     if ($default_value != '') {
595
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
595
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
596 596
                                     }
597 597
 
598
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
598
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add);
599 599
                                 }
600 600
 
601 601
                             }
602 602
                             if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
603 603
 
604
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
604
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapview'");
605 605
 
606 606
                                 if ($is_column) {
607
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
607
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapview` `".$prefix."mapview` VARCHAR( 15 ) NULL";
608 608
 
609 609
                                     if ($default_value != '') {
610
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
610
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
611 611
                                     }
612 612
 
613 613
                                     $wpdb->query($meta_field_add);
614 614
                                 } else {
615 615
 
616
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
616
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL";
617 617
 
618 618
                                     $meta_field_add = "VARCHAR( 15 ) NULL";
619 619
                                     if ($default_value != '') {
620
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
620
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
621 621
                                     }
622 622
 
623
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
623
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add);
624 624
                                 }
625 625
 
626 626
 
627 627
                             }
628 628
                             if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
629 629
 
630
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
630
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapzoom'");
631 631
                                 if ($is_column) {
632
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
632
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapzoom` `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
633 633
 
634 634
                                     if ($default_value != '') {
635
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
635
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
636 636
                                     }
637 637
 
638 638
                                     $wpdb->query($meta_field_add);
639 639
 
640 640
                                 } else {
641 641
 
642
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
642
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
643 643
 
644 644
                                     $meta_field_add = "VARCHAR( 3 ) NULL";
645 645
                                     if ($default_value != '') {
646
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
646
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
647 647
                                     }
648 648
 
649
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
649
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add);
650 650
                                 }
651 651
 
652 652
                             }
653 653
                             // show lat lng
654 654
                             if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
655
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
655
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latlng'");
656 656
 
657 657
                                 if ($is_column) {
658
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
658
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latlng` `".$prefix."latlng` VARCHAR( 3 ) NULL";
659 659
                                     $meta_field_add .= " DEFAULT '1'";
660 660
 
661 661
                                     $wpdb->query($meta_field_add);
662 662
                                 } else {
663
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
663
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL";
664 664
 
665 665
                                     $meta_field_add = "VARCHAR( 3 ) NULL";
666 666
                                     $meta_field_add .= " DEFAULT '1'";
667 667
 
668
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
668
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add);
669 669
                                 }
670 670
 
671 671
                             }
@@ -681,30 +681,30 @@  discard block
 block discarded – undo
681 681
                         $op_size = '500';
682 682
 
683 683
                         // only make the field as big as it needs to be.
684
-                        if(isset($option_values) && $option_values && $field_type=='select'){
685
-                            $option_values_arr = explode(',',$option_values);
686
-                            if(is_array($option_values_arr)){
684
+                        if (isset($option_values) && $option_values && $field_type == 'select') {
685
+                            $option_values_arr = explode(',', $option_values);
686
+                            if (is_array($option_values_arr)) {
687 687
                                 $op_max = 0;
688
-                                foreach($option_values_arr as $op_val){
689
-                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
688
+                                foreach ($option_values_arr as $op_val) {
689
+                                    if (strlen($op_val) && strlen($op_val) > $op_max) {$op_max = strlen($op_val); }
690 690
                                 }
691
-                                if($op_max){$op_size =$op_max; }
691
+                                if ($op_max) {$op_size = $op_max; }
692 692
                             }
693
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694
-                            if(strlen($option_values)){
695
-                                $op_size =  strlen($option_values);
693
+                        }elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
694
+                            if (strlen($option_values)) {
695
+                                $op_size = strlen($option_values);
696 696
                             }
697 697
                         }
698 698
 
699
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
699
+                        $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."`VARCHAR( $op_size ) NULL";
700 700
 
701 701
                         if ($default_value != '') {
702
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
702
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
703 703
                         }
704 704
 
705 705
                         $alter_result = $wpdb->query($meta_field_add);
706
-                        if($alter_result===false){
707
-                            return __('Column change failed, you may have too many columns.','geodirectory');
706
+                        if ($alter_result === false) {
707
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
708 708
                         }
709 709
 
710 710
                         if (isset($request_field['cat_display_type']))
@@ -721,9 +721,9 @@  discard block
 block discarded – undo
721 721
                     case 'url':
722 722
                     case 'file':
723 723
 
724
-                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
725
-                        if($alter_result===false){
726
-                            return __('Column change failed, you may have too many columns.','geodirectory');
724
+                        $alter_result = $wpdb->query("ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` TEXT NULL");
725
+                        if ($alter_result === false) {
726
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
727 727
                         }
728 728
                         if (isset($request_field['advanced_editor']))
729 729
                             $extra_fields = $request_field['advanced_editor'];
@@ -737,24 +737,24 @@  discard block
 block discarded – undo
737 737
                     default:
738 738
                         if ($data_type != 'VARCHAR' && $data_type != '') {
739 739
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
740
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
740
+                                $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` DECIMAL(11, ".(int) $decimal_point.") NULL";
741 741
                             } else {
742
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
742
+                                $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` ".$data_type." NULL";
743 743
                             }
744 744
 
745 745
                             if (is_numeric($default_value) && $default_value != '') {
746
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
746
+                                $default_value_add .= " DEFAULT '".$default_value."'";
747 747
                             }
748 748
                         } else {
749
-                            $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
749
+                            $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` VARCHAR( 254 ) NULL";
750 750
                             if ($default_value != '') {
751
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
751
+                                $default_value_add .= " DEFAULT '".$default_value."'";
752 752
                             }
753 753
                         }
754 754
 
755 755
                         $alter_result = $wpdb->query($default_value_add);
756
-                        if($alter_result===false){
757
-                            return __('Column change failed, you may have too many columns.','geodirectory');
756
+                        if ($alter_result === false) {
757
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
758 758
                         }
759 759
                         break;
760 760
                 endswitch;
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 
771 771
                     $wpdb->prepare(
772 772
 
773
-                        "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
773
+                        "update ".GEODIR_CUSTOM_FIELDS_TABLE." set 
774 774
 					post_type = %s,
775 775
 					admin_title = %s,
776 776
 					site_title = %s,
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 					for_admin_use = %s
805 805
 					where id = %d",
806 806
 
807
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
807
+                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use, $cf)
808 808
                     )
809 809
 
810 810
                 );
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 
815 815
                 $wpdb->query(
816 816
                     $wpdb->prepare(
817
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
817
+                        "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
818 818
 					 	site_title=%s
819 819
 					where post_type = %s and htmlvar_name = %s",
820 820
                         array($site_title, $post_type, $htmlvar_name)
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 
824 824
 
825 825
                 if ($cat_sort == '')
826
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
826
+                    $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827 827
 
828 828
 
829 829
                 /**
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
                         $data_type = '';
844 844
 
845 845
                         if ($htmlvar_name != '') {
846
-                            $prefix = $htmlvar_name . '_';
846
+                            $prefix = $htmlvar_name.'_';
847 847
                         }
848 848
                         $old_prefix = $old_html_variable;
849 849
 
@@ -851,109 +851,109 @@  discard block
 block discarded – undo
851 851
 
852 852
                         $meta_field_add = "VARCHAR( 254 ) NULL";
853 853
                         if ($default_value != '') {
854
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
854
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
855 855
                         }
856 856
 
857
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
857
+                        geodir_add_column_if_not_exist($detail_table, $prefix."address", $meta_field_add);
858 858
                         //$wpdb->query($meta_field_add);
859 859
 
860 860
 
861 861
                         if (!empty($extra_fields)) {
862 862
 
863 863
                             if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
864
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
864
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."city` VARCHAR( 30 ) NULL";
865 865
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
866 866
                                 if ($default_value != '') {
867
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
867
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
868 868
                                 }
869 869
 
870
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
870
+                                geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add);
871 871
                                 //$wpdb->query($meta_field_add);
872 872
                             }
873 873
                             if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
874
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
874
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."region` VARCHAR( 30 ) NULL";
875 875
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
876 876
                                 if ($default_value != '') {
877
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
877
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
878 878
                                 }
879 879
 
880
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
880
+                                geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add);
881 881
                                 //$wpdb->query($meta_field_add);
882 882
                             }
883 883
                             if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
884
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
884
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."country` VARCHAR( 30 ) NULL";
885 885
 
886 886
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
887 887
                                 if ($default_value != '') {
888
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
888
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
889 889
                                 }
890 890
 
891
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
891
+                                geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add);
892 892
                                 //$wpdb->query($meta_field_add);
893 893
                             }
894 894
                             if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
895
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
895
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."zip` VARCHAR( 15 ) NULL";
896 896
                                 $meta_field_add = "VARCHAR( 15 ) NULL";
897 897
                                 if ($default_value != '') {
898
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
898
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
899 899
                                 }
900 900
 
901
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
901
+                                geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add);
902 902
                                 //$wpdb->query($meta_field_add);
903 903
                             }
904 904
                             if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
905
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
905
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL";
906 906
                                 $meta_field_add = "VARCHAR( 20 ) NULL";
907 907
                                 if ($default_value != '') {
908
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
908
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
909 909
                                 }
910 910
 
911
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
911
+                                geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add);
912 912
                                 //$wpdb->query($meta_field_add);
913 913
 
914
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
914
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL";
915 915
 
916 916
                                 $meta_field_add = "VARCHAR( 20 ) NULL";
917 917
                                 if ($default_value != '') {
918
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
918
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
919 919
                                 }
920 920
 
921
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
921
+                                geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add);
922 922
 
923 923
                                 //$wpdb->query($meta_field_add);
924 924
                             }
925 925
                             if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
926
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
926
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL";
927 927
 
928 928
                                 $meta_field_add = "VARCHAR( 15 ) NULL";
929 929
                                 if ($default_value != '') {
930
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
930
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
931 931
                                 }
932 932
 
933
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
933
+                                geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add);
934 934
 
935 935
                                 //$wpdb->query($meta_field_add);
936 936
                             }
937 937
                             if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
938
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
938
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
939 939
 
940 940
                                 $meta_field_add = "VARCHAR( 3 ) NULL";
941 941
                                 if ($default_value != '') {
942
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
942
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
943 943
                                 }
944 944
 
945
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
945
+                                geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add);
946 946
 
947 947
                                 //$wpdb->query($meta_field_add);
948 948
                             }
949 949
                             // show lat lng
950 950
                             if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
951
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
951
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL";
952 952
 
953 953
                                 $meta_field_add = "VARCHAR( 3 ) NULL";
954 954
                                 $meta_field_add .= " DEFAULT '1'";
955 955
 
956
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
956
+                                geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add);
957 957
                                 //$wpdb->query($meta_field_add);
958 958
                             }
959 959
                         }
@@ -963,8 +963,8 @@  discard block
 block discarded – undo
963 963
                     case 'checkbox':
964 964
                         $data_type = 'TINYINT';
965 965
 
966
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
967
-                        if ((int)$default_value === 1) {
966
+                        $meta_field_add = $data_type."( 1 ) NOT NULL ";
967
+                        if ((int) $default_value === 1) {
968 968
                             $meta_field_add .= " DEFAULT '1'";
969 969
                         }
970 970
 
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
                             }
998 998
                         } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
999 999
                             if (strlen($option_values)) {
1000
-                                $op_size =  strlen($option_values);
1000
+                                $op_size = strlen($option_values);
1001 1001
                             }
1002 1002
 
1003 1003
                             if (isset($request_field['multi_display_type'])) {
@@ -1005,9 +1005,9 @@  discard block
 block discarded – undo
1005 1005
                             }
1006 1006
                         }
1007 1007
 
1008
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1008
+                        $meta_field_add = $data_type."( $op_size ) NULL ";
1009 1009
                         if ($default_value != '') {
1010
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1010
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
1011 1011
                         }
1012 1012
 
1013 1013
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
@@ -1022,9 +1022,9 @@  discard block
 block discarded – undo
1022 1022
 
1023 1023
                         $data_type = 'TEXT';
1024 1024
 
1025
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1025
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1026 1026
 
1027
-                        $meta_field_add = $data_type . " NULL ";
1027
+                        $meta_field_add = $data_type." NULL ";
1028 1028
                         /*if($default_value != '')
1029 1029
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1030 1030
 
@@ -1039,9 +1039,9 @@  discard block
 block discarded – undo
1039 1039
 
1040 1040
                         $data_type = 'DATE';
1041 1041
 
1042
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1042
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1043 1043
 
1044
-                        $meta_field_add = $data_type . " NULL ";
1044
+                        $meta_field_add = $data_type." NULL ";
1045 1045
 
1046 1046
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1047 1047
                         if ($add_result === false) {
@@ -1054,9 +1054,9 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
                         $data_type = 'TIME';
1056 1056
 
1057
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1057
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1058 1058
 
1059
-                        $meta_field_add = $data_type . " NULL ";
1059
+                        $meta_field_add = $data_type." NULL ";
1060 1060
 
1061 1061
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1062 1062
                         if ($add_result === false) {
@@ -1068,22 +1068,22 @@  discard block
 block discarded – undo
1068 1068
                     default:
1069 1069
 
1070 1070
                         if ($data_type != 'VARCHAR' && $data_type != '') {
1071
-                            $meta_field_add = $data_type . " NULL ";
1071
+                            $meta_field_add = $data_type." NULL ";
1072 1072
 
1073 1073
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
1074
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1074
+                                $meta_field_add = "DECIMAL(11, ".(int) $decimal_point.") NULL ";
1075 1075
                             }
1076 1076
 
1077 1077
                             if (is_numeric($default_value) && $default_value != '') {
1078
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1079
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1078
+                                $default_value_add .= " DEFAULT '".$default_value."'";
1079
+                                $meta_field_add .= " DEFAULT '".$default_value."'";
1080 1080
                             }
1081 1081
                         } else {
1082 1082
                             $meta_field_add = " VARCHAR( 254 ) NULL ";
1083 1083
 
1084 1084
                             if ($default_value != '') {
1085
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1086
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1085
+                                $default_value_add .= " DEFAULT '".$default_value."'";
1086
+                                $meta_field_add .= " DEFAULT '".$default_value."'";
1087 1087
                             }
1088 1088
                         }
1089 1089
 
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 
1106 1106
                     $wpdb->prepare(
1107 1107
 
1108
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1108
+                        "insert into ".GEODIR_CUSTOM_FIELDS_TABLE." set 
1109 1109
 					post_type = %s,
1110 1110
 					admin_title = %s,
1111 1111
 					site_title = %s,
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 					validation_msg = %s,
1139 1139
 					for_admin_use = %s ",
1140 1140
 
1141
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1141
+                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use)
1142 1142
 
1143 1143
                     )
1144 1144
 
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
 
1151 1151
             }
1152 1152
 
1153
-            return (int)$lastid;
1153
+            return (int) $lastid;
1154 1154
 
1155 1155
 
1156 1156
         } else {
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 
1184 1184
             $post_meta_info = $wpdb->query(
1185 1185
                 $wpdb->prepare(
1186
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1186
+                    "update ".GEODIR_CUSTOM_FIELDS_TABLE." set 
1187 1187
 															sort_order=%d 
1188 1188
 															where id= %d",
1189 1189
                     array($count, $cf)
@@ -1199,11 +1199,11 @@  discard block
 block discarded – undo
1199 1199
 }
1200 1200
 
1201 1201
 
1202
-function geodir_get_cf_value($cf){
1202
+function geodir_get_cf_value($cf) {
1203 1203
     global $gd_session;
1204 1204
     $value = '';
1205 1205
     if (is_admin()) {
1206
-        global $post,$gd_session;
1206
+        global $post, $gd_session;
1207 1207
 
1208 1208
         if (isset($_REQUEST['post']))
1209 1209
             $_REQUEST['pid'] = $_REQUEST['post'];
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
         $is_default = $val['is_default'];
1252 1252
 
1253 1253
         /* field available to site admin only for edit */
1254
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1254
+        $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false;
1255 1255
         if ($for_admin_use && !is_super_admin()) {
1256 1256
             continue;
1257 1257
         }
@@ -1276,11 +1276,11 @@  discard block
 block discarded – undo
1276 1276
          * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1277 1277
          * @see 'geodir_after_custom_form_field_$name'
1278 1278
          */
1279
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1279
+        do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
1280 1280
 
1281 1281
 
1282 1282
         $custom_field = $val;
1283
-        $html ='';
1283
+        $html = '';
1284 1284
         /**
1285 1285
          * Filter the output for custom fields.
1286 1286
          *
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
          * @param string $html The html to be filtered (blank).
1290 1290
          * @param array $custom_field The custom field array values.
1291 1291
          */
1292
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1292
+        echo apply_filters("geodir_custom_field_input_{$type}", $html, $custom_field);
1293 1293
 
1294 1294
 
1295 1295
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
          * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1305 1305
          * @see 'geodir_before_custom_form_field_$name'
1306 1306
          */
1307
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1307
+        do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
1308 1308
 
1309 1309
     }
1310 1310
 
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
         $filter = $wpdb->get_row(
1332 1332
             $wpdb->prepare(
1333
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1333
+                "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'",
1334 1334
                 array($geodir_post_type)
1335 1335
             )
1336 1336
         );
@@ -1345,14 +1345,14 @@  discard block
 block discarded – undo
1345 1345
 }
1346 1346
 
1347 1347
 
1348
-function geodir_field_icon_proccess($cf){
1348
+function geodir_field_icon_proccess($cf) {
1349 1349
 
1350 1350
 
1351 1351
     if (strpos($cf['field_icon'], 'http') !== false) {
1352
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1352
+        $field_icon = ' background: url('.$cf['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353 1353
     } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
-    }else{
1354
+        $field_icon = '<i class="'.$cf['field_icon'].'"></i>';
1355
+    } else {
1356 1356
         $field_icon = $cf['field_icon'];
1357 1357
     }
1358 1358
 
@@ -1402,7 +1402,7 @@  discard block
 block discarded – undo
1402 1402
                 $field_icon = geodir_field_icon_proccess($type);
1403 1403
                 $filed_type = $type['type'];
1404 1404
                 $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1405
-                if($html_var=='post'){$html_var='post_address';}
1405
+                if ($html_var == 'post') {$html_var = 'post_address'; }
1406 1406
 
1407 1407
                 /**
1408 1408
                  * Filter the output for custom fields.
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
                  * @param string $fields_location The location the field is to be show.
1414 1414
                  * @param array $type The array of field values.
1415 1415
                  */
1416
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1416
+                $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
1417 1417
 
1418 1418
                 $variables_array = array();
1419 1419
 
@@ -1542,7 +1542,7 @@  discard block
 block discarded – undo
1542 1542
 
1543 1543
         $post_type = get_post_type($post_id);
1544 1544
         //echo $field_id; exit;
1545
-        $table = $plugin_prefix . $post_type . '_detail';
1545
+        $table = $plugin_prefix.$post_type.'_detail';
1546 1546
 
1547 1547
         $postcurr_images = array();
1548 1548
         $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
@@ -1561,13 +1561,13 @@  discard block
 block discarded – undo
1561 1561
             $geodir_uploadurl = $uploads['url'];
1562 1562
             $sub_dir = $uploads['subdir'];
1563 1563
 
1564
-            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1564
+            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
1565 1565
 
1566 1566
             for ($m = 0; $m < count($post_image); $m++) {
1567 1567
 
1568 1568
                 /* --------- start ------- */
1569 1569
 
1570
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1570
+                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM ".$table." WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1571 1571
 
1572 1572
 
1573 1573
                     $curr_img_url = $post_image[$m];
@@ -1593,24 +1593,24 @@  discard block
 block discarded – undo
1593 1593
                     //$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');
1594 1594
 
1595 1595
                     if (!function_exists('wp_handle_upload'))
1596
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1596
+                        require_once(ABSPATH.'wp-admin/includes/file.php');
1597 1597
 
1598 1598
                     if (!is_dir($geodir_uploadpath))
1599 1599
                         mkdir($geodir_uploadpath);
1600 1600
 
1601
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1601
+                    $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1];
1602 1602
                     $explode_sub_dir = explode("/", $sub_dir);
1603 1603
                     if ($curr_img_dir == end($explode_sub_dir)) {
1604
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1605
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1604
+                        $img_path = $geodir_uploadpath.'/'.$filename;
1605
+                        $img_url = $geodir_uploadurl.'/'.$filename;
1606 1606
                     } else {
1607
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1608
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1607
+                        $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
1608
+                        $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename;
1609 1609
                     }
1610 1610
 
1611 1611
                     $uploaded_file = '';
1612 1612
                     if (file_exists($img_path))
1613
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1613
+                        $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name);
1614 1614
 
1615 1615
                     if ($curr_img_dir != $geodir_uploaddir) {
1616 1616
                         if (file_exists($img_path))
@@ -1618,7 +1618,7 @@  discard block
 block discarded – undo
1618 1618
                     }
1619 1619
 
1620 1620
                     if (!empty($uploaded_file))
1621
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1621
+                        $file_urls = $geodir_uploadurl.'/'.$new_name;
1622 1622
 
1623 1623
                 } else {
1624 1624
                     $file_urls = $post_image[$m];
@@ -1632,8 +1632,8 @@  discard block
 block discarded – undo
1632 1632
         if (!empty($postcurr_images)) {
1633 1633
 
1634 1634
             if ($file_urls != $postcurr_images) {
1635
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1636
-                $invalid_files = (object)$invalid_files;
1635
+                $invalid_files[] = (object) array('src' => $postcurr_images);
1636
+                $invalid_files = (object) $invalid_files;
1637 1637
             }
1638 1638
         }
1639 1639
 
@@ -1685,9 +1685,9 @@  discard block
 block discarded – undo
1685 1685
     function geodir_upload_dir($upload)
1686 1686
     {
1687 1687
         global $current_user;
1688
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1689
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1690
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1688
+        $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID;
1689
+        $upload['path'] = $upload['basedir'].$upload['subdir'];
1690
+        $upload['url'] = $upload['baseurl'].$upload['subdir'];
1691 1691
         return $upload;
1692 1692
     }
1693 1693
 
@@ -1702,20 +1702,20 @@  discard block
 block discarded – undo
1702 1702
         // check ajax noonce
1703 1703
         $imgid = $_POST["imgid"];
1704 1704
 
1705
-        check_ajax_referer($imgid . 'pluploadan');
1705
+        check_ajax_referer($imgid.'pluploadan');
1706 1706
 
1707 1707
         // handle custom file uploaddir
1708 1708
         add_filter('upload_dir', 'geodir_upload_dir');
1709 1709
 
1710 1710
         // change file orinetation if needed
1711
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1711
+        $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']);
1712 1712
 
1713 1713
         // handle file upload
1714 1714
         $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1715 1715
         // remove handle custom file uploaddir
1716 1716
         remove_filter('upload_dir', 'geodir_upload_dir');
1717 1717
 
1718
-        if(!isset($status['url']) && isset($status['error'])){
1718
+        if (!isset($status['url']) && isset($status['error'])) {
1719 1719
             print_r($status);
1720 1720
         }
1721 1721
 
@@ -1745,9 +1745,9 @@  discard block
 block discarded – undo
1745 1745
 
1746 1746
     $post_type = get_post_type($post_id);
1747 1747
 
1748
-    $table = $plugin_prefix . $post_type . '_detail';
1748
+    $table = $plugin_prefix.$post_type.'_detail';
1749 1749
 
1750
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1750
+    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
1751 1751
 
1752 1752
     if ($results) {
1753 1753
         return $results[0]->geodir_video;
@@ -1771,9 +1771,9 @@  discard block
 block discarded – undo
1771 1771
 
1772 1772
     $post_type = get_post_type($post_id);
1773 1773
 
1774
-    $table = $plugin_prefix . $post_type . '_detail';
1774
+    $table = $plugin_prefix.$post_type.'_detail';
1775 1775
 
1776
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1776
+    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
1777 1777
 
1778 1778
     if ($results) {
1779 1779
         return $results[0]->geodir_special_offers;
@@ -1791,12 +1791,12 @@  discard block
 block discarded – undo
1791 1791
      */
1792 1792
     function geodir_max_upload_size()
1793 1793
     {
1794
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1794
+        $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1795 1795
 
1796 1796
         if ($max_filesize > 0 && $max_filesize < 1) {
1797
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1797
+            $max_filesize = (int) ($max_filesize * 1024).'kb';
1798 1798
         } else {
1799
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1799
+            $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1800 1800
         }
1801 1801
         /** Filter documented in geodirectory-functions/general_functions.php **/
1802 1802
         return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
 
1829 1829
             $custom_fields = $wpdb->get_results(
1830 1830
                 $wpdb->prepare(
1831
-                    "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1831
+                    "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from ".GEODIR_CUSTOM_FIELDS_TABLE." where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1832 1832
                     array($post_type)
1833 1833
                 ), 'ARRAY_A'
1834 1834
             );
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 
1956 1956
             $post_meta_info = $wpdb->query(
1957 1957
                 $wpdb->prepare(
1958
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1958
+                    "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
1959 1959
 															sort_order=%d 
1960 1960
 															where id= %d",
1961 1961
                     array($count, $cf)
@@ -2037,14 +2037,14 @@  discard block
 block discarded – undo
2037 2037
 
2038 2038
         $check_html_variable = $wpdb->get_var(
2039 2039
             $wpdb->prepare(
2040
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2040
+                "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ",
2041 2041
                 array($cehhtmlvar_name, $post_type, $field_type)
2042 2042
             )
2043 2043
         );
2044 2044
 
2045 2045
         if ($is_default == 1) {
2046 2046
 
2047
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2047
+            $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
2048 2048
 
2049 2049
         }
2050 2050
 
@@ -2055,7 +2055,7 @@  discard block
 block discarded – undo
2055 2055
 
2056 2056
                 $wpdb->prepare(
2057 2057
 
2058
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2058
+                    "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2059 2059
 				post_type = %s,
2060 2060
 				data_type = %s,
2061 2061
 				field_type = %s,
@@ -2086,7 +2086,7 @@  discard block
 block discarded – undo
2086 2086
 
2087 2087
                 $wpdb->prepare(
2088 2088
 
2089
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2089
+                    "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2090 2090
 				post_type = %s,
2091 2091
 				data_type = %s,
2092 2092
 				field_type = %s,
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
         }
2113 2113
 
2114 2114
 
2115
-        return (int)$lastid;
2115
+        return (int) $lastid;
2116 2116
 
2117 2117
     }
2118 2118
 }
@@ -2135,7 +2135,7 @@  discard block
 block discarded – undo
2135 2135
         if ($field_id != '') {
2136 2136
             $cf = trim($field_id, '_');
2137 2137
 
2138
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2138
+            $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
2139 2139
 
2140 2140
             return $field_id;
2141 2141
 
@@ -2158,12 +2158,12 @@  discard block
 block discarded – undo
2158 2158
      * @param string $field_ins_upd When set to "submit" displays form.
2159 2159
      * @param bool $default when set to true field will be for admin use only.
2160 2160
      */
2161
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2161
+    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '')
2162 2162
     {
2163 2163
         global $wpdb;
2164 2164
         $cf = $result_str;
2165 2165
         if (!is_object($cf)) {
2166
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2166
+            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
2167 2167
         } else {
2168 2168
             $field_info = $cf;
2169 2169
             $result_str = $cf->id;
@@ -2199,18 +2199,18 @@  discard block
 block discarded – undo
2199 2199
         if ($htmlvar_name == '')
2200 2200
             $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2201 2201
 
2202
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2202
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
2203 2203
 
2204 2204
         $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2205 2205
         $cso_arr = geodir_get_custom_sort_options($post_type);
2206 2206
 
2207 2207
         $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2208
-        foreach($cso_arr as $cso){
2209
-            if($cur_field_type==$cso['field_type']){
2208
+        foreach ($cso_arr as $cso) {
2209
+            if ($cur_field_type == $cso['field_type']) {
2210 2210
 
2211 2211
                 if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2212 2212
                     $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2213
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2213
+                }elseif (isset($cso['field_icon']) && $cso['field_icon']) {
2214 2214
                     $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2215 2215
                 }
2216 2216
 
@@ -2220,40 +2220,40 @@  discard block
 block discarded – undo
2220 2220
         $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2221 2221
         ?>
2222 2222
 
2223
-        <li class="text" id="licontainer_<?php echo $result_str;?>">
2223
+        <li class="text" id="licontainer_<?php echo $result_str; ?>">
2224 2224
             <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
2225
-            <div class="title title<?php echo $result_str;?> gt-fieldset"
2226
-                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
2227
-                 ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2225
+            <div class="title title<?php echo $result_str; ?> gt-fieldset"
2226
+                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
2227
+                 ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
2228 2228
                 <?php
2229 2229
 
2230 2230
                 ?>
2231 2231
 
2232
-                <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2233
-                     onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
2232
+                <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
2233
+                     onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
2234 2234
                      class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
2235 2235
 
2236 2236
 
2237
-                <?php echo $field_icon;?>
2237
+                <?php echo $field_icon; ?>
2238 2238
                 <b style="cursor:pointer;"
2239
-                   onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
2239
+                   onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
2240 2240
 
2241 2241
             </div>
2242 2242
 
2243
-            <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2243
+            <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
2244 2244
                  style="display:<?php if ($field_ins_upd == 'submit') {
2245 2245
                      echo 'block;';
2246 2246
                  } else {
2247 2247
                      echo 'none;';
2248 2248
                  } ?>">
2249 2249
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2250
-                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2251
-                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2252
-                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2250
+                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
2251
+                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
2252
+                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/>
2253 2253
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2254 2254
                     echo $field_info->data_type;
2255 2255
                 }?>"/>
2256
-                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2256
+                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/>
2257 2257
 
2258 2258
 
2259 2259
                 <ul class="widefat post fixed" border="0" style="width:100%;">
@@ -2263,7 +2263,7 @@  discard block
 block discarded – undo
2263 2263
                         <input type="hidden" name="site_title" id="site_title" value="<?php echo esc_attr($site_title); ?>"/>
2264 2264
 
2265 2265
                         <li>
2266
-                            <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0;?>
2266
+                            <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0; ?>
2267 2267
 
2268 2268
                             <label for="asc" class="gd-cf-tooltip-wrap">
2269 2269
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Ascending Sort (low to high)', 'geodirectory'); ?>
@@ -2273,24 +2273,24 @@  discard block
 block discarded – undo
2273 2273
                             </label>
2274 2274
                             <div class="gd-cf-input-wrap gd-switch">
2275 2275
 
2276
-                                <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled"  value="1"
2276
+                                <input type="radio" id="asc_yes<?php echo $radio_id; ?>" name="asc" class="gdri-enabled"  value="1"
2277 2277
                                     <?php if ($value == '1') {
2278 2278
                                         echo 'checked';
2279 2279
                                     } ?>/>
2280
-                                <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2280
+                                <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2281 2281
 
2282
-                                <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0"
2282
+                                <input type="radio" id="asc_no<?php echo $radio_id; ?>" name="asc" class="gdri-disabled" value="0"
2283 2283
                                     <?php if ($value == '0' || !$value) {
2284 2284
                                         echo 'checked';
2285 2285
                                     } ?>/>
2286
-                                <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2286
+                                <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2287 2287
 
2288 2288
                             </div>
2289 2289
 
2290 2290
                         </li>
2291 2291
 
2292
-                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
2293
-                            <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : '';?>
2292
+                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
2293
+                            <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : ''; ?>
2294 2294
 
2295 2295
                             <label for="asc_title" class="gd-cf-tooltip-wrap">
2296 2296
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Ascending title', 'geodirectory'); ?>
@@ -2300,14 +2300,14 @@  discard block
 block discarded – undo
2300 2300
                             </label>
2301 2301
                             <div class="gd-cf-input-wrap">
2302 2302
 
2303
-                                <input type="text" name="asc_title" id="asc_title" value="<?php echo $value;?>" />
2303
+                                <input type="text" name="asc_title" id="asc_title" value="<?php echo $value; ?>" />
2304 2304
                             </div>
2305 2305
 
2306 2306
 
2307 2307
                         </li>
2308 2308
 
2309 2309
 
2310
-                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
2310
+                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
2311 2311
 
2312 2312
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2313 2313
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
                             <div class="gd-cf-input-wrap">
2319 2319
 
2320 2320
                                 <input type="radio" name="is_default"
2321
-                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2321
+                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
2322 2322
                                     echo 'checked="checked"';
2323 2323
                                 } ?>/>
2324 2324
                             </div>
@@ -2328,7 +2328,7 @@  discard block
 block discarded – undo
2328 2328
 
2329 2329
 
2330 2330
                         <li>
2331
-                            <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0;?>
2331
+                            <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0; ?>
2332 2332
 
2333 2333
                             <label for="desc" class="gd-cf-tooltip-wrap">
2334 2334
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Descending Sort (high to low)', 'geodirectory'); ?>
@@ -2338,24 +2338,24 @@  discard block
 block discarded – undo
2338 2338
                             </label>
2339 2339
                             <div class="gd-cf-input-wrap gd-switch">
2340 2340
 
2341
-                                <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled"  value="1"
2341
+                                <input type="radio" id="desc_yes<?php echo $radio_id; ?>" name="desc" class="gdri-enabled"  value="1"
2342 2342
                                     <?php if ($value == '1') {
2343 2343
                                         echo 'checked';
2344 2344
                                     } ?>/>
2345
-                                <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2345
+                                <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2346 2346
 
2347
-                                <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0"
2347
+                                <input type="radio" id="desc_no<?php echo $radio_id; ?>" name="desc" class="gdri-disabled" value="0"
2348 2348
                                     <?php if ($value == '0' || !$value) {
2349 2349
                                         echo 'checked';
2350 2350
                                     } ?>/>
2351
-                                <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2351
+                                <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2352 2352
 
2353 2353
                             </div>
2354 2354
 
2355 2355
                         </li>
2356 2356
 
2357
-                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
2358
-                            <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : '';?>
2357
+                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
2358
+                            <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : ''; ?>
2359 2359
 
2360 2360
                             <label for="desc_title" class="gd-cf-tooltip-wrap">
2361 2361
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Descending title', 'geodirectory'); ?>
@@ -2365,13 +2365,13 @@  discard block
 block discarded – undo
2365 2365
                             </label>
2366 2366
                             <div class="gd-cf-input-wrap">
2367 2367
 
2368
-                                <input type="text" name="desc_title" id="desc_title" value="<?php echo $value;?>" />
2368
+                                <input type="text" name="desc_title" id="desc_title" value="<?php echo $value; ?>" />
2369 2369
                             </div>
2370 2370
 
2371 2371
 
2372 2372
                         </li>
2373 2373
 
2374
-                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
2374
+                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
2375 2375
 
2376 2376
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2377 2377
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2382,7 +2382,7 @@  discard block
 block discarded – undo
2382 2382
                             <div class="gd-cf-input-wrap">
2383 2383
 
2384 2384
                                 <input type="radio" name="is_default"
2385
-                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2385
+                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
2386 2386
                                     echo 'checked="checked"';
2387 2387
                                 } ?>/>
2388 2388
                             </div>
@@ -2407,14 +2407,14 @@  discard block
 block discarded – undo
2407 2407
                             </label>
2408 2408
                             <div class="gd-cf-input-wrap">
2409 2409
 
2410
-                                <input type="text" name="site_title" id="site_title" value="<?php echo $value;?>" />
2410
+                                <input type="text" name="site_title" id="site_title" value="<?php echo $value; ?>" />
2411 2411
                             </div>
2412 2412
 
2413 2413
 
2414 2414
                         </li>
2415 2415
 
2416 2416
                         <li>
2417
-                            <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : '';?>
2417
+                            <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : ''; ?>
2418 2418
 
2419 2419
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2420 2420
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2438,7 +2438,7 @@  discard block
 block discarded – undo
2438 2438
 
2439 2439
 
2440 2440
                     <li>
2441
-                        <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active: 0;?>
2441
+                        <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active : 0; ?>
2442 2442
 
2443 2443
                         <label for="is_active" class="gd-cf-tooltip-wrap">
2444 2444
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active', 'geodirectory'); ?>
@@ -2448,17 +2448,17 @@  discard block
 block discarded – undo
2448 2448
                         </label>
2449 2449
                         <div class="gd-cf-input-wrap gd-switch">
2450 2450
 
2451
-                            <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
2451
+                            <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled"  value="1"
2452 2452
                                 <?php if ($value == '1') {
2453 2453
                                     echo 'checked';
2454 2454
                                 } ?>/>
2455
-                            <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2455
+                            <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2456 2456
 
2457
-                            <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
2457
+                            <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0"
2458 2458
                                 <?php if ($value == '0' || !$value) {
2459 2459
                                     echo 'checked';
2460 2460
                                 } ?>/>
2461
-                            <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2461
+                            <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2462 2462
 
2463 2463
                         </div>
2464 2464
 
@@ -2479,10 +2479,10 @@  discard block
 block discarded – undo
2479 2479
                             <h3></h3>
2480 2480
                         </label>
2481 2481
                         <div class="gd-cf-input-wrap">
2482
-                            <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
2482
+                            <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
2483 2483
                                    onclick="save_sort_field('<?php echo esc_attr($result_str); ?>')"/>
2484
-                                <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
2485
-                                                                    onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
2484
+                                <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
2485
+                                                                    onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
2486 2486
                                                                     class="button"/></a>
2487 2487
                         </div>
2488 2488
                     </li>
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
         if (!$package_id || !$field_name || !$post_type) {
2518 2518
             return true;
2519 2519
         }
2520
-        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
2520
+        $sql = $wpdb->prepare("SELECT id FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int) $package_id));
2521 2521
 
2522 2522
         if ($wpdb->get_var($sql)) {
2523 2523
             return true;
@@ -2639,7 +2639,7 @@  discard block
 block discarded – undo
2639 2639
 }
2640 2640
 
2641 2641
 
2642
-function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2642
+function geodir_cfa_data_type_text($output, $result_str, $cf, $field_info) {
2643 2643
     ob_start();
2644 2644
     ?>
2645 2645
     <li>
@@ -2685,43 +2685,43 @@  discard block
 block discarded – undo
2685 2685
     $output = ob_get_clean();
2686 2686
     return $output;
2687 2687
 }
2688
-add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2688
+add_filter('geodir_cfa_data_type_text', 'geodir_cfa_data_type_text', 10, 4);
2689 2689
 
2690 2690
 // htmlvar not needed for fieldset and taxonomy
2691
-add_filter('geodir_cfa_htmlvar_name_fieldset','__return_empty_string',10,4);
2692
-add_filter('geodir_cfa_htmlvar_name_taxonomy','__return_empty_string',10,4);
2691
+add_filter('geodir_cfa_htmlvar_name_fieldset', '__return_empty_string', 10, 4);
2692
+add_filter('geodir_cfa_htmlvar_name_taxonomy', '__return_empty_string', 10, 4);
2693 2693
 
2694 2694
 
2695 2695
 // default_value not needed for textarea, html, file, fieldset, taxonomy, address
2696
-add_filter('geodir_cfa_default_value_textarea','__return_empty_string',10,4);
2697
-add_filter('geodir_cfa_default_value_html','__return_empty_string',10,4);
2698
-add_filter('geodir_cfa_default_value_file','__return_empty_string',10,4);
2699
-add_filter('geodir_cfa_default_value_taxonomy','__return_empty_string',10,4);
2700
-add_filter('geodir_cfa_default_value_address','__return_empty_string',10,4);
2701
-add_filter('geodir_cfa_default_value_fieldset','__return_empty_string',10,4);
2696
+add_filter('geodir_cfa_default_value_textarea', '__return_empty_string', 10, 4);
2697
+add_filter('geodir_cfa_default_value_html', '__return_empty_string', 10, 4);
2698
+add_filter('geodir_cfa_default_value_file', '__return_empty_string', 10, 4);
2699
+add_filter('geodir_cfa_default_value_taxonomy', '__return_empty_string', 10, 4);
2700
+add_filter('geodir_cfa_default_value_address', '__return_empty_string', 10, 4);
2701
+add_filter('geodir_cfa_default_value_fieldset', '__return_empty_string', 10, 4);
2702 2702
 
2703 2703
 // is_required not needed for fieldset
2704
-add_filter('geodir_cfa_is_required_fieldset','__return_empty_string',10,4);
2705
-add_filter('geodir_cfa_required_msg_fieldset','__return_empty_string',10,4);
2704
+add_filter('geodir_cfa_is_required_fieldset', '__return_empty_string', 10, 4);
2705
+add_filter('geodir_cfa_required_msg_fieldset', '__return_empty_string', 10, 4);
2706 2706
 
2707 2707
 // field_icon not needed for fieldset
2708
-add_filter('geodir_cfa_field_icon_fieldset','__return_empty_string',10,4);
2709
-add_filter('geodir_cfa_css_class_fieldset','__return_empty_string',10,4);
2708
+add_filter('geodir_cfa_field_icon_fieldset', '__return_empty_string', 10, 4);
2709
+add_filter('geodir_cfa_css_class_fieldset', '__return_empty_string', 10, 4);
2710 2710
 
2711 2711
 // cat_sort not needed for some fields
2712
-add_filter('geodir_cfa_cat_sort_html','__return_empty_string',10,4);
2713
-add_filter('geodir_cfa_cat_sort_file','__return_empty_string',10,4);
2714
-add_filter('geodir_cfa_cat_sort_url','__return_empty_string',10,4);
2715
-add_filter('geodir_cfa_cat_sort_fieldset','__return_empty_string',10,4);
2716
-add_filter('geodir_cfa_cat_sort_multiselect','__return_empty_string',10,4);
2717
-add_filter('geodir_cfa_cat_sort_textarea','__return_empty_string',10,4);
2718
-add_filter('geodir_cfa_cat_sort_taxonomy','__return_empty_string',10,4);
2719
-add_filter('geodir_cfa_cat_sort_address','__return_empty_string',10,4);
2712
+add_filter('geodir_cfa_cat_sort_html', '__return_empty_string', 10, 4);
2713
+add_filter('geodir_cfa_cat_sort_file', '__return_empty_string', 10, 4);
2714
+add_filter('geodir_cfa_cat_sort_url', '__return_empty_string', 10, 4);
2715
+add_filter('geodir_cfa_cat_sort_fieldset', '__return_empty_string', 10, 4);
2716
+add_filter('geodir_cfa_cat_sort_multiselect', '__return_empty_string', 10, 4);
2717
+add_filter('geodir_cfa_cat_sort_textarea', '__return_empty_string', 10, 4);
2718
+add_filter('geodir_cfa_cat_sort_taxonomy', '__return_empty_string', 10, 4);
2719
+add_filter('geodir_cfa_cat_sort_address', '__return_empty_string', 10, 4);
2720 2720
 
2721 2721
 
2722 2722
 
2723
-function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2724
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2723
+function geodir_cfa_advanced_editor_geodir_special_offers($output, $result_str, $cf, $field_info) {
2724
+    if ($field_info->htmlvar_name != 'geodir_special_offers') {return ''; }
2725 2725
     ob_start();
2726 2726
     ?>
2727 2727
     <li>
@@ -2752,16 +2752,16 @@  discard block
 block discarded – undo
2752 2752
     $output = ob_get_clean();
2753 2753
     return $output;
2754 2754
 }
2755
-add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2755
+add_filter('geodir_cfa_advanced_editor_textarea', 'geodir_cfa_advanced_editor_geodir_special_offers', 10, 4);
2756 2756
 
2757 2757
 
2758
-function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2758
+function geodir_cfa_validation_pattern_text($output, $result_str, $cf, $field_info) {
2759 2759
     ob_start();
2760 2760
 
2761 2761
     $value = '';
2762 2762
     if (isset($field_info->validation_pattern)) {
2763 2763
         $value = esc_attr($field_info->validation_pattern);
2764
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2764
+    }elseif (isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']) {
2765 2765
         $value = esc_attr($cf['defaults']['validation_pattern']);
2766 2766
     }
2767 2767
     ?>
@@ -2781,7 +2781,7 @@  discard block
 block discarded – undo
2781 2781
     $value = '';
2782 2782
     if (isset($field_info->validation_msg)) {
2783 2783
         $value = esc_attr($field_info->validation_msg);
2784
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2784
+    }elseif (isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']) {
2785 2785
         $value = esc_attr($cf['defaults']['validation_msg']);
2786 2786
     }
2787 2787
     ?>
@@ -2802,10 +2802,10 @@  discard block
 block discarded – undo
2802 2802
     $output = ob_get_clean();
2803 2803
     return $output;
2804 2804
 }
2805
-add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2805
+add_filter('geodir_cfa_validation_pattern_text', 'geodir_cfa_validation_pattern_text', 10, 4);
2806 2806
 
2807 2807
 
2808
-function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2808
+function geodir_cfa_htmlvar_name_taxonomy($output, $result_str, $cf, $field_info) {
2809 2809
     ob_start();
2810 2810
     global $post_type;
2811 2811
 
@@ -2830,7 +2830,7 @@  discard block
 block discarded – undo
2830 2830
                     ?>
2831 2831
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2832 2832
                         echo 'selected="selected"';
2833
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2833
+                    }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php
2834 2834
                 }
2835 2835
                 ?>
2836 2836
             </select>
@@ -2841,7 +2841,7 @@  discard block
 block discarded – undo
2841 2841
         <label for="cat_display_type" class="gd-cf-tooltip-wrap">
2842 2842
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Category display type :', 'geodirectory'); ?>
2843 2843
             <div class="gdcf-tooltip">
2844
-                <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory');?>
2844
+                <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory'); ?>
2845 2845
             </div>
2846 2846
         </label>
2847 2847
         <div class="gd-cf-input-wrap">
@@ -2849,19 +2849,19 @@  discard block
 block discarded – undo
2849 2849
             <select name="cat_display_type" id="cat_display_type">
2850 2850
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2851 2851
                     echo 'selected="selected"';
2852
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2852
+                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
2853 2853
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2854 2854
                     echo 'selected="selected"';
2855
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2855
+                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
2856 2856
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2857 2857
                     echo 'selected="selected"';
2858
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2858
+                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
2859 2859
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2860 2860
                     echo 'selected="selected"';
2861
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2861
+                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
2862 2862
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2863 2863
                     echo 'selected="selected"';
2864
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2864
+                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
2865 2865
             </select>
2866 2866
         </div>
2867 2867
     </li>
@@ -2870,10 +2870,10 @@  discard block
 block discarded – undo
2870 2870
     $output = ob_get_clean();
2871 2871
     return $output;
2872 2872
 }
2873
-add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2873
+add_filter('geodir_cfa_htmlvar_name_taxonomy', 'geodir_cfa_htmlvar_name_taxonomy', 10, 4);
2874 2874
 
2875 2875
 
2876
-function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2876
+function geodir_cfa_extra_fields_address($output, $result_str, $cf, $field_info) {
2877 2877
 
2878 2878
     ob_start();
2879 2879
     if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
@@ -2896,32 +2896,32 @@  discard block
 block discarded – undo
2896 2896
         <label for="show_zip" class="gd-cf-tooltip-wrap">
2897 2897
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display zip/post code :', 'geodirectory'); ?>
2898 2898
             <div class="gdcf-tooltip">
2899
-                <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?>
2899
+                <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?>
2900 2900
             </div>
2901 2901
         </label>
2902 2902
         <div class="gd-cf-input-wrap gd-switch">
2903 2903
 
2904
-            <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2904
+            <input type="radio" id="show_zip_yes<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2905 2905
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2906 2906
                     echo 'checked';
2907 2907
                 } ?>/>
2908
-            <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2908
+            <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2909 2909
 
2910
-            <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2910
+            <input type="radio" id="show_zip_no<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2911 2911
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2912 2912
                     echo 'checked';
2913 2913
                 } ?>/>
2914
-            <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2914
+            <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2915 2915
 
2916 2916
 
2917 2917
         </div>
2918 2918
     </li>
2919 2919
 
2920
-    <li class="cf-zip-lable"  <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'";}?> >
2920
+    <li class="cf-zip-lable"  <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'"; }?> >
2921 2921
         <label for="zip_lable" class="gd-cf-tooltip-wrap">
2922 2922
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Zip/Post code label :', 'geodirectory'); ?>
2923 2923
             <div class="gdcf-tooltip">
2924
-                <?php _e('Enter zip/post code field label in address section.', 'geodirectory');?>
2924
+                <?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?>
2925 2925
             </div>
2926 2926
         </label>
2927 2927
         <div class="gd-cf-input-wrap">
@@ -2939,7 +2939,7 @@  discard block
 block discarded – undo
2939 2939
         <label for="map_lable" class="gd-cf-tooltip-wrap">
2940 2940
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map button label :', 'geodirectory'); ?>
2941 2941
             <div class="gdcf-tooltip">
2942
-                <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?>
2942
+                <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory'); ?>
2943 2943
             </div>
2944 2944
         </label>
2945 2945
         <div class="gd-cf-input-wrap">
@@ -2954,22 +2954,22 @@  discard block
 block discarded – undo
2954 2954
         <label for="show_mapzoom" class="gd-cf-tooltip-wrap">
2955 2955
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Use user zoom level:', 'geodirectory'); ?>
2956 2956
             <div class="gdcf-tooltip">
2957
-                <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory');?>
2957
+                <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory'); ?>
2958 2958
             </div>
2959 2959
         </label>
2960 2960
         <div class="gd-cf-input-wrap gd-switch">
2961 2961
 
2962
-            <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2962
+            <input type="radio" id="show_mapzoom_yes<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2963 2963
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
2964 2964
                     echo 'checked';
2965 2965
                 } ?>/>
2966
-            <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2966
+            <label for="show_mapzoom_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2967 2967
 
2968
-            <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2968
+            <input type="radio" id="show_mapzoom_no<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2969 2969
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
2970 2970
                     echo 'checked';
2971 2971
                 } ?>/>
2972
-            <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2972
+            <label for="show_mapzoom_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2973 2973
 
2974 2974
         </div>
2975 2975
     </li>
@@ -2978,22 +2978,22 @@  discard block
 block discarded – undo
2978 2978
         <label for="show_mapview" class="gd-cf-tooltip-wrap">
2979 2979
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display map view:', 'geodirectory'); ?>
2980 2980
             <div class="gdcf-tooltip">
2981
-                <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory');?>
2981
+                <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory'); ?>
2982 2982
             </div>
2983 2983
         </label>
2984 2984
         <div class="gd-cf-input-wrap gd-switch">
2985 2985
 
2986
-            <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
2986
+            <input type="radio" id="show_mapview_yes<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
2987 2987
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
2988 2988
                     echo 'checked';
2989 2989
                 } ?>/>
2990
-            <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2990
+            <label for="show_mapview_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2991 2991
 
2992
-            <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
2992
+            <input type="radio" id="show_mapview_no<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
2993 2993
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
2994 2994
                     echo 'checked';
2995 2995
                 } ?>/>
2996
-            <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2996
+            <label for="show_mapview_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2997 2997
 
2998 2998
         </div>
2999 2999
     </li>
@@ -3003,7 +3003,7 @@  discard block
 block discarded – undo
3003 3003
         <label for="mapview_lable" class="gd-cf-tooltip-wrap">
3004 3004
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map view label:', 'geodirectory'); ?>
3005 3005
             <div class="gdcf-tooltip">
3006
-                <?php _e('Enter mapview field label in address section.', 'geodirectory');?>
3006
+                <?php _e('Enter mapview field label in address section.', 'geodirectory'); ?>
3007 3007
             </div>
3008 3008
         </label>
3009 3009
         <div class="gd-cf-input-wrap">
@@ -3017,22 +3017,22 @@  discard block
 block discarded – undo
3017 3017
         <label for="show_latlng" class="gd-cf-tooltip-wrap">
3018 3018
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show latitude and longitude', 'geodirectory'); ?>
3019 3019
             <div class="gdcf-tooltip">
3020
-                <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory');?>
3020
+                <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory'); ?>
3021 3021
             </div>
3022 3022
         </label>
3023 3023
         <div class="gd-cf-input-wrap gd-switch">
3024 3024
 
3025
-            <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3025
+            <input type="radio" id="show_latlng_yes<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3026 3026
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
3027 3027
                     echo 'checked';
3028 3028
                 } ?>/>
3029
-            <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3029
+            <label for="show_latlng_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3030 3030
 
3031
-            <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3031
+            <input type="radio" id="show_latlng_no<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3032 3032
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
3033 3033
                     echo 'checked';
3034 3034
                 } ?>/>
3035
-            <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3035
+            <label for="show_latlng_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3036 3036
 
3037 3037
         </div>
3038 3038
     </li>
@@ -3041,17 +3041,17 @@  discard block
 block discarded – undo
3041 3041
     $html = ob_get_clean();
3042 3042
     return $output.$html;
3043 3043
 }
3044
-add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
3044
+add_filter('geodir_cfa_extra_fields_address', 'geodir_cfa_extra_fields_address', 10, 4);
3045 3045
 
3046 3046
 
3047
-function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
3047
+function geodir_cfa_extra_fields_multiselect($output, $result_str, $cf, $field_info) {
3048 3048
     ob_start();
3049 3049
     ?>
3050 3050
     <li>
3051 3051
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
3052 3052
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
3053 3053
             <div class="gdcf-tooltip">
3054
-                <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory');?>
3054
+                <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory'); ?>
3055 3055
             </div>
3056 3056
         </label>
3057 3057
         <div class="gd-cf-input-wrap">
@@ -3059,13 +3059,13 @@  discard block
 block discarded – undo
3059 3059
             <select name="multi_display_type" id="multi_display_type">
3060 3060
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
3061 3061
                     echo 'selected="selected"';
3062
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
3062
+                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
3063 3063
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
3064 3064
                     echo 'selected="selected"';
3065
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3065
+                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
3066 3066
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
3067 3067
                     echo 'selected="selected"';
3068
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3068
+                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
3069 3069
             </select>
3070 3070
 
3071 3071
             <br/>
@@ -3076,17 +3076,17 @@  discard block
 block discarded – undo
3076 3076
     $html = ob_get_clean();
3077 3077
     return $output.$html;
3078 3078
 }
3079
-add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
3079
+add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_multiselect', 10, 4);
3080 3080
 
3081 3081
 
3082
-function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
3082
+function geodir_cfa_extra_fields_smr($output, $result_str, $cf, $field_info) {
3083 3083
 
3084 3084
     ob_start();
3085 3085
 
3086 3086
     $value = '';
3087 3087
     if (isset($field_info->option_values)) {
3088 3088
         $value = esc_attr($field_info->option_values);
3089
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3089
+    }elseif (isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']) {
3090 3090
         $value = esc_attr($cf['defaults']['option_values']);
3091 3091
     }
3092 3092
 
@@ -3096,11 +3096,11 @@  discard block
 block discarded – undo
3096 3096
         <label for="option_values" class="gd-cf-tooltip-wrap">
3097 3097
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
3098 3098
             <div class="gdcf-tooltip">
3099
-                <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
3099
+                <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
3100 3100
                 <br/>
3101
-                <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory');?></span>
3101
+                <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory'); ?></span>
3102 3102
                     <br/>
3103
-                    <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
3103
+                    <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
3104 3104
                     <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
3105 3105
                         <br/>
3106 3106
                         <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
@@ -3111,7 +3111,7 @@  discard block
 block discarded – undo
3111 3111
         </label>
3112 3112
         <div class="gd-cf-input-wrap">
3113 3113
             <input type="text" name="option_values" id="option_values"
3114
-                   value="<?php echo $value;?>"/>
3114
+                   value="<?php echo $value; ?>"/>
3115 3115
             <br/>
3116 3116
 
3117 3117
         </div>
@@ -3121,12 +3121,12 @@  discard block
 block discarded – undo
3121 3121
     $html = ob_get_clean();
3122 3122
     return $output.$html;
3123 3123
 }
3124
-add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
3125
-add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
3126
-add_filter('geodir_cfa_extra_fields_radio','geodir_cfa_extra_fields_smr',10,4);
3124
+add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_smr', 10, 4);
3125
+add_filter('geodir_cfa_extra_fields_select', 'geodir_cfa_extra_fields_smr', 10, 4);
3126
+add_filter('geodir_cfa_extra_fields_radio', 'geodir_cfa_extra_fields_smr', 10, 4);
3127 3127
 
3128 3128
 
3129
-function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
3129
+function geodir_cfa_extra_fields_datepicker($output, $result_str, $cf, $field_info) {
3130 3130
     ob_start();
3131 3131
     $extra = array();
3132 3132
     if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
@@ -3137,7 +3137,7 @@  discard block
 block discarded – undo
3137 3137
         <label for="date_format" class="gd-cf-tooltip-wrap">
3138 3138
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
3139 3139
             <div class="gdcf-tooltip">
3140
-                <?php _e('Select the date format.', 'geodirectory');?>
3140
+                <?php _e('Select the date format.', 'geodirectory'); ?>
3141 3141
             </div>
3142 3142
         </label>
3143 3143
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
@@ -3157,16 +3157,16 @@  discard block
 block discarded – undo
3157 3157
              * @since 1.6.5
3158 3158
              * @param array $date_formats The PHP date format array.
3159 3159
              */
3160
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
3160
+            $date_formats = apply_filters('geodir_date_formats', $date_formats);
3161 3161
             ?>
3162 3162
             <select name="extra[date_format]" id="date_format">
3163 3163
                 <?php
3164
-                foreach($date_formats as $format){
3164
+                foreach ($date_formats as $format) {
3165 3165
                     $selected = '';
3166
-                    if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3166
+                    if (!empty($extra) && esc_attr($extra['date_format']) == $format) {
3167 3167
                         $selected = "selected='selected'";
3168 3168
                     }
3169
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3169
+                    echo "<option $selected value='$format'>$format       (".date_i18n($format, time()).")</option>";
3170 3170
                 }
3171 3171
                 ?>
3172 3172
             </select>
@@ -3178,10 +3178,10 @@  discard block
 block discarded – undo
3178 3178
     $html = ob_get_clean();
3179 3179
     return $output.$html;
3180 3180
 }
3181
-add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3181
+add_filter('geodir_cfa_extra_fields_datepicker', 'geodir_cfa_extra_fields_datepicker', 10, 4);
3182 3182
 
3183 3183
 
3184
-function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3184
+function geodir_cfa_extra_fields_file($output, $result_str, $cf, $field_info) {
3185 3185
     ob_start();
3186 3186
     $allowed_file_types = geodir_allowed_mime_types();
3187 3187
 
@@ -3192,16 +3192,16 @@  discard block
 block discarded – undo
3192 3192
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3193 3193
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
3194 3194
             <div class="gdcf-tooltip">
3195
-                <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory');?>
3195
+                <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory'); ?>
3196 3196
             </div>
3197 3197
         </label>
3198 3198
         <div class="gd-cf-input-wrap">
3199 3199
             <select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;">
3200
-                <option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
3201
-                <?php foreach ( $allowed_file_types as $format => $types ) { ?>
3202
-                    <optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
3203
-                        <?php foreach ( $types as $ext => $type ) { ?>
3204
-                            <option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option>
3200
+                <option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
3201
+                <?php foreach ($allowed_file_types as $format => $types) { ?>
3202
+                    <optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
3203
+                        <?php foreach ($types as $ext => $type) { ?>
3204
+                            <option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.'.$ext; ?></option>
3205 3205
                         <?php } ?>
3206 3206
                     </optgroup>
3207 3207
                 <?php } ?>
@@ -3213,11 +3213,11 @@  discard block
 block discarded – undo
3213 3213
     $html = ob_get_clean();
3214 3214
     return $output.$html;
3215 3215
 }
3216
-add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3216
+add_filter('geodir_cfa_extra_fields_file', 'geodir_cfa_extra_fields_file', 10, 4);
3217 3217
 
3218
-function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
3218
+function geodir_default_custom_fields($post_type = 'gd_place', $package_id = '') {
3219 3219
     $fields = array();
3220
-    $package = ($package_id=='') ? '' : array($package_id);
3220
+    $package = ($package_id == '') ? '' : array($package_id);
3221 3221
 
3222 3222
     $fields[] = array('listing_type' => $post_type,
3223 3223
                       'data_type' => 'VARCHAR',
Please login to merge, or discard this patch.
Braces   +124 added lines, -83 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
 
@@ -349,7 +353,9 @@  discard block
 block discarded – undo
349 353
 
350 354
 
351 355
 
352
-            if ($post_type == '') $post_type = 'gd_place';
356
+            if ($post_type == '') {
357
+            	$post_type = 'gd_place';
358
+            }
353 359
 
354 360
 
355 361
             $detail_table = $plugin_prefix . $post_type . '_detail';
@@ -389,16 +395,17 @@  discard block
 block discarded – undo
389 395
             }
390 396
 
391 397
             $option_values = '';
392
-            if (isset($request_field['option_values']))
393
-                $option_values = $request_field['option_values'];
398
+            if (isset($request_field['option_values'])) {
399
+                            $option_values = $request_field['option_values'];
400
+            }
394 401
 
395 402
             $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
396 403
 
397 404
             $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
398 405
 
399
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
401
-            else {
406
+            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) {
407
+                            $price_pkg = implode(",", $request_field['show_on_pkg']);
408
+            } else {
402 409
                 $package_info = array();
403 410
 
404 411
                 $package_info = geodir_post_package_info($package_info, '', $post_type);
@@ -406,22 +413,29 @@  discard block
 block discarded – undo
406 413
             }
407 414
 
408 415
 
409
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
410
-                $extra_fields = $request_field['extra'];
416
+            if (isset($request_field['extra']) && !empty($request_field['extra'])) {
417
+                            $extra_fields = $request_field['extra'];
418
+            }
411 419
 
412
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
413
-                $is_default = $request_field['is_default'];
414
-            else
415
-                $is_default = '0';
420
+            if (isset($request_field['is_default']) && $request_field['is_default'] != '') {
421
+                            $is_default = $request_field['is_default'];
422
+            } else {
423
+                            $is_default = '0';
424
+            }
416 425
 
417
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
418
-                $is_admin = $request_field['is_admin'];
419
-            else
420
-                $is_admin = '0';
426
+            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') {
427
+                            $is_admin = $request_field['is_admin'];
428
+            } else {
429
+                            $is_admin = '0';
430
+            }
421 431
 
422 432
 
423
-            if ($is_active == '') $is_active = 1;
424
-            if ($is_required == '') $is_required = 0;
433
+            if ($is_active == '') {
434
+            	$is_active = 1;
435
+            }
436
+            if ($is_required == '') {
437
+            	$is_required = 0;
438
+            }
425 439
 
426 440
 
427 441
             if ($sort_order == '') {
@@ -690,7 +704,7 @@  discard block
 block discarded – undo
690 704
                                 }
691 705
                                 if($op_max){$op_size =$op_max; }
692 706
                             }
693
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
707
+                        } elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694 708
                             if(strlen($option_values)){
695 709
                                 $op_size =  strlen($option_values);
696 710
                             }
@@ -707,11 +721,13 @@  discard block
 block discarded – undo
707 721
                             return __('Column change failed, you may have too many columns.','geodirectory');
708 722
                         }
709 723
 
710
-                        if (isset($request_field['cat_display_type']))
711
-                            $extra_fields = $request_field['cat_display_type'];
724
+                        if (isset($request_field['cat_display_type'])) {
725
+                                                    $extra_fields = $request_field['cat_display_type'];
726
+                        }
712 727
 
713
-                        if (isset($request_field['multi_display_type']))
714
-                            $extra_fields = $request_field['multi_display_type'];
728
+                        if (isset($request_field['multi_display_type'])) {
729
+                                                    $extra_fields = $request_field['multi_display_type'];
730
+                        }
715 731
 
716 732
 
717 733
                         break;
@@ -725,8 +741,9 @@  discard block
 block discarded – undo
725 741
                         if($alter_result===false){
726 742
                             return __('Column change failed, you may have too many columns.','geodirectory');
727 743
                         }
728
-                        if (isset($request_field['advanced_editor']))
729
-                            $extra_fields = $request_field['advanced_editor'];
744
+                        if (isset($request_field['advanced_editor'])) {
745
+                                                    $extra_fields = $request_field['advanced_editor'];
746
+                        }
730 747
 
731 748
                         break;
732 749
 
@@ -822,8 +839,9 @@  discard block
 block discarded – undo
822 839
                 );
823 840
 
824 841
 
825
-                if ($cat_sort == '')
826
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
842
+                if ($cat_sort == '') {
843
+                                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
844
+                }
827 845
 
828 846
 
829 847
                 /**
@@ -1193,8 +1211,10 @@  discard block
 block discarded – undo
1193 1211
         }
1194 1212
 
1195 1213
         return $post_meta_info;
1196
-    else:
1197
-        return false;
1214
+    else {
1215
+    	:
1216
+        return false;
1217
+    }
1198 1218
     endif;
1199 1219
 }
1200 1220
 
@@ -1205,8 +1225,9 @@  discard block
 block discarded – undo
1205 1225
     if (is_admin()) {
1206 1226
         global $post,$gd_session;
1207 1227
 
1208
-        if (isset($_REQUEST['post']))
1209
-            $_REQUEST['pid'] = $_REQUEST['post'];
1228
+        if (isset($_REQUEST['post'])) {
1229
+                    $_REQUEST['pid'] = $_REQUEST['post'];
1230
+        }
1210 1231
     }
1211 1232
 
1212 1233
     if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
@@ -1259,8 +1280,9 @@  discard block
 block discarded – undo
1259 1280
         if (is_admin()) {
1260 1281
             global $post;
1261 1282
 
1262
-            if (isset($_REQUEST['post']))
1263
-                $_REQUEST['pid'] = $_REQUEST['post'];
1283
+            if (isset($_REQUEST['post'])) {
1284
+                            $_REQUEST['pid'] = $_REQUEST['post'];
1285
+            }
1264 1286
         }
1265 1287
 
1266 1288
         
@@ -1352,7 +1374,7 @@  discard block
 block discarded – undo
1352 1374
         $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353 1375
     } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354 1376
         $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
-    }else{
1377
+    } else{
1356 1378
         $field_icon = $cf['field_icon'];
1357 1379
     }
1358 1380
 
@@ -1425,8 +1447,9 @@  discard block
 block discarded – undo
1425 1447
                     $variables_array['post_id'] = $post->ID;
1426 1448
                     $variables_array['label'] = __($type['site_title'], 'geodirectory');
1427 1449
                     $variables_array['value'] = '';
1428
-                    if (isset($post->{$type['htmlvar_name']}))
1429
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1450
+                    if (isset($post->{$type['htmlvar_name']})) {
1451
+                                            $variables_array['value'] = $post->{$type['htmlvar_name']};
1452
+                    }
1430 1453
                 endif;
1431 1454
 
1432 1455
 
@@ -1448,7 +1471,9 @@  discard block
 block discarded – undo
1448 1471
                      * @param string $html Custom field unfiltered HTML.
1449 1472
                      * @param array $variables_array Custom field variables array.
1450 1473
                      */
1451
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1474
+                    if ($html) {
1475
+                    	echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1476
+                    }
1452 1477
 
1453 1478
                     /**
1454 1479
                      * Called after a custom fields is output on the frontend.
@@ -1482,10 +1507,11 @@  discard block
 block discarded – undo
1482 1507
      */
1483 1508
     function geodir_default_date_format()
1484 1509
     {
1485
-        if ($format = get_option('date_format'))
1486
-            return $format;
1487
-        else
1488
-            return 'dd-mm-yy';
1510
+        if ($format = get_option('date_format')) {
1511
+                    return $format;
1512
+        } else {
1513
+                    return 'dd-mm-yy';
1514
+        }
1489 1515
     }
1490 1516
 }
1491 1517
 
@@ -1592,11 +1618,13 @@  discard block
 block discarded – undo
1592 1618
                     // Set an array containing a list of acceptable formats
1593 1619
                     //$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');
1594 1620
 
1595
-                    if (!function_exists('wp_handle_upload'))
1596
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1621
+                    if (!function_exists('wp_handle_upload')) {
1622
+                                            require_once(ABSPATH . 'wp-admin/includes/file.php');
1623
+                    }
1597 1624
 
1598
-                    if (!is_dir($geodir_uploadpath))
1599
-                        mkdir($geodir_uploadpath);
1625
+                    if (!is_dir($geodir_uploadpath)) {
1626
+                                            mkdir($geodir_uploadpath);
1627
+                    }
1600 1628
 
1601 1629
                     $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1602 1630
                     $explode_sub_dir = explode("/", $sub_dir);
@@ -1609,16 +1637,19 @@  discard block
 block discarded – undo
1609 1637
                     }
1610 1638
 
1611 1639
                     $uploaded_file = '';
1612
-                    if (file_exists($img_path))
1613
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1640
+                    if (file_exists($img_path)) {
1641
+                                            $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1642
+                    }
1614 1643
 
1615 1644
                     if ($curr_img_dir != $geodir_uploaddir) {
1616
-                        if (file_exists($img_path))
1617
-                            unlink($img_path);
1645
+                        if (file_exists($img_path)) {
1646
+                                                    unlink($img_path);
1647
+                        }
1618 1648
                     }
1619 1649
 
1620
-                    if (!empty($uploaded_file))
1621
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1650
+                    if (!empty($uploaded_file)) {
1651
+                                            $file_urls = $geodir_uploadurl . '/' . $new_name;
1652
+                    }
1622 1653
 
1623 1654
                 } else {
1624 1655
                     $file_urls = $post_image[$m];
@@ -1639,8 +1670,9 @@  discard block
 block discarded – undo
1639 1670
 
1640 1671
         geodir_save_post_meta($post_id, $field_id, $file_urls);
1641 1672
 
1642
-        if (!empty($invalid_files))
1643
-            geodir_remove_attachments($invalid_files);
1673
+        if (!empty($invalid_files)) {
1674
+                    geodir_remove_attachments($invalid_files);
1675
+        }
1644 1676
 
1645 1677
     }
1646 1678
 }
@@ -1866,8 +1898,9 @@  discard block
 block discarded – undo
1866 1898
 
1867 1899
         $all_postypes = geodir_get_posttypes();
1868 1900
 
1869
-        if (!in_array($post_type, $all_postypes))
1870
-            return false;
1901
+        if (!in_array($post_type, $all_postypes)) {
1902
+                    return false;
1903
+        }
1871 1904
 
1872 1905
         $fields = array();
1873 1906
 
@@ -1965,8 +1998,10 @@  discard block
 block discarded – undo
1965 1998
         }
1966 1999
 
1967 2000
         return $field_ids;
1968
-    else:
1969
-        return false;
2001
+    else {
2002
+    	:
2003
+        return false;
2004
+    }
1970 2005
     endif;
1971 2006
 }
1972 2007
 
@@ -2139,8 +2174,9 @@  discard block
 block discarded – undo
2139 2174
 
2140 2175
             return $field_id;
2141 2176
 
2142
-        } else
2143
-            return 0;
2177
+        } else {
2178
+                    return 0;
2179
+        }
2144 2180
 
2145 2181
     }
2146 2182
 }
@@ -2181,8 +2217,9 @@  discard block
 block discarded – undo
2181 2217
         $htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2182 2218
 
2183 2219
         $site_title = '';
2184
-        if ($site_title == '')
2185
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2220
+        if ($site_title == '') {
2221
+                    $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2222
+        }
2186 2223
 
2187 2224
         if ($site_title == '') {
2188 2225
             $fields = geodir_get_custom_sort_options($post_type);
@@ -2196,8 +2233,9 @@  discard block
 block discarded – undo
2196 2233
             }
2197 2234
         }
2198 2235
 
2199
-        if ($htmlvar_name == '')
2200
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2236
+        if ($htmlvar_name == '') {
2237
+                    $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2238
+        }
2201 2239
 
2202 2240
         $nonce = wp_create_nonce('custom_fields_' . $result_str);
2203 2241
 
@@ -2210,7 +2248,7 @@  discard block
 block discarded – undo
2210 2248
 
2211 2249
                 if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2212 2250
                     $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2213
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2251
+                } elseif(isset($cso['field_icon']) && $cso['field_icon']){
2214 2252
                     $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2215 2253
                 }
2216 2254
 
@@ -2735,11 +2773,13 @@  discard block
 block discarded – undo
2735 2773
 
2736 2774
             <?php
2737 2775
             $selected = '';
2738
-            if (isset($field_info->extra_fields))
2739
-                $advanced_editor = unserialize($field_info->extra_fields);
2776
+            if (isset($field_info->extra_fields)) {
2777
+                            $advanced_editor = unserialize($field_info->extra_fields);
2778
+            }
2740 2779
 
2741
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2742
-                $selected = 'checked="checked"';
2780
+            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) {
2781
+                            $selected = 'checked="checked"';
2782
+            }
2743 2783
             ?>
2744 2784
 
2745 2785
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
@@ -2761,7 +2801,7 @@  discard block
 block discarded – undo
2761 2801
     $value = '';
2762 2802
     if (isset($field_info->validation_pattern)) {
2763 2803
         $value = esc_attr($field_info->validation_pattern);
2764
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2804
+    } elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2765 2805
         $value = esc_attr($cf['defaults']['validation_pattern']);
2766 2806
     }
2767 2807
     ?>
@@ -2781,7 +2821,7 @@  discard block
 block discarded – undo
2781 2821
     $value = '';
2782 2822
     if (isset($field_info->validation_msg)) {
2783 2823
         $value = esc_attr($field_info->validation_msg);
2784
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2824
+    } elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2785 2825
         $value = esc_attr($cf['defaults']['validation_msg']);
2786 2826
     }
2787 2827
     ?>
@@ -2811,8 +2851,9 @@  discard block
 block discarded – undo
2811 2851
 
2812 2852
     if (!isset($field_info->post_type)) {
2813 2853
         $post_type = sanitize_text_field($_REQUEST['listing_type']);
2814
-    } else
2815
-        $post_type = $field_info->post_type;
2854
+    } else {
2855
+            $post_type = $field_info->post_type;
2856
+    }
2816 2857
     ?>
2817 2858
     <li style="display: none;">
2818 2859
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
@@ -3086,7 +3127,7 @@  discard block
 block discarded – undo
3086 3127
     $value = '';
3087 3128
     if (isset($field_info->option_values)) {
3088 3129
         $value = esc_attr($field_info->option_values);
3089
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3130
+    } elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3090 3131
         $value = esc_attr($cf['defaults']['option_values']);
3091 3132
     }
3092 3133
 
Please login to merge, or discard this patch.
geodirectory-functions/ajax_handler_functions.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function geodir_on_wp()
46 46
 {
47
-    if(geodir_is_page('login')) {
47
+    if (geodir_is_page('login')) {
48 48
         geodir_user_signup();
49 49
     }
50 50
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
          * @since 1.0.0
83 83
          * @package GeoDirectory
84 84
          */
85
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
85
+        include_once(geodir_plugin_path().'/geodirectory-functions/map-functions/get_markers.php');
86 86
         die;
87 87
     }
88 88
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
              * @since 1.0.0
141 141
              * @package GeoDirectory
142 142
              */
143
-            include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
143
+            include_once(geodir_plugin_path().'/geodirectory-admin/geodir_admin_ajax.php');
144 144
         } else {
145 145
             wp_redirect(geodir_login_url());
146 146
             gd_die();
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                          *
163 163
                          * @since 1.0.0
164 164
                          */
165
-                        do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
165
+                        do_action('geodir_delete_dummy_posts_'.$_REQUEST['posttype']);
166 166
                     break;
167 167
                 case "geodir_dummy_insert" :
168 168
                     if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
                          *
184 184
                          * @since 1.0.0
185 185
                          */
186
-                        do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
186
+                        do_action('geodir_insert_dummy_posts_'.$_REQUEST['posttype']);
187 187
 
188 188
                     break;
189 189
             endswitch;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') {
199 199
             $template = locate_template(array("geodirectory/popup-forms.php"));
200 200
             if (!$template) {
201
-                $template = geodir_plugin_path() . '/geodirectory-templates/popup-forms.php';
201
+                $template = geodir_plugin_path().'/geodirectory-templates/popup-forms.php';
202 202
             }
203 203
             require_once($template);
204 204
         }
@@ -217,17 +217,17 @@  discard block
 block discarded – undo
217 217
          * @since 1.0.0
218 218
          * @package GeoDirectory
219 219
          */
220
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
220
+        include_once(geodir_plugin_path().'/geodirectory-functions/map-functions/get_markers.php');
221 221
     }
222 222
 
223 223
     if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
224 224
         if (is_user_logged_in()) {
225 225
             switch ($_REQUEST['ajax_action']):
226 226
                 case "add" :
227
-                    geodir_add_to_favorite((int)$_REQUEST['pid']);
227
+                    geodir_add_to_favorite((int) $_REQUEST['pid']);
228 228
                     break;
229 229
                 case "remove" :
230
-                    geodir_remove_from_favorite((int)$_REQUEST['pid']);
230
+                    geodir_remove_from_favorite((int) $_REQUEST['pid']);
231 231
                     break;
232 232
             endswitch;
233 233
         } else {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
         $is_current_user_owner = true;
242 242
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
243
-            $is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
243
+            $is_current_user_owner = geodir_listing_belong_to_current_user((int) $_REQUEST['pid']);
244 244
         }
245 245
 
246 246
         $request = $gd_session->get('listing');
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
          * @since 1.0.0
352 352
          * @package GeoDirectory
353 353
          */
354
-        include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
354
+        include_once(geodir_plugin_path().'/geodirectory-functions/geodirectory_reg.php');
355 355
     }
356 356
 
357 357
 
Please login to merge, or discard this patch.
Braces   +31 added lines, -23 removed lines patch added patch discarded remove patch
@@ -126,10 +126,11 @@  discard block
 block discarded – undo
126 126
     }
127 127
 
128 128
     if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
129
-        if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
130
-            geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
131
-        else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
132
-            geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
129
+        if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude'])) {
130
+                    geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
131
+        } else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax'])) {
132
+                    geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
133
+        }
133 134
     }
134 135
 
135 136
     if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
@@ -151,22 +152,25 @@  discard block
 block discarded – undo
151 152
         if (current_user_can('manage_options')) {
152 153
             switch ($_REQUEST['geodir_autofill']):
153 154
                 case "geodir_dummy_delete" :
154
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename'))
155
-                        return;
155
+                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename')) {
156
+                                            return;
157
+                    }
156 158
 
157
-                    if (isset($_REQUEST['posttype']))
158
-                        /**
159
+                    if (isset($_REQUEST['posttype'])) {
160
+                                            /**
159 161
                          * Used to delete the dummy post data per post type.
160 162
                          *
161 163
                          * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
162 164
                          *
163 165
                          * @since 1.0.0
164 166
                          */
165
-                        do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
167
+                        do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
168
+                    }
166 169
                     break;
167 170
                 case "geodir_dummy_insert" :
168
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
169
-                        return;
171
+                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename')) {
172
+                                            return;
173
+                    }
170 174
 
171 175
                     global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
172 176
                     $dummy_post_index = $_REQUEST['insert_dummy_post_index'];
@@ -175,15 +179,16 @@  discard block
 block discarded – undo
175 179
                     $city_bound_lat2 = $_REQUEST['city_bound_lat2'];
176 180
                     $city_bound_lng2 = $_REQUEST['city_bound_lng2'];
177 181
 
178
-                    if (isset($_REQUEST['posttype']))
179
-                        /**
182
+                    if (isset($_REQUEST['posttype'])) {
183
+                                            /**
180 184
                          * Used to insert the dummy post data per post type.
181 185
                          *
182 186
                          * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
183 187
                          *
184 188
                          * @since 1.0.0
185 189
                          */
186
-                        do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
190
+                        do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
191
+                    }
187 192
 
188 193
                     break;
189 194
             endswitch;
@@ -261,8 +266,9 @@  discard block
 block discarded – undo
261 266
                         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
262 267
                             $redirect_to = get_permalink(geodir_add_listing_page_id());
263 268
                             $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
264
-                        } else
265
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
269
+                        } else {
270
+                                                    $redirect_to = get_permalink(geodir_add_listing_page_id());
271
+                        }
266 272
 
267 273
                         wp_redirect($redirect_to);
268 274
                     } else {
@@ -275,9 +281,9 @@  discard block
 block discarded – undo
275 281
 
276 282
                     $gd_session->un_set('listing');
277 283
 
278
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
279
-                        wp_redirect(get_permalink($_REQUEST['pid']));
280
-                    else {
284
+                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid'])) {
285
+                                            wp_redirect(get_permalink($_REQUEST['pid']));
286
+                    } else {
281 287
                         geodir_remove_temp_images();
282 288
                         wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
283 289
                     }
@@ -305,8 +311,9 @@  discard block
 block discarded – undo
305 311
                             } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
306 312
                                 $redirect_to = get_permalink(geodir_add_listing_page_id());
307 313
                                 $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
308
-                            } else
309
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
314
+                            } else {
315
+                                                            $redirect_to = get_permalink(geodir_add_listing_page_id());
316
+                            }
310 317
 
311 318
                             $gd_session->un_set('listing');
312 319
                             wp_redirect($redirect_to);
@@ -327,8 +334,9 @@  discard block
 block discarded – undo
327 334
                             $lastid = wp_delete_post($_REQUEST['pid']);
328 335
                         }
329 336
 
330
-                        if ($lastid && !is_wp_error($lastid))
331
-                            wp_redirect($_SERVER['HTTP_REFERER']);
337
+                        if ($lastid && !is_wp_error($lastid)) {
338
+                                                    wp_redirect($_SERVER['HTTP_REFERER']);
339
+                        }
332 340
 
333 341
                         //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
334 342
                     }
Please login to merge, or discard this patch.
Indentation   +308 added lines, -308 removed lines patch added patch discarded remove patch
@@ -16,22 +16,22 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_on_wp_loaded()
18 18
 {
19
-    /**
20
-     * Called on the wp_loaded WP hook and used to send the send inquiry and send to friend forms.
21
-     *
22
-     * @since 1.0.0
23
-     */
24
-    do_action('giodir_handle_request_plugins_loaded');
25
-    global $wpdb;
19
+	/**
20
+	 * Called on the wp_loaded WP hook and used to send the send inquiry and send to friend forms.
21
+	 *
22
+	 * @since 1.0.0
23
+	 */
24
+	do_action('giodir_handle_request_plugins_loaded');
25
+	global $wpdb;
26 26
 
27 27
 
28
-    if (isset($_POST['sendact']) && $_POST['sendact'] == 'send_inqury') {
29
-        geodir_send_inquiry($_REQUEST); // function in custom_functions.php
28
+	if (isset($_POST['sendact']) && $_POST['sendact'] == 'send_inqury') {
29
+		geodir_send_inquiry($_REQUEST); // function in custom_functions.php
30 30
 
31
-    } elseif (isset($_POST['sendact']) && $_POST['sendact'] == 'email_frnd') {
32
-        geodir_send_friend($_REQUEST); // function in custom_functions.php
31
+	} elseif (isset($_POST['sendact']) && $_POST['sendact'] == 'email_frnd') {
32
+		geodir_send_friend($_REQUEST); // function in custom_functions.php
33 33
 
34
-    }
34
+	}
35 35
 
36 36
 }
37 37
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function geodir_on_wp()
46 46
 {
47
-    if(geodir_is_page('login')) {
48
-        geodir_user_signup();
49
-    }
47
+	if(geodir_is_page('login')) {
48
+		geodir_user_signup();
49
+	}
50 50
 
51 51
 }
52 52
 
@@ -59,47 +59,47 @@  discard block
 block discarded – undo
59 59
  */
60 60
 function geodir_on_init()
61 61
 {
62
-    /**
63
-     * Called on the wp_init WP hook at the start of the geodir_on_init() function.
64
-     *
65
-     * @since 1.0.0
66
-     */
67
-    do_action('giodir_handle_request');
68
-    global $wpdb;
69
-
70
-
71
-
72
-
73
-    if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && !current_user_can('manage_options') && !class_exists('BuddyPress')) {
74
-        show_admin_bar(false);
75
-    }
76
-
77
-
78
-    if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'get_markers') {
79
-        /**
80
-         * Contains map marker functions.
81
-         *
82
-         * @since 1.0.0
83
-         * @package GeoDirectory
84
-         */
85
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
86
-        die;
87
-    }
88
-
89
-    if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'ga') {
90
-        if (isset($_REQUEST['ga_start'])) {
91
-            $ga_start = $_REQUEST['ga_start'];
92
-        } else {
93
-            $ga_start = '';
94
-        }
95
-        if (isset($_REQUEST['ga_end'])) {
96
-            $ga_end = $_REQUEST['ga_end'];
97
-        } else {
98
-            $ga_end = '';
99
-        }
100
-        geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end);
101
-        die;
102
-    }
62
+	/**
63
+	 * Called on the wp_init WP hook at the start of the geodir_on_init() function.
64
+	 *
65
+	 * @since 1.0.0
66
+	 */
67
+	do_action('giodir_handle_request');
68
+	global $wpdb;
69
+
70
+
71
+
72
+
73
+	if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && !current_user_can('manage_options') && !class_exists('BuddyPress')) {
74
+		show_admin_bar(false);
75
+	}
76
+
77
+
78
+	if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'get_markers') {
79
+		/**
80
+		 * Contains map marker functions.
81
+		 *
82
+		 * @since 1.0.0
83
+		 * @package GeoDirectory
84
+		 */
85
+		include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
86
+		die;
87
+	}
88
+
89
+	if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'ga') {
90
+		if (isset($_REQUEST['ga_start'])) {
91
+			$ga_start = $_REQUEST['ga_start'];
92
+		} else {
93
+			$ga_start = '';
94
+		}
95
+		if (isset($_REQUEST['ga_end'])) {
96
+			$ga_end = $_REQUEST['ga_end'];
97
+		} else {
98
+			$ga_end = '';
99
+		}
100
+		geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end);
101
+		die;
102
+	}
103 103
 
104 104
 
105 105
 }
@@ -118,265 +118,265 @@  discard block
 block discarded – undo
118 118
  * @todo check if nonce is required here and if so add one.
119 119
  */
120 120
 function geodir_ajax_handler() {
121
-    global $wpdb, $gd_session;
121
+	global $wpdb, $gd_session;
122 122
 
123
-    if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') {
123
+	if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') {
124 124
 		$gd_session->set('gd_listing_view', $_REQUEST['gd_listing_view']);
125
-        echo '1';
126
-    }
127
-
128
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
129
-        if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
130
-            geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
131
-        else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
132
-            geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
133
-    }
134
-
135
-    if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
136
-        if (current_user_can('manage_options')) {
137
-            /**
138
-             * Contains admin ajax handling functions.
139
-             *
140
-             * @since 1.0.0
141
-             * @package GeoDirectory
142
-             */
143
-            include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
144
-        } else {
145
-            wp_redirect(geodir_login_url());
146
-            gd_die();
147
-        }
148
-    }
149
-
150
-    if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) {
151
-        if (current_user_can('manage_options')) {
152
-            switch ($_REQUEST['geodir_autofill']):
153
-                case "geodir_dummy_delete" :
154
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename'))
155
-                        return;
156
-
157
-                    if (isset($_REQUEST['posttype']))
158
-                        /**
159
-                         * Used to delete the dummy post data per post type.
160
-                         *
161
-                         * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
162
-                         *
163
-                         * @since 1.0.0
164
-                         */
165
-                        do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
166
-                    break;
167
-                case "geodir_dummy_insert" :
168
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
169
-                        return;
170
-
171
-                    global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
172
-                    $dummy_post_index = $_REQUEST['insert_dummy_post_index'];
173
-                    $city_bound_lat1 = $_REQUEST['city_bound_lat1'];
174
-                    $city_bound_lng1 = $_REQUEST['city_bound_lng1'];
175
-                    $city_bound_lat2 = $_REQUEST['city_bound_lat2'];
176
-                    $city_bound_lng2 = $_REQUEST['city_bound_lng2'];
177
-
178
-                    if (isset($_REQUEST['posttype']))
179
-                        /**
180
-                         * Used to insert the dummy post data per post type.
181
-                         *
182
-                         * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
183
-                         *
184
-                         * @since 1.0.0
185
-                         */
186
-                        do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
187
-
188
-                    break;
189
-            endswitch;
190
-        } else {
191
-            wp_redirect(geodir_login_url());
192
-            exit();
193
-        }
194
-    }
195
-
196
-    if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') {
197
-
198
-        if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') {
199
-            $template = locate_template(array("geodirectory/popup-forms.php"));
200
-            if (!$template) {
201
-                $template = geodir_plugin_path() . '/geodirectory-templates/popup-forms.php';
202
-            }
203
-            require_once($template);
204
-        }
205
-
206
-        gd_die();
207
-    }
208
-
209
-    /*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){
125
+		echo '1';
126
+	}
127
+
128
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
129
+		if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
130
+			geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
131
+		else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
132
+			geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
133
+	}
134
+
135
+	if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
136
+		if (current_user_can('manage_options')) {
137
+			/**
138
+			 * Contains admin ajax handling functions.
139
+			 *
140
+			 * @since 1.0.0
141
+			 * @package GeoDirectory
142
+			 */
143
+			include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
144
+		} else {
145
+			wp_redirect(geodir_login_url());
146
+			gd_die();
147
+		}
148
+	}
149
+
150
+	if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) {
151
+		if (current_user_can('manage_options')) {
152
+			switch ($_REQUEST['geodir_autofill']):
153
+				case "geodir_dummy_delete" :
154
+					if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename'))
155
+						return;
156
+
157
+					if (isset($_REQUEST['posttype']))
158
+						/**
159
+						 * Used to delete the dummy post data per post type.
160
+						 *
161
+						 * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
162
+						 *
163
+						 * @since 1.0.0
164
+						 */
165
+						do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
166
+					break;
167
+				case "geodir_dummy_insert" :
168
+					if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
169
+						return;
170
+
171
+					global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
172
+					$dummy_post_index = $_REQUEST['insert_dummy_post_index'];
173
+					$city_bound_lat1 = $_REQUEST['city_bound_lat1'];
174
+					$city_bound_lng1 = $_REQUEST['city_bound_lng1'];
175
+					$city_bound_lat2 = $_REQUEST['city_bound_lat2'];
176
+					$city_bound_lng2 = $_REQUEST['city_bound_lng2'];
177
+
178
+					if (isset($_REQUEST['posttype']))
179
+						/**
180
+						 * Used to insert the dummy post data per post type.
181
+						 *
182
+						 * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
183
+						 *
184
+						 * @since 1.0.0
185
+						 */
186
+						do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
187
+
188
+					break;
189
+			endswitch;
190
+		} else {
191
+			wp_redirect(geodir_login_url());
192
+			exit();
193
+		}
194
+	}
195
+
196
+	if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') {
197
+
198
+		if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') {
199
+			$template = locate_template(array("geodirectory/popup-forms.php"));
200
+			if (!$template) {
201
+				$template = geodir_plugin_path() . '/geodirectory-templates/popup-forms.php';
202
+			}
203
+			require_once($template);
204
+		}
205
+
206
+		gd_die();
207
+	}
208
+
209
+	/*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){
210 210
         include_once ( geodir_plugin_path() . '/geodirectory-templates/advance-search-form.php');
211 211
     }*/
212 212
 
213
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') {
214
-        /**
215
-         * Contains map marker functions.
216
-         *
217
-         * @since 1.0.0
218
-         * @package GeoDirectory
219
-         */
220
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
221
-    }
222
-
223
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
224
-        if (is_user_logged_in()) {
225
-            switch ($_REQUEST['ajax_action']):
226
-                case "add" :
227
-                    geodir_add_to_favorite((int)$_REQUEST['pid']);
228
-                    break;
229
-                case "remove" :
230
-                    geodir_remove_from_favorite((int)$_REQUEST['pid']);
231
-                    break;
232
-            endswitch;
233
-        } else {
234
-            wp_redirect(geodir_login_url());
235
-            exit();
236
-        }
237
-    }
238
-
239
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') {
240
-
241
-        $is_current_user_owner = true;
242
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
243
-            $is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
244
-        }
245
-
246
-        $request = $gd_session->get('listing');
247
-
248
-        if (is_user_logged_in() && $is_current_user_owner) {
249
-
250
-            switch ($_REQUEST['ajax_action']):
251
-                case "add":
252
-                case "update":
253
-
254
-                    if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
255
-                        $last_id = geodir_save_listing();
256
-
257
-                        if ($last_id) {
258
-                            //$redirect_to = get_permalink( $last_id );
259
-                            $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
260
-
261
-                        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
262
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
263
-                            $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
264
-                        } else
265
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
266
-
267
-                        wp_redirect($redirect_to);
268
-                    } else {
269
-                        $gd_session->un_set('listing');
270
-                        wp_redirect(home_url());
271
-                    }
272
-
273
-                    break;
274
-                case "cancel" :
275
-
276
-                    $gd_session->un_set('listing');
277
-
278
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
279
-                        wp_redirect(get_permalink($_REQUEST['pid']));
280
-                    else {
281
-                        geodir_remove_temp_images();
282
-                        wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
283
-                    }
284
-
285
-                    break;
286
-
287
-                case "publish" :
288
-
289
-                    if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
290
-
291
-                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
292
-                            $new_post = array();
293
-                            $new_post['ID'] = $_REQUEST['pid'];
294
-
295
-                            $lastid = wp_update_post($new_post);
296
-
297
-                            $gd_session->un_set('listing');
298
-                            wp_redirect(get_permalink($lastid));
299
-                        } else {
300
-                            $last_id = geodir_save_listing();
301
-
302
-                            if ($last_id) {
303
-                                //$redirect_to = get_permalink( $last_id );
304
-                                $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
305
-                            } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
306
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
307
-                                $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
308
-                            } else
309
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
310
-
311
-                            $gd_session->un_set('listing');
312
-                            wp_redirect($redirect_to);
313
-                        }
314
-                    } else {
315
-                        $gd_session->un_set('listing');
316
-                        wp_redirect(home_url());
317
-                    }
318
-
319
-                    break;
320
-                case "delete" :
321
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
322
-                        global $current_user;
323
-
324
-                        if (get_option('geodir_disable_perm_delete')) {
325
-                            $lastid = wp_trash_post($_REQUEST['pid']);
326
-                        } else {
327
-                            $lastid = wp_delete_post($_REQUEST['pid']);
328
-                        }
329
-
330
-                        if ($lastid && !is_wp_error($lastid))
331
-                            wp_redirect($_SERVER['HTTP_REFERER']);
332
-
333
-                        //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
334
-                    }
335
-                    break;
336
-            endswitch;
337
-
338
-            $gd_session->un_set('listing');
339
-        } else {
340
-            $gd_session->un_set('listing');
341
-            wp_redirect(geodir_login_url());
342
-            exit();
343
-        }
344
-    }
345
-
346
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') {
347
-        /**
348
-         * Contains registration and login functions.
349
-         * @todo Fix the file path.
350
-         *
351
-         * @since 1.0.0
352
-         * @package GeoDirectory
353
-         */
354
-        include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
355
-    }
356
-
357
-    if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') {
358
-        $args = array('taxonomy' => sanitize_text_field($_REQUEST['term']));
359
-        if (!empty($_REQUEST['parent_only'])) {
360
-            $args['parent'] = 0;
361
-        }
362
-        $terms_o = get_terms($args);
213
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') {
214
+		/**
215
+		 * Contains map marker functions.
216
+		 *
217
+		 * @since 1.0.0
218
+		 * @package GeoDirectory
219
+		 */
220
+		include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
221
+	}
222
+
223
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
224
+		if (is_user_logged_in()) {
225
+			switch ($_REQUEST['ajax_action']):
226
+				case "add" :
227
+					geodir_add_to_favorite((int)$_REQUEST['pid']);
228
+					break;
229
+				case "remove" :
230
+					geodir_remove_from_favorite((int)$_REQUEST['pid']);
231
+					break;
232
+			endswitch;
233
+		} else {
234
+			wp_redirect(geodir_login_url());
235
+			exit();
236
+		}
237
+	}
238
+
239
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') {
240
+
241
+		$is_current_user_owner = true;
242
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
243
+			$is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
244
+		}
245
+
246
+		$request = $gd_session->get('listing');
247
+
248
+		if (is_user_logged_in() && $is_current_user_owner) {
249
+
250
+			switch ($_REQUEST['ajax_action']):
251
+				case "add":
252
+				case "update":
253
+
254
+					if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
255
+						$last_id = geodir_save_listing();
256
+
257
+						if ($last_id) {
258
+							//$redirect_to = get_permalink( $last_id );
259
+							$redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
260
+
261
+						} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
262
+							$redirect_to = get_permalink(geodir_add_listing_page_id());
263
+							$redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
264
+						} else
265
+							$redirect_to = get_permalink(geodir_add_listing_page_id());
266
+
267
+						wp_redirect($redirect_to);
268
+					} else {
269
+						$gd_session->un_set('listing');
270
+						wp_redirect(home_url());
271
+					}
272
+
273
+					break;
274
+				case "cancel" :
275
+
276
+					$gd_session->un_set('listing');
277
+
278
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
279
+						wp_redirect(get_permalink($_REQUEST['pid']));
280
+					else {
281
+						geodir_remove_temp_images();
282
+						wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
283
+					}
284
+
285
+					break;
286
+
287
+				case "publish" :
288
+
289
+					if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
290
+
291
+						if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
292
+							$new_post = array();
293
+							$new_post['ID'] = $_REQUEST['pid'];
294
+
295
+							$lastid = wp_update_post($new_post);
296
+
297
+							$gd_session->un_set('listing');
298
+							wp_redirect(get_permalink($lastid));
299
+						} else {
300
+							$last_id = geodir_save_listing();
301
+
302
+							if ($last_id) {
303
+								//$redirect_to = get_permalink( $last_id );
304
+								$redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
305
+							} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
306
+								$redirect_to = get_permalink(geodir_add_listing_page_id());
307
+								$redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
308
+							} else
309
+								$redirect_to = get_permalink(geodir_add_listing_page_id());
310
+
311
+							$gd_session->un_set('listing');
312
+							wp_redirect($redirect_to);
313
+						}
314
+					} else {
315
+						$gd_session->un_set('listing');
316
+						wp_redirect(home_url());
317
+					}
318
+
319
+					break;
320
+				case "delete" :
321
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
322
+						global $current_user;
323
+
324
+						if (get_option('geodir_disable_perm_delete')) {
325
+							$lastid = wp_trash_post($_REQUEST['pid']);
326
+						} else {
327
+							$lastid = wp_delete_post($_REQUEST['pid']);
328
+						}
329
+
330
+						if ($lastid && !is_wp_error($lastid))
331
+							wp_redirect($_SERVER['HTTP_REFERER']);
332
+
333
+						//wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
334
+					}
335
+					break;
336
+			endswitch;
337
+
338
+			$gd_session->un_set('listing');
339
+		} else {
340
+			$gd_session->un_set('listing');
341
+			wp_redirect(geodir_login_url());
342
+			exit();
343
+		}
344
+	}
345
+
346
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') {
347
+		/**
348
+		 * Contains registration and login functions.
349
+		 * @todo Fix the file path.
350
+		 *
351
+		 * @since 1.0.0
352
+		 * @package GeoDirectory
353
+		 */
354
+		include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
355
+	}
356
+
357
+	if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') {
358
+		$args = array('taxonomy' => sanitize_text_field($_REQUEST['term']));
359
+		if (!empty($_REQUEST['parent_only'])) {
360
+			$args['parent'] = 0;
361
+		}
362
+		$terms_o = get_terms($args);
363 363
         
364
-        // Skip terms which has no listing
365
-        if (!empty($terms_o)) {
366
-            $filter_terms = array();
364
+		// Skip terms which has no listing
365
+		if (!empty($terms_o)) {
366
+			$filter_terms = array();
367 367
             
368
-            foreach ($terms_o as $term) {
369
-                if (isset($term->count) && $term->count > 0) {
370
-                    $filter_terms[] = $term;
371
-                }
372
-            }
373
-            $terms_o = $filter_terms;
374
-        }
368
+			foreach ($terms_o as $term) {
369
+				if (isset($term->count) && $term->count > 0) {
370
+					$filter_terms[] = $term;
371
+				}
372
+			}
373
+			$terms_o = $filter_terms;
374
+		}
375 375
         
376
-        $terms = geodir_sort_terms($terms_o, 'count');
377
-        geodir_helper_cat_list_output($terms, intval($_REQUEST['limit']));
378
-        exit();
379
-    }
376
+		$terms = geodir_sort_terms($terms_o, 'count');
377
+		geodir_helper_cat_list_output($terms, intval($_REQUEST['limit']));
378
+		exit();
379
+	}
380 380
 
381
-    gd_die();
381
+	gd_die();
382 382
 }
Please login to merge, or discard this patch.
geodirectory-widgets/geodirectory_listing_slider_widget.php 3 patches
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -15,40 +15,40 @@  discard block
 block discarded – undo
15 15
 class geodir_listing_slider_widget extends WP_Widget
16 16
 {
17 17
 
18
-    /**
18
+	/**
19 19
 	 * Register the listing slider widget.
20 20
 	 *
21 21
 	 * @since 1.0.0
22
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
23 23
 	 */
24
-    public function __construct() {
25
-        $widget_ops = array('classname' => 'geodir_listing_slider_view', 'description' => __('GD > Listing Slider', 'geodirectory'));
26
-        parent::__construct(
27
-            'listing_slider_view', // Base ID
28
-            __('GD > Listing Slider', 'geodirectory'), // Name
29
-            $widget_ops// Args
30
-        );
31
-    }
24
+	public function __construct() {
25
+		$widget_ops = array('classname' => 'geodir_listing_slider_view', 'description' => __('GD > Listing Slider', 'geodirectory'));
26
+		parent::__construct(
27
+			'listing_slider_view', // Base ID
28
+			__('GD > Listing Slider', 'geodirectory'), // Name
29
+			$widget_ops// Args
30
+		);
31
+	}
32 32
 	
33 33
 	/**
34 34
 	 * Front-end display content for listing slider widget.
35 35
 	 *
36 36
 	 * @since 1.0.0
37
-     * @since 1.5.1 Declare function public.
37
+	 * @since 1.5.1 Declare function public.
38 38
 	 *
39 39
 	 * @param array $args     Widget arguments.
40 40
 	 * @param array $instance Saved values from database.
41 41
 	 */
42
-    public function widget($args, $instance)
43
-    {
44
-        geodir_listing_slider_widget_output($args, $instance);
45
-    }
42
+	public function widget($args, $instance)
43
+	{
44
+		geodir_listing_slider_widget_output($args, $instance);
45
+	}
46 46
 
47 47
 	/**
48 48
 	 * Sanitize listing slider widget form values as they are saved.
49 49
 	 *
50 50
 	 * @since 1.0.0
51
-     * @since 1.5.1 Declare function public.
51
+	 * @since 1.5.1 Declare function public.
52 52
 	 *
53 53
 	 * @param array $new_instance Values just sent to be saved.
54 54
 	 * @param array $old_instance Previously saved values from database.
@@ -56,101 +56,101 @@  discard block
 block discarded – undo
56 56
 	 * @return array Updated safe values to be saved.
57 57
 	 */
58 58
 	public function update($new_instance, $old_instance)
59
-    {
60
-        //save the widget
61
-        $instance = $old_instance;
62
-        $instance['title'] = strip_tags($new_instance['title']);
63
-        $instance['post_type'] = strip_tags($new_instance['post_type']);
64
-        $instance['category'] = strip_tags($new_instance['category']);
65
-        $instance['post_number'] = strip_tags($new_instance['post_number']);
66
-        $instance['max_show'] = strip_tags($new_instance['max_show']);
67
-        $instance['slide_width'] = strip_tags($new_instance['slide_width']);
68
-        $instance['show_title'] = isset($new_instance['show_title']) ? $new_instance['show_title'] : '';
69
-        $instance['slideshow'] = isset($new_instance['slideshow']) ? $new_instance['slideshow'] : '';
70
-        $instance['animationLoop'] = isset($new_instance['animationLoop']) ? $new_instance['animationLoop'] : '';
71
-        $instance['directionNav'] = isset($new_instance['directionNav']) ? $new_instance['directionNav'] : '';
72
-        $instance['slideshowSpeed'] = $new_instance['slideshowSpeed'];
73
-        $instance['animationSpeed'] = $new_instance['animationSpeed'];
74
-        $instance['animation'] = $new_instance['animation'];
75
-        $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : '';
76
-        $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0;
77
-        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
78
-            $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
79
-        else
80
-            $instance['add_location_filter'] = '0';
81
-
82
-        return $instance;
83
-    }
59
+	{
60
+		//save the widget
61
+		$instance = $old_instance;
62
+		$instance['title'] = strip_tags($new_instance['title']);
63
+		$instance['post_type'] = strip_tags($new_instance['post_type']);
64
+		$instance['category'] = strip_tags($new_instance['category']);
65
+		$instance['post_number'] = strip_tags($new_instance['post_number']);
66
+		$instance['max_show'] = strip_tags($new_instance['max_show']);
67
+		$instance['slide_width'] = strip_tags($new_instance['slide_width']);
68
+		$instance['show_title'] = isset($new_instance['show_title']) ? $new_instance['show_title'] : '';
69
+		$instance['slideshow'] = isset($new_instance['slideshow']) ? $new_instance['slideshow'] : '';
70
+		$instance['animationLoop'] = isset($new_instance['animationLoop']) ? $new_instance['animationLoop'] : '';
71
+		$instance['directionNav'] = isset($new_instance['directionNav']) ? $new_instance['directionNav'] : '';
72
+		$instance['slideshowSpeed'] = $new_instance['slideshowSpeed'];
73
+		$instance['animationSpeed'] = $new_instance['animationSpeed'];
74
+		$instance['animation'] = $new_instance['animation'];
75
+		$instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : '';
76
+		$instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0;
77
+		if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
78
+			$instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
79
+		else
80
+			$instance['add_location_filter'] = '0';
81
+
82
+		return $instance;
83
+	}
84 84
 
85 85
 	/**
86 86
 	 * Back-end listing slider widget settings form.
87 87
 	 *
88 88
 	 * @since 1.0.0
89
-     * @since 1.5.1 Declare function public.
89
+	 * @since 1.5.1 Declare function public.
90 90
 	 *
91 91
 	 * @param array $instance Previously saved values from database.
92 92
 	 */
93 93
 	public function form($instance)
94
-    {
94
+	{
95 95
 
96
-        //widgetform in backend
97
-        $instance = wp_parse_args((array)$instance,
98
-            array('title' => '',
99
-                'post_type' => '',
100
-                'category' => '',
101
-                'post_number' => '5',
102
-                'max_show' => '1',
103
-                'slide_width' => '',
104
-                'show_title' => '',
105
-                'slideshow' => '',
106
-                'animationLoop' => '',
107
-                'directionNav' => '',
108
-                'slideshowSpeed' => 5000,
109
-                'animationSpeed' => 600,
110
-                'animation' => '',
111
-                'list_sort' => 'latest',
112
-                'show_featured_only' => '',
113
-                'add_location_filter' => '0',
114
-            )
115
-        );
96
+		//widgetform in backend
97
+		$instance = wp_parse_args((array)$instance,
98
+			array('title' => '',
99
+				'post_type' => '',
100
+				'category' => '',
101
+				'post_number' => '5',
102
+				'max_show' => '1',
103
+				'slide_width' => '',
104
+				'show_title' => '',
105
+				'slideshow' => '',
106
+				'animationLoop' => '',
107
+				'directionNav' => '',
108
+				'slideshowSpeed' => 5000,
109
+				'animationSpeed' => 600,
110
+				'animation' => '',
111
+				'list_sort' => 'latest',
112
+				'show_featured_only' => '',
113
+				'add_location_filter' => '0',
114
+			)
115
+		);
116 116
 
117
-        $title = strip_tags($instance['title']);
117
+		$title = strip_tags($instance['title']);
118 118
 
119
-        $post_type = strip_tags($instance['post_type']);
119
+		$post_type = strip_tags($instance['post_type']);
120 120
 
121
-        $category = strip_tags($instance['category']);
121
+		$category = strip_tags($instance['category']);
122 122
 
123
-        $post_number = strip_tags($instance['post_number']);
123
+		$post_number = strip_tags($instance['post_number']);
124 124
 
125
-        $max_show = strip_tags($instance['max_show']);
125
+		$max_show = strip_tags($instance['max_show']);
126 126
 
127
-        $slide_width = strip_tags($instance['slide_width']);
127
+		$slide_width = strip_tags($instance['slide_width']);
128 128
 
129
-        $show_title = $instance['show_title'];
129
+		$show_title = $instance['show_title'];
130 130
 
131
-        $slideshow = $instance['slideshow'];
131
+		$slideshow = $instance['slideshow'];
132 132
 
133
-        $animationLoop = $instance['animationLoop'];
133
+		$animationLoop = $instance['animationLoop'];
134 134
 
135
-        $directionNav = $instance['directionNav'];
135
+		$directionNav = $instance['directionNav'];
136 136
 
137
-        $slideshowSpeed = $instance['slideshowSpeed'];
137
+		$slideshowSpeed = $instance['slideshowSpeed'];
138 138
 
139
-        $animationSpeed = $instance['animationSpeed'];
139
+		$animationSpeed = $instance['animationSpeed'];
140 140
 
141
-        $add_location_filter = strip_tags($instance['add_location_filter']);
141
+		$add_location_filter = strip_tags($instance['add_location_filter']);
142 142
 
143
-        $animation = $instance['animation'];
144
-        $list_sort = $instance['list_sort'];
145
-        $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false;
143
+		$animation = $instance['animation'];
144
+		$list_sort = $instance['list_sort'];
145
+		$show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false;
146 146
 
147
-        $sort_fields = array();
148
-        $sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory'));
149
-        $sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory'));
150
-        $sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory'));
151
-        $sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory'));
152
-        $sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory'));
153
-        ?>
147
+		$sort_fields = array();
148
+		$sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory'));
149
+		$sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory'));
150
+		$sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory'));
151
+		$sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory'));
152
+		$sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory'));
153
+		?>
154 154
 
155 155
         <p>
156 156
             <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
                     <?php foreach ($postypes as $postypes_obj) { ?>
175 175
 
176 176
                         <option <?php if ($post_type == $postypes_obj) {
177
-                            echo 'selected="selected"';
178
-                        } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
179
-                            echo ucfirst($extvalue[1]); ?></option>
177
+							echo 'selected="selected"';
178
+						} ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
179
+							echo ucfirst($extvalue[1]); ?></option>
180 180
 
181 181
                     <?php } ?>
182 182
 
@@ -190,20 +190,20 @@  discard block
 block discarded – undo
190 190
                 for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?>
191 191
 
192 192
                 <?php
193
-                $category_taxonomy = geodir_get_taxonomies('gd_place');
194
-                $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
195
-                ?>
193
+				$category_taxonomy = geodir_get_taxonomies('gd_place');
194
+				$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
195
+				?>
196 196
 
197 197
                 <select class="widefat" id="<?php echo $this->get_field_id('category'); ?>"
198 198
                         name="<?php echo $this->get_field_name('category'); ?>">
199 199
                     <option <?php if ($category == '0') {
200
-                        echo 'selected="selected"';
201
-                    } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
200
+						echo 'selected="selected"';
201
+					} ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
202 202
                     <?php foreach ($categories as $category_obj) { ?>
203 203
 
204 204
                         <option <?php if ($category == $category_obj->term_id) {
205
-                            echo 'selected="selected"';
206
-                        } ?>
205
+							echo 'selected="selected"';
206
+						} ?>
207 207
                             value="<?php echo $category_obj->term_id; ?>"><?php echo ucfirst($category_obj->name); ?></option>
208 208
 
209 209
                     <?php } ?>
@@ -256,12 +256,12 @@  discard block
 block discarded – undo
256 256
                 <select class="widefat" id="<?php echo $this->get_field_id('animation'); ?>"
257 257
                         name="<?php echo $this->get_field_name('animation'); ?>">
258 258
                     <option <?php if ($animation == 'slide') {
259
-                        echo 'selected="selected"';
260
-                    } ?> value="slide">Slide
259
+						echo 'selected="selected"';
260
+					} ?> value="slide">Slide
261 261
                     </option>
262 262
                     <option <?php if ($animation == 'fade') {
263
-                        echo 'selected="selected"';
264
-                    } ?> value="fade">Fade
263
+						echo 'selected="selected"';
264
+					} ?> value="fade">Fade
265 265
                     </option>
266 266
                 </select>
267 267
             </label>
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
                 for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory');?>
293 293
 
294 294
                 <input type="checkbox" <?php if ($slideshow) {
295
-                    echo 'checked="checked"';
296
-                } ?> id="<?php echo $this->get_field_id('slideshow'); ?>" value="1"
295
+					echo 'checked="checked"';
296
+				} ?> id="<?php echo $this->get_field_id('slideshow'); ?>" value="1"
297 297
                        name="<?php echo $this->get_field_name('slideshow'); ?>"/>
298 298
 
299 299
             </label>
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
                 for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory');?>
305 305
 
306 306
                 <input type="checkbox" <?php if ($animationLoop) {
307
-                    echo 'checked="checked"';
308
-                } ?> id="<?php echo $this->get_field_id('animationLoop'); ?>" value="1"
307
+					echo 'checked="checked"';
308
+				} ?> id="<?php echo $this->get_field_id('animationLoop'); ?>" value="1"
309 309
                        name="<?php echo $this->get_field_name('animationLoop'); ?>"/>
310 310
 
311 311
             </label>
@@ -316,8 +316,8 @@  discard block
 block discarded – undo
316 316
                 for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory');?>
317 317
 
318 318
                 <input type="checkbox" <?php if ($directionNav) {
319
-                    echo 'checked="checked"';
320
-                } ?> id="<?php echo $this->get_field_id('directionNav'); ?>" value="1"
319
+					echo 'checked="checked"';
320
+				} ?> id="<?php echo $this->get_field_id('directionNav'); ?>" value="1"
321 321
                        name="<?php echo $this->get_field_name('directionNav'); ?>"/>
322 322
 
323 323
             </label>
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
                 for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory');?>
330 330
 
331 331
                 <input type="checkbox" <?php if ($show_title) {
332
-                    echo 'checked="checked"';
333
-                } ?> id="<?php echo $this->get_field_id('show_title'); ?>" value="1"
332
+					echo 'checked="checked"';
333
+				} ?> id="<?php echo $this->get_field_id('show_title'); ?>" value="1"
334 334
                        name="<?php echo $this->get_field_name('show_title'); ?>"/>
335 335
 
336 336
             </label>
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 
379 379
 
380 380
     <?php
381
-    }
381
+	}
382 382
 } // class geodir_listing_slider_widget
383 383
 
384 384
 register_widget('geodir_listing_slider_widget');
385 385
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
 
96 96
         //widgetform in backend
97
-        $instance = wp_parse_args((array)$instance,
97
+        $instance = wp_parse_args((array) $instance,
98 98
             array('title' => '',
99 99
                 'post_type' => '',
100 100
                 'category' => '',
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         ?>
154 154
 
155 155
         <p>
156
-            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
156
+            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
157 157
 
158 158
                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
159 159
                        name="<?php echo $this->get_field_name('title'); ?>" type="text"
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
         <p>
165 165
             <label
166
-                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?>
166
+                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?>
167 167
 
168 168
                 <?php $postypes = geodir_get_posttypes(); ?>
169 169
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
         <p>
189 189
             <label
190
-                for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?>
190
+                for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?>
191 191
 
192 192
                 <?php
193 193
                 $category_taxonomy = geodir_get_taxonomies('gd_place');
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         </p>
225 225
         <p>
226 226
             <label
227
-                for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts(total):', 'geodirectory');?>
227
+                for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts(total):', 'geodirectory'); ?>
228 228
                 <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>"
229 229
                        name="<?php echo $this->get_field_name('post_number'); ?>" type="text"
230 230
                        value="<?php echo esc_attr($post_number); ?>"/>
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
         <p>
235 235
             <label
236
-                for="<?php echo $this->get_field_id('max_show'); ?>"><?php _e('Number of posts(shown at one time, requires a slide width to be set):', 'geodirectory');?>
236
+                for="<?php echo $this->get_field_id('max_show'); ?>"><?php _e('Number of posts(shown at one time, requires a slide width to be set):', 'geodirectory'); ?>
237 237
                 <input class="widefat" id="<?php echo $this->get_field_id('max_show'); ?>"
238 238
                        name="<?php echo $this->get_field_name('max_show'); ?>" type="text"
239 239
                        value="<?php echo esc_attr($max_show); ?>"/>
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
         <p>
244 244
             <label
245
-                for="<?php echo $this->get_field_id('slide_width'); ?>"><?php _e('Slide width(leave blank unless showing more than one slide at a time, ex: 210):', 'geodirectory');?>
245
+                for="<?php echo $this->get_field_id('slide_width'); ?>"><?php _e('Slide width(leave blank unless showing more than one slide at a time, ex: 210):', 'geodirectory'); ?>
246 246
                 <input class="widefat" id="<?php echo $this->get_field_id('slide_width'); ?>"
247 247
                        name="<?php echo $this->get_field_name('slide_width'); ?>" type="text"
248 248
                        value="<?php echo esc_attr($slide_width); ?>"/>
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
         <p>
253 253
             <label
254
-                for="<?php echo $this->get_field_id('animation'); ?>"><?php _e('Animation:', 'geodirectory');?>
254
+                for="<?php echo $this->get_field_id('animation'); ?>"><?php _e('Animation:', 'geodirectory'); ?>
255 255
 
256 256
                 <select class="widefat" id="<?php echo $this->get_field_id('animation'); ?>"
257 257
                         name="<?php echo $this->get_field_name('animation'); ?>">
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
         <p>
271 271
             <label
272
-                for="<?php echo $this->get_field_id('slideshowSpeed'); ?>"><?php _e('Slide Show Speed: (milliseconds)', 'geodirectory');?>
272
+                for="<?php echo $this->get_field_id('slideshowSpeed'); ?>"><?php _e('Slide Show Speed: (milliseconds)', 'geodirectory'); ?>
273 273
 
274 274
                 <input class="widefat" id="<?php echo $this->get_field_id('slideshowSpeed'); ?>"
275 275
                        name="<?php echo $this->get_field_name('slideshowSpeed'); ?>" type="text"
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
         <p>
281 281
             <label
282
-                for="<?php echo $this->get_field_id('animationSpeed'); ?>"><?php _e('Animation Speed: (milliseconds)', 'geodirectory');?>
282
+                for="<?php echo $this->get_field_id('animationSpeed'); ?>"><?php _e('Animation Speed: (milliseconds)', 'geodirectory'); ?>
283 283
 
284 284
                 <input class="widefat" id="<?php echo $this->get_field_id('animationSpeed'); ?>"
285 285
                        name="<?php echo $this->get_field_name('animationSpeed'); ?>" type="text"
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
         <p>
291 291
             <label
292
-                for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory');?>
292
+                for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory'); ?>
293 293
 
294 294
                 <input type="checkbox" <?php if ($slideshow) {
295 295
                     echo 'checked="checked"';
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
         <p>
303 303
             <label
304
-                for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory');?>
304
+                for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory'); ?>
305 305
 
306 306
                 <input type="checkbox" <?php if ($animationLoop) {
307 307
                     echo 'checked="checked"';
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
         <p>
315 315
             <label
316
-                for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory');?>
316
+                for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory'); ?>
317 317
 
318 318
                 <input type="checkbox" <?php if ($directionNav) {
319 319
                     echo 'checked="checked"';
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 
327 327
         <p>
328 328
             <label
329
-                for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory');?>
329
+                for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory'); ?>
330 330
 
331 331
                 <input type="checkbox" <?php if ($show_title) {
332 332
                     echo 'checked="checked"';
@@ -345,9 +345,9 @@  discard block
 block discarded – undo
345 345
         </p>
346 346
         <p>
347 347
             <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
348
-                <?php _e('Enable Location Filter:', 'geodirectory');?>
348
+                <?php _e('Enable Location Filter:', 'geodirectory'); ?>
349 349
                 <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
350
-                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
350
+                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?>
351 351
                        value="1"/>
352 352
             </label>
353 353
         </p>
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 
369 369
             }
370 370
 
371
-            <?php if(is_active_widget( false, false, $this->id_base, true )){ ?>
371
+            <?php if (is_active_widget(false, false, $this->id_base, true)) { ?>
372 372
             var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val();
373 373
 
374
-            geodir_change_category_list(post_type, '<?php echo $category;?>');
374
+            geodir_change_category_list(post_type, '<?php echo $category; ?>');
375 375
             <?php } ?>
376 376
 
377 377
         </script>
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -74,10 +74,11 @@  discard block
 block discarded – undo
74 74
         $instance['animation'] = $new_instance['animation'];
75 75
         $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : '';
76 76
         $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0;
77
-        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
78
-            $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
79
-        else
80
-            $instance['add_location_filter'] = '0';
77
+        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') {
78
+                    $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
79
+        } else {
80
+                    $instance['add_location_filter'] = '0';
81
+        }
81 82
 
82 83
         return $instance;
83 84
     }
@@ -339,7 +340,10 @@  discard block
 block discarded – undo
339 340
             <label
340 341
                 for="<?php echo $this->get_field_id('show_featured_only'); ?>"><?php _e('Show only featured listings:', 'geodirectory'); ?>
341 342
                 <input type="checkbox" id="<?php echo $this->get_field_id('show_featured_only'); ?>"
342
-                       name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?>
343
+                       name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) {
344
+	echo 'checked="checked"';
345
+}
346
+?>
343 347
                        value="1"/>
344 348
             </label>
345 349
         </p>
@@ -347,7 +351,10 @@  discard block
 block discarded – undo
347 351
             <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
348 352
                 <?php _e('Enable Location Filter:', 'geodirectory');?>
349 353
                 <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
350
-                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
354
+                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) {
355
+	echo 'checked="checked"';
356
+}
357
+?>
351 358
                        value="1"/>
352 359
             </label>
353 360
         </p>
Please login to merge, or discard this patch.
geodirectory-templates/listing-filter-form.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -14,18 +14,18 @@  discard block
 block discarded – undo
14 14
 
15 15
 
16 16
 if (function_exists('geodir_location_geo_home_link')) {
17
-    remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
17
+	remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
18 18
 }
19 19
 $search_url = trailingslashit(get_home_url());
20 20
 if (function_exists('geodir_location_geo_home_link')) {
21
-    add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
21
+	add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
22 22
 }
23 23
 
24 24
 
25 25
 $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
26 26
 $form_class = 'geodir-listing-search';
27 27
 if($new_style){
28
-    $form_class .= ' gd-search-bar-style';
28
+	$form_class .= ' gd-search-bar-style';
29 29
 }
30 30
 ?>
31 31
 
@@ -44,56 +44,56 @@  discard block
 block discarded – undo
44 44
     <div class="geodir-loc-bar">
45 45
 
46 46
         <?php
47
-        /**
48
-         * Called inside the search form but before any of the fields.
49
-         *
50
-         * @since 1.0.0
51
-         */
52
-        do_action('geodir_before_search_form') ?>
47
+		/**
48
+		 * Called inside the search form but before any of the fields.
49
+		 *
50
+		 * @since 1.0.0
51
+		 */
52
+		do_action('geodir_before_search_form') ?>
53 53
 
54 54
         <div class="clearfix geodir-loc-bar-in">
55 55
             <div class="geodir-search">
56 56
 
57 57
                 <?php
58 58
 
59
-                /**
60
-                 * Adds the input fields to the search form.
61
-                 *
62
-                 * @since 1.6.9
63
-                 */
64
-                do_action('geodir_search_form_inputs');
59
+				/**
60
+				 * Adds the input fields to the search form.
61
+				 *
62
+				 * @since 1.6.9
63
+				 */
64
+				do_action('geodir_search_form_inputs');
65 65
 
66 66
 
67 67
 
68
-                /**
69
-                 * Called on the GD search form just before the search button.
70
-                 *
71
-                 * @since 1.0.0
72
-                 */
73
-                do_action('geodir_before_search_button');
68
+				/**
69
+				 * Called on the GD search form just before the search button.
70
+				 *
71
+				 * @since 1.0.0
72
+				 */
73
+				do_action('geodir_before_search_button');
74 74
 
75 75
                 
76
-                /**
77
-                 * Called on the GD search form just after the search button.
78
-                 *
79
-                 * @since 1.0.0
80
-                 */
81
-                do_action('geodir_after_search_button');
76
+				/**
77
+				 * Called on the GD search form just after the search button.
78
+				 *
79
+				 * @since 1.0.0
80
+				 */
81
+				do_action('geodir_after_search_button');
82 82
 
83 83
                 
84
-                ?>
84
+				?>
85 85
             </div>
86 86
 
87 87
 
88 88
         </div>
89 89
 
90 90
         <?php
91
-        /**
92
-         * Called inside the search form but after all the input fields.
93
-         *
94
-         * @since 1.0.0
95
-         */
96
-        do_action('geodir_after_search_form') ?>
91
+		/**
92
+		 * Called inside the search form but after all the input fields.
93
+		 *
94
+		 * @since 1.0.0
95
+		 */
96
+		do_action('geodir_after_search_form') ?>
97 97
 
98 98
 
99 99
     </div>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 
25 25
 $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
26 26
 $form_class = 'geodir-listing-search';
27
-if($new_style){
27
+if ($new_style) {
28 28
     $form_class .= ' gd-search-bar-style';
29 29
 }
30 30
 ?>
Please login to merge, or discard this patch.
geodirectory-functions/custom_field_html.php 3 patches
Indentation   +328 added lines, -328 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 global $post_type;
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21
-    $post_type = sanitize_text_field($_REQUEST['listing_type']);
21
+	$post_type = sanitize_text_field($_REQUEST['listing_type']);
22 22
 } else
23
-    $post_type = $field_info->post_type;
23
+	$post_type = $field_info->post_type;
24 24
 
25 25
 //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
26 26
 //    $cf_arr = geodir_custom_fields_predefined($post_type);
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 $field_admin_title = '';
46 46
 if (isset($field_info->admin_title))
47
-    $field_admin_title = $field_info->admin_title;
47
+	$field_admin_title = $field_info->admin_title;
48 48
 
49 49
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
50 50
 
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
 //print_r($field_info);
65 65
 
66 66
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
67
-    $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
67
+	$field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
68 68
 }elseif(isset($cf['icon']) && $cf['icon']){
69
-    $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
69
+	$field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
70 70
 }else{
71
-    $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
71
+	$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
72 72
 }
73 73
 
74 74
 if(isset($cf['name']) && $cf['name']){
75
-    $field_type_name = $cf['name'];
75
+	$field_type_name = $cf['name'];
76 76
 }else{
77
-    $field_type_name = $field_type;
77
+	$field_type_name = $field_type;
78 78
 }
79 79
 
80 80
 ?>
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
85 85
         <?php
86 86
 
87
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
88
-        ?>
87
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
88
+		?>
89 89
 
90 90
         <?php if ($default): ?>
91 91
             <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div>
@@ -94,37 +94,37 @@  discard block
 block discarded – undo
94 94
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
95 95
                  class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
96 96
         <?php endif;
97
-        if ($field_type == 'fieldset') {
98
-            ?>
97
+		if ($field_type == 'fieldset') {
98
+			?>
99 99
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
100 100
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
101 101
             <b style="cursor:pointer;"
102 102
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
103 103
         <?php
104
-        } else {echo $field_icon;
105
-            ?>
104
+		} else {echo $field_icon;
105
+			?>
106 106
             <b style="cursor:pointer;"
107 107
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
108 108
         <?php
109
-        }
110
-        ?>
109
+		}
110
+		?>
111 111
     </div>
112 112
 
113 113
     <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
114 114
     <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
115 115
          style="display:<?php if ($field_ins_upd == 'submit') {
116
-             echo 'block;';
117
-         } else {
118
-             echo 'none;';
119
-         } ?>">
116
+			 echo 'block;';
117
+		 } else {
118
+			 echo 'none;';
119
+		 } ?>">
120 120
         <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/>
121 121
         <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
122 122
         <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
123 123
         <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo $field_type_key; ?>"/>
124 124
         <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/>
125 125
         <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
126
-            echo $field_info->data_type;
127
-        } ?>"/>
126
+			echo $field_info->data_type;
127
+		} ?>"/>
128 128
         <input type="hidden" name="is_active" id="is_active" value="1"/>
129 129
 
130 130
         <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?>
@@ -136,37 +136,37 @@  discard block
 block discarded – undo
136 136
 
137 137
             <?php
138 138
 
139
-            // data_type
140
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
139
+			// data_type
140
+			if(has_filter("geodir_cfa_data_type_{$field_type}")){
141 141
 
142
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
142
+				echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
143 143
 
144
-            }else{
145
-                $value = '';
146
-                if (isset($field_info->data_type)) {
147
-                    $value = esc_attr($field_info->data_type);
148
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
149
-                    $value = $cf['defaults']['data_type'];
150
-                }
151
-                ?>
144
+			}else{
145
+				$value = '';
146
+				if (isset($field_info->data_type)) {
147
+					$value = esc_attr($field_info->data_type);
148
+				}elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
149
+					$value = $cf['defaults']['data_type'];
150
+				}
151
+				?>
152 152
                 <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
153 153
             <?php
154
-            }
154
+			}
155 155
 
156 156
 
157
-            // admin_title
158
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
157
+			// admin_title
158
+			if(has_filter("geodir_cfa_admin_title_{$field_type}")){
159 159
 
160
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
160
+				echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
161 161
 
162
-            }else{
163
-                $value = '';
164
-                if (isset($field_info->admin_title)) {
165
-                    $value = esc_attr($field_info->admin_title);
166
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
167
-                    $value = $cf['defaults']['admin_title'];
168
-                }
169
-                ?>
162
+			}else{
163
+				$value = '';
164
+				if (isset($field_info->admin_title)) {
165
+					$value = esc_attr($field_info->admin_title);
166
+				}elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
167
+					$value = $cf['defaults']['admin_title'];
168
+				}
169
+				?>
170 170
                 <li>
171 171
                     <label for="admin_title" class="gd-cf-tooltip-wrap">
172 172
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Admin title :', 'geodirectory'); ?>
@@ -180,22 +180,22 @@  discard block
 block discarded – undo
180 180
                     </div>
181 181
                 </li>
182 182
                 <?php
183
-            }
183
+			}
184 184
 
185 185
 
186
-            // site_title
187
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
186
+			// site_title
187
+			if(has_filter("geodir_cfa_site_title_{$field_type}")){
188 188
 
189
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
189
+				echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
190 190
 
191
-            }else{
192
-                $value = '';
193
-                if (isset($field_info->site_title)) {
194
-                    $value = esc_attr($field_info->site_title);
195
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
196
-                    $value = $cf['defaults']['site_title'];
197
-                }
198
-                ?>
191
+			}else{
192
+				$value = '';
193
+				if (isset($field_info->site_title)) {
194
+					$value = esc_attr($field_info->site_title);
195
+				}elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
196
+					$value = $cf['defaults']['site_title'];
197
+				}
198
+				?>
199 199
                 <li>
200 200
                     <label for="site_title" class="gd-cf-tooltip-wrap"> <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend title :', 'geodirectory'); ?>
201 201
                         <div class="gdcf-tooltip">
@@ -208,22 +208,22 @@  discard block
 block discarded – undo
208 208
                     </div>
209 209
                 </li>
210 210
                 <?php
211
-            }
211
+			}
212 212
 
213 213
 
214
-            // admin_desc
215
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
214
+			// admin_desc
215
+			if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
216 216
 
217
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
217
+				echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
218 218
 
219
-            }else{
220
-                $value = '';
221
-                if (isset($field_info->admin_desc)) {
222
-                    $value = esc_attr($field_info->admin_desc);
223
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
224
-                    $value = $cf['defaults']['admin_desc'];
225
-                }
226
-                ?>
219
+			}else{
220
+				$value = '';
221
+				if (isset($field_info->admin_desc)) {
222
+					$value = esc_attr($field_info->admin_desc);
223
+				}elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
224
+					$value = $cf['defaults']['admin_desc'];
225
+				}
226
+				?>
227 227
                 <li>
228 228
                     <label for="admin_desc" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend description :', 'geodirectory'); ?>
229 229
                         <div class="gdcf-tooltip">
@@ -235,23 +235,23 @@  discard block
 block discarded – undo
235 235
                     </div>
236 236
                 </li>
237 237
                 <?php
238
-            }
238
+			}
239 239
 
240 240
 
241 241
 
242
-            // htmlvar_name
243
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
242
+			// htmlvar_name
243
+			if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
244 244
 
245
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
245
+				echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
246 246
 
247
-            }else{
248
-                $value = '';
249
-                if (isset($field_info->htmlvar_name)) {
250
-                    $value = esc_attr($field_info->htmlvar_name);
251
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
252
-                    $value = $cf['defaults']['htmlvar_name'];
253
-                }
254
-                ?>
247
+			}else{
248
+				$value = '';
249
+				if (isset($field_info->htmlvar_name)) {
250
+					$value = esc_attr($field_info->htmlvar_name);
251
+				}elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
252
+					$value = $cf['defaults']['htmlvar_name'];
253
+				}
254
+				?>
255 255
                 <li>
256 256
                     <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
257 257
                         <div class="gdcf-tooltip">
@@ -261,29 +261,29 @@  discard block
 block discarded – undo
261 261
                     <div class="gd-cf-input-wrap">
262 262
                         <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
263 263
                                value="<?php if ($value) {
264
-                                   echo preg_replace('/geodir_/', '', $value, 1);
265
-                               }?>" <?php if ($default) {
266
-                            echo 'readonly="readonly"';
267
-                        }?> />
264
+								   echo preg_replace('/geodir_/', '', $value, 1);
265
+							   }?>" <?php if ($default) {
266
+							echo 'readonly="readonly"';
267
+						}?> />
268 268
                     </div>
269 269
                 </li>
270 270
                 <?php
271
-            }
271
+			}
272 272
 
273 273
 
274
-            // is_active
275
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
274
+			// is_active
275
+			if(has_filter("geodir_cfa_is_active_{$field_type}")){
276 276
 
277
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
277
+				echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
278 278
 
279
-            }else{
280
-                $value = '';
281
-                if (isset($field_info->is_active)) {
282
-                    $value = esc_attr($field_info->is_active);
283
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
284
-                    $value = $cf['defaults']['is_active'];
285
-                }
286
-                ?>
279
+			}else{
280
+				$value = '';
281
+				if (isset($field_info->is_active)) {
282
+					$value = esc_attr($field_info->is_active);
283
+				}elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
284
+					$value = $cf['defaults']['is_active'];
285
+				}
286
+				?>
287 287
                 <li <?php echo $field_display; ?>>
288 288
                     <label for="is_active" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active :', 'geodirectory'); ?>
289 289
                         <div class="gdcf-tooltip">
@@ -294,35 +294,35 @@  discard block
 block discarded – undo
294 294
 
295 295
                         <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
296 296
                             <?php if ($value == '1') {
297
-                                echo 'checked';
298
-                            } ?>/>
297
+								echo 'checked';
298
+							} ?>/>
299 299
                         <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
300 300
 
301 301
                         <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
302 302
                             <?php if ($value == '0' || !$value) {
303
-                                echo 'checked';
304
-                            } ?>/>
303
+								echo 'checked';
304
+							} ?>/>
305 305
                         <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
306 306
 
307 307
                     </div>
308 308
                 </li>
309 309
                 <?php
310
-            }
310
+			}
311 311
 
312 312
 
313
-            // for_admin_use
314
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
313
+			// for_admin_use
314
+			if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
315 315
 
316
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
316
+				echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
317 317
 
318
-            }else{
319
-                $value = '';
320
-                if (isset($field_info->for_admin_use)) {
321
-                    $value = esc_attr($field_info->for_admin_use);
322
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
323
-                    $value = $cf['defaults']['for_admin_use'];
324
-                }
325
-                ?>
318
+			}else{
319
+				$value = '';
320
+				if (isset($field_info->for_admin_use)) {
321
+					$value = esc_attr($field_info->for_admin_use);
322
+				}elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
323
+					$value = $cf['defaults']['for_admin_use'];
324
+				}
325
+				?>
326 326
                 <li>
327 327
                     <label for="for_admin_use" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('For admin use only? :', 'geodirectory'); ?>
328 328
                         <div class="gdcf-tooltip">
@@ -333,47 +333,47 @@  discard block
 block discarded – undo
333 333
 
334 334
                         <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
335 335
                             <?php if ($value == '1') {
336
-                                echo 'checked';
337
-                            } ?>/>
336
+								echo 'checked';
337
+							} ?>/>
338 338
                         <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
339 339
 
340 340
                         <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
341 341
                             <?php if ($value == '0' || !$value) {
342
-                                echo 'checked';
343
-                            } ?>/>
342
+								echo 'checked';
343
+							} ?>/>
344 344
                         <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
345 345
 
346 346
                     </div>
347 347
                 </li>
348 348
                 <?php
349
-            }
349
+			}
350 350
 
351 351
 
352
-            // default_value
353
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
352
+			// default_value
353
+			if(has_filter("geodir_cfa_default_value_{$field_type}")){
354 354
 
355
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
355
+				echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
356 356
 
357
-            }else{
358
-                $value = '';
359
-                if (isset($field_info->default_value)) {
360
-                    $value = esc_attr($field_info->default_value);
361
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
362
-                    $value = $cf['defaults']['default_value'];
363
-                }
364
-                ?>
357
+			}else{
358
+				$value = '';
359
+				if (isset($field_info->default_value)) {
360
+					$value = esc_attr($field_info->default_value);
361
+				}elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
362
+					$value = $cf['defaults']['default_value'];
363
+				}
364
+				?>
365 365
                 <li>
366 366
                     <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
367 367
                         <div class="gdcf-tooltip">
368 368
                             <?php
369
-                            if ($field_type == 'checkbox') {
370
-                                _e('Should the checkbox be checked by default?', 'geodirectory');
371
-                            } else if ($field_type == 'email') {
372
-                                _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
373
-                            } else {
374
-                                _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
375
-                            }
376
-                            ?>
369
+							if ($field_type == 'checkbox') {
370
+								_e('Should the checkbox be checked by default?', 'geodirectory');
371
+							} else if ($field_type == 'email') {
372
+								_e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
373
+							} else {
374
+								_e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
375
+							}
376
+							?>
377 377
                         </div>
378 378
                     </label>
379 379
                     <div class="gd-cf-input-wrap">
@@ -390,22 +390,22 @@  discard block
 block discarded – undo
390 390
                     </div>
391 391
                 </li>
392 392
                 <?php
393
-            }
393
+			}
394 394
 
395 395
 
396
-            // show_in
397
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
396
+			// show_in
397
+			if(has_filter("geodir_cfa_show_in_{$field_type}")){
398 398
 
399
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
399
+				echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
400 400
 
401
-            }else{
402
-                $value = '';
403
-                if (isset($field_info->show_in)) {
404
-                    $value = esc_attr($field_info->show_in);
405
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
406
-                    $value = esc_attr($cf['defaults']['show_in']);
407
-                }
408
-                ?>
401
+			}else{
402
+				$value = '';
403
+				if (isset($field_info->show_in)) {
404
+					$value = esc_attr($field_info->show_in);
405
+				}elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
406
+					$value = esc_attr($cf['defaults']['show_in']);
407
+				}
408
+				?>
409 409
                 <li>
410 410
                     <label for="show_in" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show in what locations?:', 'geodirectory'); ?>
411 411
                         <div class="gdcf-tooltip">
@@ -416,42 +416,42 @@  discard block
 block discarded – undo
416 416
 
417 417
                         <?php
418 418
 
419
-                        /*
419
+						/*
420 420
 						 * We wrap the key values in [] so we can search the DB easier with a LIKE query.
421 421
 						 */
422
-                        $show_in_locations = array(
423
-                            "[detail]" => __("Details page sidebar", 'geodirectory'),
424
-                            "[moreinfo]" => __("More info tab", 'geodirectory'),
425
-                            "[listing]" => __("Listings page", 'geodirectory'),
426
-                            "[owntab]" => __("Details page own tab", 'geodirectory'),
427
-                            "[mapbubble]" => __("Map bubble", 'geodirectory'),
428
-                        );
429
-
430
-                        /**
431
-                         * Filter the locations array for where to display custom fields.
432
-                         *
433
-                         * @since 1.6.6
434
-                         * @param array $show_in_locations The array of locations and descriptions.
435
-                         * @param object $field_info The field being displayed info.
436
-                         * @param string $field_info The type of field.
437
-                         */
438
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
422
+						$show_in_locations = array(
423
+							"[detail]" => __("Details page sidebar", 'geodirectory'),
424
+							"[moreinfo]" => __("More info tab", 'geodirectory'),
425
+							"[listing]" => __("Listings page", 'geodirectory'),
426
+							"[owntab]" => __("Details page own tab", 'geodirectory'),
427
+							"[mapbubble]" => __("Map bubble", 'geodirectory'),
428
+						);
429
+
430
+						/**
431
+						 * Filter the locations array for where to display custom fields.
432
+						 *
433
+						 * @since 1.6.6
434
+						 * @param array $show_in_locations The array of locations and descriptions.
435
+						 * @param object $field_info The field being displayed info.
436
+						 * @param string $field_info The type of field.
437
+						 */
438
+						$show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
439 439
 
440 440
 
441
-                        // remove some locations for some field types
441
+						// remove some locations for some field types
442 442
 
443
-                        // don't show new tab option for some types
443
+						// don't show new tab option for some types
444 444
 
445
-                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
446
-                        }else{
447
-                            unset($show_in_locations['[owntab]']);
448
-                        }
445
+						if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
446
+						}else{
447
+							unset($show_in_locations['[owntab]']);
448
+						}
449 449
 
450
-                        if(!$display_on_listing){
451
-                            unset($show_in_locations['[listings]']);
452
-                        }
450
+						if(!$display_on_listing){
451
+							unset($show_in_locations['[listings]']);
452
+						}
453 453
 
454
-                        ?>
454
+						?>
455 455
 
456 456
                         <select multiple="multiple" name="show_in[]"
457 457
                                 id="show_in"
@@ -461,38 +461,38 @@  discard block
 block discarded – undo
461 461
                                 option-ajaxchosen="false">
462 462
                             <?php
463 463
 
464
-                            $show_in_values = explode(',',$value);
464
+							$show_in_values = explode(',',$value);
465 465
 
466
-                            foreach( $show_in_locations as $key => $val){
467
-                                $selected = '';
466
+							foreach( $show_in_locations as $key => $val){
467
+								$selected = '';
468 468
 
469
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
470
-                                    $selected = 'selected';
471
-                                }
469
+								if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
470
+									$selected = 'selected';
471
+								}
472 472
 
473
-                                ?>
473
+								?>
474 474
                                 <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
475 475
                                 <?php
476
-                            }
477
-                            ?>
476
+							}
477
+							?>
478 478
                         </select>
479 479
                     </div>
480 480
                 </li>
481 481
                 <?php
482
-            }
482
+			}
483 483
 
484 484
 
485
-            // advanced_editor
486
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
485
+			// advanced_editor
486
+			if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
487 487
 
488
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
488
+				echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
489 489
 
490
-            }
490
+			}
491 491
 
492 492
 
493 493
 
494 494
 
495
-            ?>
495
+			?>
496 496
 
497 497
 
498 498
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
@@ -505,38 +505,38 @@  discard block
 block discarded – undo
505 505
 
506 506
             <?php
507 507
 
508
-            $pricearr = array();
509
-            if (isset($field_info->packages) && $field_info->packages != '') {
510
-                $pricearr = explode(',', trim($field_info->packages, ','));
511
-            } else {
512
-                $package_info = array();
508
+			$pricearr = array();
509
+			if (isset($field_info->packages) && $field_info->packages != '') {
510
+				$pricearr = explode(',', trim($field_info->packages, ','));
511
+			} else {
512
+				$package_info = array();
513 513
 
514
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
515
-                $pricearr[] = $package_info->pid;
516
-            }
514
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
515
+				$pricearr[] = $package_info->pid;
516
+			}
517 517
 
518
-            ob_start()
519
-            ?>
518
+			ob_start()
519
+			?>
520 520
 
521 521
             <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple">
522 522
                 <?php
523
-                if (!empty($pricearr)) {
524
-                    foreach ($pricearr as $val) {
525
-                        ?>
523
+				if (!empty($pricearr)) {
524
+					foreach ($pricearr as $val) {
525
+						?>
526 526
                         <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php
527
-                    }
528
-                }
529
-                ?>
527
+					}
528
+				}
529
+				?>
530 530
             </select>
531 531
 
532 532
             <?php
533
-            $html = ob_get_clean();
533
+			$html = ob_get_clean();
534 534
 
535 535
 			/**
536 536
 			 * Filter the price packages list.
537 537
 			 *
538 538
 			 * Filter the price packages list in custom field form in admin
539
-             * custom fields settings.
539
+			 * custom fields settings.
540 540
 			 *
541 541
 			 * @since 1.0.0
542 542
 			 *
@@ -545,25 +545,25 @@  discard block
 block discarded – undo
545 545
 			 */
546 546
 			echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info);
547 547
 
548
-            ?>
548
+			?>
549 549
 
550 550
 
551 551
 
552 552
             <?php
553 553
 
554
-            // is_required
555
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
554
+			// is_required
555
+			if(has_filter("geodir_cfa_is_required_{$field_type}")){
556 556
 
557
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
557
+				echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
558 558
 
559
-            }else{
560
-                $value = '';
561
-                if (isset($field_info->is_required)) {
562
-                    $value = esc_attr($field_info->is_required);
563
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
564
-                    $value = $cf['defaults']['is_required'];
565
-                }
566
-                ?>
559
+			}else{
560
+				$value = '';
561
+				if (isset($field_info->is_required)) {
562
+					$value = esc_attr($field_info->is_required);
563
+				}elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
564
+					$value = $cf['defaults']['is_required'];
565
+				}
566
+				?>
567 567
                 <li>
568 568
                     <label for="is_required" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is required :', 'geodirectory'); ?>
569 569
                         <div class="gdcf-tooltip">
@@ -575,14 +575,14 @@  discard block
 block discarded – undo
575 575
 
576 576
                         <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
577 577
                             <?php if ($value == '1') {
578
-                                echo 'checked';
579
-                            } ?>/>
578
+								echo 'checked';
579
+							} ?>/>
580 580
                         <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
581 581
 
582 582
                         <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
583 583
                             <?php if ($value == '0' || !$value) {
584
-                                echo 'checked';
585
-                            } ?>/>
584
+								echo 'checked';
585
+							} ?>/>
586 586
                         <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
587 587
 
588 588
                     </div>
@@ -590,21 +590,21 @@  discard block
 block discarded – undo
590 590
                 </li>
591 591
 
592 592
                 <?php
593
-            }
593
+			}
594 594
 
595
-            // required_msg
596
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
595
+			// required_msg
596
+			if(has_filter("geodir_cfa_required_msg_{$field_type}")){
597 597
 
598
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
598
+				echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
599 599
 
600
-            }else{
601
-                $value = '';
602
-                if (isset($field_info->required_msg)) {
603
-                    $value = esc_attr($field_info->required_msg);
604
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
605
-                    $value = $cf['defaults']['required_msg'];
606
-                }
607
-                ?>
600
+			}else{
601
+				$value = '';
602
+				if (isset($field_info->required_msg)) {
603
+					$value = esc_attr($field_info->required_msg);
604
+				}elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
605
+					$value = $cf['defaults']['required_msg'];
606
+				}
607
+				?>
608 608
                 <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
609 609
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
610 610
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
@@ -618,38 +618,38 @@  discard block
 block discarded – undo
618 618
                     </div>
619 619
                 </li>
620 620
                 <?php
621
-            }
621
+			}
622 622
 
623 623
 
624
-            // required_msg
625
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
624
+			// required_msg
625
+			if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
626 626
 
627
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
627
+				echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
628 628
 
629
-            }
629
+			}
630 630
 
631 631
 
632
-            // extra_fields
633
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
632
+			// extra_fields
633
+			if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
634 634
 
635
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
635
+				echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
636 636
 
637
-            }
637
+			}
638 638
 
639 639
 
640
-            // field_icon
641
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
640
+			// field_icon
641
+			if(has_filter("geodir_cfa_field_icon_{$field_type}")){
642 642
 
643
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
643
+				echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
644 644
 
645
-            }else{
646
-                $value = '';
647
-                if (isset($field_info->field_icon)) {
648
-                    $value = esc_attr($field_info->field_icon);
649
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
650
-                    $value = $cf['defaults']['field_icon'];
651
-                }
652
-                ?>
645
+			}else{
646
+				$value = '';
647
+				if (isset($field_info->field_icon)) {
648
+					$value = esc_attr($field_info->field_icon);
649
+				}elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
650
+					$value = $cf['defaults']['field_icon'];
651
+				}
652
+				?>
653 653
                 <li>
654 654
                     <h3><?php echo __('Custom css', 'geodirectory'); ?></h3>
655 655
 
@@ -667,22 +667,22 @@  discard block
 block discarded – undo
667 667
 
668 668
                 </li>
669 669
                 <?php
670
-            }
670
+			}
671 671
 
672 672
 
673
-            // css_class
674
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
673
+			// css_class
674
+			if(has_filter("geodir_cfa_css_class_{$field_type}")){
675 675
 
676
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
676
+				echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
677 677
 
678
-            }else{
679
-                $value = '';
680
-                if (isset($field_info->css_class)) {
681
-                    $value = esc_attr($field_info->css_class);
682
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
683
-                    $value = $cf['defaults']['css_class'];
684
-                }
685
-                ?>
678
+			}else{
679
+				$value = '';
680
+				if (isset($field_info->css_class)) {
681
+					$value = esc_attr($field_info->css_class);
682
+				}elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
683
+					$value = $cf['defaults']['css_class'];
684
+				}
685
+				?>
686 686
                 <li>
687 687
 
688 688
                     <label for="css_class" class="gd-cf-tooltip-wrap">
@@ -695,47 +695,47 @@  discard block
 block discarded – undo
695 695
                     <div class="gd-cf-input-wrap">
696 696
                         <input type="text" name="css_class" id="css_class"
697 697
                                value="<?php if (isset($field_info->css_class)) {
698
-                                   echo esc_attr($field_info->css_class);
699
-                               }?>"/>
698
+								   echo esc_attr($field_info->css_class);
699
+							   }?>"/>
700 700
                     </div>
701 701
                 </li>
702 702
                 <?php
703
-            }
703
+			}
704 704
 
705 705
 
706
-            // cat_sort
707
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
706
+			// cat_sort
707
+			if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
708 708
 
709
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
709
+				echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
710 710
 
711
-            }else{
712
-                $value = '';
713
-                $hide_cat_sort  ='';
714
-                if (isset($field_info->cat_sort)) {
715
-                    $value = esc_attr($field_info->cat_sort);
716
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
717
-                    $value = $cf['defaults']['cat_sort'];
718
-                    $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
719
-                }
711
+			}else{
712
+				$value = '';
713
+				$hide_cat_sort  ='';
714
+				if (isset($field_info->cat_sort)) {
715
+					$value = esc_attr($field_info->cat_sort);
716
+				}elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
717
+					$value = $cf['defaults']['cat_sort'];
718
+					$hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
719
+				}
720 720
 
721
-                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
722
-                ?>
721
+				$hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
722
+				?>
723 723
                 <li <?php echo $hide_cat_sort ;?>>
724 724
                     <h3><?php
725
-                        /**
726
-                         * Filter the section title.
727
-                         *
728
-                         * Filter the section title in custom field form in admin
729
-                         * custom fields settings.
730
-                         *
731
-                         * @since 1.0.0
732
-                         *
733
-                         * @param string $title Title of the section.
734
-                         * @param string $field_type Current field type.
735
-                         */
736
-                        echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
737
-
738
-                        ?></h3>
725
+						/**
726
+						 * Filter the section title.
727
+						 *
728
+						 * Filter the section title in custom field form in admin
729
+						 * custom fields settings.
730
+						 *
731
+						 * @since 1.0.0
732
+						 *
733
+						 * @param string $title Title of the section.
734
+						 * @param string $field_type Current field type.
735
+						 */
736
+						echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
737
+
738
+						?></h3>
739 739
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
740 740
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
741 741
                         <div class="gdcf-tooltip">
@@ -747,42 +747,42 @@  discard block
 block discarded – undo
747 747
 
748 748
                         <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
749 749
                             <?php if ($value == '1') {
750
-                                echo 'checked';
751
-                            } ?>/>
750
+								echo 'checked';
751
+							} ?>/>
752 752
                         <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
753 753
 
754 754
                         <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
755 755
                             <?php if (!$value) {
756
-                                echo 'checked';
757
-                            } ?>/>
756
+								echo 'checked';
757
+							} ?>/>
758 758
                         <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
759 759
 
760 760
                     </div>
761 761
                 </li>
762 762
                 <?php
763
-            }
764
-
765
-
766
-
767
-            switch ($field_type):
768
-                case 'html':
769
-                case 'file':
770
-                case 'url':
771
-                case 'fieldset':
772
-                    break;
773
-                default:
774
-
775
-                    /**
776
-                     * Called at the end of the advanced custom fields settings page loop.
777
-                     *
778
-                     * Can be used to add or deal with different settings types.
779
-                     *
780
-                     * @since 1.0.0
781
-                     * @since 1.6.6 $cf param added.
782
-                     * @param object $field_info The current fields info.
783
-                     * @param array $cf The custom field settings
784
-                     */
785
-                    do_action('geodir_advance_custom_fields', $field_info,$cf);?>
763
+			}
764
+
765
+
766
+
767
+			switch ($field_type):
768
+				case 'html':
769
+				case 'file':
770
+				case 'url':
771
+				case 'fieldset':
772
+					break;
773
+				default:
774
+
775
+					/**
776
+					 * Called at the end of the advanced custom fields settings page loop.
777
+					 *
778
+					 * Can be used to add or deal with different settings types.
779
+					 *
780
+					 * @since 1.0.0
781
+					 * @since 1.6.6 $cf param added.
782
+					 * @param object $field_info The current fields info.
783
+					 * @param array $cf The custom field settings
784
+					 */
785
+					do_action('geodir_advance_custom_fields', $field_info,$cf);?>
786 786
 
787 787
 
788 788
                 <?php endswitch; ?>
Please login to merge, or discard this patch.
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 $field_info = stripslashes_deep($field_info); // strip slashes from labels
42 42
 
43
-$nonce = wp_create_nonce('custom_fields_' . $result_str);
43
+$nonce = wp_create_nonce('custom_fields_'.$result_str);
44 44
 
45 45
 $field_admin_title = '';
46 46
 if (isset($field_info->admin_title))
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
 
66 66
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
67 67
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
68
-}elseif(isset($cf['icon']) && $cf['icon']){
68
+}elseif (isset($cf['icon']) && $cf['icon']) {
69 69
     $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
70
-}else{
70
+} else {
71 71
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
72 72
 }
73 73
 
74
-if(isset($cf['name']) && $cf['name']){
74
+if (isset($cf['name']) && $cf['name']) {
75 75
     $field_type_name = $cf['name'];
76
-}else{
76
+} else {
77 77
     $field_type_name = $field_type;
78 78
 }
79 79
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
85 85
         <?php
86 86
 
87
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
87
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
88 88
         ?>
89 89
 
90 90
         <?php if ($default): ?>
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
100 100
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
101 101
             <b style="cursor:pointer;"
102
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
102
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
103 103
         <?php
104 104
         } else {echo $field_icon;
105 105
             ?>
106 106
             <b style="cursor:pointer;"
107
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
107
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b>
108 108
         <?php
109 109
         }
110 110
         ?>
@@ -127,43 +127,43 @@  discard block
 block discarded – undo
127 127
         } ?>"/>
128 128
         <input type="hidden" name="is_active" id="is_active" value="1"/>
129 129
 
130
-        <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?>
131
-        <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" />
132
-        <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" />
133
-        <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" />
130
+        <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?>
131
+        <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" />
132
+        <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" />
133
+        <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" />
134 134
 
135 135
         <ul class="widefat post fixed" border="0" style="width:100%;">
136 136
 
137 137
             <?php
138 138
 
139 139
             // data_type
140
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
140
+            if (has_filter("geodir_cfa_data_type_{$field_type}")) {
141 141
 
142
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
142
+                echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info);
143 143
 
144
-            }else{
144
+            } else {
145 145
                 $value = '';
146 146
                 if (isset($field_info->data_type)) {
147 147
                     $value = esc_attr($field_info->data_type);
148
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
148
+                }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
149 149
                     $value = $cf['defaults']['data_type'];
150 150
                 }
151 151
                 ?>
152
-                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
152
+                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/>
153 153
             <?php
154 154
             }
155 155
 
156 156
 
157 157
             // admin_title
158
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
158
+            if (has_filter("geodir_cfa_admin_title_{$field_type}")) {
159 159
 
160
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
160
+                echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info);
161 161
 
162
-            }else{
162
+            } else {
163 163
                 $value = '';
164 164
                 if (isset($field_info->admin_title)) {
165 165
                     $value = esc_attr($field_info->admin_title);
166
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
166
+                }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) {
167 167
                     $value = $cf['defaults']['admin_title'];
168 168
                 }
169 169
                 ?>
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                     </label>
177 177
                     <div class="gd-cf-input-wrap">
178 178
                         <input type="text" name="admin_title" id="admin_title"
179
-                               value="<?php echo $value;?>"/>
179
+                               value="<?php echo $value; ?>"/>
180 180
                     </div>
181 181
                 </li>
182 182
                 <?php
@@ -184,15 +184,15 @@  discard block
 block discarded – undo
184 184
 
185 185
 
186 186
             // site_title
187
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
187
+            if (has_filter("geodir_cfa_site_title_{$field_type}")) {
188 188
 
189
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
189
+                echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info);
190 190
 
191
-            }else{
191
+            } else {
192 192
                 $value = '';
193 193
                 if (isset($field_info->site_title)) {
194 194
                     $value = esc_attr($field_info->site_title);
195
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
195
+                }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) {
196 196
                     $value = $cf['defaults']['site_title'];
197 197
                 }
198 198
                 ?>
@@ -212,15 +212,15 @@  discard block
 block discarded – undo
212 212
 
213 213
 
214 214
             // admin_desc
215
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
215
+            if (has_filter("geodir_cfa_admin_desc_{$field_type}")) {
216 216
 
217
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
217
+                echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info);
218 218
 
219
-            }else{
219
+            } else {
220 220
                 $value = '';
221 221
                 if (isset($field_info->admin_desc)) {
222 222
                     $value = esc_attr($field_info->admin_desc);
223
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
223
+                }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) {
224 224
                     $value = $cf['defaults']['admin_desc'];
225 225
                 }
226 226
                 ?>
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
                         </div>
232 232
                     </label>
233 233
                     <div class="gd-cf-input-wrap">
234
-                        <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/>
234
+                        <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/>
235 235
                     </div>
236 236
                 </li>
237 237
                 <?php
@@ -240,26 +240,26 @@  discard block
 block discarded – undo
240 240
 
241 241
 
242 242
             // htmlvar_name
243
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
243
+            if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) {
244 244
 
245
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
245
+                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info);
246 246
 
247
-            }else{
247
+            } else {
248 248
                 $value = '';
249 249
                 if (isset($field_info->htmlvar_name)) {
250 250
                     $value = esc_attr($field_info->htmlvar_name);
251
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
251
+                }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) {
252 252
                     $value = $cf['defaults']['htmlvar_name'];
253 253
                 }
254 254
                 ?>
255 255
                 <li>
256
-                    <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
256
+                    <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory'); ?>
257 257
                         <div class="gdcf-tooltip">
258 258
                             <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?>
259 259
                         </div>
260 260
                     </label>
261 261
                     <div class="gd-cf-input-wrap">
262
-                        <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
262
+                        <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory'); ?>"
263 263
                                value="<?php if ($value) {
264 264
                                    echo preg_replace('/geodir_/', '', $value, 1);
265 265
                                }?>" <?php if ($default) {
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
 
273 273
 
274 274
             // is_active
275
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
275
+            if (has_filter("geodir_cfa_is_active_{$field_type}")) {
276 276
 
277
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
277
+                echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info);
278 278
 
279
-            }else{
279
+            } else {
280 280
                 $value = '';
281 281
                 if (isset($field_info->is_active)) {
282 282
                     $value = esc_attr($field_info->is_active);
283
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
283
+                }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) {
284 284
                     $value = $cf['defaults']['is_active'];
285 285
                 }
286 286
                 ?>
@@ -292,17 +292,17 @@  discard block
 block discarded – undo
292 292
                     </label>
293 293
                     <div class="gd-cf-input-wrap gd-switch">
294 294
 
295
-                        <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
295
+                        <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled"  value="1"
296 296
                             <?php if ($value == '1') {
297 297
                                 echo 'checked';
298 298
                             } ?>/>
299
-                        <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
299
+                        <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
300 300
 
301
-                        <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
301
+                        <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0"
302 302
                             <?php if ($value == '0' || !$value) {
303 303
                                 echo 'checked';
304 304
                             } ?>/>
305
-                        <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
305
+                        <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
306 306
 
307 307
                     </div>
308 308
                 </li>
@@ -311,15 +311,15 @@  discard block
 block discarded – undo
311 311
 
312 312
 
313 313
             // for_admin_use
314
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
314
+            if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) {
315 315
 
316
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
316
+                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info);
317 317
 
318
-            }else{
318
+            } else {
319 319
                 $value = '';
320 320
                 if (isset($field_info->for_admin_use)) {
321 321
                     $value = esc_attr($field_info->for_admin_use);
322
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
322
+                }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) {
323 323
                     $value = $cf['defaults']['for_admin_use'];
324 324
                 }
325 325
                 ?>
@@ -331,17 +331,17 @@  discard block
 block discarded – undo
331 331
                     </label>
332 332
                     <div class="gd-cf-input-wrap gd-switch">
333 333
 
334
-                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
334
+                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled"  value="1"
335 335
                             <?php if ($value == '1') {
336 336
                                 echo 'checked';
337 337
                             } ?>/>
338
-                        <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
338
+                        <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
339 339
 
340
-                        <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
340
+                        <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0"
341 341
                             <?php if ($value == '0' || !$value) {
342 342
                                 echo 'checked';
343 343
                             } ?>/>
344
-                        <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
344
+                        <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
345 345
 
346 346
                     </div>
347 347
                 </li>
@@ -350,20 +350,20 @@  discard block
 block discarded – undo
350 350
 
351 351
 
352 352
             // default_value
353
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
353
+            if (has_filter("geodir_cfa_default_value_{$field_type}")) {
354 354
 
355
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
355
+                echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info);
356 356
 
357
-            }else{
357
+            } else {
358 358
                 $value = '';
359 359
                 if (isset($field_info->default_value)) {
360 360
                     $value = esc_attr($field_info->default_value);
361
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
361
+                }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) {
362 362
                     $value = $cf['defaults']['default_value'];
363 363
                 }
364 364
                 ?>
365 365
                 <li>
366
-                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
366
+                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?>
367 367
                         <div class="gdcf-tooltip">
368 368
                             <?php
369 369
                             if ($field_type == 'checkbox') {
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
                         <?php if ($field_type == 'checkbox') { ?>
381 381
                             <select name="default_value" id="default_value">
382 382
                                 <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
383
-                                <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
383
+                                <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
384 384
                             </select>
385 385
                         <?php } else if ($field_type == 'email') { ?>
386
-                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
386
+                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
387 387
                         <?php } else { ?>
388
-                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
388
+                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
389 389
                         <?php } ?>
390 390
                     </div>
391 391
                 </li>
@@ -394,15 +394,15 @@  discard block
 block discarded – undo
394 394
 
395 395
 
396 396
             // show_in
397
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
397
+            if (has_filter("geodir_cfa_show_in_{$field_type}")) {
398 398
 
399
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
399
+                echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info);
400 400
 
401
-            }else{
401
+            } else {
402 402
                 $value = '';
403 403
                 if (isset($field_info->show_in)) {
404 404
                     $value = esc_attr($field_info->show_in);
405
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
405
+                }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) {
406 406
                     $value = esc_attr($cf['defaults']['show_in']);
407 407
                 }
408 408
                 ?>
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
                          * @param object $field_info The field being displayed info.
436 436
                          * @param string $field_info The type of field.
437 437
                          */
438
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
438
+                        $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type);
439 439
 
440 440
 
441 441
                         // remove some locations for some field types
@@ -443,11 +443,11 @@  discard block
 block discarded – undo
443 443
                         // don't show new tab option for some types
444 444
 
445 445
                         if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
446
-                        }else{
446
+                        } else {
447 447
                             unset($show_in_locations['[owntab]']);
448 448
                         }
449 449
 
450
-                        if(!$display_on_listing){
450
+                        if (!$display_on_listing) {
451 451
                             unset($show_in_locations['[listings]']);
452 452
                         }
453 453
 
@@ -461,17 +461,17 @@  discard block
 block discarded – undo
461 461
                                 option-ajaxchosen="false">
462 462
                             <?php
463 463
 
464
-                            $show_in_values = explode(',',$value);
464
+                            $show_in_values = explode(',', $value);
465 465
 
466
-                            foreach( $show_in_locations as $key => $val){
466
+                            foreach ($show_in_locations as $key => $val) {
467 467
                                 $selected = '';
468 468
 
469
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
469
+                                if (is_array($show_in_values) && in_array($key, $show_in_values)) {
470 470
                                     $selected = 'selected';
471 471
                                 }
472 472
 
473 473
                                 ?>
474
-                                <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
474
+                                <option  value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option>
475 475
                                 <?php
476 476
                             }
477 477
                             ?>
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
 
484 484
 
485 485
             // advanced_editor
486
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
486
+            if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) {
487 487
 
488
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
488
+                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info);
489 489
 
490 490
             }
491 491
 
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
 
497 497
 
498 498
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
499
-            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/>
499
+            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/>
500 500
 
501 501
             <?php // we dont need to show the sort order ?>
502
-            <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/>
502
+            <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order); } ?>"/>
503 503
 
504 504
 
505 505
 
@@ -552,15 +552,15 @@  discard block
 block discarded – undo
552 552
             <?php
553 553
 
554 554
             // is_required
555
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
555
+            if (has_filter("geodir_cfa_is_required_{$field_type}")) {
556 556
 
557
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
557
+                echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info);
558 558
 
559
-            }else{
559
+            } else {
560 560
                 $value = '';
561 561
                 if (isset($field_info->is_required)) {
562 562
                     $value = esc_attr($field_info->is_required);
563
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
563
+                }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) {
564 564
                     $value = $cf['defaults']['is_required'];
565 565
                 }
566 566
                 ?>
@@ -573,17 +573,17 @@  discard block
 block discarded – undo
573 573
 
574 574
                     <div class="gd-cf-input-wrap gd-switch">
575 575
 
576
-                        <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
576
+                        <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled"  value="1"
577 577
                             <?php if ($value == '1') {
578 578
                                 echo 'checked';
579 579
                             } ?>/>
580
-                        <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
580
+                        <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
581 581
 
582
-                        <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
582
+                        <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0"
583 583
                             <?php if ($value == '0' || !$value) {
584 584
                                 echo 'checked';
585 585
                             } ?>/>
586
-                        <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
586
+                        <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
587 587
 
588 588
                     </div>
589 589
 
@@ -593,19 +593,19 @@  discard block
 block discarded – undo
593 593
             }
594 594
 
595 595
             // required_msg
596
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
596
+            if (has_filter("geodir_cfa_required_msg_{$field_type}")) {
597 597
 
598
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
598
+                echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info);
599 599
 
600
-            }else{
600
+            } else {
601 601
                 $value = '';
602 602
                 if (isset($field_info->required_msg)) {
603 603
                     $value = esc_attr($field_info->required_msg);
604
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
604
+                }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) {
605 605
                     $value = $cf['defaults']['required_msg'];
606 606
                 }
607 607
                 ?>
608
-                <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
608
+                <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'"; }?>>
609 609
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
610 610
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
611 611
                         <div class="gdcf-tooltip">
@@ -622,31 +622,31 @@  discard block
 block discarded – undo
622 622
 
623 623
 
624 624
             // required_msg
625
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
625
+            if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) {
626 626
 
627
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
627
+                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info);
628 628
 
629 629
             }
630 630
 
631 631
 
632 632
             // extra_fields
633
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
633
+            if (has_filter("geodir_cfa_extra_fields_{$field_type}")) {
634 634
 
635
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
635
+                echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info);
636 636
 
637 637
             }
638 638
 
639 639
 
640 640
             // field_icon
641
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
641
+            if (has_filter("geodir_cfa_field_icon_{$field_type}")) {
642 642
 
643
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
643
+                echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info);
644 644
 
645
-            }else{
645
+            } else {
646 646
                 $value = '';
647 647
                 if (isset($field_info->field_icon)) {
648 648
                     $value = esc_attr($field_info->field_icon);
649
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
649
+                }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) {
650 650
                     $value = $cf['defaults']['field_icon'];
651 651
                 }
652 652
                 ?>
@@ -657,12 +657,12 @@  discard block
 block discarded – undo
657 657
                     <label for="field_icon" class="gd-cf-tooltip-wrap">
658 658
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?>
659 659
                         <div class="gdcf-tooltip">
660
-                            <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
660
+                            <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?>
661 661
                         </div>
662 662
                     </label>
663 663
                     <div class="gd-cf-input-wrap">
664 664
                         <input type="text" name="field_icon" id="field_icon"
665
-                               value="<?php echo $value;?>"/>
665
+                               value="<?php echo $value; ?>"/>
666 666
                     </div>
667 667
 
668 668
                 </li>
@@ -671,15 +671,15 @@  discard block
 block discarded – undo
671 671
 
672 672
 
673 673
             // css_class
674
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
674
+            if (has_filter("geodir_cfa_css_class_{$field_type}")) {
675 675
 
676
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
676
+                echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info);
677 677
 
678
-            }else{
678
+            } else {
679 679
                 $value = '';
680 680
                 if (isset($field_info->css_class)) {
681 681
                     $value = esc_attr($field_info->css_class);
682
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
682
+                }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) {
683 683
                     $value = $cf['defaults']['css_class'];
684 684
                 }
685 685
                 ?>
@@ -688,8 +688,8 @@  discard block
 block discarded – undo
688 688
                     <label for="css_class" class="gd-cf-tooltip-wrap">
689 689
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?>
690 690
                         <div class="gdcf-tooltip">
691
-                            <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
692
-                            <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?>
691
+                            <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
692
+                            <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?>
693 693
                         </div>
694 694
                     </label>
695 695
                     <div class="gd-cf-input-wrap">
@@ -704,23 +704,23 @@  discard block
 block discarded – undo
704 704
 
705 705
 
706 706
             // cat_sort
707
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
707
+            if (has_filter("geodir_cfa_cat_sort_{$field_type}")) {
708 708
 
709
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
709
+                echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info);
710 710
 
711
-            }else{
711
+            } else {
712 712
                 $value = '';
713
-                $hide_cat_sort  ='';
713
+                $hide_cat_sort = '';
714 714
                 if (isset($field_info->cat_sort)) {
715 715
                     $value = esc_attr($field_info->cat_sort);
716
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
716
+                }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) {
717 717
                     $value = $cf['defaults']['cat_sort'];
718
-                    $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
718
+                    $hide_cat_sort = ($value === false) ? "style='display:none;'" : '';
719 719
                 }
720 720
 
721
-                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
721
+                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : '';
722 722
                 ?>
723
-                <li <?php echo $hide_cat_sort ;?>>
723
+                <li <?php echo $hide_cat_sort; ?>>
724 724
                     <h3><?php
725 725
                         /**
726 726
                          * Filter the section title.
@@ -739,23 +739,23 @@  discard block
 block discarded – undo
739 739
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
740 740
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
741 741
                         <div class="gdcf-tooltip">
742
-                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?>
742
+                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?>
743 743
                         </div>
744 744
                     </label>
745 745
 
746 746
                     <div class="gd-cf-input-wrap gd-switch">
747 747
 
748
-                        <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
748
+                        <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled"  value="1"
749 749
                             <?php if ($value == '1') {
750 750
                                 echo 'checked';
751 751
                             } ?>/>
752
-                        <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
752
+                        <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
753 753
 
754
-                        <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
754
+                        <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0"
755 755
                             <?php if (!$value) {
756 756
                                 echo 'checked';
757 757
                             } ?>/>
758
-                        <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
758
+                        <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
759 759
 
760 760
                     </div>
761 761
                 </li>
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
                      * @param object $field_info The current fields info.
783 783
                      * @param array $cf The custom field settings
784 784
                      */
785
-                    do_action('geodir_advance_custom_fields', $field_info,$cf);?>
785
+                    do_action('geodir_advance_custom_fields', $field_info, $cf); ?>
786 786
 
787 787
 
788 788
                 <?php endswitch; ?>
@@ -794,10 +794,10 @@  discard block
 block discarded – undo
794 794
                     <h3></h3>
795 795
                 </label>
796 796
                 <div class="gd-cf-input-wrap">
797
-                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
797
+                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
798 798
                            onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
799 799
                     <?php if (!$default): ?>
800
-                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
800
+                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
801 801
                                                             onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
802 802
                                                             class="button"/></a>
803 803
                     <?php endif; ?>
Please login to merge, or discard this patch.
Braces   +43 added lines, -38 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21 21
     $post_type = sanitize_text_field($_REQUEST['listing_type']);
22
-} else
23
-    $post_type = $field_info->post_type;
22
+} else {
23
+    $post_type = $field_info->post_type;
24
+}
24 25
 
25 26
 //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
26 27
 //    $cf_arr = geodir_custom_fields_predefined($post_type);
@@ -43,8 +44,9 @@  discard block
 block discarded – undo
43 44
 $nonce = wp_create_nonce('custom_fields_' . $result_str);
44 45
 
45 46
 $field_admin_title = '';
46
-if (isset($field_info->admin_title))
47
-    $field_admin_title = $field_info->admin_title;
47
+if (isset($field_info->admin_title)) {
48
+    $field_admin_title = $field_info->admin_title;
49
+}
48 50
 
49 51
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
50 52
 
@@ -65,15 +67,15 @@  discard block
 block discarded – undo
65 67
 
66 68
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
67 69
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
68
-}elseif(isset($cf['icon']) && $cf['icon']){
70
+} elseif(isset($cf['icon']) && $cf['icon']){
69 71
     $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
70
-}else{
72
+} else{
71 73
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
72 74
 }
73 75
 
74 76
 if(isset($cf['name']) && $cf['name']){
75 77
     $field_type_name = $cf['name'];
76
-}else{
78
+} else{
77 79
     $field_type_name = $field_type;
78 80
 }
79 81
 
@@ -89,8 +91,11 @@  discard block
 block discarded – undo
89 91
 
90 92
         <?php if ($default): ?>
91 93
             <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div>
92
-        <?php else: ?>
93
-            <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
94
+        <?php else {
95
+	: ?>
96
+            <div title="<?php _e('Click to remove field', 'geodirectory');
97
+}
98
+?>"
94 99
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
95 100
                  class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
96 101
         <?php endif;
@@ -141,11 +146,11 @@  discard block
 block discarded – undo
141 146
 
142 147
                 echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
143 148
 
144
-            }else{
149
+            } else{
145 150
                 $value = '';
146 151
                 if (isset($field_info->data_type)) {
147 152
                     $value = esc_attr($field_info->data_type);
148
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
153
+                } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
149 154
                     $value = $cf['defaults']['data_type'];
150 155
                 }
151 156
                 ?>
@@ -159,11 +164,11 @@  discard block
 block discarded – undo
159 164
 
160 165
                 echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
161 166
 
162
-            }else{
167
+            } else{
163 168
                 $value = '';
164 169
                 if (isset($field_info->admin_title)) {
165 170
                     $value = esc_attr($field_info->admin_title);
166
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
171
+                } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
167 172
                     $value = $cf['defaults']['admin_title'];
168 173
                 }
169 174
                 ?>
@@ -188,11 +193,11 @@  discard block
 block discarded – undo
188 193
 
189 194
                 echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
190 195
 
191
-            }else{
196
+            } else{
192 197
                 $value = '';
193 198
                 if (isset($field_info->site_title)) {
194 199
                     $value = esc_attr($field_info->site_title);
195
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
200
+                } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
196 201
                     $value = $cf['defaults']['site_title'];
197 202
                 }
198 203
                 ?>
@@ -216,11 +221,11 @@  discard block
 block discarded – undo
216 221
 
217 222
                 echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
218 223
 
219
-            }else{
224
+            } else{
220 225
                 $value = '';
221 226
                 if (isset($field_info->admin_desc)) {
222 227
                     $value = esc_attr($field_info->admin_desc);
223
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
228
+                } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
224 229
                     $value = $cf['defaults']['admin_desc'];
225 230
                 }
226 231
                 ?>
@@ -244,11 +249,11 @@  discard block
 block discarded – undo
244 249
 
245 250
                 echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
246 251
 
247
-            }else{
252
+            } else{
248 253
                 $value = '';
249 254
                 if (isset($field_info->htmlvar_name)) {
250 255
                     $value = esc_attr($field_info->htmlvar_name);
251
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
256
+                } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
252 257
                     $value = $cf['defaults']['htmlvar_name'];
253 258
                 }
254 259
                 ?>
@@ -276,11 +281,11 @@  discard block
 block discarded – undo
276 281
 
277 282
                 echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
278 283
 
279
-            }else{
284
+            } else{
280 285
                 $value = '';
281 286
                 if (isset($field_info->is_active)) {
282 287
                     $value = esc_attr($field_info->is_active);
283
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
288
+                } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
284 289
                     $value = $cf['defaults']['is_active'];
285 290
                 }
286 291
                 ?>
@@ -315,11 +320,11 @@  discard block
 block discarded – undo
315 320
 
316 321
                 echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
317 322
 
318
-            }else{
323
+            } else{
319 324
                 $value = '';
320 325
                 if (isset($field_info->for_admin_use)) {
321 326
                     $value = esc_attr($field_info->for_admin_use);
322
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
327
+                } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
323 328
                     $value = $cf['defaults']['for_admin_use'];
324 329
                 }
325 330
                 ?>
@@ -354,11 +359,11 @@  discard block
 block discarded – undo
354 359
 
355 360
                 echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
356 361
 
357
-            }else{
362
+            } else{
358 363
                 $value = '';
359 364
                 if (isset($field_info->default_value)) {
360 365
                     $value = esc_attr($field_info->default_value);
361
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
366
+                } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
362 367
                     $value = $cf['defaults']['default_value'];
363 368
                 }
364 369
                 ?>
@@ -398,11 +403,11 @@  discard block
 block discarded – undo
398 403
 
399 404
                 echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
400 405
 
401
-            }else{
406
+            } else{
402 407
                 $value = '';
403 408
                 if (isset($field_info->show_in)) {
404 409
                     $value = esc_attr($field_info->show_in);
405
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
410
+                } elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
406 411
                     $value = esc_attr($cf['defaults']['show_in']);
407 412
                 }
408 413
                 ?>
@@ -443,7 +448,7 @@  discard block
 block discarded – undo
443 448
                         // don't show new tab option for some types
444 449
 
445 450
                         if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
446
-                        }else{
451
+                        } else{
447 452
                             unset($show_in_locations['[owntab]']);
448 453
                         }
449 454
 
@@ -556,11 +561,11 @@  discard block
 block discarded – undo
556 561
 
557 562
                 echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
558 563
 
559
-            }else{
564
+            } else{
560 565
                 $value = '';
561 566
                 if (isset($field_info->is_required)) {
562 567
                     $value = esc_attr($field_info->is_required);
563
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
568
+                } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
564 569
                     $value = $cf['defaults']['is_required'];
565 570
                 }
566 571
                 ?>
@@ -597,11 +602,11 @@  discard block
 block discarded – undo
597 602
 
598 603
                 echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
599 604
 
600
-            }else{
605
+            } else{
601 606
                 $value = '';
602 607
                 if (isset($field_info->required_msg)) {
603 608
                     $value = esc_attr($field_info->required_msg);
604
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
609
+                } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
605 610
                     $value = $cf['defaults']['required_msg'];
606 611
                 }
607 612
                 ?>
@@ -642,11 +647,11 @@  discard block
 block discarded – undo
642 647
 
643 648
                 echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
644 649
 
645
-            }else{
650
+            } else{
646 651
                 $value = '';
647 652
                 if (isset($field_info->field_icon)) {
648 653
                     $value = esc_attr($field_info->field_icon);
649
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
654
+                } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
650 655
                     $value = $cf['defaults']['field_icon'];
651 656
                 }
652 657
                 ?>
@@ -675,11 +680,11 @@  discard block
 block discarded – undo
675 680
 
676 681
                 echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
677 682
 
678
-            }else{
683
+            } else{
679 684
                 $value = '';
680 685
                 if (isset($field_info->css_class)) {
681 686
                     $value = esc_attr($field_info->css_class);
682
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
687
+                } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
683 688
                     $value = $cf['defaults']['css_class'];
684 689
                 }
685 690
                 ?>
@@ -708,12 +713,12 @@  discard block
 block discarded – undo
708 713
 
709 714
                 echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
710 715
 
711
-            }else{
716
+            } else{
712 717
                 $value = '';
713 718
                 $hide_cat_sort  ='';
714 719
                 if (isset($field_info->cat_sort)) {
715 720
                     $value = esc_attr($field_info->cat_sort);
716
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
721
+                } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
717 722
                     $value = $cf['defaults']['cat_sort'];
718 723
                     $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
719 724
                 }
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_predefined.php 3 patches
Indentation   +334 added lines, -334 removed lines patch added patch discarded remove patch
@@ -16,301 +16,301 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_custom_fields_predefined($post_type=''){
18 18
 
19
-    $custom_fields = array();
20
-
21
-
22
-    // price
23
-    $custom_fields['price'] = array( // The key value should be unique and not contain any spaces.
24
-        'field_type'  =>  'text',
25
-        'class'       =>  'gd-price',
26
-        'icon'        =>  'fa fa-usd',
27
-        'name'        =>  __('Price', 'geodirectory'),
28
-        'description' =>  __('Adds a input for a price field. This will let you filter and sort by price.', 'geodirectory'),
29
-        'defaults'    => array(
30
-            'data_type'           =>  'FLOAT',
31
-            'admin_title'         =>  'Price',
32
-            'site_title'          =>  'Price',
33
-            'admin_desc'          =>  'Enter the price in $ (no currency symbol)',
34
-            'htmlvar_name'        =>  'price',
35
-            'is_active'           =>  true,
36
-            'for_admin_use'       =>  false,
37
-            'default_value'       =>  '',
38
-            'show_in' 	      =>  '[detail],[listing]',
39
-            'is_required'         =>  false,
40
-            'validation_pattern'  =>  '\d+(\.\d{2})?',
41
-            'validation_msg'      =>  'Please enter number and decimal only ie: 100.50',
42
-            'required_msg'        =>  '',
43
-            'field_icon'          =>  'fa fa-usd',
44
-            'css_class'           =>  '',
45
-            'cat_sort'            =>  true,
46
-            'cat_filter'	      =>  true
47
-        )
48
-    );
49
-
50
-    // property status
51
-    $custom_fields['property_status'] = array( // The key value should be unique and not contain any spaces.
52
-        'field_type'  =>  'select',
53
-        'class'       =>  'gd-property-status',
54
-        'icon'        =>  'fa fa-home',
55
-        'name'        =>  __('Property Status', 'geodirectory'),
56
-        'description' =>  __('Adds a select input to be able to set the status of a property ie: For Sale, For Rent', 'geodirectory'),
57
-        'defaults'    => array(
58
-            'data_type'           =>  'VARCHAR',
59
-            'admin_title'         =>  'Property Status',
60
-            'site_title'          =>  'Property Status',
61
-            'admin_desc'          =>  'Enter the status of the property.',
62
-            'htmlvar_name'        =>  'property_status',
63
-            'is_active'           =>  true,
64
-            'for_admin_use'       =>  false,
65
-            'default_value'       =>  '',
66
-            'show_in' 	          =>  '[detail],[listing]',
67
-            'is_required'         =>  true,
68
-            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
69
-            'validation_pattern'  =>  '',
70
-            'validation_msg'      =>  '',
71
-            'required_msg'        =>  '',
72
-            'field_icon'          =>  'fa fa-home',
73
-            'css_class'           =>  '',
74
-            'cat_sort'            =>  true,
75
-            'cat_filter'	      =>  true
76
-        )
77
-    );
78
-
79
-    // property furnishing
80
-    $custom_fields['property_furnishing'] = array( // The key value should be unique and not contain any spaces.
81
-        'field_type'  =>  'select',
82
-        'class'       =>  'gd-property-furnishing',
83
-        'icon'        =>  'fa fa-home',
84
-        'name'        =>  __('Property Furnishing', 'geodirectory'),
85
-        'description' =>  __('Adds a select input to be able to set the furnishing status of a property ie: Unfurnished, Furnished', 'geodirectory'),
86
-        'defaults'    => array(
87
-            'data_type'           =>  'VARCHAR',
88
-            'admin_title'         =>  'Furnishing',
89
-            'site_title'          =>  'Furnishing',
90
-            'admin_desc'          =>  'Enter the furnishing status of the property.',
91
-            'htmlvar_name'        =>  'property_furnishing',
92
-            'is_active'           =>  true,
93
-            'for_admin_use'       =>  false,
94
-            'default_value'       =>  '',
95
-            'show_in' 	          =>  '[detail],[listing]',
96
-            'is_required'         =>  true,
97
-            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
98
-            'validation_pattern'  =>  '',
99
-            'validation_msg'      =>  '',
100
-            'required_msg'        =>  '',
101
-            'field_icon'          =>  'fa fa-th-larg',
102
-            'css_class'           =>  '',
103
-            'cat_sort'            =>  true,
104
-            'cat_filter'	      =>  true
105
-        )
106
-    );
107
-
108
-    // property type
109
-    $custom_fields['property_type'] = array( // The key value should be unique and not contain any spaces.
110
-        'field_type'  =>  'select',
111
-        'class'       =>  'gd-property-type',
112
-        'icon'        =>  'fa fa-home',
113
-        'name'        =>  __('Property Type', 'geodirectory'),
114
-        'description' =>  __('Adds a select input for the property type ie: Detached house, Apartment', 'geodirectory'),
115
-        'defaults'    => array(
116
-            'data_type'           =>  'VARCHAR',
117
-            'admin_title'         =>  'Property Type',
118
-            'site_title'          =>  'Property Type',
119
-            'admin_desc'          =>  'Select the property type.',
120
-            'htmlvar_name'        =>  'property_type',
121
-            'is_active'           =>  true,
122
-            'for_admin_use'       =>  false,
123
-            'default_value'       =>  '',
124
-            'show_in' 	          =>  '[detail],[listing]',
125
-            'is_required'         =>  true,
126
-            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
127
-            'validation_pattern'  =>  '',
128
-            'validation_msg'      =>  '',
129
-            'required_msg'        =>  '',
130
-            'field_icon'          =>  'fa fa-home',
131
-            'css_class'           =>  '',
132
-            'cat_sort'            =>  true,
133
-            'cat_filter'	      =>  true
134
-        )
135
-    );
136
-
137
-    // property bedrooms
138
-    $custom_fields['property_bedrooms'] = array( // The key value should be unique and not contain any spaces.
139
-        'field_type'  =>  'select',
140
-        'class'       =>  'gd-property-bedrooms',
141
-        'icon'        =>  'fa fa-home',
142
-        'name'        =>  __('Property Bedrooms', 'geodirectory'),
143
-        'description' =>  __('Adds a select input for the number of bedrooms.', 'geodirectory'),
144
-        'defaults'    => array(
145
-            'data_type'           =>  'VARCHAR',
146
-            'admin_title'         =>  'Property Bedrooms',
147
-            'site_title'          =>  'Bedrooms',
148
-            'admin_desc'          =>  'Select the number of bedrooms',
149
-            'htmlvar_name'        =>  'property_bedrooms',
150
-            'is_active'           =>  true,
151
-            'for_admin_use'       =>  false,
152
-            'default_value'       =>  '',
153
-            'show_in' 	          =>  '[detail],[listing]',
154
-            'is_required'         =>  true,
155
-            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
156
-            'validation_pattern'  =>  '',
157
-            'validation_msg'      =>  '',
158
-            'required_msg'        =>  '',
159
-            'field_icon'          =>  'fa fa-bed',
160
-            'css_class'           =>  '',
161
-            'cat_sort'            =>  true,
162
-            'cat_filter'	      =>  true
163
-        )
164
-    );
165
-
166
-    // property bathrooms
167
-    $custom_fields['property_bathrooms'] = array( // The key value should be unique and not contain any spaces.
168
-        'field_type'  =>  'select',
169
-        'class'       =>  'gd-property-bathrooms',
170
-        'icon'        =>  'fa fa-home',
171
-        'name'        =>  __('Property Bathrooms', 'geodirectory'),
172
-        'description' =>  __('Adds a select input for the number of bathrooms.', 'geodirectory'),
173
-        'defaults'    => array(
174
-            'data_type'           =>  'VARCHAR',
175
-            'admin_title'         =>  'Property Bathrooms',
176
-            'site_title'          =>  'Bathrooms',
177
-            'admin_desc'          =>  'Select the number of bathrooms',
178
-            'htmlvar_name'        =>  'property_bathrooms',
179
-            'is_active'           =>  true,
180
-            'for_admin_use'       =>  false,
181
-            'default_value'       =>  '',
182
-            'show_in' 	          =>  '[detail],[listing]',
183
-            'is_required'         =>  true,
184
-            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
185
-            'validation_pattern'  =>  '',
186
-            'validation_msg'      =>  '',
187
-            'required_msg'        =>  '',
188
-            'field_icon'          =>  'fa fa-bold',
189
-            'css_class'           =>  '',
190
-            'cat_sort'            =>  true,
191
-            'cat_filter'	      =>  true
192
-        )
193
-    );
194
-
195
-    // property area
196
-    $custom_fields['property_area'] = array( // The key value should be unique and not contain any spaces.
197
-        'field_type'  =>  'text',
198
-        'class'       =>  'gd-area',
199
-        'icon'        =>  'fa fa-home',
200
-        'name'        =>  __('Property Area', 'geodirectory'),
201
-        'description' =>  __('Adds a input for the property area.', 'geodirectory'),
202
-        'defaults'    => array(
203
-            'data_type'           =>  'FLOAT',
204
-            'admin_title'         =>  'Property Area',
205
-            'site_title'          =>  'Area (Sq Ft)',
206
-            'admin_desc'          =>  'Enter the Sq Ft value for the property',
207
-            'htmlvar_name'        =>  'property_area',
208
-            'is_active'           =>  true,
209
-            'for_admin_use'       =>  false,
210
-            'default_value'       =>  '',
211
-            'show_in' 	      =>  '[detail],[listing]',
212
-            'is_required'         =>  false,
213
-            'validation_pattern'  =>  '\d+(\.\d{2})?',
214
-            'validation_msg'      =>  'Please enter the property area in numbers only: 1500',
215
-            'required_msg'        =>  '',
216
-            'field_icon'          =>  'fa fa-area-chart',
217
-            'css_class'           =>  '',
218
-            'cat_sort'            =>  true,
219
-            'cat_filter'	      =>  true
220
-        )
221
-    );
222
-
223
-    // property type
224
-    $custom_fields['property_features'] = array( // The key value should be unique and not contain any spaces.
225
-        'field_type'  =>  'multiselect',
226
-        'class'       =>  'gd-property-features',
227
-        'icon'        =>  'fa fa-home',
228
-        'name'        =>  __('Property Features', 'geodirectory'),
229
-        'description' =>  __('Adds a select input for the property features.', 'geodirectory'),
230
-        'defaults'    => array(
231
-            'data_type'           =>  'VARCHAR',
232
-            'admin_title'         =>  'Property Features',
233
-            'site_title'          =>  'Features',
234
-            'admin_desc'          =>  'Select the property features.',
235
-            'htmlvar_name'        =>  'property_features',
236
-            'is_active'           =>  true,
237
-            'for_admin_use'       =>  false,
238
-            'default_value'       =>  '',
239
-            'show_in' 	          =>  '[detail],[listing]',
240
-            'is_required'         =>  true,
241
-            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
242
-            'validation_pattern'  =>  '',
243
-            'validation_msg'      =>  '',
244
-            'required_msg'        =>  '',
245
-            'field_icon'          =>  'fa fa-plus-square',
246
-            'css_class'           =>  '',
247
-            'cat_sort'            =>  true,
248
-            'cat_filter'	      =>  true
249
-        )
250
-    );
251
-
252
-    // Twitter feed
253
-    $custom_fields['twitter_feed'] = array( // The key value should be unique and not contain any spaces.
254
-        'field_type'  =>  'text',
255
-        'class'       =>  'gd-twitter',
256
-        'icon'        =>  'fa fa-twitter',
257
-        'name'        =>  __('Twitter feed', 'geodirectory'),
258
-        'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
259
-        'defaults'    => array(
260
-            'data_type'           =>  'VARCHAR',
261
-            'admin_title'         =>  'Twitter',
262
-            'site_title'          =>  'Twitter',
263
-            'admin_desc'          =>  'Enter your Twitter username',
264
-            'htmlvar_name'        =>  'twitterusername',
265
-            'is_active'           =>  true,
266
-            'for_admin_use'       =>  false,
267
-            'default_value'       =>  '',
268
-            'show_in' 	      =>  '[detail],[owntab]',
269
-            'is_required'         =>  false,
270
-            'validation_pattern'  =>  '^[A-Za-z0-9_]{1,32}$',
271
-            'validation_msg'      =>  'Please enter a valid twitter username.',
272
-            'required_msg'        =>  '',
273
-            'field_icon'          =>  'fa fa-twitter',
274
-            'css_class'           =>  '',
275
-            'cat_sort'            =>  false,
276
-            'cat_filter'	      =>  false
277
-        )
278
-    );
279
-
280
-    // Get directions link
281
-    $custom_fields['get_directions'] = array( // The key value should be unique and not contain any spaces.
282
-        'field_type'  =>  'text',
283
-        'class'       =>  'gd-get-directions',
284
-        'icon'        =>  'fa fa-location-arrow',
285
-        'name'        =>  __('Get Directions Link', 'geodirectory'),
286
-        'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
287
-        'defaults'    => array(
288
-            'data_type'           =>  'VARCHAR',
289
-            'admin_title'         =>  'Get Directions',
290
-            'site_title'          =>  'Get Directions',
291
-            'admin_desc'          =>  '',
292
-            'htmlvar_name'        =>  'get_directions',
293
-            'is_active'           =>  true,
294
-            'for_admin_use'       =>  true,
295
-            'default_value'       =>  'Get Directions',
296
-            'show_in' 	      =>  '[detail],[listing]',
297
-            'is_required'         =>  false,
298
-            'validation_pattern'  =>  '',
299
-            'validation_msg'      =>  '',
300
-            'required_msg'        =>  '',
301
-            'field_icon'          =>  'fa fa-location-arrow',
302
-            'css_class'           =>  '',
303
-            'cat_sort'            =>  false,
304
-            'cat_filter'	      =>  false
305
-        )
306
-    );
307
-
308
-
309
-
310
-    /**
311
-     * @see `geodir_custom_fields`
312
-     */
313
-    return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
19
+	$custom_fields = array();
20
+
21
+
22
+	// price
23
+	$custom_fields['price'] = array( // The key value should be unique and not contain any spaces.
24
+		'field_type'  =>  'text',
25
+		'class'       =>  'gd-price',
26
+		'icon'        =>  'fa fa-usd',
27
+		'name'        =>  __('Price', 'geodirectory'),
28
+		'description' =>  __('Adds a input for a price field. This will let you filter and sort by price.', 'geodirectory'),
29
+		'defaults'    => array(
30
+			'data_type'           =>  'FLOAT',
31
+			'admin_title'         =>  'Price',
32
+			'site_title'          =>  'Price',
33
+			'admin_desc'          =>  'Enter the price in $ (no currency symbol)',
34
+			'htmlvar_name'        =>  'price',
35
+			'is_active'           =>  true,
36
+			'for_admin_use'       =>  false,
37
+			'default_value'       =>  '',
38
+			'show_in' 	      =>  '[detail],[listing]',
39
+			'is_required'         =>  false,
40
+			'validation_pattern'  =>  '\d+(\.\d{2})?',
41
+			'validation_msg'      =>  'Please enter number and decimal only ie: 100.50',
42
+			'required_msg'        =>  '',
43
+			'field_icon'          =>  'fa fa-usd',
44
+			'css_class'           =>  '',
45
+			'cat_sort'            =>  true,
46
+			'cat_filter'	      =>  true
47
+		)
48
+	);
49
+
50
+	// property status
51
+	$custom_fields['property_status'] = array( // The key value should be unique and not contain any spaces.
52
+		'field_type'  =>  'select',
53
+		'class'       =>  'gd-property-status',
54
+		'icon'        =>  'fa fa-home',
55
+		'name'        =>  __('Property Status', 'geodirectory'),
56
+		'description' =>  __('Adds a select input to be able to set the status of a property ie: For Sale, For Rent', 'geodirectory'),
57
+		'defaults'    => array(
58
+			'data_type'           =>  'VARCHAR',
59
+			'admin_title'         =>  'Property Status',
60
+			'site_title'          =>  'Property Status',
61
+			'admin_desc'          =>  'Enter the status of the property.',
62
+			'htmlvar_name'        =>  'property_status',
63
+			'is_active'           =>  true,
64
+			'for_admin_use'       =>  false,
65
+			'default_value'       =>  '',
66
+			'show_in' 	          =>  '[detail],[listing]',
67
+			'is_required'         =>  true,
68
+			'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
69
+			'validation_pattern'  =>  '',
70
+			'validation_msg'      =>  '',
71
+			'required_msg'        =>  '',
72
+			'field_icon'          =>  'fa fa-home',
73
+			'css_class'           =>  '',
74
+			'cat_sort'            =>  true,
75
+			'cat_filter'	      =>  true
76
+		)
77
+	);
78
+
79
+	// property furnishing
80
+	$custom_fields['property_furnishing'] = array( // The key value should be unique and not contain any spaces.
81
+		'field_type'  =>  'select',
82
+		'class'       =>  'gd-property-furnishing',
83
+		'icon'        =>  'fa fa-home',
84
+		'name'        =>  __('Property Furnishing', 'geodirectory'),
85
+		'description' =>  __('Adds a select input to be able to set the furnishing status of a property ie: Unfurnished, Furnished', 'geodirectory'),
86
+		'defaults'    => array(
87
+			'data_type'           =>  'VARCHAR',
88
+			'admin_title'         =>  'Furnishing',
89
+			'site_title'          =>  'Furnishing',
90
+			'admin_desc'          =>  'Enter the furnishing status of the property.',
91
+			'htmlvar_name'        =>  'property_furnishing',
92
+			'is_active'           =>  true,
93
+			'for_admin_use'       =>  false,
94
+			'default_value'       =>  '',
95
+			'show_in' 	          =>  '[detail],[listing]',
96
+			'is_required'         =>  true,
97
+			'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
98
+			'validation_pattern'  =>  '',
99
+			'validation_msg'      =>  '',
100
+			'required_msg'        =>  '',
101
+			'field_icon'          =>  'fa fa-th-larg',
102
+			'css_class'           =>  '',
103
+			'cat_sort'            =>  true,
104
+			'cat_filter'	      =>  true
105
+		)
106
+	);
107
+
108
+	// property type
109
+	$custom_fields['property_type'] = array( // The key value should be unique and not contain any spaces.
110
+		'field_type'  =>  'select',
111
+		'class'       =>  'gd-property-type',
112
+		'icon'        =>  'fa fa-home',
113
+		'name'        =>  __('Property Type', 'geodirectory'),
114
+		'description' =>  __('Adds a select input for the property type ie: Detached house, Apartment', 'geodirectory'),
115
+		'defaults'    => array(
116
+			'data_type'           =>  'VARCHAR',
117
+			'admin_title'         =>  'Property Type',
118
+			'site_title'          =>  'Property Type',
119
+			'admin_desc'          =>  'Select the property type.',
120
+			'htmlvar_name'        =>  'property_type',
121
+			'is_active'           =>  true,
122
+			'for_admin_use'       =>  false,
123
+			'default_value'       =>  '',
124
+			'show_in' 	          =>  '[detail],[listing]',
125
+			'is_required'         =>  true,
126
+			'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
127
+			'validation_pattern'  =>  '',
128
+			'validation_msg'      =>  '',
129
+			'required_msg'        =>  '',
130
+			'field_icon'          =>  'fa fa-home',
131
+			'css_class'           =>  '',
132
+			'cat_sort'            =>  true,
133
+			'cat_filter'	      =>  true
134
+		)
135
+	);
136
+
137
+	// property bedrooms
138
+	$custom_fields['property_bedrooms'] = array( // The key value should be unique and not contain any spaces.
139
+		'field_type'  =>  'select',
140
+		'class'       =>  'gd-property-bedrooms',
141
+		'icon'        =>  'fa fa-home',
142
+		'name'        =>  __('Property Bedrooms', 'geodirectory'),
143
+		'description' =>  __('Adds a select input for the number of bedrooms.', 'geodirectory'),
144
+		'defaults'    => array(
145
+			'data_type'           =>  'VARCHAR',
146
+			'admin_title'         =>  'Property Bedrooms',
147
+			'site_title'          =>  'Bedrooms',
148
+			'admin_desc'          =>  'Select the number of bedrooms',
149
+			'htmlvar_name'        =>  'property_bedrooms',
150
+			'is_active'           =>  true,
151
+			'for_admin_use'       =>  false,
152
+			'default_value'       =>  '',
153
+			'show_in' 	          =>  '[detail],[listing]',
154
+			'is_required'         =>  true,
155
+			'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
156
+			'validation_pattern'  =>  '',
157
+			'validation_msg'      =>  '',
158
+			'required_msg'        =>  '',
159
+			'field_icon'          =>  'fa fa-bed',
160
+			'css_class'           =>  '',
161
+			'cat_sort'            =>  true,
162
+			'cat_filter'	      =>  true
163
+		)
164
+	);
165
+
166
+	// property bathrooms
167
+	$custom_fields['property_bathrooms'] = array( // The key value should be unique and not contain any spaces.
168
+		'field_type'  =>  'select',
169
+		'class'       =>  'gd-property-bathrooms',
170
+		'icon'        =>  'fa fa-home',
171
+		'name'        =>  __('Property Bathrooms', 'geodirectory'),
172
+		'description' =>  __('Adds a select input for the number of bathrooms.', 'geodirectory'),
173
+		'defaults'    => array(
174
+			'data_type'           =>  'VARCHAR',
175
+			'admin_title'         =>  'Property Bathrooms',
176
+			'site_title'          =>  'Bathrooms',
177
+			'admin_desc'          =>  'Select the number of bathrooms',
178
+			'htmlvar_name'        =>  'property_bathrooms',
179
+			'is_active'           =>  true,
180
+			'for_admin_use'       =>  false,
181
+			'default_value'       =>  '',
182
+			'show_in' 	          =>  '[detail],[listing]',
183
+			'is_required'         =>  true,
184
+			'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
185
+			'validation_pattern'  =>  '',
186
+			'validation_msg'      =>  '',
187
+			'required_msg'        =>  '',
188
+			'field_icon'          =>  'fa fa-bold',
189
+			'css_class'           =>  '',
190
+			'cat_sort'            =>  true,
191
+			'cat_filter'	      =>  true
192
+		)
193
+	);
194
+
195
+	// property area
196
+	$custom_fields['property_area'] = array( // The key value should be unique and not contain any spaces.
197
+		'field_type'  =>  'text',
198
+		'class'       =>  'gd-area',
199
+		'icon'        =>  'fa fa-home',
200
+		'name'        =>  __('Property Area', 'geodirectory'),
201
+		'description' =>  __('Adds a input for the property area.', 'geodirectory'),
202
+		'defaults'    => array(
203
+			'data_type'           =>  'FLOAT',
204
+			'admin_title'         =>  'Property Area',
205
+			'site_title'          =>  'Area (Sq Ft)',
206
+			'admin_desc'          =>  'Enter the Sq Ft value for the property',
207
+			'htmlvar_name'        =>  'property_area',
208
+			'is_active'           =>  true,
209
+			'for_admin_use'       =>  false,
210
+			'default_value'       =>  '',
211
+			'show_in' 	      =>  '[detail],[listing]',
212
+			'is_required'         =>  false,
213
+			'validation_pattern'  =>  '\d+(\.\d{2})?',
214
+			'validation_msg'      =>  'Please enter the property area in numbers only: 1500',
215
+			'required_msg'        =>  '',
216
+			'field_icon'          =>  'fa fa-area-chart',
217
+			'css_class'           =>  '',
218
+			'cat_sort'            =>  true,
219
+			'cat_filter'	      =>  true
220
+		)
221
+	);
222
+
223
+	// property type
224
+	$custom_fields['property_features'] = array( // The key value should be unique and not contain any spaces.
225
+		'field_type'  =>  'multiselect',
226
+		'class'       =>  'gd-property-features',
227
+		'icon'        =>  'fa fa-home',
228
+		'name'        =>  __('Property Features', 'geodirectory'),
229
+		'description' =>  __('Adds a select input for the property features.', 'geodirectory'),
230
+		'defaults'    => array(
231
+			'data_type'           =>  'VARCHAR',
232
+			'admin_title'         =>  'Property Features',
233
+			'site_title'          =>  'Features',
234
+			'admin_desc'          =>  'Select the property features.',
235
+			'htmlvar_name'        =>  'property_features',
236
+			'is_active'           =>  true,
237
+			'for_admin_use'       =>  false,
238
+			'default_value'       =>  '',
239
+			'show_in' 	          =>  '[detail],[listing]',
240
+			'is_required'         =>  true,
241
+			'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
242
+			'validation_pattern'  =>  '',
243
+			'validation_msg'      =>  '',
244
+			'required_msg'        =>  '',
245
+			'field_icon'          =>  'fa fa-plus-square',
246
+			'css_class'           =>  '',
247
+			'cat_sort'            =>  true,
248
+			'cat_filter'	      =>  true
249
+		)
250
+	);
251
+
252
+	// Twitter feed
253
+	$custom_fields['twitter_feed'] = array( // The key value should be unique and not contain any spaces.
254
+		'field_type'  =>  'text',
255
+		'class'       =>  'gd-twitter',
256
+		'icon'        =>  'fa fa-twitter',
257
+		'name'        =>  __('Twitter feed', 'geodirectory'),
258
+		'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
259
+		'defaults'    => array(
260
+			'data_type'           =>  'VARCHAR',
261
+			'admin_title'         =>  'Twitter',
262
+			'site_title'          =>  'Twitter',
263
+			'admin_desc'          =>  'Enter your Twitter username',
264
+			'htmlvar_name'        =>  'twitterusername',
265
+			'is_active'           =>  true,
266
+			'for_admin_use'       =>  false,
267
+			'default_value'       =>  '',
268
+			'show_in' 	      =>  '[detail],[owntab]',
269
+			'is_required'         =>  false,
270
+			'validation_pattern'  =>  '^[A-Za-z0-9_]{1,32}$',
271
+			'validation_msg'      =>  'Please enter a valid twitter username.',
272
+			'required_msg'        =>  '',
273
+			'field_icon'          =>  'fa fa-twitter',
274
+			'css_class'           =>  '',
275
+			'cat_sort'            =>  false,
276
+			'cat_filter'	      =>  false
277
+		)
278
+	);
279
+
280
+	// Get directions link
281
+	$custom_fields['get_directions'] = array( // The key value should be unique and not contain any spaces.
282
+		'field_type'  =>  'text',
283
+		'class'       =>  'gd-get-directions',
284
+		'icon'        =>  'fa fa-location-arrow',
285
+		'name'        =>  __('Get Directions Link', 'geodirectory'),
286
+		'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
287
+		'defaults'    => array(
288
+			'data_type'           =>  'VARCHAR',
289
+			'admin_title'         =>  'Get Directions',
290
+			'site_title'          =>  'Get Directions',
291
+			'admin_desc'          =>  '',
292
+			'htmlvar_name'        =>  'get_directions',
293
+			'is_active'           =>  true,
294
+			'for_admin_use'       =>  true,
295
+			'default_value'       =>  'Get Directions',
296
+			'show_in' 	      =>  '[detail],[listing]',
297
+			'is_required'         =>  false,
298
+			'validation_pattern'  =>  '',
299
+			'validation_msg'      =>  '',
300
+			'required_msg'        =>  '',
301
+			'field_icon'          =>  'fa fa-location-arrow',
302
+			'css_class'           =>  '',
303
+			'cat_sort'            =>  false,
304
+			'cat_filter'	      =>  false
305
+		)
306
+	);
307
+
308
+
309
+
310
+	/**
311
+	 * @see `geodir_custom_fields`
312
+	 */
313
+	return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
314 314
 }
315 315
 
316 316
 
@@ -325,32 +325,32 @@  discard block
 block discarded – undo
325 325
  * @return string The html to output.
326 326
  */
327 327
 function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){
328
-    global $post;
328
+	global $post;
329 329
 
330 330
 
331
-    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
331
+	if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
332 332
 
333
-        $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
333
+		$class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
334 334
 
335
-        $field_icon = geodir_field_icon_proccess($cf);
336
-        if (strpos($field_icon, 'http') !== false) {
337
-            $field_icon_af = '';
338
-        } elseif ($field_icon == '') {
339
-            $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
340
-        } else {
341
-            $field_icon_af = $field_icon;
342
-            $field_icon = '';
343
-        }
335
+		$field_icon = geodir_field_icon_proccess($cf);
336
+		if (strpos($field_icon, 'http') !== false) {
337
+			$field_icon_af = '';
338
+		} elseif ($field_icon == '') {
339
+			$field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
340
+		} else {
341
+			$field_icon_af = $field_icon;
342
+			$field_icon = '';
343
+		}
344 344
 
345 345
 
346
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
346
+		$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
347 347
 
348
-        $html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>';
349
-        $html .= '</div>';
348
+		$html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>';
349
+		$html .= '</div>';
350 350
 
351
-    endif;
351
+	endif;
352 352
 
353
-    return $html;
353
+	return $html;
354 354
 }
355 355
 add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3);
356 356
 
@@ -365,36 +365,36 @@  discard block
 block discarded – undo
365 365
  * @return string The html to output.
366 366
  */
367 367
 function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) {
368
-    global $post;
368
+	global $post;
369 369
 
370 370
 
371
-    if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
371
+	if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
372 372
 
373
-        $field_icon = geodir_field_icon_proccess( $cf );
374
-        if ( strpos( $field_icon, 'http' ) !== false ) {
375
-            $field_icon_af = '';
376
-        } elseif ( $field_icon == '' ) {
377
-            $field_icon_af = '<i class="fa fa-location-arrow"></i>';
378
-        } else {
379
-            $field_icon_af = $field_icon;
380
-            $field_icon    = '';
381
-        }
373
+		$field_icon = geodir_field_icon_proccess( $cf );
374
+		if ( strpos( $field_icon, 'http' ) !== false ) {
375
+			$field_icon_af = '';
376
+		} elseif ( $field_icon == '' ) {
377
+			$field_icon_af = '<i class="fa fa-location-arrow"></i>';
378
+		} else {
379
+			$field_icon_af = $field_icon;
380
+			$field_icon    = '';
381
+		}
382 382
 
383
-        $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
383
+		$link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
384 384
 
385
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
385
+		$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
386 386
 
387
-        if(isset( $cf['field_icon'] ) && $cf['field_icon']){
388
-            $html .= $field_icon_af;
389
-        }
387
+		if(isset( $cf['field_icon'] ) && $cf['field_icon']){
388
+			$html .= $field_icon_af;
389
+		}
390 390
 
391
-        $html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>';
392
-        $html .= '</div>';
391
+		$html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>';
392
+		$html .= '</div>';
393 393
 
394
-    }else{
395
-        $html ='';
396
-    }
394
+	}else{
395
+		$html ='';
396
+	}
397 397
 
398
-    return $html;
398
+	return $html;
399 399
 }
400 400
 add_filter('geodir_custom_field_output_text_key_get_directions','geodir_predefined_custom_field_output_get_directions',10,3);
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @since 1.6.9
15 15
  * @package GeoDirectory
16 16
  */
17
-function geodir_custom_fields_predefined($post_type=''){
17
+function geodir_custom_fields_predefined($post_type = '') {
18 18
 
19 19
     $custom_fields = array();
20 20
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             'default_value'       =>  '',
66 66
             'show_in' 	          =>  '[detail],[listing]',
67 67
             'is_required'         =>  true,
68
-            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
68
+            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let', 'geodirectory'),
69 69
             'validation_pattern'  =>  '',
70 70
             'validation_msg'      =>  '',
71 71
             'required_msg'        =>  '',
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             'default_value'       =>  '',
95 95
             'show_in' 	          =>  '[detail],[listing]',
96 96
             'is_required'         =>  true,
97
-            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
97
+            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional', 'geodirectory'),
98 98
             'validation_pattern'  =>  '',
99 99
             'validation_msg'      =>  '',
100 100
             'required_msg'        =>  '',
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             'default_value'       =>  '',
124 124
             'show_in' 	          =>  '[detail],[listing]',
125 125
             'is_required'         =>  true,
126
-            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
126
+            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage', 'geodirectory'),
127 127
             'validation_pattern'  =>  '',
128 128
             'validation_msg'      =>  '',
129 129
             'required_msg'        =>  '',
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             'default_value'       =>  '',
153 153
             'show_in' 	          =>  '[detail],[listing]',
154 154
             'is_required'         =>  true,
155
-            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
155
+            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'),
156 156
             'validation_pattern'  =>  '',
157 157
             'validation_msg'      =>  '',
158 158
             'required_msg'        =>  '',
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             'default_value'       =>  '',
182 182
             'show_in' 	          =>  '[detail],[listing]',
183 183
             'is_required'         =>  true,
184
-            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
184
+            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'),
185 185
             'validation_pattern'  =>  '',
186 186
             'validation_msg'      =>  '',
187 187
             'required_msg'        =>  '',
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
             'default_value'       =>  '',
239 239
             'show_in' 	          =>  '[detail],[listing]',
240 240
             'is_required'         =>  true,
241
-            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
241
+            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace', 'geodirectory'),
242 242
             'validation_pattern'  =>  '',
243 243
             'validation_msg'      =>  '',
244 244
             'required_msg'        =>  '',
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
     /**
311 311
      * @see `geodir_custom_fields`
312 312
      */
313
-    return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
313
+    return apply_filters('geodir_custom_fields_predefined', $custom_fields, $post_type);
314 314
 }
315 315
 
316 316
 
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
  * @since 1.6.9
325 325
  * @return string The html to output.
326 326
  */
327
-function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){
327
+function geodir_predefined_custom_field_output_twitter_feed($html, $location, $cf) {
328 328
     global $post;
329 329
 
330 330
 
331
-    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
331
+    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
332 332
 
333 333
         $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
334 334
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         }
344 344
 
345 345
 
346
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
346
+        $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;">';
347 347
 
348 348
         $html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>';
349 349
         $html .= '</div>';
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
     return $html;
354 354
 }
355
-add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3);
355
+add_filter('geodir_custom_field_output_text_key_twitter_feed', 'geodir_predefined_custom_field_output_twitter_feed', 10, 3);
356 356
 
357 357
 /**
358 358
  * Filter the get_directions custom field output to show a link.
@@ -364,37 +364,37 @@  discard block
 block discarded – undo
364 364
  * @since 1.6.9
365 365
  * @return string The html to output.
366 366
  */
367
-function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) {
367
+function geodir_predefined_custom_field_output_get_directions($html, $location, $cf) {
368 368
     global $post;
369 369
 
370 370
 
371
-    if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
371
+    if (isset($post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset($post->post_latitude) && $post->post_latitude) {
372 372
 
373
-        $field_icon = geodir_field_icon_proccess( $cf );
374
-        if ( strpos( $field_icon, 'http' ) !== false ) {
373
+        $field_icon = geodir_field_icon_proccess($cf);
374
+        if (strpos($field_icon, 'http') !== false) {
375 375
             $field_icon_af = '';
376
-        } elseif ( $field_icon == '' ) {
376
+        } elseif ($field_icon == '') {
377 377
             $field_icon_af = '<i class="fa fa-location-arrow"></i>';
378 378
         } else {
379 379
             $field_icon_af = $field_icon;
380 380
             $field_icon    = '';
381 381
         }
382 382
 
383
-        $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
383
+        $link_text = isset($post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __('Get Directions', 'geodirectory');
384 384
 
385
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
385
+        $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;">';
386 386
 
387
-        if(isset( $cf['field_icon'] ) && $cf['field_icon']){
387
+        if (isset($cf['field_icon']) && $cf['field_icon']) {
388 388
             $html .= $field_icon_af;
389 389
         }
390 390
 
391
-        $html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>';
391
+        $html .= '<a href="https://www.google.com/maps/dir//\''.$post->post_latitude.','.$post->post_longitude.'\'/" target="_blank" >'.$link_text.'</a>';
392 392
         $html .= '</div>';
393 393
 
394
-    }else{
395
-        $html ='';
394
+    } else {
395
+        $html = '';
396 396
     }
397 397
 
398 398
     return $html;
399 399
 }
400
-add_filter('geodir_custom_field_output_text_key_get_directions','geodir_predefined_custom_field_output_get_directions',10,3);
400
+add_filter('geodir_custom_field_output_text_key_get_directions', 'geodir_predefined_custom_field_output_get_directions', 10, 3);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -353,7 +353,7 @@
 block discarded – undo
353 353
 
354 354
     if(!$cpt_left){
355 355
         $cpt_left = "gd-cpt-flat";
356
-    }else{
356
+    } else{
357 357
         $cpt_left = '';
358 358
     }
359 359
 
Please login to merge, or discard this patch.