Test Failed
Pull Request — master (#296)
by Viruthagiri
11:50
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 = stripslashes_deep(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 = stripslashes_deep(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.
Braces   +136 added lines, -94 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@  discard block
 block discarded – undo
51 51
         global $wpdb;
52 52
         $result = 0;// no rows affected
53 53
         if (!geodir_column_exist($db, $column)) {
54
-            if (!empty($db) && !empty($column))
55
-                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
54
+            if (!empty($db) && !empty($column)) {
55
+                            $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
+            }
56 57
         }
57 58
         return $result;
58 59
     }
@@ -82,10 +83,11 @@  discard block
 block discarded – undo
82 83
 
83 84
     $default_query = '';
84 85
 
85
-    if ($default == 'default')
86
-        $default_query .= " and is_admin IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query .= " and is_admin = '0' ";
86
+    if ($default == 'default') {
87
+            $default_query .= " and is_admin IN ('1') ";
88
+    } elseif ($default == 'custom') {
89
+            $default_query .= " and is_admin = '0' ";
90
+    }
89 91
 
90 92
     if ($fields_location == 'none') {
91 93
     } else{
@@ -239,10 +241,12 @@  discard block
 block discarded – undo
239 241
                 }
240 242
 
241 243
                 return $field_id;
242
-            } else
243
-                return 0;
244
-        } else
245
-            return 0;
244
+            } else {
245
+                            return 0;
246
+            }
247
+        } else {
248
+                    return 0;
249
+        }
246 250
     }
247 251
 }
248 252
 
@@ -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.
@@ -1491,10 +1516,11 @@  discard block
 block discarded – undo
1491 1516
      */
1492 1517
     function geodir_default_date_format()
1493 1518
     {
1494
-        if ($format = get_option('date_format'))
1495
-            return $format;
1496
-        else
1497
-            return 'dd-mm-yy';
1519
+        if ($format = get_option('date_format')) {
1520
+                    return $format;
1521
+        } else {
1522
+                    return 'dd-mm-yy';
1523
+        }
1498 1524
     }
1499 1525
 }
1500 1526
 
@@ -1601,11 +1627,13 @@  discard block
 block discarded – undo
1601 1627
                     // Set an array containing a list of acceptable formats
1602 1628
                     //$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');
1603 1629
 
1604
-                    if (!function_exists('wp_handle_upload'))
1605
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1630
+                    if (!function_exists('wp_handle_upload')) {
1631
+                                            require_once(ABSPATH . 'wp-admin/includes/file.php');
1632
+                    }
1606 1633
 
1607
-                    if (!is_dir($geodir_uploadpath))
1608
-                        mkdir($geodir_uploadpath);
1634
+                    if (!is_dir($geodir_uploadpath)) {
1635
+                                            mkdir($geodir_uploadpath);
1636
+                    }
1609 1637
 
1610 1638
                     $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1611 1639
                     $explode_sub_dir = explode("/", $sub_dir);
@@ -1618,16 +1646,19 @@  discard block
 block discarded – undo
1618 1646
                     }
1619 1647
 
1620 1648
                     $uploaded_file = '';
1621
-                    if (file_exists($img_path))
1622
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1649
+                    if (file_exists($img_path)) {
1650
+                                            $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1651
+                    }
1623 1652
 
1624 1653
                     if ($curr_img_dir != $geodir_uploaddir) {
1625
-                        if (file_exists($img_path))
1626
-                            unlink($img_path);
1654
+                        if (file_exists($img_path)) {
1655
+                                                    unlink($img_path);
1656
+                        }
1627 1657
                     }
1628 1658
 
1629
-                    if (!empty($uploaded_file))
1630
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1659
+                    if (!empty($uploaded_file)) {
1660
+                                            $file_urls = $geodir_uploadurl . '/' . $new_name;
1661
+                    }
1631 1662
 
1632 1663
                 } else {
1633 1664
                     $file_urls = $post_image[$m];
@@ -1648,8 +1679,9 @@  discard block
 block discarded – undo
1648 1679
 
1649 1680
         geodir_save_post_meta($post_id, $field_id, $file_urls);
1650 1681
 
1651
-        if (!empty($invalid_files))
1652
-            geodir_remove_attachments($invalid_files);
1682
+        if (!empty($invalid_files)) {
1683
+                    geodir_remove_attachments($invalid_files);
1684
+        }
1653 1685
 
1654 1686
     }
1655 1687
 }
@@ -1875,8 +1907,9 @@  discard block
 block discarded – undo
1875 1907
 
1876 1908
         $all_postypes = geodir_get_posttypes();
1877 1909
 
1878
-        if (!in_array($post_type, $all_postypes))
1879
-            return false;
1910
+        if (!in_array($post_type, $all_postypes)) {
1911
+                    return false;
1912
+        }
1880 1913
 
1881 1914
         $fields = array();
1882 1915
 
@@ -1974,8 +2007,10 @@  discard block
 block discarded – undo
1974 2007
         }
1975 2008
 
1976 2009
         return $field_ids;
1977
-    else:
1978
-        return false;
2010
+    else {
2011
+    	:
2012
+        return false;
2013
+    }
1979 2014
     endif;
1980 2015
 }
1981 2016
 
@@ -2148,8 +2183,9 @@  discard block
 block discarded – undo
2148 2183
 
2149 2184
             return $field_id;
2150 2185
 
2151
-        } else
2152
-            return 0;
2186
+        } else {
2187
+                    return 0;
2188
+        }
2153 2189
 
2154 2190
     }
2155 2191
 }
@@ -2190,8 +2226,9 @@  discard block
 block discarded – undo
2190 2226
         $htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2191 2227
 
2192 2228
         $site_title = '';
2193
-        if ($site_title == '')
2194
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2229
+        if ($site_title == '') {
2230
+                    $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2231
+        }
2195 2232
 
2196 2233
         if ($site_title == '') {
2197 2234
             $fields = geodir_get_custom_sort_options($post_type);
@@ -2205,8 +2242,9 @@  discard block
 block discarded – undo
2205 2242
             }
2206 2243
         }
2207 2244
 
2208
-        if ($htmlvar_name == '')
2209
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2245
+        if ($htmlvar_name == '') {
2246
+                    $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2247
+        }
2210 2248
 
2211 2249
         $nonce = wp_create_nonce('custom_fields_' . $result_str);
2212 2250
 
@@ -2219,7 +2257,7 @@  discard block
 block discarded – undo
2219 2257
 
2220 2258
                 if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2221 2259
                     $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2222
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2260
+                } elseif(isset($cso['field_icon']) && $cso['field_icon']){
2223 2261
                     $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2224 2262
                 }
2225 2263
 
@@ -2654,7 +2692,7 @@  discard block
 block discarded – undo
2654 2692
     $dt_value = '';
2655 2693
     if (isset($field_info->data_type)) {
2656 2694
         $dt_value  = esc_attr($field_info->data_type);
2657
-    }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2695
+    } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2658 2696
         $dt_value  = $cf['defaults']['data_type'];
2659 2697
     }
2660 2698
     ?>
@@ -2686,7 +2724,7 @@  discard block
 block discarded – undo
2686 2724
     $value = '';
2687 2725
     if (isset($field_info->decimal_point)) {
2688 2726
         $value = esc_attr($field_info->decimal_point);
2689
-    }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2727
+    } elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2690 2728
         $value = $cf['defaults']['decimal_point'];
2691 2729
     }
2692 2730
     ?>
@@ -2760,11 +2798,13 @@  discard block
 block discarded – undo
2760 2798
 
2761 2799
             <?php
2762 2800
             $selected = '';
2763
-            if (isset($field_info->extra_fields))
2764
-                $advanced_editor = unserialize($field_info->extra_fields);
2801
+            if (isset($field_info->extra_fields)) {
2802
+                            $advanced_editor = unserialize($field_info->extra_fields);
2803
+            }
2765 2804
 
2766
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2767
-                $selected = 'checked="checked"';
2805
+            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) {
2806
+                            $selected = 'checked="checked"';
2807
+            }
2768 2808
             ?>
2769 2809
 
2770 2810
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
@@ -2786,7 +2826,7 @@  discard block
 block discarded – undo
2786 2826
     $value = '';
2787 2827
     if (isset($field_info->validation_pattern)) {
2788 2828
         $value = esc_attr($field_info->validation_pattern);
2789
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2829
+    } elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2790 2830
         $value = esc_attr($cf['defaults']['validation_pattern']);
2791 2831
     }
2792 2832
     ?>
@@ -2806,7 +2846,7 @@  discard block
 block discarded – undo
2806 2846
     $value = '';
2807 2847
     if (isset($field_info->validation_msg)) {
2808 2848
         $value = esc_attr($field_info->validation_msg);
2809
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2849
+    } elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2810 2850
         $value = esc_attr($cf['defaults']['validation_msg']);
2811 2851
     }
2812 2852
     ?>
@@ -2836,8 +2876,9 @@  discard block
 block discarded – undo
2836 2876
 
2837 2877
     if (!isset($field_info->post_type)) {
2838 2878
         $post_type = sanitize_text_field($_REQUEST['listing_type']);
2839
-    } else
2840
-        $post_type = $field_info->post_type;
2879
+    } else {
2880
+            $post_type = $field_info->post_type;
2881
+    }
2841 2882
     ?>
2842 2883
     <li style="display: none;">
2843 2884
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
@@ -3111,7 +3152,7 @@  discard block
 block discarded – undo
3111 3152
     $value = '';
3112 3153
     if (isset($field_info->option_values)) {
3113 3154
         $value = esc_attr($field_info->option_values);
3114
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3155
+    } elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3115 3156
         $value = esc_attr($cf['defaults']['option_values']);
3116 3157
     }
3117 3158
 
@@ -3254,7 +3295,7 @@  discard block
 block discarded – undo
3254 3295
     $value = '';
3255 3296
     if ($extra_fields && isset($extra_fields['is_price'])) {
3256 3297
     $value = esc_attr($extra_fields['is_price']);
3257
-    }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3298
+    } elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3258 3299
     $value = esc_attr($cf['defaults']['extra_fields']['is_price']);
3259 3300
     }
3260 3301
 
@@ -3289,7 +3330,7 @@  discard block
 block discarded – undo
3289 3330
     $value = '';
3290 3331
     if ($extra_fields && isset($extra_fields['thousand_separator'])) {
3291 3332
         $value = esc_attr($extra_fields['thousand_separator']);
3292
-    }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3333
+    } elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3293 3334
         $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']);
3294 3335
     }
3295 3336
     ?>
@@ -3316,7 +3357,7 @@  discard block
 block discarded – undo
3316 3357
     $value = '';
3317 3358
     if ($extra_fields && isset($extra_fields['decimal_separator'])) {
3318 3359
         $value = esc_attr($extra_fields['decimal_separator']);
3319
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3360
+    } elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3320 3361
         $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']);
3321 3362
     }
3322 3363
     ?>
@@ -3339,7 +3380,7 @@  discard block
 block discarded – undo
3339 3380
     $value = '';
3340 3381
     if ($extra_fields && isset($extra_fields['decimal_display'])) {
3341 3382
         $value = esc_attr($extra_fields['decimal_display']);
3342
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3383
+    } elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3343 3384
         $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']);
3344 3385
     }
3345 3386
     ?>
@@ -3362,7 +3403,7 @@  discard block
 block discarded – undo
3362 3403
     $value = '';
3363 3404
     if ($extra_fields && isset($extra_fields['currency_symbol'])) {
3364 3405
         $value = esc_attr($extra_fields['currency_symbol']);
3365
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3406
+    } elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3366 3407
         $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']);
3367 3408
     }
3368 3409
     ?>
@@ -3383,7 +3424,7 @@  discard block
 block discarded – undo
3383 3424
     $value = '';
3384 3425
     if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
3385 3426
         $value = esc_attr($extra_fields['currency_symbol_placement']);
3386
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3427
+    } elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3387 3428
         $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']);
3388 3429
     }
3389 3430
     ?>
@@ -3610,8 +3651,9 @@  discard block
 block discarded – undo
3610 3651
     $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left';
3611 3652
 
3612 3653
     if($decimals>0 && $decimal_display=='if'){
3613
-        if(is_int($number) || floor( $number ) == $number)
3614
-            $decimals = 0;
3654
+        if(is_int($number) || floor( $number ) == $number) {
3655
+                    $decimals = 0;
3656
+        }
3615 3657
     }
3616 3658
 
3617 3659
     $number = number_format($number,$decimals,$decimalpoint,$separator);
@@ -3620,7 +3662,7 @@  discard block
 block discarded – undo
3620 3662
 
3621 3663
     if($currency_symbol_placement=='left'){
3622 3664
         $number = $symbol . $number;
3623
-    }else{
3665
+    } else{
3624 3666
         $number = $number . $symbol;
3625 3667
     }
3626 3668
 
Please login to merge, or discard this patch.
Spacing   +414 added lines, -414 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
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
306 306
 
307 307
         // some servers fail if a POST value is VARCHAR so we change it.
308
-        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
308
+        if (isset($request_field['data_type']) && $request_field['data_type'] == 'XVARCHAR') {
309 309
             $request_field['data_type'] = 'VARCHAR';
310 310
         }
311 311
 
@@ -318,12 +318,12 @@  discard block
 block discarded – undo
318 318
         $post_type = $request_field['listing_type'];
319 319
 
320 320
         if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
321
-            $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
321
+            $cehhtmlvar_name = 'geodir_'.$cehhtmlvar_name;
322 322
         }
323 323
 
324 324
         $check_html_variable = $wpdb->get_var(
325 325
             $wpdb->prepare(
326
-                "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
326
+                "select htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where id <> %d and htmlvar_name = %s and post_type = %s ",
327 327
                 array($cf, $cehhtmlvar_name, $post_type)
328 328
             )
329 329
         );
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 
336 336
                 $post_meta_info = $wpdb->get_row(
337 337
                     $wpdb->prepare(
338
-                        "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
338
+                        "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id = %d",
339 339
                         array($cf)
340 340
                     )
341 341
                 );
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
             if ($post_type == '') $post_type = 'gd_place';
354 354
 
355 355
 
356
-            $detail_table = $plugin_prefix . $post_type . '_detail';
356
+            $detail_table = $plugin_prefix.$post_type.'_detail';
357 357
 
358 358
             $admin_title = $request_field['admin_title'];
359 359
             $site_title = $request_field['site_title'];
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
             $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
382 382
 
383 383
             
384
-            if(is_array($show_in)){
384
+            if (is_array($show_in)) {
385 385
                 $show_in = implode(",", $request_field['show_in']);
386 386
             }
387 387
             
388 388
             if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
389
-                $htmlvar_name = 'geodir_' . $htmlvar_name;
389
+                $htmlvar_name = 'geodir_'.$htmlvar_name;
390 390
             }
391 391
 
392 392
             $option_values = '';
@@ -427,9 +427,9 @@  discard block
 block discarded – undo
427 427
 
428 428
             if ($sort_order == '') {
429 429
 
430
-                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
430
+                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM ".GEODIR_CUSTOM_FIELDS_TABLE);
431 431
 
432
-                $sort_order = (int)$last_order + 1;
432
+                $sort_order = (int) $last_order + 1;
433 433
             }
434 434
 
435 435
             $default_value_add = '';
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
                     case 'address':
442 442
 
443 443
                         if ($htmlvar_name != '') {
444
-                            $prefix = $htmlvar_name . '_';
444
+                            $prefix = $htmlvar_name.'_';
445 445
                         }
446
-                        $old_prefix = $old_html_variable . '_';
446
+                        $old_prefix = $old_html_variable.'_';
447 447
 
448 448
 
449
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
449
+                        $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."address` `".$prefix."address` VARCHAR( 254 ) NULL";
450 450
 
451 451
                         if ($default_value != '') {
452
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
452
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
453 453
                         }
454 454
 
455 455
                         $wpdb->query($meta_field_add);
@@ -458,12 +458,12 @@  discard block
 block discarded – undo
458 458
 
459 459
                             if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
460 460
 
461
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
461
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."city'");
462 462
                                 if ($is_column) {
463
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
463
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."city` `".$prefix."city` VARCHAR( 50 ) NULL";
464 464
 
465 465
                                     if ($default_value != '') {
466
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
466
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
467 467
                                     }
468 468
 
469 469
                                     $wpdb->query($meta_field_add);
@@ -471,9 +471,9 @@  discard block
 block discarded – undo
471 471
 
472 472
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
473 473
                                     if ($default_value != '') {
474
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
474
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
475 475
                                     }
476
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
476
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add);
477 477
 
478 478
                                 }
479 479
 
@@ -483,36 +483,36 @@  discard block
 block discarded – undo
483 483
 
484 484
                             if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
485 485
 
486
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
486
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."region'");
487 487
 
488 488
                                 if ($is_column) {
489
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
489
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."region` `".$prefix."region` VARCHAR( 50 ) NULL";
490 490
 
491 491
                                     if ($default_value != '') {
492
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
492
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
493 493
                                     }
494 494
 
495 495
                                     $wpdb->query($meta_field_add);
496 496
                                 } else {
497 497
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
498 498
                                     if ($default_value != '') {
499
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
499
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
500 500
                                     }
501 501
 
502
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
502
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add);
503 503
                                 }
504 504
 
505 505
                             }
506 506
                             if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
507 507
 
508
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
508
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."country'");
509 509
 
510 510
                                 if ($is_column) {
511 511
 
512
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
512
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."country` `".$prefix."country` VARCHAR( 50 ) NULL";
513 513
 
514 514
                                     if ($default_value != '') {
515
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
515
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
516 516
                                     }
517 517
 
518 518
                                     $wpdb->query($meta_field_add);
@@ -520,24 +520,24 @@  discard block
 block discarded – undo
520 520
 
521 521
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
522 522
                                     if ($default_value != '') {
523
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
523
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
524 524
                                     }
525 525
 
526
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
526
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add);
527 527
 
528 528
                                 }
529 529
 
530 530
                             }
531 531
                             if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
532 532
 
533
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
533
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."zip'");
534 534
 
535 535
                                 if ($is_column) {
536 536
 
537
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
537
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."zip` `".$prefix."zip` VARCHAR( 50 ) NULL";
538 538
 
539 539
                                     if ($default_value != '') {
540
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
540
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
541 541
                                     }
542 542
 
543 543
                                     $wpdb->query($meta_field_add);
@@ -545,128 +545,128 @@  discard block
 block discarded – undo
545 545
 
546 546
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
547 547
                                     if ($default_value != '') {
548
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
548
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
549 549
                                     }
550 550
 
551
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
551
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add);
552 552
 
553 553
                                 }
554 554
 
555 555
                             }
556 556
                             if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
557 557
 
558
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
558
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latitude'");
559 559
                                 if ($is_column) {
560 560
 
561
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
561
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latitude` `".$prefix."latitude` VARCHAR( 20 ) NULL";
562 562
 
563 563
                                     if ($default_value != '') {
564
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
564
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
565 565
                                     }
566 566
 
567 567
                                     $wpdb->query($meta_field_add);
568 568
                                 } else {
569 569
 
570
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
570
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL";
571 571
                                     $meta_field_add = "VARCHAR( 20 ) NULL";
572 572
                                     if ($default_value != '') {
573
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
573
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
574 574
                                     }
575 575
 
576
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
576
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add);
577 577
 
578 578
                                 }
579 579
 
580 580
 
581
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
581
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."longitude'");
582 582
 
583 583
                                 if ($is_column) {
584
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
584
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."longitude` `".$prefix."longitude` VARCHAR( 20 ) NULL";
585 585
 
586 586
                                     if ($default_value != '') {
587
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
587
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
588 588
                                     }
589 589
 
590 590
                                     $wpdb->query($meta_field_add);
591 591
                                 } else {
592 592
 
593
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
593
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL";
594 594
                                     $meta_field_add = "VARCHAR( 20 ) NULL";
595 595
                                     if ($default_value != '') {
596
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
596
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
597 597
                                     }
598 598
 
599
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
599
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add);
600 600
                                 }
601 601
 
602 602
                             }
603 603
                             if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
604 604
 
605
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
605
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapview'");
606 606
 
607 607
                                 if ($is_column) {
608
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
608
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapview` `".$prefix."mapview` VARCHAR( 15 ) NULL";
609 609
 
610 610
                                     if ($default_value != '') {
611
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
611
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
612 612
                                     }
613 613
 
614 614
                                     $wpdb->query($meta_field_add);
615 615
                                 } else {
616 616
 
617
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
617
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL";
618 618
 
619 619
                                     $meta_field_add = "VARCHAR( 15 ) NULL";
620 620
                                     if ($default_value != '') {
621
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
621
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
622 622
                                     }
623 623
 
624
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
624
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add);
625 625
                                 }
626 626
 
627 627
 
628 628
                             }
629 629
                             if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
630 630
 
631
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
631
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapzoom'");
632 632
                                 if ($is_column) {
633
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
633
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapzoom` `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
634 634
 
635 635
                                     if ($default_value != '') {
636
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
636
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
637 637
                                     }
638 638
 
639 639
                                     $wpdb->query($meta_field_add);
640 640
 
641 641
                                 } else {
642 642
 
643
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
643
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
644 644
 
645 645
                                     $meta_field_add = "VARCHAR( 3 ) NULL";
646 646
                                     if ($default_value != '') {
647
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
647
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
648 648
                                     }
649 649
 
650
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
650
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add);
651 651
                                 }
652 652
 
653 653
                             }
654 654
                             // show lat lng
655 655
                             if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
656
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
656
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latlng'");
657 657
 
658 658
                                 if ($is_column) {
659
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
659
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latlng` `".$prefix."latlng` VARCHAR( 3 ) NULL";
660 660
                                     $meta_field_add .= " DEFAULT '1'";
661 661
 
662 662
                                     $wpdb->query($meta_field_add);
663 663
                                 } else {
664
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
664
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL";
665 665
 
666 666
                                     $meta_field_add = "VARCHAR( 3 ) NULL";
667 667
                                     $meta_field_add .= " DEFAULT '1'";
668 668
 
669
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
669
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add);
670 670
                                 }
671 671
 
672 672
                             }
@@ -682,30 +682,30 @@  discard block
 block discarded – undo
682 682
                         $op_size = '500';
683 683
 
684 684
                         // only make the field as big as it needs to be.
685
-                        if(isset($option_values) && $option_values && $field_type=='select'){
686
-                            $option_values_arr = explode(',',$option_values);
687
-                            if(is_array($option_values_arr)){
685
+                        if (isset($option_values) && $option_values && $field_type == 'select') {
686
+                            $option_values_arr = explode(',', $option_values);
687
+                            if (is_array($option_values_arr)) {
688 688
                                 $op_max = 0;
689
-                                foreach($option_values_arr as $op_val){
690
-                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
689
+                                foreach ($option_values_arr as $op_val) {
690
+                                    if (strlen($op_val) && strlen($op_val) > $op_max) {$op_max = strlen($op_val); }
691 691
                                 }
692
-                                if($op_max){$op_size =$op_max; }
692
+                                if ($op_max) {$op_size = $op_max; }
693 693
                             }
694
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
695
-                            if(strlen($option_values)){
696
-                                $op_size =  strlen($option_values);
694
+                        }elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
695
+                            if (strlen($option_values)) {
696
+                                $op_size = strlen($option_values);
697 697
                             }
698 698
                         }
699 699
 
700
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
700
+                        $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."`VARCHAR( $op_size ) NULL";
701 701
 
702 702
                         if ($default_value != '') {
703
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
703
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
704 704
                         }
705 705
 
706 706
                         $alter_result = $wpdb->query($meta_field_add);
707
-                        if($alter_result===false){
708
-                            return __('Column change failed, you may have too many columns.','geodirectory');
707
+                        if ($alter_result === false) {
708
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
709 709
                         }
710 710
 
711 711
                         if (isset($request_field['cat_display_type']))
@@ -722,9 +722,9 @@  discard block
 block discarded – undo
722 722
                     case 'url':
723 723
                     case 'file':
724 724
 
725
-                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
726
-                        if($alter_result===false){
727
-                            return __('Column change failed, you may have too many columns.','geodirectory');
725
+                        $alter_result = $wpdb->query("ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` TEXT NULL");
726
+                        if ($alter_result === false) {
727
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
728 728
                         }
729 729
                         if (isset($request_field['advanced_editor']))
730 730
                             $extra_fields = $request_field['advanced_editor'];
@@ -738,24 +738,24 @@  discard block
 block discarded – undo
738 738
                     default:
739 739
                         if ($data_type != 'VARCHAR' && $data_type != '') {
740 740
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
741
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
741
+                                $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` DECIMAL(11, ".(int) $decimal_point.") NULL";
742 742
                             } else {
743
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
743
+                                $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` ".$data_type." NULL";
744 744
                             }
745 745
 
746 746
                             if (is_numeric($default_value) && $default_value != '') {
747
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
747
+                                $default_value_add .= " DEFAULT '".$default_value."'";
748 748
                             }
749 749
                         } else {
750
-                            $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
750
+                            $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` VARCHAR( 254 ) NULL";
751 751
                             if ($default_value != '') {
752
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
752
+                                $default_value_add .= " DEFAULT '".$default_value."'";
753 753
                             }
754 754
                         }
755 755
 
756 756
                         $alter_result = $wpdb->query($default_value_add);
757
-                        if($alter_result===false){
758
-                            return __('Column change failed, you may have too many columns.','geodirectory');
757
+                        if ($alter_result === false) {
758
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
759 759
                         }
760 760
                         break;
761 761
                 endswitch;
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 
772 772
                     $wpdb->prepare(
773 773
 
774
-                        "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
774
+                        "update ".GEODIR_CUSTOM_FIELDS_TABLE." set 
775 775
 					post_type = %s,
776 776
 					admin_title = %s,
777 777
 					site_title = %s,
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 					for_admin_use = %s
806 806
 					where id = %d",
807 807
 
808
-                        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
+                        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)
809 809
                     )
810 810
 
811 811
                 );
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 
816 816
                 $wpdb->query(
817 817
                     $wpdb->prepare(
818
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
818
+                        "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
819 819
 					 	site_title=%s
820 820
 					where post_type = %s and htmlvar_name = %s",
821 821
                         array($site_title, $post_type, $htmlvar_name)
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 
825 825
 
826 826
                 if ($cat_sort == '')
827
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827
+                    $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
828 828
 
829 829
 
830 830
                 /**
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
                         $data_type = '';
845 845
 
846 846
                         if ($htmlvar_name != '') {
847
-                            $prefix = $htmlvar_name . '_';
847
+                            $prefix = $htmlvar_name.'_';
848 848
                         }
849 849
                         $old_prefix = $old_html_variable;
850 850
 
@@ -852,109 +852,109 @@  discard block
 block discarded – undo
852 852
 
853 853
                         $meta_field_add = "VARCHAR( 254 ) NULL";
854 854
                         if ($default_value != '') {
855
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
855
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
856 856
                         }
857 857
 
858
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
858
+                        geodir_add_column_if_not_exist($detail_table, $prefix."address", $meta_field_add);
859 859
                         //$wpdb->query($meta_field_add);
860 860
 
861 861
 
862 862
                         if (!empty($extra_fields)) {
863 863
 
864 864
                             if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
865
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
865
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."city` VARCHAR( 30 ) NULL";
866 866
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
867 867
                                 if ($default_value != '') {
868
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
868
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
869 869
                                 }
870 870
 
871
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
871
+                                geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add);
872 872
                                 //$wpdb->query($meta_field_add);
873 873
                             }
874 874
                             if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
875
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
875
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."region` VARCHAR( 30 ) NULL";
876 876
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
877 877
                                 if ($default_value != '') {
878
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
878
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
879 879
                                 }
880 880
 
881
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
881
+                                geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add);
882 882
                                 //$wpdb->query($meta_field_add);
883 883
                             }
884 884
                             if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
885
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
885
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."country` VARCHAR( 30 ) NULL";
886 886
 
887 887
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
888 888
                                 if ($default_value != '') {
889
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
889
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
890 890
                                 }
891 891
 
892
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
892
+                                geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add);
893 893
                                 //$wpdb->query($meta_field_add);
894 894
                             }
895 895
                             if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
896
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
896
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."zip` VARCHAR( 15 ) NULL";
897 897
                                 $meta_field_add = "VARCHAR( 15 ) NULL";
898 898
                                 if ($default_value != '') {
899
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
899
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
900 900
                                 }
901 901
 
902
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
902
+                                geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add);
903 903
                                 //$wpdb->query($meta_field_add);
904 904
                             }
905 905
                             if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
906
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
906
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL";
907 907
                                 $meta_field_add = "VARCHAR( 20 ) NULL";
908 908
                                 if ($default_value != '') {
909
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
909
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
910 910
                                 }
911 911
 
912
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
912
+                                geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add);
913 913
                                 //$wpdb->query($meta_field_add);
914 914
 
915
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
915
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL";
916 916
 
917 917
                                 $meta_field_add = "VARCHAR( 20 ) NULL";
918 918
                                 if ($default_value != '') {
919
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
919
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
920 920
                                 }
921 921
 
922
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
922
+                                geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add);
923 923
 
924 924
                                 //$wpdb->query($meta_field_add);
925 925
                             }
926 926
                             if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
927
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
927
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL";
928 928
 
929 929
                                 $meta_field_add = "VARCHAR( 15 ) NULL";
930 930
                                 if ($default_value != '') {
931
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
931
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
932 932
                                 }
933 933
 
934
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
934
+                                geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add);
935 935
 
936 936
                                 //$wpdb->query($meta_field_add);
937 937
                             }
938 938
                             if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
939
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
939
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
940 940
 
941 941
                                 $meta_field_add = "VARCHAR( 3 ) NULL";
942 942
                                 if ($default_value != '') {
943
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
943
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
944 944
                                 }
945 945
 
946
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
946
+                                geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add);
947 947
 
948 948
                                 //$wpdb->query($meta_field_add);
949 949
                             }
950 950
                             // show lat lng
951 951
                             if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
952
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
952
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL";
953 953
 
954 954
                                 $meta_field_add = "VARCHAR( 3 ) NULL";
955 955
                                 $meta_field_add .= " DEFAULT '1'";
956 956
 
957
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
957
+                                geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add);
958 958
                                 //$wpdb->query($meta_field_add);
959 959
                             }
960 960
                         }
@@ -964,8 +964,8 @@  discard block
 block discarded – undo
964 964
                     case 'checkbox':
965 965
                         $data_type = 'TINYINT';
966 966
 
967
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
968
-                        if ((int)$default_value === 1) {
967
+                        $meta_field_add = $data_type."( 1 ) NOT NULL ";
968
+                        if ((int) $default_value === 1) {
969 969
                             $meta_field_add .= " DEFAULT '1'";
970 970
                         }
971 971
 
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
                             }
999 999
                         } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
1000 1000
                             if (strlen($option_values)) {
1001
-                                $op_size =  strlen($option_values);
1001
+                                $op_size = strlen($option_values);
1002 1002
                             }
1003 1003
 
1004 1004
                             if (isset($request_field['multi_display_type'])) {
@@ -1006,9 +1006,9 @@  discard block
 block discarded – undo
1006 1006
                             }
1007 1007
                         }
1008 1008
 
1009
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1009
+                        $meta_field_add = $data_type."( $op_size ) NULL ";
1010 1010
                         if ($default_value != '') {
1011
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1011
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
1012 1012
                         }
1013 1013
 
1014 1014
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
@@ -1023,9 +1023,9 @@  discard block
 block discarded – undo
1023 1023
 
1024 1024
                         $data_type = 'TEXT';
1025 1025
 
1026
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1026
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1027 1027
 
1028
-                        $meta_field_add = $data_type . " NULL ";
1028
+                        $meta_field_add = $data_type." NULL ";
1029 1029
                         /*if($default_value != '')
1030 1030
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1031 1031
 
@@ -1040,9 +1040,9 @@  discard block
 block discarded – undo
1040 1040
 
1041 1041
                         $data_type = 'DATE';
1042 1042
 
1043
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1043
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1044 1044
 
1045
-                        $meta_field_add = $data_type . " NULL ";
1045
+                        $meta_field_add = $data_type." NULL ";
1046 1046
 
1047 1047
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1048 1048
                         if ($add_result === false) {
@@ -1055,9 +1055,9 @@  discard block
 block discarded – undo
1055 1055
 
1056 1056
                         $data_type = 'TIME';
1057 1057
 
1058
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1058
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1059 1059
 
1060
-                        $meta_field_add = $data_type . " NULL ";
1060
+                        $meta_field_add = $data_type." NULL ";
1061 1061
 
1062 1062
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1063 1063
                         if ($add_result === false) {
@@ -1069,22 +1069,22 @@  discard block
 block discarded – undo
1069 1069
                     default:
1070 1070
 
1071 1071
                         if ($data_type != 'VARCHAR' && $data_type != '') {
1072
-                            $meta_field_add = $data_type . " NULL ";
1072
+                            $meta_field_add = $data_type." NULL ";
1073 1073
 
1074 1074
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
1075
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1075
+                                $meta_field_add = "DECIMAL(11, ".(int) $decimal_point.") NULL ";
1076 1076
                             }
1077 1077
 
1078 1078
                             if (is_numeric($default_value) && $default_value != '') {
1079
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1080
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1079
+                                $default_value_add .= " DEFAULT '".$default_value."'";
1080
+                                $meta_field_add .= " DEFAULT '".$default_value."'";
1081 1081
                             }
1082 1082
                         } else {
1083 1083
                             $meta_field_add = " VARCHAR( 254 ) NULL ";
1084 1084
 
1085 1085
                             if ($default_value != '') {
1086
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1087
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1086
+                                $default_value_add .= " DEFAULT '".$default_value."'";
1087
+                                $meta_field_add .= " DEFAULT '".$default_value."'";
1088 1088
                             }
1089 1089
                         }
1090 1090
 
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 
1107 1107
                     $wpdb->prepare(
1108 1108
 
1109
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1109
+                        "insert into ".GEODIR_CUSTOM_FIELDS_TABLE." set 
1110 1110
 					post_type = %s,
1111 1111
 					admin_title = %s,
1112 1112
 					site_title = %s,
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 					validation_msg = %s,
1140 1140
 					for_admin_use = %s ",
1141 1141
 
1142
-                        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
+                        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)
1143 1143
 
1144 1144
                     )
1145 1145
 
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
 
1152 1152
             }
1153 1153
 
1154
-            return (int)$lastid;
1154
+            return (int) $lastid;
1155 1155
 
1156 1156
 
1157 1157
         } else {
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 
1185 1185
             $post_meta_info = $wpdb->query(
1186 1186
                 $wpdb->prepare(
1187
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1187
+                    "update ".GEODIR_CUSTOM_FIELDS_TABLE." set 
1188 1188
 															sort_order=%d 
1189 1189
 															where id= %d",
1190 1190
                     array($count, $cf)
@@ -1200,11 +1200,11 @@  discard block
 block discarded – undo
1200 1200
 }
1201 1201
 
1202 1202
 
1203
-function geodir_get_cf_value($cf){
1203
+function geodir_get_cf_value($cf) {
1204 1204
     global $gd_session;
1205 1205
     $value = '';
1206 1206
     if (is_admin()) {
1207
-        global $post,$gd_session;
1207
+        global $post, $gd_session;
1208 1208
 
1209 1209
         if (isset($_REQUEST['post']))
1210 1210
             $_REQUEST['pid'] = $_REQUEST['post'];
@@ -1246,16 +1246,16 @@  discard block
 block discarded – undo
1246 1246
     $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1247 1247
 
1248 1248
     foreach ($custom_fields as $key => $val) {
1249
-        if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
1249
+        if (isset($val['extra_fields'])) {$extra_fields = $val['extra_fields']; }
1250 1250
         $val = stripslashes_deep($val); // strip slashes from labels
1251
-        if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
1251
+        if (isset($val['extra_fields'])) {$val['extra_fields'] = $extra_fields; }
1252 1252
 
1253 1253
         $name = $val['name'];
1254 1254
         $type = $val['type'];
1255 1255
         $is_default = $val['is_default'];
1256 1256
 
1257 1257
         /* field available to site admin only for edit */
1258
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1258
+        $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false;
1259 1259
         if ($for_admin_use && !is_super_admin()) {
1260 1260
             continue;
1261 1261
         }
@@ -1280,11 +1280,11 @@  discard block
 block discarded – undo
1280 1280
          * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1281 1281
          * @see 'geodir_after_custom_form_field_$name'
1282 1282
          */
1283
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1283
+        do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
1284 1284
 
1285 1285
 
1286 1286
         $custom_field = $val;
1287
-        $html ='';
1287
+        $html = '';
1288 1288
         /**
1289 1289
          * Filter the output for custom fields.
1290 1290
          *
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
          * @param string $html The html to be filtered (blank).
1294 1294
          * @param array $custom_field The custom field array values.
1295 1295
          */
1296
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1296
+        echo apply_filters("geodir_custom_field_input_{$type}", $html, $custom_field);
1297 1297
 
1298 1298
 
1299 1299
 
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
          * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1309 1309
          * @see 'geodir_before_custom_form_field_$name'
1310 1310
          */
1311
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1311
+        do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
1312 1312
 
1313 1313
     }
1314 1314
 
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 
1335 1335
         $filter = $wpdb->get_row(
1336 1336
             $wpdb->prepare(
1337
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1337
+                "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'",
1338 1338
                 array($geodir_post_type)
1339 1339
             )
1340 1340
         );
@@ -1349,14 +1349,14 @@  discard block
 block discarded – undo
1349 1349
 }
1350 1350
 
1351 1351
 
1352
-function geodir_field_icon_proccess($cf){
1352
+function geodir_field_icon_proccess($cf) {
1353 1353
 
1354 1354
 
1355 1355
     if (strpos($cf['field_icon'], 'http') !== false) {
1356
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1356
+        $field_icon = ' background: url('.$cf['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1357 1357
     } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1358
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1359
-    }else{
1358
+        $field_icon = '<i class="'.$cf['field_icon'].'"></i>';
1359
+    } else {
1360 1360
         $field_icon = $cf['field_icon'];
1361 1361
     }
1362 1362
 
@@ -1401,14 +1401,14 @@  discard block
 block discarded – undo
1401 1401
 
1402 1402
 
1403 1403
             foreach ($fields_info as $type) {
1404
-                if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
1404
+                if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; }
1405 1405
                 $type = stripslashes_deep($type); // strip slashes
1406
-                if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
1406
+                if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; }
1407 1407
                 $html = '';
1408 1408
                 $field_icon = geodir_field_icon_proccess($type);
1409 1409
                 $filed_type = $type['type'];
1410 1410
                 $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1411
-                if($html_var=='post'){$html_var='post_address';}
1411
+                if ($html_var == 'post') {$html_var = 'post_address'; }
1412 1412
 
1413 1413
                 /**
1414 1414
                  * Filter the output for custom fields.
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
                  * @param string $fields_location The location the field is to be show.
1420 1420
                  * @param array $type The array of field values.
1421 1421
                  */
1422
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1422
+                $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
1423 1423
 
1424 1424
                 $variables_array = array();
1425 1425
 
@@ -1479,7 +1479,7 @@  discard block
 block discarded – undo
1479 1479
          * @param string $fields_location The location the fields are being output.
1480 1480
          * @since 1.6.9
1481 1481
          */
1482
-        return apply_filters('geodir_show_listing_info',$html,$fields_location);
1482
+        return apply_filters('geodir_show_listing_info', $html, $fields_location);
1483 1483
 
1484 1484
     }
1485 1485
 }
@@ -1554,7 +1554,7 @@  discard block
 block discarded – undo
1554 1554
 
1555 1555
         $post_type = get_post_type($post_id);
1556 1556
         //echo $field_id; exit;
1557
-        $table = $plugin_prefix . $post_type . '_detail';
1557
+        $table = $plugin_prefix.$post_type.'_detail';
1558 1558
 
1559 1559
         $postcurr_images = array();
1560 1560
         $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
@@ -1573,13 +1573,13 @@  discard block
 block discarded – undo
1573 1573
             $geodir_uploadurl = $uploads['url'];
1574 1574
             $sub_dir = $uploads['subdir'];
1575 1575
 
1576
-            $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'] : '';
1576
+            $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'] : '';
1577 1577
 
1578 1578
             for ($m = 0; $m < count($post_image); $m++) {
1579 1579
 
1580 1580
                 /* --------- start ------- */
1581 1581
 
1582
-                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)))) {
1582
+                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)))) {
1583 1583
 
1584 1584
 
1585 1585
                     $curr_img_url = $post_image[$m];
@@ -1605,24 +1605,24 @@  discard block
 block discarded – undo
1605 1605
                     //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1606 1606
 
1607 1607
                     if (!function_exists('wp_handle_upload'))
1608
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1608
+                        require_once(ABSPATH.'wp-admin/includes/file.php');
1609 1609
 
1610 1610
                     if (!is_dir($geodir_uploadpath))
1611 1611
                         mkdir($geodir_uploadpath);
1612 1612
 
1613
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1613
+                    $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1];
1614 1614
                     $explode_sub_dir = explode("/", $sub_dir);
1615 1615
                     if ($curr_img_dir == end($explode_sub_dir)) {
1616
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1617
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1616
+                        $img_path = $geodir_uploadpath.'/'.$filename;
1617
+                        $img_url = $geodir_uploadurl.'/'.$filename;
1618 1618
                     } else {
1619
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1620
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1619
+                        $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
1620
+                        $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename;
1621 1621
                     }
1622 1622
 
1623 1623
                     $uploaded_file = '';
1624 1624
                     if (file_exists($img_path))
1625
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1625
+                        $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name);
1626 1626
 
1627 1627
                     if ($curr_img_dir != $geodir_uploaddir) {
1628 1628
                         if (file_exists($img_path))
@@ -1630,7 +1630,7 @@  discard block
 block discarded – undo
1630 1630
                     }
1631 1631
 
1632 1632
                     if (!empty($uploaded_file))
1633
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1633
+                        $file_urls = $geodir_uploadurl.'/'.$new_name;
1634 1634
 
1635 1635
                 } else {
1636 1636
                     $file_urls = $post_image[$m];
@@ -1644,8 +1644,8 @@  discard block
 block discarded – undo
1644 1644
         if (!empty($postcurr_images)) {
1645 1645
 
1646 1646
             if ($file_urls != $postcurr_images) {
1647
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1648
-                $invalid_files = (object)$invalid_files;
1647
+                $invalid_files[] = (object) array('src' => $postcurr_images);
1648
+                $invalid_files = (object) $invalid_files;
1649 1649
             }
1650 1650
         }
1651 1651
 
@@ -1697,9 +1697,9 @@  discard block
 block discarded – undo
1697 1697
     function geodir_upload_dir($upload)
1698 1698
     {
1699 1699
         global $current_user;
1700
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1701
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1702
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1700
+        $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID;
1701
+        $upload['path'] = $upload['basedir'].$upload['subdir'];
1702
+        $upload['url'] = $upload['baseurl'].$upload['subdir'];
1703 1703
         return $upload;
1704 1704
     }
1705 1705
 
@@ -1714,20 +1714,20 @@  discard block
 block discarded – undo
1714 1714
         // check ajax nonce
1715 1715
         $imgid = $_POST["imgid"];
1716 1716
 
1717
-        check_ajax_referer($imgid . 'pluploadan');
1717
+        check_ajax_referer($imgid.'pluploadan');
1718 1718
 
1719 1719
         // handle custom file uploaddir
1720 1720
         add_filter('upload_dir', 'geodir_upload_dir');
1721 1721
 
1722 1722
         // change file orientation if needed
1723
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1723
+        $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']);
1724 1724
 
1725 1725
         // handle file upload
1726 1726
         $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1727 1727
         // remove handle custom file uploaddir
1728 1728
         remove_filter('upload_dir', 'geodir_upload_dir');
1729 1729
 
1730
-        if(!isset($status['url']) && isset($status['error'])){
1730
+        if (!isset($status['url']) && isset($status['error'])) {
1731 1731
             print_r($status);
1732 1732
         }
1733 1733
 
@@ -1757,9 +1757,9 @@  discard block
 block discarded – undo
1757 1757
 
1758 1758
     $post_type = get_post_type($post_id);
1759 1759
 
1760
-    $table = $plugin_prefix . $post_type . '_detail';
1760
+    $table = $plugin_prefix.$post_type.'_detail';
1761 1761
 
1762
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1762
+    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
1763 1763
 
1764 1764
     if ($results) {
1765 1765
         return $results[0]->geodir_video;
@@ -1783,9 +1783,9 @@  discard block
 block discarded – undo
1783 1783
 
1784 1784
     $post_type = get_post_type($post_id);
1785 1785
 
1786
-    $table = $plugin_prefix . $post_type . '_detail';
1786
+    $table = $plugin_prefix.$post_type.'_detail';
1787 1787
 
1788
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1788
+    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
1789 1789
 
1790 1790
     if ($results) {
1791 1791
         return $results[0]->geodir_special_offers;
@@ -1803,12 +1803,12 @@  discard block
 block discarded – undo
1803 1803
      */
1804 1804
     function geodir_max_upload_size()
1805 1805
     {
1806
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1806
+        $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1807 1807
 
1808 1808
         if ($max_filesize > 0 && $max_filesize < 1) {
1809
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1809
+            $max_filesize = (int) ($max_filesize * 1024).'kb';
1810 1810
         } else {
1811
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1811
+            $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1812 1812
         }
1813 1813
         /** Filter documented in geodirectory-functions/general_functions.php **/
1814 1814
         return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
 
1841 1841
             $custom_fields = $wpdb->get_results(
1842 1842
                 $wpdb->prepare(
1843
-                    "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",
1843
+                    "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",
1844 1844
                     array($post_type)
1845 1845
                 ), 'ARRAY_A'
1846 1846
             );
@@ -1967,7 +1967,7 @@  discard block
 block discarded – undo
1967 1967
 
1968 1968
             $post_meta_info = $wpdb->query(
1969 1969
                 $wpdb->prepare(
1970
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1970
+                    "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
1971 1971
 															sort_order=%d 
1972 1972
 															where id= %d",
1973 1973
                     array($count, $cf)
@@ -2049,14 +2049,14 @@  discard block
 block discarded – undo
2049 2049
 
2050 2050
         $check_html_variable = $wpdb->get_var(
2051 2051
             $wpdb->prepare(
2052
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2052
+                "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ",
2053 2053
                 array($cehhtmlvar_name, $post_type, $field_type)
2054 2054
             )
2055 2055
         );
2056 2056
 
2057 2057
         if ($is_default == 1) {
2058 2058
 
2059
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2059
+            $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
2060 2060
 
2061 2061
         }
2062 2062
 
@@ -2067,7 +2067,7 @@  discard block
 block discarded – undo
2067 2067
 
2068 2068
                 $wpdb->prepare(
2069 2069
 
2070
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2070
+                    "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2071 2071
 				post_type = %s,
2072 2072
 				data_type = %s,
2073 2073
 				field_type = %s,
@@ -2098,7 +2098,7 @@  discard block
 block discarded – undo
2098 2098
 
2099 2099
                 $wpdb->prepare(
2100 2100
 
2101
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2101
+                    "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2102 2102
 				post_type = %s,
2103 2103
 				data_type = %s,
2104 2104
 				field_type = %s,
@@ -2124,7 +2124,7 @@  discard block
 block discarded – undo
2124 2124
         }
2125 2125
 
2126 2126
 
2127
-        return (int)$lastid;
2127
+        return (int) $lastid;
2128 2128
 
2129 2129
     }
2130 2130
 }
@@ -2147,7 +2147,7 @@  discard block
 block discarded – undo
2147 2147
         if ($field_id != '') {
2148 2148
             $cf = trim($field_id, '_');
2149 2149
 
2150
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2150
+            $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
2151 2151
 
2152 2152
             return $field_id;
2153 2153
 
@@ -2170,12 +2170,12 @@  discard block
 block discarded – undo
2170 2170
      * @param string $field_ins_upd When set to "submit" displays form.
2171 2171
      * @param bool $default when set to true field will be for admin use only.
2172 2172
      */
2173
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2173
+    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '')
2174 2174
     {
2175 2175
         global $wpdb;
2176 2176
         $cf = $result_str;
2177 2177
         if (!is_object($cf)) {
2178
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2178
+            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
2179 2179
         } else {
2180 2180
             $field_info = $cf;
2181 2181
             $result_str = $cf->id;
@@ -2211,18 +2211,18 @@  discard block
 block discarded – undo
2211 2211
         if ($htmlvar_name == '')
2212 2212
             $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2213 2213
 
2214
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2214
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
2215 2215
 
2216 2216
         $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2217 2217
         $cso_arr = geodir_get_custom_sort_options($post_type);
2218 2218
 
2219 2219
         $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2220
-        foreach($cso_arr as $cso){
2221
-            if($cur_field_type==$cso['field_type']){
2220
+        foreach ($cso_arr as $cso) {
2221
+            if ($cur_field_type == $cso['field_type']) {
2222 2222
 
2223 2223
                 if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2224 2224
                     $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2225
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2225
+                }elseif (isset($cso['field_icon']) && $cso['field_icon']) {
2226 2226
                     $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2227 2227
                 }
2228 2228
 
@@ -2232,40 +2232,40 @@  discard block
 block discarded – undo
2232 2232
         $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2233 2233
         ?>
2234 2234
 
2235
-        <li class="text" id="licontainer_<?php echo $result_str;?>">
2235
+        <li class="text" id="licontainer_<?php echo $result_str; ?>">
2236 2236
             <form><!-- we need to wrap in a form so we can use radio buttons with same name -->
2237
-            <div class="title title<?php echo $result_str;?> gt-fieldset"
2238
-                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
2239
-                 ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2237
+            <div class="title title<?php echo $result_str; ?> gt-fieldset"
2238
+                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
2239
+                 ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
2240 2240
                 <?php
2241 2241
 
2242 2242
                 ?>
2243 2243
 
2244
-                <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2245
-                     onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
2244
+                <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
2245
+                     onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
2246 2246
                      class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
2247 2247
 
2248 2248
 
2249
-                <?php echo $field_icon;?>
2249
+                <?php echo $field_icon; ?>
2250 2250
                 <b style="cursor:pointer;"
2251
-                   onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
2251
+                   onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
2252 2252
 
2253 2253
             </div>
2254 2254
 
2255
-            <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2255
+            <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
2256 2256
                  style="display:<?php if ($field_ins_upd == 'submit') {
2257 2257
                      echo 'block;';
2258 2258
                  } else {
2259 2259
                      echo 'none;';
2260 2260
                  } ?>">
2261 2261
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2262
-                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2263
-                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2264
-                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2262
+                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
2263
+                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
2264
+                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/>
2265 2265
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2266 2266
                     echo $field_info->data_type;
2267 2267
                 }?>"/>
2268
-                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2268
+                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/>
2269 2269
 
2270 2270
 
2271 2271
                 <ul class="widefat post fixed" border="0" style="width:100%;">
@@ -2275,7 +2275,7 @@  discard block
 block discarded – undo
2275 2275
                         <input type="hidden" name="site_title" id="site_title" value="<?php echo esc_attr($site_title); ?>"/>
2276 2276
 
2277 2277
                         <li>
2278
-                            <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0;?>
2278
+                            <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0; ?>
2279 2279
 
2280 2280
                             <label for="asc" class="gd-cf-tooltip-wrap">
2281 2281
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Ascending Sort (low to high)', 'geodirectory'); ?>
@@ -2285,24 +2285,24 @@  discard block
 block discarded – undo
2285 2285
                             </label>
2286 2286
                             <div class="gd-cf-input-wrap gd-switch">
2287 2287
 
2288
-                                <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled"  value="1"
2288
+                                <input type="radio" id="asc_yes<?php echo $radio_id; ?>" name="asc" class="gdri-enabled"  value="1"
2289 2289
                                     <?php if ($value == '1') {
2290 2290
                                         echo 'checked';
2291 2291
                                     } ?>/>
2292
-                                <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>
2292
+                                <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>
2293 2293
 
2294
-                                <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0"
2294
+                                <input type="radio" id="asc_no<?php echo $radio_id; ?>" name="asc" class="gdri-disabled" value="0"
2295 2295
                                     <?php if ($value == '0' || !$value) {
2296 2296
                                         echo 'checked';
2297 2297
                                     } ?>/>
2298
-                                <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>
2298
+                                <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>
2299 2299
 
2300 2300
                             </div>
2301 2301
 
2302 2302
                         </li>
2303 2303
 
2304
-                        <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;'";}?>>
2305
-                            <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : '';?>
2304
+                        <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;'"; }?>>
2305
+                            <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : ''; ?>
2306 2306
 
2307 2307
                             <label for="asc_title" class="gd-cf-tooltip-wrap">
2308 2308
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Ascending title', 'geodirectory'); ?>
@@ -2312,14 +2312,14 @@  discard block
 block discarded – undo
2312 2312
                             </label>
2313 2313
                             <div class="gd-cf-input-wrap">
2314 2314
 
2315
-                                <input type="text" name="asc_title" id="asc_title" value="<?php echo $value;?>" />
2315
+                                <input type="text" name="asc_title" id="asc_title" value="<?php echo $value; ?>" />
2316 2316
                             </div>
2317 2317
 
2318 2318
 
2319 2319
                         </li>
2320 2320
 
2321 2321
 
2322
-                        <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;'";}?>>
2322
+                        <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;'"; }?>>
2323 2323
 
2324 2324
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2325 2325
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2330,7 +2330,7 @@  discard block
 block discarded – undo
2330 2330
                             <div class="gd-cf-input-wrap">
2331 2331
 
2332 2332
                                 <input type="radio" name="is_default"
2333
-                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2333
+                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
2334 2334
                                     echo 'checked="checked"';
2335 2335
                                 } ?>/>
2336 2336
                             </div>
@@ -2340,7 +2340,7 @@  discard block
 block discarded – undo
2340 2340
 
2341 2341
 
2342 2342
                         <li>
2343
-                            <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0;?>
2343
+                            <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0; ?>
2344 2344
 
2345 2345
                             <label for="desc" class="gd-cf-tooltip-wrap">
2346 2346
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Descending Sort (high to low)', 'geodirectory'); ?>
@@ -2350,24 +2350,24 @@  discard block
 block discarded – undo
2350 2350
                             </label>
2351 2351
                             <div class="gd-cf-input-wrap gd-switch">
2352 2352
 
2353
-                                <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled"  value="1"
2353
+                                <input type="radio" id="desc_yes<?php echo $radio_id; ?>" name="desc" class="gdri-enabled"  value="1"
2354 2354
                                     <?php if ($value == '1') {
2355 2355
                                         echo 'checked';
2356 2356
                                     } ?>/>
2357
-                                <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>
2357
+                                <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>
2358 2358
 
2359
-                                <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0"
2359
+                                <input type="radio" id="desc_no<?php echo $radio_id; ?>" name="desc" class="gdri-disabled" value="0"
2360 2360
                                     <?php if ($value == '0' || !$value) {
2361 2361
                                         echo 'checked';
2362 2362
                                     } ?>/>
2363
-                                <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>
2363
+                                <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>
2364 2364
 
2365 2365
                             </div>
2366 2366
 
2367 2367
                         </li>
2368 2368
 
2369
-                        <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;'";}?>>
2370
-                            <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : '';?>
2369
+                        <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;'"; }?>>
2370
+                            <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : ''; ?>
2371 2371
 
2372 2372
                             <label for="desc_title" class="gd-cf-tooltip-wrap">
2373 2373
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Descending title', 'geodirectory'); ?>
@@ -2377,13 +2377,13 @@  discard block
 block discarded – undo
2377 2377
                             </label>
2378 2378
                             <div class="gd-cf-input-wrap">
2379 2379
 
2380
-                                <input type="text" name="desc_title" id="desc_title" value="<?php echo $value;?>" />
2380
+                                <input type="text" name="desc_title" id="desc_title" value="<?php echo $value; ?>" />
2381 2381
                             </div>
2382 2382
 
2383 2383
 
2384 2384
                         </li>
2385 2385
 
2386
-                        <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;'";}?>>
2386
+                        <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;'"; }?>>
2387 2387
 
2388 2388
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2389 2389
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2394,7 +2394,7 @@  discard block
 block discarded – undo
2394 2394
                             <div class="gd-cf-input-wrap">
2395 2395
 
2396 2396
                                 <input type="radio" name="is_default"
2397
-                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2397
+                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
2398 2398
                                     echo 'checked="checked"';
2399 2399
                                 } ?>/>
2400 2400
                             </div>
@@ -2419,14 +2419,14 @@  discard block
 block discarded – undo
2419 2419
                             </label>
2420 2420
                             <div class="gd-cf-input-wrap">
2421 2421
 
2422
-                                <input type="text" name="site_title" id="site_title" value="<?php echo $value;?>" />
2422
+                                <input type="text" name="site_title" id="site_title" value="<?php echo $value; ?>" />
2423 2423
                             </div>
2424 2424
 
2425 2425
 
2426 2426
                         </li>
2427 2427
 
2428 2428
                         <li>
2429
-                            <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : '';?>
2429
+                            <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : ''; ?>
2430 2430
 
2431 2431
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2432 2432
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2450,7 +2450,7 @@  discard block
 block discarded – undo
2450 2450
 
2451 2451
 
2452 2452
                     <li>
2453
-                        <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active: 0;?>
2453
+                        <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active : 0; ?>
2454 2454
 
2455 2455
                         <label for="is_active" class="gd-cf-tooltip-wrap">
2456 2456
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active', 'geodirectory'); ?>
@@ -2460,17 +2460,17 @@  discard block
 block discarded – undo
2460 2460
                         </label>
2461 2461
                         <div class="gd-cf-input-wrap gd-switch">
2462 2462
 
2463
-                            <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
2463
+                            <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled"  value="1"
2464 2464
                                 <?php if ($value == '1') {
2465 2465
                                     echo 'checked';
2466 2466
                                 } ?>/>
2467
-                            <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2467
+                            <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2468 2468
 
2469
-                            <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
2469
+                            <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0"
2470 2470
                                 <?php if ($value == '0' || !$value) {
2471 2471
                                     echo 'checked';
2472 2472
                                 } ?>/>
2473
-                            <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2473
+                            <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2474 2474
 
2475 2475
                         </div>
2476 2476
 
@@ -2491,10 +2491,10 @@  discard block
 block discarded – undo
2491 2491
                             <h3></h3>
2492 2492
                         </label>
2493 2493
                         <div class="gd-cf-input-wrap">
2494
-                            <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
2494
+                            <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
2495 2495
                                    onclick="save_sort_field('<?php echo esc_attr($result_str); ?>')"/>
2496
-                                <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
2497
-                                                                    onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
2496
+                                <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
2497
+                                                                    onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
2498 2498
                                                                     class="button"/></a>
2499 2499
                         </div>
2500 2500
                     </li>
@@ -2529,7 +2529,7 @@  discard block
 block discarded – undo
2529 2529
         if (!$package_id || !$field_name || !$post_type) {
2530 2530
             return true;
2531 2531
         }
2532
-        $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));
2532
+        $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));
2533 2533
 
2534 2534
         if ($wpdb->get_var($sql)) {
2535 2535
             return true;
@@ -2652,13 +2652,13 @@  discard block
 block discarded – undo
2652 2652
 }
2653 2653
 
2654 2654
 
2655
-function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2655
+function geodir_cfa_data_type_text($output, $result_str, $cf, $field_info) {
2656 2656
     ob_start();
2657 2657
 
2658 2658
     $dt_value = '';
2659 2659
     if (isset($field_info->data_type)) {
2660 2660
         $dt_value  = esc_attr($field_info->data_type);
2661
-    }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2661
+    }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
2662 2662
         $dt_value  = $cf['defaults']['data_type'];
2663 2663
     }
2664 2664
     ?>
@@ -2669,15 +2669,15 @@  discard block
 block discarded – undo
2669 2669
             <select name="data_type" id="data_type"
2670 2670
                     onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');">
2671 2671
                 <option
2672
-                    value="XVARCHAR" <?php if ($dt_value  == 'VARCHAR') {
2672
+                    value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
2673 2673
                     echo 'selected="selected"';
2674 2674
                 } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2675 2675
                 <option
2676
-                    value="INT" <?php if ($dt_value   == 'INT') {
2676
+                    value="INT" <?php if ($dt_value == 'INT') {
2677 2677
                     echo 'selected="selected"';
2678 2678
                 } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2679 2679
                 <option
2680
-                    value="FLOAT" <?php if ($dt_value   == 'FLOAT') {
2680
+                    value="FLOAT" <?php if ($dt_value == 'FLOAT') {
2681 2681
                     echo 'selected="selected"';
2682 2682
                 } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2683 2683
             </select>
@@ -2690,13 +2690,13 @@  discard block
 block discarded – undo
2690 2690
     $value = '';
2691 2691
     if (isset($field_info->decimal_point)) {
2692 2692
         $value = esc_attr($field_info->decimal_point);
2693
-    }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2693
+    }elseif (isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']) {
2694 2694
         $value = $cf['defaults']['decimal_point'];
2695 2695
     }
2696 2696
     ?>
2697 2697
 
2698 2698
     <li class="decimal-point-wrapper"
2699
-        style="<?php echo ($dt_value  == 'FLOAT') ? '' : 'display:none' ?>">
2699
+        style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>">
2700 2700
         <label for="decimal_point"><?php _e('Select decimal point :', 'geodirectory'); ?></label>
2701 2701
         <div class="gd-cf-input-wrap">
2702 2702
             <select name="decimal_point" id="decimal_point">
@@ -2714,43 +2714,43 @@  discard block
 block discarded – undo
2714 2714
     $output = ob_get_clean();
2715 2715
     return $output;
2716 2716
 }
2717
-add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2717
+add_filter('geodir_cfa_data_type_text', 'geodir_cfa_data_type_text', 10, 4);
2718 2718
 
2719 2719
 // htmlvar not needed for fieldset and taxonomy
2720
-add_filter('geodir_cfa_htmlvar_name_fieldset','__return_empty_string',10,4);
2721
-add_filter('geodir_cfa_htmlvar_name_taxonomy','__return_empty_string',10,4);
2720
+add_filter('geodir_cfa_htmlvar_name_fieldset', '__return_empty_string', 10, 4);
2721
+add_filter('geodir_cfa_htmlvar_name_taxonomy', '__return_empty_string', 10, 4);
2722 2722
 
2723 2723
 
2724 2724
 // default_value not needed for textarea, html, file, fieldset, taxonomy, address
2725
-add_filter('geodir_cfa_default_value_textarea','__return_empty_string',10,4);
2726
-add_filter('geodir_cfa_default_value_html','__return_empty_string',10,4);
2727
-add_filter('geodir_cfa_default_value_file','__return_empty_string',10,4);
2728
-add_filter('geodir_cfa_default_value_taxonomy','__return_empty_string',10,4);
2729
-add_filter('geodir_cfa_default_value_address','__return_empty_string',10,4);
2730
-add_filter('geodir_cfa_default_value_fieldset','__return_empty_string',10,4);
2725
+add_filter('geodir_cfa_default_value_textarea', '__return_empty_string', 10, 4);
2726
+add_filter('geodir_cfa_default_value_html', '__return_empty_string', 10, 4);
2727
+add_filter('geodir_cfa_default_value_file', '__return_empty_string', 10, 4);
2728
+add_filter('geodir_cfa_default_value_taxonomy', '__return_empty_string', 10, 4);
2729
+add_filter('geodir_cfa_default_value_address', '__return_empty_string', 10, 4);
2730
+add_filter('geodir_cfa_default_value_fieldset', '__return_empty_string', 10, 4);
2731 2731
 
2732 2732
 // is_required not needed for fieldset
2733
-add_filter('geodir_cfa_is_required_fieldset','__return_empty_string',10,4);
2734
-add_filter('geodir_cfa_required_msg_fieldset','__return_empty_string',10,4);
2733
+add_filter('geodir_cfa_is_required_fieldset', '__return_empty_string', 10, 4);
2734
+add_filter('geodir_cfa_required_msg_fieldset', '__return_empty_string', 10, 4);
2735 2735
 
2736 2736
 // field_icon not needed for fieldset
2737
-add_filter('geodir_cfa_field_icon_fieldset','__return_empty_string',10,4);
2738
-add_filter('geodir_cfa_css_class_fieldset','__return_empty_string',10,4);
2737
+add_filter('geodir_cfa_field_icon_fieldset', '__return_empty_string', 10, 4);
2738
+add_filter('geodir_cfa_css_class_fieldset', '__return_empty_string', 10, 4);
2739 2739
 
2740 2740
 // cat_sort not needed for some fields
2741
-add_filter('geodir_cfa_cat_sort_html','__return_empty_string',10,4);
2742
-add_filter('geodir_cfa_cat_sort_file','__return_empty_string',10,4);
2743
-add_filter('geodir_cfa_cat_sort_url','__return_empty_string',10,4);
2744
-add_filter('geodir_cfa_cat_sort_fieldset','__return_empty_string',10,4);
2745
-add_filter('geodir_cfa_cat_sort_multiselect','__return_empty_string',10,4);
2746
-add_filter('geodir_cfa_cat_sort_textarea','__return_empty_string',10,4);
2747
-add_filter('geodir_cfa_cat_sort_taxonomy','__return_empty_string',10,4);
2748
-add_filter('geodir_cfa_cat_sort_address','__return_empty_string',10,4);
2741
+add_filter('geodir_cfa_cat_sort_html', '__return_empty_string', 10, 4);
2742
+add_filter('geodir_cfa_cat_sort_file', '__return_empty_string', 10, 4);
2743
+add_filter('geodir_cfa_cat_sort_url', '__return_empty_string', 10, 4);
2744
+add_filter('geodir_cfa_cat_sort_fieldset', '__return_empty_string', 10, 4);
2745
+add_filter('geodir_cfa_cat_sort_multiselect', '__return_empty_string', 10, 4);
2746
+add_filter('geodir_cfa_cat_sort_textarea', '__return_empty_string', 10, 4);
2747
+add_filter('geodir_cfa_cat_sort_taxonomy', '__return_empty_string', 10, 4);
2748
+add_filter('geodir_cfa_cat_sort_address', '__return_empty_string', 10, 4);
2749 2749
 
2750 2750
 
2751 2751
 
2752
-function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2753
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2752
+function geodir_cfa_advanced_editor_geodir_special_offers($output, $result_str, $cf, $field_info) {
2753
+    if ($field_info->htmlvar_name != 'geodir_special_offers') {return ''; }
2754 2754
     ob_start();
2755 2755
     ?>
2756 2756
     <li>
@@ -2781,16 +2781,16 @@  discard block
 block discarded – undo
2781 2781
     $output = ob_get_clean();
2782 2782
     return $output;
2783 2783
 }
2784
-add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2784
+add_filter('geodir_cfa_advanced_editor_textarea', 'geodir_cfa_advanced_editor_geodir_special_offers', 10, 4);
2785 2785
 
2786 2786
 
2787
-function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2787
+function geodir_cfa_validation_pattern_text($output, $result_str, $cf, $field_info) {
2788 2788
     ob_start();
2789 2789
 
2790 2790
     $value = '';
2791 2791
     if (isset($field_info->validation_pattern)) {
2792 2792
         $value = esc_attr($field_info->validation_pattern);
2793
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2793
+    }elseif (isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']) {
2794 2794
         $value = esc_attr($cf['defaults']['validation_pattern']);
2795 2795
     }
2796 2796
     ?>
@@ -2810,7 +2810,7 @@  discard block
 block discarded – undo
2810 2810
     $value = '';
2811 2811
     if (isset($field_info->validation_msg)) {
2812 2812
         $value = esc_attr($field_info->validation_msg);
2813
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2813
+    }elseif (isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']) {
2814 2814
         $value = esc_attr($cf['defaults']['validation_msg']);
2815 2815
     }
2816 2816
     ?>
@@ -2831,10 +2831,10 @@  discard block
 block discarded – undo
2831 2831
     $output = ob_get_clean();
2832 2832
     return $output;
2833 2833
 }
2834
-add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2834
+add_filter('geodir_cfa_validation_pattern_text', 'geodir_cfa_validation_pattern_text', 10, 4);
2835 2835
 
2836 2836
 
2837
-function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2837
+function geodir_cfa_htmlvar_name_taxonomy($output, $result_str, $cf, $field_info) {
2838 2838
     ob_start();
2839 2839
     global $post_type;
2840 2840
 
@@ -2859,7 +2859,7 @@  discard block
 block discarded – undo
2859 2859
                     ?>
2860 2860
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2861 2861
                         echo 'selected="selected"';
2862
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2862
+                    }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php
2863 2863
                 }
2864 2864
                 ?>
2865 2865
             </select>
@@ -2870,7 +2870,7 @@  discard block
 block discarded – undo
2870 2870
         <label for="cat_display_type" class="gd-cf-tooltip-wrap">
2871 2871
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Category display type :', 'geodirectory'); ?>
2872 2872
             <div class="gdcf-tooltip">
2873
-                <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory');?>
2873
+                <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory'); ?>
2874 2874
             </div>
2875 2875
         </label>
2876 2876
         <div class="gd-cf-input-wrap">
@@ -2878,19 +2878,19 @@  discard block
 block discarded – undo
2878 2878
             <select name="cat_display_type" id="cat_display_type">
2879 2879
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2880 2880
                     echo 'selected="selected"';
2881
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2881
+                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
2882 2882
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2883 2883
                     echo 'selected="selected"';
2884
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2884
+                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
2885 2885
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2886 2886
                     echo 'selected="selected"';
2887
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2887
+                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
2888 2888
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2889 2889
                     echo 'selected="selected"';
2890
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2890
+                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
2891 2891
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2892 2892
                     echo 'selected="selected"';
2893
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2893
+                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
2894 2894
             </select>
2895 2895
         </div>
2896 2896
     </li>
@@ -2899,10 +2899,10 @@  discard block
 block discarded – undo
2899 2899
     $output = ob_get_clean();
2900 2900
     return $output;
2901 2901
 }
2902
-add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2902
+add_filter('geodir_cfa_htmlvar_name_taxonomy', 'geodir_cfa_htmlvar_name_taxonomy', 10, 4);
2903 2903
 
2904 2904
 
2905
-function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2905
+function geodir_cfa_extra_fields_address($output, $result_str, $cf, $field_info) {
2906 2906
 
2907 2907
     ob_start();
2908 2908
     if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
@@ -2925,32 +2925,32 @@  discard block
 block discarded – undo
2925 2925
         <label for="show_zip" class="gd-cf-tooltip-wrap">
2926 2926
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display zip/post code :', 'geodirectory'); ?>
2927 2927
             <div class="gdcf-tooltip">
2928
-                <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?>
2928
+                <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?>
2929 2929
             </div>
2930 2930
         </label>
2931 2931
         <div class="gd-cf-input-wrap gd-switch">
2932 2932
 
2933
-            <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2933
+            <input type="radio" id="show_zip_yes<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2934 2934
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2935 2935
                     echo 'checked';
2936 2936
                 } ?>/>
2937
-            <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>
2937
+            <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>
2938 2938
 
2939
-            <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2939
+            <input type="radio" id="show_zip_no<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2940 2940
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2941 2941
                     echo 'checked';
2942 2942
                 } ?>/>
2943
-            <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>
2943
+            <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>
2944 2944
 
2945 2945
 
2946 2946
         </div>
2947 2947
     </li>
2948 2948
 
2949
-    <li class="cf-zip-lable"  <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'";}?> >
2949
+    <li class="cf-zip-lable"  <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'"; }?> >
2950 2950
         <label for="zip_lable" class="gd-cf-tooltip-wrap">
2951 2951
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Zip/Post code label :', 'geodirectory'); ?>
2952 2952
             <div class="gdcf-tooltip">
2953
-                <?php _e('Enter zip/post code field label in address section.', 'geodirectory');?>
2953
+                <?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?>
2954 2954
             </div>
2955 2955
         </label>
2956 2956
         <div class="gd-cf-input-wrap">
@@ -2968,7 +2968,7 @@  discard block
 block discarded – undo
2968 2968
         <label for="map_lable" class="gd-cf-tooltip-wrap">
2969 2969
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map button label :', 'geodirectory'); ?>
2970 2970
             <div class="gdcf-tooltip">
2971
-                <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?>
2971
+                <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory'); ?>
2972 2972
             </div>
2973 2973
         </label>
2974 2974
         <div class="gd-cf-input-wrap">
@@ -2983,22 +2983,22 @@  discard block
 block discarded – undo
2983 2983
         <label for="show_mapzoom" class="gd-cf-tooltip-wrap">
2984 2984
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Use user zoom level:', 'geodirectory'); ?>
2985 2985
             <div class="gdcf-tooltip">
2986
-                <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory');?>
2986
+                <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory'); ?>
2987 2987
             </div>
2988 2988
         </label>
2989 2989
         <div class="gd-cf-input-wrap gd-switch">
2990 2990
 
2991
-            <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2991
+            <input type="radio" id="show_mapzoom_yes<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2992 2992
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
2993 2993
                     echo 'checked';
2994 2994
                 } ?>/>
2995
-            <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2995
+            <label for="show_mapzoom_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2996 2996
 
2997
-            <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2997
+            <input type="radio" id="show_mapzoom_no<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2998 2998
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
2999 2999
                     echo 'checked';
3000 3000
                 } ?>/>
3001
-            <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3001
+            <label for="show_mapzoom_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3002 3002
 
3003 3003
         </div>
3004 3004
     </li>
@@ -3007,22 +3007,22 @@  discard block
 block discarded – undo
3007 3007
         <label for="show_mapview" class="gd-cf-tooltip-wrap">
3008 3008
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display map view:', 'geodirectory'); ?>
3009 3009
             <div class="gdcf-tooltip">
3010
-                <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory');?>
3010
+                <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory'); ?>
3011 3011
             </div>
3012 3012
         </label>
3013 3013
         <div class="gd-cf-input-wrap gd-switch">
3014 3014
 
3015
-            <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
3015
+            <input type="radio" id="show_mapview_yes<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
3016 3016
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
3017 3017
                     echo 'checked';
3018 3018
                 } ?>/>
3019
-            <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3019
+            <label for="show_mapview_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3020 3020
 
3021
-            <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
3021
+            <input type="radio" id="show_mapview_no<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
3022 3022
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
3023 3023
                     echo 'checked';
3024 3024
                 } ?>/>
3025
-            <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3025
+            <label for="show_mapview_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3026 3026
 
3027 3027
         </div>
3028 3028
     </li>
@@ -3032,7 +3032,7 @@  discard block
 block discarded – undo
3032 3032
         <label for="mapview_lable" class="gd-cf-tooltip-wrap">
3033 3033
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map view label:', 'geodirectory'); ?>
3034 3034
             <div class="gdcf-tooltip">
3035
-                <?php _e('Enter mapview field label in address section.', 'geodirectory');?>
3035
+                <?php _e('Enter mapview field label in address section.', 'geodirectory'); ?>
3036 3036
             </div>
3037 3037
         </label>
3038 3038
         <div class="gd-cf-input-wrap">
@@ -3046,22 +3046,22 @@  discard block
 block discarded – undo
3046 3046
         <label for="show_latlng" class="gd-cf-tooltip-wrap">
3047 3047
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show latitude and longitude', 'geodirectory'); ?>
3048 3048
             <div class="gdcf-tooltip">
3049
-                <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory');?>
3049
+                <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory'); ?>
3050 3050
             </div>
3051 3051
         </label>
3052 3052
         <div class="gd-cf-input-wrap gd-switch">
3053 3053
 
3054
-            <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3054
+            <input type="radio" id="show_latlng_yes<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3055 3055
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
3056 3056
                     echo 'checked';
3057 3057
                 } ?>/>
3058
-            <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3058
+            <label for="show_latlng_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3059 3059
 
3060
-            <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3060
+            <input type="radio" id="show_latlng_no<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3061 3061
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
3062 3062
                     echo 'checked';
3063 3063
                 } ?>/>
3064
-            <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3064
+            <label for="show_latlng_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3065 3065
 
3066 3066
         </div>
3067 3067
     </li>
@@ -3070,17 +3070,17 @@  discard block
 block discarded – undo
3070 3070
     $html = ob_get_clean();
3071 3071
     return $output.$html;
3072 3072
 }
3073
-add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
3073
+add_filter('geodir_cfa_extra_fields_address', 'geodir_cfa_extra_fields_address', 10, 4);
3074 3074
 
3075 3075
 
3076
-function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
3076
+function geodir_cfa_extra_fields_multiselect($output, $result_str, $cf, $field_info) {
3077 3077
     ob_start();
3078 3078
     ?>
3079 3079
     <li>
3080 3080
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
3081 3081
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
3082 3082
             <div class="gdcf-tooltip">
3083
-                <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory');?>
3083
+                <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory'); ?>
3084 3084
             </div>
3085 3085
         </label>
3086 3086
         <div class="gd-cf-input-wrap">
@@ -3088,13 +3088,13 @@  discard block
 block discarded – undo
3088 3088
             <select name="multi_display_type" id="multi_display_type">
3089 3089
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
3090 3090
                     echo 'selected="selected"';
3091
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
3091
+                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
3092 3092
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
3093 3093
                     echo 'selected="selected"';
3094
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3094
+                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
3095 3095
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
3096 3096
                     echo 'selected="selected"';
3097
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3097
+                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
3098 3098
             </select>
3099 3099
 
3100 3100
             <br/>
@@ -3105,17 +3105,17 @@  discard block
 block discarded – undo
3105 3105
     $html = ob_get_clean();
3106 3106
     return $output.$html;
3107 3107
 }
3108
-add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
3108
+add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_multiselect', 10, 4);
3109 3109
 
3110 3110
 
3111
-function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
3111
+function geodir_cfa_extra_fields_smr($output, $result_str, $cf, $field_info) {
3112 3112
 
3113 3113
     ob_start();
3114 3114
 
3115 3115
     $value = '';
3116 3116
     if (isset($field_info->option_values)) {
3117 3117
         $value = esc_attr($field_info->option_values);
3118
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3118
+    }elseif (isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']) {
3119 3119
         $value = esc_attr($cf['defaults']['option_values']);
3120 3120
     }
3121 3121
 
@@ -3125,11 +3125,11 @@  discard block
 block discarded – undo
3125 3125
         <label for="option_values" class="gd-cf-tooltip-wrap">
3126 3126
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
3127 3127
             <div class="gdcf-tooltip">
3128
-                <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
3128
+                <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
3129 3129
                 <br/>
3130
-                <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>
3130
+                <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>
3131 3131
                     <br/>
3132
-                    <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
3132
+                    <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
3133 3133
                     <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
3134 3134
                         <br/>
3135 3135
                         <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
@@ -3140,7 +3140,7 @@  discard block
 block discarded – undo
3140 3140
         </label>
3141 3141
         <div class="gd-cf-input-wrap">
3142 3142
             <input type="text" name="option_values" id="option_values"
3143
-                   value="<?php echo $value;?>"/>
3143
+                   value="<?php echo $value; ?>"/>
3144 3144
             <br/>
3145 3145
 
3146 3146
         </div>
@@ -3150,12 +3150,12 @@  discard block
 block discarded – undo
3150 3150
     $html = ob_get_clean();
3151 3151
     return $output.$html;
3152 3152
 }
3153
-add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
3154
-add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
3155
-add_filter('geodir_cfa_extra_fields_radio','geodir_cfa_extra_fields_smr',10,4);
3153
+add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_smr', 10, 4);
3154
+add_filter('geodir_cfa_extra_fields_select', 'geodir_cfa_extra_fields_smr', 10, 4);
3155
+add_filter('geodir_cfa_extra_fields_radio', 'geodir_cfa_extra_fields_smr', 10, 4);
3156 3156
 
3157 3157
 
3158
-function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
3158
+function geodir_cfa_extra_fields_datepicker($output, $result_str, $cf, $field_info) {
3159 3159
     ob_start();
3160 3160
     $extra = array();
3161 3161
     if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
@@ -3166,7 +3166,7 @@  discard block
 block discarded – undo
3166 3166
         <label for="date_format" class="gd-cf-tooltip-wrap">
3167 3167
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
3168 3168
             <div class="gdcf-tooltip">
3169
-                <?php _e('Select the date format.', 'geodirectory');?>
3169
+                <?php _e('Select the date format.', 'geodirectory'); ?>
3170 3170
             </div>
3171 3171
         </label>
3172 3172
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
@@ -3186,16 +3186,16 @@  discard block
 block discarded – undo
3186 3186
              * @since 1.6.5
3187 3187
              * @param array $date_formats The PHP date format array.
3188 3188
              */
3189
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
3189
+            $date_formats = apply_filters('geodir_date_formats', $date_formats);
3190 3190
             ?>
3191 3191
             <select name="extra[date_format]" id="date_format">
3192 3192
                 <?php
3193
-                foreach($date_formats as $format){
3193
+                foreach ($date_formats as $format) {
3194 3194
                     $selected = '';
3195
-                    if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3195
+                    if (!empty($extra) && esc_attr($extra['date_format']) == $format) {
3196 3196
                         $selected = "selected='selected'";
3197 3197
                     }
3198
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3198
+                    echo "<option $selected value='$format'>$format       (".date_i18n($format, time()).")</option>";
3199 3199
                 }
3200 3200
                 ?>
3201 3201
             </select>
@@ -3207,10 +3207,10 @@  discard block
 block discarded – undo
3207 3207
     $html = ob_get_clean();
3208 3208
     return $output.$html;
3209 3209
 }
3210
-add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3210
+add_filter('geodir_cfa_extra_fields_datepicker', 'geodir_cfa_extra_fields_datepicker', 10, 4);
3211 3211
 
3212 3212
 
3213
-function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3213
+function geodir_cfa_extra_fields_file($output, $result_str, $cf, $field_info) {
3214 3214
     ob_start();
3215 3215
     $allowed_file_types = geodir_allowed_mime_types();
3216 3216
 
@@ -3221,16 +3221,16 @@  discard block
 block discarded – undo
3221 3221
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3222 3222
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
3223 3223
             <div class="gdcf-tooltip">
3224
-                <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory');?>
3224
+                <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory'); ?>
3225 3225
             </div>
3226 3226
         </label>
3227 3227
         <div class="gd-cf-input-wrap">
3228 3228
             <select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;">
3229
-                <option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
3230
-                <?php foreach ( $allowed_file_types as $format => $types ) { ?>
3231
-                    <optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
3232
-                        <?php foreach ( $types as $ext => $type ) { ?>
3233
-                            <option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option>
3229
+                <option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
3230
+                <?php foreach ($allowed_file_types as $format => $types) { ?>
3231
+                    <optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
3232
+                        <?php foreach ($types as $ext => $type) { ?>
3233
+                            <option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.'.$ext; ?></option>
3234 3234
                         <?php } ?>
3235 3235
                     </optgroup>
3236 3236
                 <?php } ?>
@@ -3242,9 +3242,9 @@  discard block
 block discarded – undo
3242 3242
     $html = ob_get_clean();
3243 3243
     return $output.$html;
3244 3244
 }
3245
-add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3245
+add_filter('geodir_cfa_extra_fields_file', 'geodir_cfa_extra_fields_file', 10, 4);
3246 3246
 
3247
-function geodir_cfa_extra_fields_text($output,$result_str,$cf,$field_info){
3247
+function geodir_cfa_extra_fields_text($output, $result_str, $cf, $field_info) {
3248 3248
     ob_start();
3249 3249
 
3250 3250
     $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
@@ -3258,15 +3258,15 @@  discard block
 block discarded – undo
3258 3258
     $value = '';
3259 3259
     if ($extra_fields && isset($extra_fields['is_price'])) {
3260 3260
     $value = esc_attr($extra_fields['is_price']);
3261
-    }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3261
+    }elseif (isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']) {
3262 3262
     $value = esc_attr($cf['defaults']['extra_fields']['is_price']);
3263 3263
     }
3264 3264
 
3265
-    $show_price_extra = ($value==1) ? 1 : 0;
3265
+    $show_price_extra = ($value == 1) ? 1 : 0;
3266 3266
 
3267
-    $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0;
3267
+    $show_price = (isset($field_info->data_type) && ($field_info->data_type == 'INT' && $field_info->data_type == 'FLOAT')) ? 1 : 0;
3268 3268
     ?>
3269
-    <li class="gdcf-price-extra-set" <?php if(!$show_price){ echo "style='display:none;'";}?>>
3269
+    <li class="gdcf-price-extra-set" <?php if (!$show_price) { echo "style='display:none;'"; }?>>
3270 3270
         <label for="is_price" class="gd-cf-tooltip-wrap">
3271 3271
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display as price? :', 'geodirectory'); ?>
3272 3272
             <div class="gdcf-tooltip">
@@ -3275,17 +3275,17 @@  discard block
 block discarded – undo
3275 3275
         </label>
3276 3276
         <div class="gd-cf-input-wrap gd-switch">
3277 3277
 
3278
-            <input type="radio" id="is_price_yes<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-enabled"  value="1"
3278
+            <input type="radio" id="is_price_yes<?php echo $radio_id; ?>" name="extra[is_price]" class="gdri-enabled"  value="1"
3279 3279
                 <?php if ($value == '1') {
3280 3280
                     echo 'checked';
3281 3281
                 } ?>/>
3282
-            <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3282
+            <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3283 3283
 
3284
-            <input type="radio" id="is_price_no<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-disabled" value="0"
3284
+            <input type="radio" id="is_price_no<?php echo $radio_id; ?>" name="extra[is_price]" class="gdri-disabled" value="0"
3285 3285
                 <?php if ($value == '0' || !$value) {
3286 3286
                     echo 'checked';
3287 3287
                 } ?>/>
3288
-            <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3288
+            <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3289 3289
 
3290 3290
         </div>
3291 3291
     </li>
@@ -3295,23 +3295,23 @@  discard block
 block discarded – undo
3295 3295
     $value = '';
3296 3296
     if ($extra_fields && isset($extra_fields['thousand_separator'])) {
3297 3297
         $value = esc_attr($extra_fields['thousand_separator']);
3298
-    }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3298
+    }elseif (isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']) {
3299 3299
         $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']);
3300 3300
     }
3301 3301
     ?>
3302
-    <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3303
-        <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory');?>
3302
+    <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
3303
+        <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory'); ?>
3304 3304
             <div class="gdcf-tooltip">
3305 3305
                 <?php _e('Select the thousand separator.', 'geodirectory'); ?>
3306 3306
             </div>
3307 3307
         </label>
3308 3308
         <div class="gd-cf-input-wrap">
3309 3309
                 <select name="extra[thousand_separator]" id="thousand_separator">
3310
-                    <option value="comma" <?php selected(true, $value == 'comma');?>><?php _e(', (comma)', 'geodirectory'); ?></option>
3311
-                    <option value="slash" <?php selected(true, $value == "slash");?>><?php _e('\ (slash)', 'geodirectory'); ?></option>
3312
-                    <option value="period" <?php selected(true, $value == 'period');?>><?php _e('. (period)', 'geodirectory'); ?></option>
3313
-                    <option value="space" <?php selected(true, $value == 'space');?>><?php _e(' (space)', 'geodirectory'); ?></option>
3314
-                    <option value="none" <?php selected(true, $value == 'none');?>><?php _e('(none)', 'geodirectory'); ?></option>
3310
+                    <option value="comma" <?php selected(true, $value == 'comma'); ?>><?php _e(', (comma)', 'geodirectory'); ?></option>
3311
+                    <option value="slash" <?php selected(true, $value == "slash"); ?>><?php _e('\ (slash)', 'geodirectory'); ?></option>
3312
+                    <option value="period" <?php selected(true, $value == 'period'); ?>><?php _e('. (period)', 'geodirectory'); ?></option>
3313
+                    <option value="space" <?php selected(true, $value == 'space'); ?>><?php _e(' (space)', 'geodirectory'); ?></option>
3314
+                    <option value="none" <?php selected(true, $value == 'none'); ?>><?php _e('(none)', 'geodirectory'); ?></option>
3315 3315
                 </select>
3316 3316
         </div>
3317 3317
     </li>
@@ -3322,20 +3322,20 @@  discard block
 block discarded – undo
3322 3322
     $value = '';
3323 3323
     if ($extra_fields && isset($extra_fields['decimal_separator'])) {
3324 3324
         $value = esc_attr($extra_fields['decimal_separator']);
3325
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3325
+    }elseif (isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']) {
3326 3326
         $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']);
3327 3327
     }
3328 3328
     ?>
3329
-    <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3330
-        <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory');?>
3329
+    <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
3330
+        <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory'); ?>
3331 3331
             <div class="gdcf-tooltip">
3332 3332
                 <?php _e('Select the decimal separator.', 'geodirectory'); ?>
3333 3333
             </div>
3334 3334
         </label>
3335 3335
         <div class="gd-cf-input-wrap">
3336 3336
             <select name="extra[decimal_separator]" id="decimal_separator">
3337
-                <option value="period" <?php selected(true, $value == 'period');?>><?php _e('. (period)', 'geodirectory'); ?></option>
3338
-                <option value="comma" <?php selected(true, $value == "comma");?>><?php _e(', (comma)', 'geodirectory'); ?></option>
3337
+                <option value="period" <?php selected(true, $value == 'period'); ?>><?php _e('. (period)', 'geodirectory'); ?></option>
3338
+                <option value="comma" <?php selected(true, $value == "comma"); ?>><?php _e(', (comma)', 'geodirectory'); ?></option>
3339 3339
             </select>
3340 3340
         </div>
3341 3341
     </li>
@@ -3345,20 +3345,20 @@  discard block
 block discarded – undo
3345 3345
     $value = '';
3346 3346
     if ($extra_fields && isset($extra_fields['decimal_display'])) {
3347 3347
         $value = esc_attr($extra_fields['decimal_display']);
3348
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3348
+    }elseif (isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']) {
3349 3349
         $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']);
3350 3350
     }
3351 3351
     ?>
3352
-    <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3353
-        <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory');?>
3352
+    <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
3353
+        <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory'); ?>
3354 3354
             <div class="gdcf-tooltip">
3355 3355
                 <?php _e('Select how the decimal is displayed', 'geodirectory'); ?>
3356 3356
             </div>
3357 3357
         </label>
3358 3358
         <div class="gd-cf-input-wrap">
3359 3359
             <select name="extra[decimal_display]" id="decimal_display">
3360
-                <option value="if" <?php selected(true, $value == 'if');?>><?php _e('If used (not .00)', 'geodirectory'); ?></option>
3361
-                <option value="allways" <?php selected(true, $value == "allways");?>><?php _e('Always (.00)', 'geodirectory'); ?></option>
3360
+                <option value="if" <?php selected(true, $value == 'if'); ?>><?php _e('If used (not .00)', 'geodirectory'); ?></option>
3361
+                <option value="allways" <?php selected(true, $value == "allways"); ?>><?php _e('Always (.00)', 'geodirectory'); ?></option>
3362 3362
             </select>
3363 3363
         </div>
3364 3364
     </li>
@@ -3368,12 +3368,12 @@  discard block
 block discarded – undo
3368 3368
     $value = '';
3369 3369
     if ($extra_fields && isset($extra_fields['currency_symbol'])) {
3370 3370
         $value = esc_attr($extra_fields['currency_symbol']);
3371
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3371
+    }elseif (isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']) {
3372 3372
         $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']);
3373 3373
     }
3374 3374
     ?>
3375
-    <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3376
-        <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory');?>
3375
+    <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
3376
+        <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory'); ?>
3377 3377
             <div class="gdcf-tooltip">
3378 3378
                 <?php _e('Select the currency symbol.', 'geodirectory'); ?>
3379 3379
             </div>
@@ -3389,20 +3389,20 @@  discard block
 block discarded – undo
3389 3389
     $value = '';
3390 3390
     if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
3391 3391
         $value = esc_attr($extra_fields['currency_symbol_placement']);
3392
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3392
+    }elseif (isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']) {
3393 3393
         $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']);
3394 3394
     }
3395 3395
     ?>
3396
-    <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3397
-        <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory');?>
3396
+    <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
3397
+        <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory'); ?>
3398 3398
             <div class="gdcf-tooltip">
3399 3399
                 <?php _e('Select the currency symbol placement.', 'geodirectory'); ?>
3400 3400
             </div>
3401 3401
         </label>
3402 3402
         <div class="gd-cf-input-wrap">
3403 3403
             <select name="extra[currency_symbol_placement]" id="currency_symbol_placement">
3404
-                <option value="left" <?php selected(true, $value == 'left');?>><?php _e('Left', 'geodirectory'); ?></option>
3405
-                <option value="right" <?php selected(true, $value == "right");?>><?php _e('Right', 'geodirectory'); ?></option>
3404
+                <option value="left" <?php selected(true, $value == 'left'); ?>><?php _e('Left', 'geodirectory'); ?></option>
3405
+                <option value="right" <?php selected(true, $value == "right"); ?>><?php _e('Right', 'geodirectory'); ?></option>
3406 3406
             </select>
3407 3407
         </div>
3408 3408
     </li>
@@ -3413,11 +3413,11 @@  discard block
 block discarded – undo
3413 3413
     $html = ob_get_clean();
3414 3414
     return $output.$html;
3415 3415
 }
3416
-add_filter('geodir_cfa_extra_fields_text','geodir_cfa_extra_fields_text',10,4);
3416
+add_filter('geodir_cfa_extra_fields_text', 'geodir_cfa_extra_fields_text', 10, 4);
3417 3417
 
3418
-function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
3418
+function geodir_default_custom_fields($post_type = 'gd_place', $package_id = '') {
3419 3419
     $fields = array();
3420
-    $package = ($package_id=='') ? '' : array($package_id);
3420
+    $package = ($package_id == '') ? '' : array($package_id);
3421 3421
 
3422 3422
     $fields[] = array('listing_type' => $post_type,
3423 3423
                       'data_type' => 'VARCHAR',
@@ -3590,7 +3590,7 @@  discard block
 block discarded – undo
3590 3590
     return  $fields;
3591 3591
 }
3592 3592
 
3593
-function geodir_currency_format_number($number='',$cf=''){
3593
+function geodir_currency_format_number($number = '', $cf = '') {
3594 3594
 
3595 3595
     $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : '';
3596 3596
 
@@ -3599,35 +3599,35 @@  discard block
 block discarded – undo
3599 3599
     $decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if';
3600 3600
     $decimalpoint = '.';
3601 3601
 
3602
-    if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
3602
+    if (isset($cs['decimal_separator']) && $cs['decimal_separator'] == 'comma') {
3603 3603
         $decimalpoint = ',';
3604 3604
     }
3605 3605
 
3606 3606
     $separator = ',';
3607 3607
 
3608
-    if(isset($cs['thousand_separator'])){
3609
-        if($cs['thousand_separator']=='comma'){$separator = ',';}
3610
-        if($cs['thousand_separator']=='slash'){$separator = '\\';}
3611
-        if($cs['thousand_separator']=='period'){$separator = '.';}
3612
-        if($cs['thousand_separator']=='space'){$separator = ' ';}
3613
-        if($cs['thousand_separator']=='none'){$separator = '';}
3608
+    if (isset($cs['thousand_separator'])) {
3609
+        if ($cs['thousand_separator'] == 'comma') {$separator = ','; }
3610
+        if ($cs['thousand_separator'] == 'slash') {$separator = '\\'; }
3611
+        if ($cs['thousand_separator'] == 'period') {$separator = '.'; }
3612
+        if ($cs['thousand_separator'] == 'space') {$separator = ' '; }
3613
+        if ($cs['thousand_separator'] == 'none') {$separator = ''; }
3614 3614
     }
3615 3615
 
3616 3616
     $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left';
3617 3617
 
3618
-    if($decimals>0 && $decimal_display=='if'){
3619
-        if(is_int($number) || floor( $number ) == $number)
3618
+    if ($decimals > 0 && $decimal_display == 'if') {
3619
+        if (is_int($number) || floor($number) == $number)
3620 3620
             $decimals = 0;
3621 3621
     }
3622 3622
 
3623
-    $number = number_format($number,$decimals,$decimalpoint,$separator);
3623
+    $number = number_format($number, $decimals, $decimalpoint, $separator);
3624 3624
 
3625 3625
 
3626 3626
 
3627
-    if($currency_symbol_placement=='left'){
3628
-        $number = $symbol . $number;
3629
-    }else{
3630
-        $number = $number . $symbol;
3627
+    if ($currency_symbol_placement == 'left') {
3628
+        $number = $symbol.$number;
3629
+    } else {
3630
+        $number = $number.$symbol;
3631 3631
     }
3632 3632
 
3633 3633
 
Please login to merge, or discard this patch.
Indentation   +2258 added lines, -2258 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,706 +72,706 @@  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 requirement.
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
-     *    @type array $extra_fields An array of extra fields to store.
291
-     *
292
-     * }
293
-     * @param bool $default Not yet implemented.
294
-     * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
295
-     */
296
-    function geodir_custom_field_save($request_field = array(), $default = false)
297
-    {
298
-
299
-        global $wpdb, $plugin_prefix;
300
-
301
-        $old_html_variable = '';
302
-
303
-        $data_type = trim($request_field['data_type']);
304
-
305
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
306
-
307
-        // some servers fail if a POST value is VARCHAR so we change it.
308
-        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
309
-            $request_field['data_type'] = 'VARCHAR';
310
-        }
311
-
312
-        $cf = trim($result_str, '_');
313
-
314
-
315
-        /*-------- check duplicate validation --------*/
316
-
317
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
318
-        $post_type = $request_field['listing_type'];
319
-
320
-        if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
321
-            $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
322
-        }
323
-
324
-        $check_html_variable = $wpdb->get_var(
325
-            $wpdb->prepare(
326
-                "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
327
-                array($cf, $cehhtmlvar_name, $post_type)
328
-            )
329
-        );
330
-
331
-
332
-        if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
333
-
334
-            if ($cf != '') {
335
-
336
-                $post_meta_info = $wpdb->get_row(
337
-                    $wpdb->prepare(
338
-                        "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
339
-                        array($cf)
340
-                    )
341
-                );
342
-
343
-            }
344
-
345
-            if (!empty($post_meta_info)) {
346
-                $post_val = $post_meta_info;
347
-                $old_html_variable = $post_val->htmlvar_name;
348
-
349
-            }
350
-
351
-
352
-
353
-            if ($post_type == '') $post_type = 'gd_place';
354
-
355
-
356
-            $detail_table = $plugin_prefix . $post_type . '_detail';
357
-
358
-            $admin_title = $request_field['admin_title'];
359
-            $site_title = $request_field['site_title'];
360
-            $data_type = $request_field['data_type'];
361
-            $field_type = $request_field['field_type'];
362
-            $field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type;
363
-            $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
364
-            $admin_desc = $request_field['admin_desc'];
365
-            $clabels = isset($request_field['clabels']) ? $request_field['clabels'] : '';
366
-            $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
367
-            $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
368
-            $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
369
-            $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
370
-            $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
371
-            $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
372
-            $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
373
-            $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
374
-            $show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
375
-            $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
376
-            $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
377
-            $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
378
-            $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
379
-            $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
380
-            $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
381
-            $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 requirement.
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
+	 *    @type array $extra_fields An array of extra fields to store.
291
+	 *
292
+	 * }
293
+	 * @param bool $default Not yet implemented.
294
+	 * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
295
+	 */
296
+	function geodir_custom_field_save($request_field = array(), $default = false)
297
+	{
298
+
299
+		global $wpdb, $plugin_prefix;
300
+
301
+		$old_html_variable = '';
302
+
303
+		$data_type = trim($request_field['data_type']);
304
+
305
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
306
+
307
+		// some servers fail if a POST value is VARCHAR so we change it.
308
+		if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
309
+			$request_field['data_type'] = 'VARCHAR';
310
+		}
311
+
312
+		$cf = trim($result_str, '_');
313
+
314
+
315
+		/*-------- check duplicate validation --------*/
316
+
317
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
318
+		$post_type = $request_field['listing_type'];
319
+
320
+		if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
321
+			$cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
322
+		}
323
+
324
+		$check_html_variable = $wpdb->get_var(
325
+			$wpdb->prepare(
326
+				"select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
327
+				array($cf, $cehhtmlvar_name, $post_type)
328
+			)
329
+		);
330
+
331
+
332
+		if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
333
+
334
+			if ($cf != '') {
335
+
336
+				$post_meta_info = $wpdb->get_row(
337
+					$wpdb->prepare(
338
+						"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
339
+						array($cf)
340
+					)
341
+				);
342
+
343
+			}
344
+
345
+			if (!empty($post_meta_info)) {
346
+				$post_val = $post_meta_info;
347
+				$old_html_variable = $post_val->htmlvar_name;
348
+
349
+			}
350
+
351
+
352
+
353
+			if ($post_type == '') $post_type = 'gd_place';
354
+
355
+
356
+			$detail_table = $plugin_prefix . $post_type . '_detail';
357
+
358
+			$admin_title = $request_field['admin_title'];
359
+			$site_title = $request_field['site_title'];
360
+			$data_type = $request_field['data_type'];
361
+			$field_type = $request_field['field_type'];
362
+			$field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type;
363
+			$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
364
+			$admin_desc = $request_field['admin_desc'];
365
+			$clabels = isset($request_field['clabels']) ? $request_field['clabels'] : '';
366
+			$default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
367
+			$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
368
+			$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
369
+			$is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
370
+			$required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
371
+			$css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
372
+			$field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
373
+			$show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
374
+			$show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
375
+			$show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
376
+			$show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
377
+			$decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
378
+			$decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
379
+			$validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
380
+			$validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
381
+			$for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
382 382
 
383 383
             
384
-            if(is_array($show_in)){
385
-                $show_in = implode(",", $request_field['show_in']);
386
-            }
384
+			if(is_array($show_in)){
385
+				$show_in = implode(",", $request_field['show_in']);
386
+			}
387 387
             
388
-            if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
389
-                $htmlvar_name = 'geodir_' . $htmlvar_name;
390
-            }
388
+			if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
389
+				$htmlvar_name = 'geodir_' . $htmlvar_name;
390
+			}
391 391
 
392
-            $option_values = '';
393
-            if (isset($request_field['option_values']))
394
-                $option_values = $request_field['option_values'];
392
+			$option_values = '';
393
+			if (isset($request_field['option_values']))
394
+				$option_values = $request_field['option_values'];
395 395
 
396
-            $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
396
+			$cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
397 397
 
398
-            $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
398
+			$cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
399 399
 
400
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
401
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
402
-            else {
403
-                $package_info = array();
400
+			if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
401
+				$price_pkg = implode(",", $request_field['show_on_pkg']);
402
+			else {
403
+				$package_info = array();
404 404
 
405
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
406
-                $price_pkg = !empty($package_info->pid) ? $package_info->pid : '';
407
-            }
405
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
406
+				$price_pkg = !empty($package_info->pid) ? $package_info->pid : '';
407
+			}
408 408
 
409 409
 
410
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
411
-                $extra_fields = $request_field['extra'];
410
+			if (isset($request_field['extra']) && !empty($request_field['extra']))
411
+				$extra_fields = $request_field['extra'];
412 412
 
413
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
414
-                $is_default = $request_field['is_default'];
415
-            else
416
-                $is_default = '0';
413
+			if (isset($request_field['is_default']) && $request_field['is_default'] != '')
414
+				$is_default = $request_field['is_default'];
415
+			else
416
+				$is_default = '0';
417 417
 
418
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
419
-                $is_admin = $request_field['is_admin'];
420
-            else
421
-                $is_admin = '0';
418
+			if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
419
+				$is_admin = $request_field['is_admin'];
420
+			else
421
+				$is_admin = '0';
422 422
 
423 423
 
424
-            if ($is_active == '') $is_active = 1;
425
-            if ($is_required == '') $is_required = 0;
424
+			if ($is_active == '') $is_active = 1;
425
+			if ($is_required == '') $is_required = 0;
426 426
 
427 427
 
428
-            if ($sort_order == '') {
428
+			if ($sort_order == '') {
429 429
 
430
-                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
430
+				$last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
431 431
 
432
-                $sort_order = (int)$last_order + 1;
433
-            }
432
+				$sort_order = (int)$last_order + 1;
433
+			}
434 434
 
435
-            $default_value_add = '';
435
+			$default_value_add = '';
436 436
 
437 437
 
438
-            if (!empty($post_meta_info)) {
439
-                switch ($field_type):
438
+			if (!empty($post_meta_info)) {
439
+				switch ($field_type):
440 440
 
441
-                    case 'address':
441
+					case 'address':
442 442
 
443
-                        if ($htmlvar_name != '') {
444
-                            $prefix = $htmlvar_name . '_';
445
-                        }
446
-                        $old_prefix = $old_html_variable . '_';
443
+						if ($htmlvar_name != '') {
444
+							$prefix = $htmlvar_name . '_';
445
+						}
446
+						$old_prefix = $old_html_variable . '_';
447 447
 
448 448
 
449
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
449
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
450 450
 
451
-                        if ($default_value != '') {
452
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
453
-                        }
451
+						if ($default_value != '') {
452
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
453
+						}
454 454
 
455
-                        $wpdb->query($meta_field_add);
455
+						$wpdb->query($meta_field_add);
456 456
 
457
-                        if ($extra_fields != '') {
457
+						if ($extra_fields != '') {
458 458
 
459
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
459
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
460 460
 
461
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
462
-                                if ($is_column) {
463
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
461
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
462
+								if ($is_column) {
463
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
464 464
 
465
-                                    if ($default_value != '') {
466
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
467
-                                    }
465
+									if ($default_value != '') {
466
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
467
+									}
468 468
 
469
-                                    $wpdb->query($meta_field_add);
470
-                                } else {
469
+									$wpdb->query($meta_field_add);
470
+								} else {
471 471
 
472
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
473
-                                    if ($default_value != '') {
474
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
475
-                                    }
476
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
472
+									$meta_field_add = "VARCHAR( 50 ) NULL";
473
+									if ($default_value != '') {
474
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
475
+									}
476
+									geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
477 477
 
478
-                                }
478
+								}
479 479
 
480 480
 
481
-                            }
481
+							}
482 482
 
483 483
 
484
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
484
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
485 485
 
486
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
486
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
487 487
 
488
-                                if ($is_column) {
489
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
488
+								if ($is_column) {
489
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
490 490
 
491
-                                    if ($default_value != '') {
492
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
493
-                                    }
491
+									if ($default_value != '') {
492
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
493
+									}
494 494
 
495
-                                    $wpdb->query($meta_field_add);
496
-                                } else {
497
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
498
-                                    if ($default_value != '') {
499
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
500
-                                    }
495
+									$wpdb->query($meta_field_add);
496
+								} else {
497
+									$meta_field_add = "VARCHAR( 50 ) NULL";
498
+									if ($default_value != '') {
499
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
500
+									}
501 501
 
502
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
503
-                                }
502
+									geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
503
+								}
504 504
 
505
-                            }
506
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
505
+							}
506
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
507 507
 
508
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
508
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
509 509
 
510
-                                if ($is_column) {
510
+								if ($is_column) {
511 511
 
512
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
512
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
513 513
 
514
-                                    if ($default_value != '') {
515
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
516
-                                    }
514
+									if ($default_value != '') {
515
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
516
+									}
517 517
 
518
-                                    $wpdb->query($meta_field_add);
519
-                                } else {
518
+									$wpdb->query($meta_field_add);
519
+								} else {
520 520
 
521
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
522
-                                    if ($default_value != '') {
523
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
524
-                                    }
521
+									$meta_field_add = "VARCHAR( 50 ) NULL";
522
+									if ($default_value != '') {
523
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
524
+									}
525 525
 
526
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
526
+									geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
527 527
 
528
-                                }
528
+								}
529 529
 
530
-                            }
531
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
530
+							}
531
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
532 532
 
533
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
533
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
534 534
 
535
-                                if ($is_column) {
535
+								if ($is_column) {
536 536
 
537
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
537
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
538 538
 
539
-                                    if ($default_value != '') {
540
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
541
-                                    }
539
+									if ($default_value != '') {
540
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
541
+									}
542 542
 
543
-                                    $wpdb->query($meta_field_add);
544
-                                } else {
543
+									$wpdb->query($meta_field_add);
544
+								} else {
545 545
 
546
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
547
-                                    if ($default_value != '') {
548
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
549
-                                    }
546
+									$meta_field_add = "VARCHAR( 50 ) NULL";
547
+									if ($default_value != '') {
548
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
549
+									}
550 550
 
551
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
551
+									geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
552 552
 
553
-                                }
553
+								}
554 554
 
555
-                            }
556
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
555
+							}
556
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
557 557
 
558
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
559
-                                if ($is_column) {
558
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
559
+								if ($is_column) {
560 560
 
561
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
561
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
562 562
 
563
-                                    if ($default_value != '') {
564
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
565
-                                    }
563
+									if ($default_value != '') {
564
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
565
+									}
566 566
 
567
-                                    $wpdb->query($meta_field_add);
568
-                                } else {
567
+									$wpdb->query($meta_field_add);
568
+								} else {
569 569
 
570
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
571
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
572
-                                    if ($default_value != '') {
573
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
574
-                                    }
570
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
571
+									$meta_field_add = "VARCHAR( 20 ) NULL";
572
+									if ($default_value != '') {
573
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
574
+									}
575 575
 
576
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
576
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
577 577
 
578
-                                }
578
+								}
579 579
 
580 580
 
581
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
581
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
582 582
 
583
-                                if ($is_column) {
584
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
583
+								if ($is_column) {
584
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
585 585
 
586
-                                    if ($default_value != '') {
587
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
588
-                                    }
586
+									if ($default_value != '') {
587
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
588
+									}
589 589
 
590
-                                    $wpdb->query($meta_field_add);
591
-                                } else {
590
+									$wpdb->query($meta_field_add);
591
+								} else {
592 592
 
593
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
594
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
595
-                                    if ($default_value != '') {
596
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
597
-                                    }
593
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
594
+									$meta_field_add = "VARCHAR( 20 ) NULL";
595
+									if ($default_value != '') {
596
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
597
+									}
598 598
 
599
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
600
-                                }
599
+									geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
600
+								}
601 601
 
602
-                            }
603
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
602
+							}
603
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
604 604
 
605
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
605
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
606 606
 
607
-                                if ($is_column) {
608
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
607
+								if ($is_column) {
608
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
609 609
 
610
-                                    if ($default_value != '') {
611
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
612
-                                    }
610
+									if ($default_value != '') {
611
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
612
+									}
613 613
 
614
-                                    $wpdb->query($meta_field_add);
615
-                                } else {
614
+									$wpdb->query($meta_field_add);
615
+								} else {
616 616
 
617
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
617
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
618 618
 
619
-                                    $meta_field_add = "VARCHAR( 15 ) NULL";
620
-                                    if ($default_value != '') {
621
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
622
-                                    }
619
+									$meta_field_add = "VARCHAR( 15 ) NULL";
620
+									if ($default_value != '') {
621
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
622
+									}
623 623
 
624
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
625
-                                }
624
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
625
+								}
626 626
 
627 627
 
628
-                            }
629
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
628
+							}
629
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
630 630
 
631
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
632
-                                if ($is_column) {
633
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
631
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
632
+								if ($is_column) {
633
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
634 634
 
635
-                                    if ($default_value != '') {
636
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
637
-                                    }
635
+									if ($default_value != '') {
636
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
637
+									}
638 638
 
639
-                                    $wpdb->query($meta_field_add);
639
+									$wpdb->query($meta_field_add);
640 640
 
641
-                                } else {
641
+								} else {
642 642
 
643
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
643
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
644 644
 
645
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
646
-                                    if ($default_value != '') {
647
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
648
-                                    }
645
+									$meta_field_add = "VARCHAR( 3 ) NULL";
646
+									if ($default_value != '') {
647
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
648
+									}
649 649
 
650
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
651
-                                }
650
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
651
+								}
652 652
 
653
-                            }
654
-                            // show lat lng
655
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
656
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
653
+							}
654
+							// show lat lng
655
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
656
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
657 657
 
658
-                                if ($is_column) {
659
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
660
-                                    $meta_field_add .= " DEFAULT '1'";
658
+								if ($is_column) {
659
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
660
+									$meta_field_add .= " DEFAULT '1'";
661 661
 
662
-                                    $wpdb->query($meta_field_add);
663
-                                } else {
664
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
662
+									$wpdb->query($meta_field_add);
663
+								} else {
664
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
665 665
 
666
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
667
-                                    $meta_field_add .= " DEFAULT '1'";
666
+									$meta_field_add = "VARCHAR( 3 ) NULL";
667
+									$meta_field_add .= " DEFAULT '1'";
668 668
 
669
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
670
-                                }
669
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
670
+								}
671 671
 
672
-                            }
673
-                        }// end extra
672
+							}
673
+						}// end extra
674 674
 
675
-                        break;
675
+						break;
676 676
 
677
-                    case 'checkbox':
678
-                    case 'multiselect':
679
-                    case 'select':
680
-                    case 'taxonomy':
677
+					case 'checkbox':
678
+					case 'multiselect':
679
+					case 'select':
680
+					case 'taxonomy':
681 681
 
682
-                        $op_size = '500';
682
+						$op_size = '500';
683 683
 
684
-                        // only make the field as big as it needs to be.
685
-                        if(isset($option_values) && $option_values && $field_type=='select'){
686
-                            $option_values_arr = explode(',',$option_values);
687
-                            if(is_array($option_values_arr)){
688
-                                $op_max = 0;
689
-                                foreach($option_values_arr as $op_val){
690
-                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
691
-                                }
692
-                                if($op_max){$op_size =$op_max; }
693
-                            }
694
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
695
-                            if(strlen($option_values)){
696
-                                $op_size =  strlen($option_values);
697
-                            }
698
-                        }
684
+						// only make the field as big as it needs to be.
685
+						if(isset($option_values) && $option_values && $field_type=='select'){
686
+							$option_values_arr = explode(',',$option_values);
687
+							if(is_array($option_values_arr)){
688
+								$op_max = 0;
689
+								foreach($option_values_arr as $op_val){
690
+									if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
691
+								}
692
+								if($op_max){$op_size =$op_max; }
693
+							}
694
+						}elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
695
+							if(strlen($option_values)){
696
+								$op_size =  strlen($option_values);
697
+							}
698
+						}
699 699
 
700
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
700
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
701 701
 
702
-                        if ($default_value != '') {
703
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
704
-                        }
702
+						if ($default_value != '') {
703
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
704
+						}
705 705
 
706
-                        $alter_result = $wpdb->query($meta_field_add);
707
-                        if($alter_result===false){
708
-                            return __('Column change failed, you may have too many columns.','geodirectory');
709
-                        }
706
+						$alter_result = $wpdb->query($meta_field_add);
707
+						if($alter_result===false){
708
+							return __('Column change failed, you may have too many columns.','geodirectory');
709
+						}
710 710
 
711
-                        if (isset($request_field['cat_display_type']))
712
-                            $extra_fields = $request_field['cat_display_type'];
711
+						if (isset($request_field['cat_display_type']))
712
+							$extra_fields = $request_field['cat_display_type'];
713 713
 
714
-                        if (isset($request_field['multi_display_type']))
715
-                            $extra_fields = $request_field['multi_display_type'];
714
+						if (isset($request_field['multi_display_type']))
715
+							$extra_fields = $request_field['multi_display_type'];
716 716
 
717 717
 
718
-                        break;
718
+						break;
719 719
 
720
-                    case 'textarea':
721
-                    case 'html':
722
-                    case 'url':
723
-                    case 'file':
720
+					case 'textarea':
721
+					case 'html':
722
+					case 'url':
723
+					case 'file':
724 724
 
725
-                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
726
-                        if($alter_result===false){
727
-                            return __('Column change failed, you may have too many columns.','geodirectory');
728
-                        }
729
-                        if (isset($request_field['advanced_editor']))
730
-                            $extra_fields = $request_field['advanced_editor'];
731
-
732
-                        break;
725
+						$alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
726
+						if($alter_result===false){
727
+							return __('Column change failed, you may have too many columns.','geodirectory');
728
+						}
729
+						if (isset($request_field['advanced_editor']))
730
+							$extra_fields = $request_field['advanced_editor'];
731
+
732
+						break;
733 733
 
734
-                    case 'fieldset':
735
-                        // Nothing happened for fieldset
736
-                        break;
734
+					case 'fieldset':
735
+						// Nothing happened for fieldset
736
+						break;
737 737
 
738
-                    default:
739
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
740
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
741
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
742
-                            } else {
743
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
744
-                            }
745
-
746
-                            if (is_numeric($default_value) && $default_value != '') {
747
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
748
-                            }
749
-                        } else {
750
-                            $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
751
-                            if ($default_value != '') {
752
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
753
-                            }
754
-                        }
755
-
756
-                        $alter_result = $wpdb->query($default_value_add);
757
-                        if($alter_result===false){
758
-                            return __('Column change failed, you may have too many columns.','geodirectory');
759
-                        }
760
-                        break;
761
-                endswitch;
762
-
763
-                $extra_field_query = '';
764
-                if (!empty($extra_fields)) {
765
-                    $extra_field_query = serialize($extra_fields);
766
-                }
767
-
768
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
769
-
770
-                $wpdb->query(
771
-
772
-                    $wpdb->prepare(
773
-
774
-                        "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
738
+					default:
739
+						if ($data_type != 'VARCHAR' && $data_type != '') {
740
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
741
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
742
+							} else {
743
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
744
+							}
745
+
746
+							if (is_numeric($default_value) && $default_value != '') {
747
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
748
+							}
749
+						} else {
750
+							$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
751
+							if ($default_value != '') {
752
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
753
+							}
754
+						}
755
+
756
+						$alter_result = $wpdb->query($default_value_add);
757
+						if($alter_result===false){
758
+							return __('Column change failed, you may have too many columns.','geodirectory');
759
+						}
760
+						break;
761
+				endswitch;
762
+
763
+				$extra_field_query = '';
764
+				if (!empty($extra_fields)) {
765
+					$extra_field_query = serialize($extra_fields);
766
+				}
767
+
768
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
769
+
770
+				$wpdb->query(
771
+
772
+					$wpdb->prepare(
773
+
774
+						"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
775 775
 					post_type = %s,
776 776
 					admin_title = %s,
777 777
 					site_title = %s,
@@ -805,308 +805,308 @@  discard block
 block discarded – undo
805 805
 					for_admin_use = %s
806 806
 					where id = %d",
807 807
 
808
-                        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)
809
-                    )
808
+						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)
809
+					)
810 810
 
811
-                );
811
+				);
812 812
 
813
-                $lastid = trim($cf);
813
+				$lastid = trim($cf);
814 814
 
815 815
 
816
-                $wpdb->query(
817
-                    $wpdb->prepare(
818
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
816
+				$wpdb->query(
817
+					$wpdb->prepare(
818
+						"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
819 819
 					 	site_title=%s
820 820
 					where post_type = %s and htmlvar_name = %s",
821
-                        array($site_title, $post_type, $htmlvar_name)
822
-                    )
823
-                );
824
-
825
-
826
-                if ($cat_sort == '')
827
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
828
-
829
-
830
-                /**
831
-                 * Called after all custom fields are saved for a post.
832
-                 *
833
-                 * @since 1.0.0
834
-                 * @param int $lastid The post ID.
835
-                 */
836
-                do_action('geodir_after_custom_fields_updated', $lastid);
837
-
838
-            } else {
839
-
840
-                switch ($field_type):
841
-
842
-                    case 'address':
843
-
844
-                        $data_type = '';
845
-
846
-                        if ($htmlvar_name != '') {
847
-                            $prefix = $htmlvar_name . '_';
848
-                        }
849
-                        $old_prefix = $old_html_variable;
850
-
851
-                        //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
852
-
853
-                        $meta_field_add = "VARCHAR( 254 ) NULL";
854
-                        if ($default_value != '') {
855
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
856
-                        }
857
-
858
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
859
-                        //$wpdb->query($meta_field_add);
860
-
861
-
862
-                        if (!empty($extra_fields)) {
821
+						array($site_title, $post_type, $htmlvar_name)
822
+					)
823
+				);
824
+
825
+
826
+				if ($cat_sort == '')
827
+					$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
828
+
829
+
830
+				/**
831
+				 * Called after all custom fields are saved for a post.
832
+				 *
833
+				 * @since 1.0.0
834
+				 * @param int $lastid The post ID.
835
+				 */
836
+				do_action('geodir_after_custom_fields_updated', $lastid);
837
+
838
+			} else {
839
+
840
+				switch ($field_type):
841
+
842
+					case 'address':
843
+
844
+						$data_type = '';
845
+
846
+						if ($htmlvar_name != '') {
847
+							$prefix = $htmlvar_name . '_';
848
+						}
849
+						$old_prefix = $old_html_variable;
850
+
851
+						//$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
852
+
853
+						$meta_field_add = "VARCHAR( 254 ) NULL";
854
+						if ($default_value != '') {
855
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
856
+						}
857
+
858
+						geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
859
+						//$wpdb->query($meta_field_add);
860
+
861
+
862
+						if (!empty($extra_fields)) {
863 863
 
864
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
865
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
866
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
867
-                                if ($default_value != '') {
868
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
869
-                                }
870
-
871
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
872
-                                //$wpdb->query($meta_field_add);
873
-                            }
874
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
875
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
876
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
877
-                                if ($default_value != '') {
878
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
879
-                                }
880
-
881
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
882
-                                //$wpdb->query($meta_field_add);
883
-                            }
884
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
885
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
886
-
887
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
888
-                                if ($default_value != '') {
889
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
890
-                                }
891
-
892
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
893
-                                //$wpdb->query($meta_field_add);
894
-                            }
895
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
896
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
897
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
898
-                                if ($default_value != '') {
899
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
900
-                                }
901
-
902
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
903
-                                //$wpdb->query($meta_field_add);
904
-                            }
905
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
906
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
907
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
908
-                                if ($default_value != '') {
909
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
910
-                                }
911
-
912
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
913
-                                //$wpdb->query($meta_field_add);
914
-
915
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
916
-
917
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
918
-                                if ($default_value != '') {
919
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
920
-                                }
921
-
922
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
923
-
924
-                                //$wpdb->query($meta_field_add);
925
-                            }
926
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
927
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
928
-
929
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
930
-                                if ($default_value != '') {
931
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
932
-                                }
933
-
934
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
935
-
936
-                                //$wpdb->query($meta_field_add);
937
-                            }
938
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
939
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
940
-
941
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
942
-                                if ($default_value != '') {
943
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
944
-                                }
945
-
946
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
947
-
948
-                                //$wpdb->query($meta_field_add);
949
-                            }
950
-                            // show lat lng
951
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
952
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
953
-
954
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
955
-                                $meta_field_add .= " DEFAULT '1'";
956
-
957
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
958
-                                //$wpdb->query($meta_field_add);
959
-                            }
960
-                        }
961
-
962
-                        break;
963
-
964
-                    case 'checkbox':
965
-                        $data_type = 'TINYINT';
966
-
967
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
968
-                        if ((int)$default_value === 1) {
969
-                            $meta_field_add .= " DEFAULT '1'";
970
-                        }
971
-
972
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
973
-                        if ($add_result === false) {
974
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
975
-                        }
976
-                        break;
977
-                    case 'multiselect':
978
-                    case 'select':
979
-                        $data_type = 'VARCHAR';
980
-                        $op_size = '500';
981
-
982
-                        // only make the field as big as it needs to be.
983
-                        if (isset($option_values) && $option_values && $field_type == 'select') {
984
-                            $option_values_arr = explode(',', $option_values);
985
-
986
-                            if (is_array($option_values_arr)) {
987
-                                $op_max = 0;
988
-
989
-                                foreach ($option_values_arr as $op_val) {
990
-                                    if (strlen($op_val) && strlen($op_val) > $op_max) {
991
-                                        $op_max = strlen($op_val);
992
-                                    }
993
-                                }
994
-
995
-                                if ($op_max) {
996
-                                    $op_size = $op_max;
997
-                                }
998
-                            }
999
-                        } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
1000
-                            if (strlen($option_values)) {
1001
-                                $op_size =  strlen($option_values);
1002
-                            }
1003
-
1004
-                            if (isset($request_field['multi_display_type'])) {
1005
-                                $extra_fields = $request_field['multi_display_type'];
1006
-                            }
1007
-                        }
1008
-
1009
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1010
-                        if ($default_value != '') {
1011
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1012
-                        }
1013
-
1014
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1015
-                        if ($add_result === false) {
1016
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1017
-                        }
1018
-                        break;
1019
-                    case 'textarea':
1020
-                    case 'html':
1021
-                    case 'url':
1022
-                    case 'file':
1023
-
1024
-                        $data_type = 'TEXT';
1025
-
1026
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1027
-
1028
-                        $meta_field_add = $data_type . " NULL ";
1029
-                        /*if($default_value != '')
864
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
865
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
866
+								$meta_field_add = "VARCHAR( 30 ) NULL";
867
+								if ($default_value != '') {
868
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
869
+								}
870
+
871
+								geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
872
+								//$wpdb->query($meta_field_add);
873
+							}
874
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
875
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
876
+								$meta_field_add = "VARCHAR( 30 ) NULL";
877
+								if ($default_value != '') {
878
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
879
+								}
880
+
881
+								geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
882
+								//$wpdb->query($meta_field_add);
883
+							}
884
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
885
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
886
+
887
+								$meta_field_add = "VARCHAR( 30 ) NULL";
888
+								if ($default_value != '') {
889
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
890
+								}
891
+
892
+								geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
893
+								//$wpdb->query($meta_field_add);
894
+							}
895
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
896
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
897
+								$meta_field_add = "VARCHAR( 15 ) NULL";
898
+								if ($default_value != '') {
899
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
900
+								}
901
+
902
+								geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
903
+								//$wpdb->query($meta_field_add);
904
+							}
905
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
906
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
907
+								$meta_field_add = "VARCHAR( 20 ) NULL";
908
+								if ($default_value != '') {
909
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
910
+								}
911
+
912
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
913
+								//$wpdb->query($meta_field_add);
914
+
915
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
916
+
917
+								$meta_field_add = "VARCHAR( 20 ) NULL";
918
+								if ($default_value != '') {
919
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
920
+								}
921
+
922
+								geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
923
+
924
+								//$wpdb->query($meta_field_add);
925
+							}
926
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
927
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
928
+
929
+								$meta_field_add = "VARCHAR( 15 ) NULL";
930
+								if ($default_value != '') {
931
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
932
+								}
933
+
934
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
935
+
936
+								//$wpdb->query($meta_field_add);
937
+							}
938
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
939
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
940
+
941
+								$meta_field_add = "VARCHAR( 3 ) NULL";
942
+								if ($default_value != '') {
943
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
944
+								}
945
+
946
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
947
+
948
+								//$wpdb->query($meta_field_add);
949
+							}
950
+							// show lat lng
951
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
952
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
953
+
954
+								$meta_field_add = "VARCHAR( 3 ) NULL";
955
+								$meta_field_add .= " DEFAULT '1'";
956
+
957
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
958
+								//$wpdb->query($meta_field_add);
959
+							}
960
+						}
961
+
962
+						break;
963
+
964
+					case 'checkbox':
965
+						$data_type = 'TINYINT';
966
+
967
+						$meta_field_add = $data_type . "( 1 ) NOT NULL ";
968
+						if ((int)$default_value === 1) {
969
+							$meta_field_add .= " DEFAULT '1'";
970
+						}
971
+
972
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
973
+						if ($add_result === false) {
974
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
975
+						}
976
+						break;
977
+					case 'multiselect':
978
+					case 'select':
979
+						$data_type = 'VARCHAR';
980
+						$op_size = '500';
981
+
982
+						// only make the field as big as it needs to be.
983
+						if (isset($option_values) && $option_values && $field_type == 'select') {
984
+							$option_values_arr = explode(',', $option_values);
985
+
986
+							if (is_array($option_values_arr)) {
987
+								$op_max = 0;
988
+
989
+								foreach ($option_values_arr as $op_val) {
990
+									if (strlen($op_val) && strlen($op_val) > $op_max) {
991
+										$op_max = strlen($op_val);
992
+									}
993
+								}
994
+
995
+								if ($op_max) {
996
+									$op_size = $op_max;
997
+								}
998
+							}
999
+						} elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
1000
+							if (strlen($option_values)) {
1001
+								$op_size =  strlen($option_values);
1002
+							}
1003
+
1004
+							if (isset($request_field['multi_display_type'])) {
1005
+								$extra_fields = $request_field['multi_display_type'];
1006
+							}
1007
+						}
1008
+
1009
+						$meta_field_add = $data_type . "( $op_size ) NULL ";
1010
+						if ($default_value != '') {
1011
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
1012
+						}
1013
+
1014
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1015
+						if ($add_result === false) {
1016
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1017
+						}
1018
+						break;
1019
+					case 'textarea':
1020
+					case 'html':
1021
+					case 'url':
1022
+					case 'file':
1023
+
1024
+						$data_type = 'TEXT';
1025
+
1026
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1027
+
1028
+						$meta_field_add = $data_type . " NULL ";
1029
+						/*if($default_value != '')
1030 1030
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1031 1031
 
1032
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1033
-                        if ($add_result === false) {
1034
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1035
-                        }
1032
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1033
+						if ($add_result === false) {
1034
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1035
+						}
1036 1036
 
1037
-                        break;
1037
+						break;
1038 1038
 
1039
-                    case 'datepicker':
1039
+					case 'datepicker':
1040 1040
 
1041
-                        $data_type = 'DATE';
1041
+						$data_type = 'DATE';
1042 1042
 
1043
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1043
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1044 1044
 
1045
-                        $meta_field_add = $data_type . " NULL ";
1045
+						$meta_field_add = $data_type . " NULL ";
1046 1046
 
1047
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1048
-                        if ($add_result === false) {
1049
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1050
-                        }
1047
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1048
+						if ($add_result === false) {
1049
+							return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1050
+						}
1051 1051
 
1052
-                        break;
1052
+						break;
1053 1053
 
1054
-                    case 'time':
1054
+					case 'time':
1055 1055
 
1056
-                        $data_type = 'TIME';
1056
+						$data_type = 'TIME';
1057 1057
 
1058
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1058
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1059 1059
 
1060
-                        $meta_field_add = $data_type . " NULL ";
1060
+						$meta_field_add = $data_type . " NULL ";
1061 1061
 
1062
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1063
-                        if ($add_result === false) {
1064
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1065
-                        }
1062
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1063
+						if ($add_result === false) {
1064
+							return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1065
+						}
1066 1066
 
1067
-                        break;
1067
+						break;
1068 1068
 
1069
-                    default:
1069
+					default:
1070 1070
 
1071
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
1072
-                            $meta_field_add = $data_type . " NULL ";
1071
+						if ($data_type != 'VARCHAR' && $data_type != '') {
1072
+							$meta_field_add = $data_type . " NULL ";
1073 1073
 
1074
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
1075
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1076
-                            }
1074
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
1075
+								$meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1076
+							}
1077 1077
 
1078
-                            if (is_numeric($default_value) && $default_value != '') {
1079
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1080
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1081
-                            }
1082
-                        } else {
1083
-                            $meta_field_add = " VARCHAR( 254 ) NULL ";
1078
+							if (is_numeric($default_value) && $default_value != '') {
1079
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1080
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1081
+							}
1082
+						} else {
1083
+							$meta_field_add = " VARCHAR( 254 ) NULL ";
1084 1084
 
1085
-                            if ($default_value != '') {
1086
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1087
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1088
-                            }
1089
-                        }
1085
+							if ($default_value != '') {
1086
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1087
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1088
+							}
1089
+						}
1090 1090
 
1091
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1092
-                        if ($add_result === false) {
1093
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1094
-                        }
1095
-                        break;
1096
-                endswitch;
1091
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1092
+						if ($add_result === false) {
1093
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1094
+						}
1095
+						break;
1096
+				endswitch;
1097 1097
 
1098
-                $extra_field_query = '';
1099
-                if (!empty($extra_fields)) {
1100
-                    $extra_field_query = serialize($extra_fields);
1101
-                }
1098
+				$extra_field_query = '';
1099
+				if (!empty($extra_fields)) {
1100
+					$extra_field_query = serialize($extra_fields);
1101
+				}
1102 1102
 
1103
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1103
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1104 1104
 
1105
-                $wpdb->query(
1105
+				$wpdb->query(
1106 1106
 
1107
-                    $wpdb->prepare(
1107
+					$wpdb->prepare(
1108 1108
 
1109
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1109
+						"insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1110 1110
 					post_type = %s,
1111 1111
 					admin_title = %s,
1112 1112
 					site_title = %s,
@@ -1139,26 +1139,26 @@  discard block
 block discarded – undo
1139 1139
 					validation_msg = %s,
1140 1140
 					for_admin_use = %s ",
1141 1141
 
1142
-                        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
+						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)
1143 1143
 
1144
-                    )
1144
+					)
1145 1145
 
1146
-                );
1146
+				);
1147 1147
 
1148
-                $lastid = $wpdb->insert_id;
1148
+				$lastid = $wpdb->insert_id;
1149 1149
 
1150
-                $lastid = trim($lastid);
1150
+				$lastid = trim($lastid);
1151 1151
 
1152
-            }
1152
+			}
1153 1153
 
1154
-            return (int)$lastid;
1154
+			return (int)$lastid;
1155 1155
 
1156 1156
 
1157
-        } else {
1158
-            return 'HTML Variable Name should be a unique name';
1159
-        }
1157
+		} else {
1158
+			return 'HTML Variable Name should be a unique name';
1159
+		}
1160 1160
 
1161
-    }
1161
+	}
1162 1162
 }
1163 1163
 
1164 1164
 /**
@@ -1173,54 +1173,54 @@  discard block
 block discarded – undo
1173 1173
 function godir_set_field_order($field_ids = array())
1174 1174
 {
1175 1175
 
1176
-    global $wpdb;
1176
+	global $wpdb;
1177 1177
 
1178
-    $count = 0;
1179
-    if (!empty($field_ids)):
1180
-        $post_meta_info = false;
1181
-        foreach ($field_ids as $id) {
1178
+	$count = 0;
1179
+	if (!empty($field_ids)):
1180
+		$post_meta_info = false;
1181
+		foreach ($field_ids as $id) {
1182 1182
 
1183
-            $cf = trim($id, '_');
1183
+			$cf = trim($id, '_');
1184 1184
 
1185
-            $post_meta_info = $wpdb->query(
1186
-                $wpdb->prepare(
1187
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1185
+			$post_meta_info = $wpdb->query(
1186
+				$wpdb->prepare(
1187
+					"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1188 1188
 															sort_order=%d 
1189 1189
 															where id= %d",
1190
-                    array($count, $cf)
1191
-                )
1192
-            );
1193
-            $count++;
1194
-        }
1195
-
1196
-        return $post_meta_info;
1197
-    else:
1198
-        return false;
1199
-    endif;
1190
+					array($count, $cf)
1191
+				)
1192
+			);
1193
+			$count++;
1194
+		}
1195
+
1196
+		return $post_meta_info;
1197
+	else:
1198
+		return false;
1199
+	endif;
1200 1200
 }
1201 1201
 
1202 1202
 
1203 1203
 function geodir_get_cf_value($cf){
1204
-    global $gd_session;
1205
-    $value = '';
1206
-    if (is_admin()) {
1207
-        global $post,$gd_session;
1208
-
1209
-        if (isset($_REQUEST['post']))
1210
-            $_REQUEST['pid'] = $_REQUEST['post'];
1211
-    }
1212
-
1213
-    if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1214
-        $post = $gd_ses_listing;
1215
-        $value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1216
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1217
-        $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1218
-    } else {
1219
-        if ($value == '') {
1220
-            $value = $cf['default'];
1221
-        }
1222
-    }
1223
-    return $value;
1204
+	global $gd_session;
1205
+	$value = '';
1206
+	if (is_admin()) {
1207
+		global $post,$gd_session;
1208
+
1209
+		if (isset($_REQUEST['post']))
1210
+			$_REQUEST['pid'] = $_REQUEST['post'];
1211
+	}
1212
+
1213
+	if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1214
+		$post = $gd_ses_listing;
1215
+		$value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1216
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1217
+		$value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1218
+	} else {
1219
+		if ($value == '') {
1220
+			$value = $cf['default'];
1221
+		}
1222
+	}
1223
+	return $value;
1224 1224
 }
1225 1225
 
1226 1226
 /**
@@ -1239,422 +1239,422 @@  discard block
 block discarded – undo
1239 1239
  * @param string $post_type Optional. The wordpress post type.
1240 1240
  */
1241 1241
 function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
1242
-    global $is_default, $mapzoom, $gd_session;
1242
+	global $is_default, $mapzoom, $gd_session;
1243 1243
 
1244
-    $listing_type = $post_type;
1244
+	$listing_type = $post_type;
1245 1245
 
1246
-    $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1246
+	$custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1247 1247
 
1248
-    foreach ($custom_fields as $key => $val) {
1249
-        if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
1250
-        $val = stripslashes_deep($val); // strip slashes from labels
1251
-        if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
1248
+	foreach ($custom_fields as $key => $val) {
1249
+		if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
1250
+		$val = stripslashes_deep($val); // strip slashes from labels
1251
+		if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
1252 1252
 
1253
-        $name = $val['name'];
1254
-        $type = $val['type'];
1255
-        $is_default = $val['is_default'];
1253
+		$name = $val['name'];
1254
+		$type = $val['type'];
1255
+		$is_default = $val['is_default'];
1256 1256
 
1257
-        /* field available to site admin only for edit */
1258
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1259
-        if ($for_admin_use && !is_super_admin()) {
1260
-            continue;
1261
-        }
1257
+		/* field available to site admin only for edit */
1258
+		$for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1259
+		if ($for_admin_use && !is_super_admin()) {
1260
+			continue;
1261
+		}
1262 1262
 
1263
-        if (is_admin()) {
1264
-            global $post;
1263
+		if (is_admin()) {
1264
+			global $post;
1265 1265
 
1266
-            if (isset($_REQUEST['post']))
1267
-                $_REQUEST['pid'] = $_REQUEST['post'];
1268
-        }
1266
+			if (isset($_REQUEST['post']))
1267
+				$_REQUEST['pid'] = $_REQUEST['post'];
1268
+		}
1269 1269
 
1270 1270
         
1271 1271
 
1272
-        /**
1273
-         * Called before the custom fields info is output for submitting a post.
1274
-         *
1275
-         * Used dynamic hook type geodir_before_custom_form_field_$name.
1276
-         *
1277
-         * @since 1.0.0
1278
-         * @param string $listing_type The post post type.
1279
-         * @param int $package_id The price package ID for the post.
1280
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1281
-         * @see 'geodir_after_custom_form_field_$name'
1282
-         */
1283
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1284
-
1285
-
1286
-        $custom_field = $val;
1287
-        $html ='';
1288
-        /**
1289
-         * Filter the output for custom fields.
1290
-         *
1291
-         * Here we can remove or add new functions depending on the field type.
1292
-         *
1293
-         * @param string $html The html to be filtered (blank).
1294
-         * @param array $custom_field The custom field array values.
1295
-         */
1296
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1297
-
1298
-
1299
-
1300
-        /**
1301
-         * Called after the custom fields info is output for submitting a post.
1302
-         *
1303
-         * Used dynamic hook type geodir_after_custom_form_field_$name.
1304
-         *
1305
-         * @since 1.0.0
1306
-         * @param string $listing_type The post post type.
1307
-         * @param int $package_id The price package ID for the post.
1308
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1309
-         * @see 'geodir_before_custom_form_field_$name'
1310
-         */
1311
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1312
-
1313
-    }
1272
+		/**
1273
+		 * Called before the custom fields info is output for submitting a post.
1274
+		 *
1275
+		 * Used dynamic hook type geodir_before_custom_form_field_$name.
1276
+		 *
1277
+		 * @since 1.0.0
1278
+		 * @param string $listing_type The post post type.
1279
+		 * @param int $package_id The price package ID for the post.
1280
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1281
+		 * @see 'geodir_after_custom_form_field_$name'
1282
+		 */
1283
+		do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1284
+
1285
+
1286
+		$custom_field = $val;
1287
+		$html ='';
1288
+		/**
1289
+		 * Filter the output for custom fields.
1290
+		 *
1291
+		 * Here we can remove or add new functions depending on the field type.
1292
+		 *
1293
+		 * @param string $html The html to be filtered (blank).
1294
+		 * @param array $custom_field The custom field array values.
1295
+		 */
1296
+		echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1297
+
1298
+
1299
+
1300
+		/**
1301
+		 * Called after the custom fields info is output for submitting a post.
1302
+		 *
1303
+		 * Used dynamic hook type geodir_after_custom_form_field_$name.
1304
+		 *
1305
+		 * @since 1.0.0
1306
+		 * @param string $listing_type The post post type.
1307
+		 * @param int $package_id The price package ID for the post.
1308
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1309
+		 * @see 'geodir_before_custom_form_field_$name'
1310
+		 */
1311
+		do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1312
+
1313
+	}
1314 1314
 
1315 1315
 }
1316 1316
 
1317 1317
 
1318 1318
 if (!function_exists('geodir_get_field_infoby')) {
1319
-    /**
1320
-     * Get custom field using key and value.
1321
-     *
1322
-     * @since 1.0.0
1323
-     * @package GeoDirectory
1324
-     * @global object $wpdb WordPress Database object.
1325
-     * @param string $key The key you want to look for.
1326
-     * @param string $value The value of the key you want to look for.
1327
-     * @param string $geodir_post_type The post type.
1328
-     * @return bool|mixed Returns field info when available. otherwise returns false.
1329
-     */
1330
-    function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1331
-    {
1332
-
1333
-        global $wpdb;
1334
-
1335
-        $filter = $wpdb->get_row(
1336
-            $wpdb->prepare(
1337
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1338
-                array($geodir_post_type)
1339
-            )
1340
-        );
1341
-
1342
-        if ($filter) {
1343
-            return $filter;
1344
-        } else {
1345
-            return false;
1346
-        }
1347
-
1348
-    }
1319
+	/**
1320
+	 * Get custom field using key and value.
1321
+	 *
1322
+	 * @since 1.0.0
1323
+	 * @package GeoDirectory
1324
+	 * @global object $wpdb WordPress Database object.
1325
+	 * @param string $key The key you want to look for.
1326
+	 * @param string $value The value of the key you want to look for.
1327
+	 * @param string $geodir_post_type The post type.
1328
+	 * @return bool|mixed Returns field info when available. otherwise returns false.
1329
+	 */
1330
+	function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1331
+	{
1332
+
1333
+		global $wpdb;
1334
+
1335
+		$filter = $wpdb->get_row(
1336
+			$wpdb->prepare(
1337
+				"SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1338
+				array($geodir_post_type)
1339
+			)
1340
+		);
1341
+
1342
+		if ($filter) {
1343
+			return $filter;
1344
+		} else {
1345
+			return false;
1346
+		}
1347
+
1348
+	}
1349 1349
 }
1350 1350
 
1351 1351
 
1352 1352
 function geodir_field_icon_proccess($cf){
1353 1353
 
1354 1354
 
1355
-    if (strpos($cf['field_icon'], 'http') !== false) {
1356
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1357
-    } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1358
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1359
-    }else{
1360
-        $field_icon = $cf['field_icon'];
1361
-    }
1355
+	if (strpos($cf['field_icon'], 'http') !== false) {
1356
+		$field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1357
+	} elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1358
+		$field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1359
+	}else{
1360
+		$field_icon = $cf['field_icon'];
1361
+	}
1362 1362
 
1363
-    return $field_icon;
1363
+	return $field_icon;
1364 1364
 }
1365 1365
 
1366 1366
 if (!function_exists('geodir_show_listing_info')) {
1367
-    /**
1368
-     * Show listing info depending on field location.
1369
-     *
1370
-     * @since 1.0.0
1371
-     * @since 1.5.7 Custom fields option values added to db translation.
1372
-     *              Changes to display url fields title.
1373
-     * @package GeoDirectory
1374
-     * @global object $wpdb WordPress Database object.
1375
-     * @global object $post The current post object.
1376
-     * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1377
-     *
1378
-     * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1379
-     * @return string Returns listing info html.
1380
-     */
1381
-    function geodir_show_listing_info($fields_location = '') {
1382
-        global $post, $preview, $wpdb, $send_to_friend;
1383
-
1384
-        $package_info = array();
1385
-
1386
-        $package_info = geodir_post_package_info($package_info, $post);
1387
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
1388
-        $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1389
-        $send_to_friend = false;
1390
-
1391
-        ob_start();
1392
-        $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1393
-
1394
-        if (!empty($fields_info)) {
1395
-            $post = stripslashes_deep($post); // strip slashes
1367
+	/**
1368
+	 * Show listing info depending on field location.
1369
+	 *
1370
+	 * @since 1.0.0
1371
+	 * @since 1.5.7 Custom fields option values added to db translation.
1372
+	 *              Changes to display url fields title.
1373
+	 * @package GeoDirectory
1374
+	 * @global object $wpdb WordPress Database object.
1375
+	 * @global object $post The current post object.
1376
+	 * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1377
+	 *
1378
+	 * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1379
+	 * @return string Returns listing info html.
1380
+	 */
1381
+	function geodir_show_listing_info($fields_location = '') {
1382
+		global $post, $preview, $wpdb, $send_to_friend;
1383
+
1384
+		$package_info = array();
1385
+
1386
+		$package_info = geodir_post_package_info($package_info, $post);
1387
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
1388
+		$p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1389
+		$send_to_friend = false;
1390
+
1391
+		ob_start();
1392
+		$fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1393
+
1394
+		if (!empty($fields_info)) {
1395
+			$post = stripslashes_deep($post); // strip slashes
1396 1396
             
1397
-            //echo '<div class="geodir-company_info field-group">';
1398
-            global $field_set_start;
1399
-            $field_set_start = 0;
1400
-
1401
-
1402
-
1403
-            foreach ($fields_info as $type) {
1404
-                if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
1405
-                $type = stripslashes_deep($type); // strip slashes
1406
-                if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
1407
-                $html = '';
1408
-                $field_icon = geodir_field_icon_proccess($type);
1409
-                $filed_type = $type['type'];
1410
-                $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1411
-                if($html_var=='post'){$html_var='post_address';}
1412
-
1413
-                /**
1414
-                 * Filter the output for custom fields.
1415
-                 *
1416
-                 * Here we can remove or add new functions depending on the field type.
1417
-                 *
1418
-                 * @param string $html The html to be filtered (blank).
1419
-                 * @param string $fields_location The location the field is to be show.
1420
-                 * @param array $type The array of field values.
1421
-                 */
1422
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1423
-
1424
-                $variables_array = array();
1425
-
1426
-
1427
-                if ($type['type'] != 'fieldset'):
1428
-                    $variables_array['post_id'] = $post->ID;
1429
-                    $variables_array['label'] = __($type['site_title'], 'geodirectory');
1430
-                    $variables_array['value'] = '';
1431
-                    if (isset($post->{$type['htmlvar_name']}))
1432
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1433
-                endif;
1434
-
1435
-
1436
-                if ($html):
1437
-
1438
-                    /**
1439
-                     * Called before a custom fields is output on the frontend.
1440
-                     *
1441
-                     * @since 1.0.0
1442
-                     * @param string $html_var The HTML variable name for the field.
1443
-                     */
1444
-                    do_action("geodir_before_show_{$html_var}");
1445
-                    /**
1446
-                     * Filter custom field output.
1447
-                     *
1448
-                     * @since 1.0.0
1449
-                     *
1450
-                     * @param string $html_var The HTML variable name for the field.
1451
-                     * @param string $html Custom field unfiltered HTML.
1452
-                     * @param array $variables_array Custom field variables array.
1453
-                     */
1454
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1455
-
1456
-                    /**
1457
-                     * Called after a custom fields is output on the frontend.
1458
-                     *
1459
-                     * @since 1.0.0
1460
-                     * @param string $html_var The HTML variable name for the field.
1461
-                     */
1462
-                    do_action("geodir_after_show_{$html_var}");
1463
-
1464
-                endif;
1465
-
1466
-            }
1467
-
1468
-            //echo '</div>';
1469
-
1470
-        }
1471
-
1472
-
1473
-        $html = ob_get_clean();
1474
-
1475
-        /**
1476
-         * Filter the custom fields over all output.
1477
-         *
1478
-         * @param string $html The html of the custom fields.
1479
-         * @param string $fields_location The location the fields are being output.
1480
-         * @since 1.6.9
1481
-         */
1482
-        return apply_filters('geodir_show_listing_info',$html,$fields_location);
1483
-
1484
-    }
1397
+			//echo '<div class="geodir-company_info field-group">';
1398
+			global $field_set_start;
1399
+			$field_set_start = 0;
1400
+
1401
+
1402
+
1403
+			foreach ($fields_info as $type) {
1404
+				if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
1405
+				$type = stripslashes_deep($type); // strip slashes
1406
+				if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
1407
+				$html = '';
1408
+				$field_icon = geodir_field_icon_proccess($type);
1409
+				$filed_type = $type['type'];
1410
+				$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1411
+				if($html_var=='post'){$html_var='post_address';}
1412
+
1413
+				/**
1414
+				 * Filter the output for custom fields.
1415
+				 *
1416
+				 * Here we can remove or add new functions depending on the field type.
1417
+				 *
1418
+				 * @param string $html The html to be filtered (blank).
1419
+				 * @param string $fields_location The location the field is to be show.
1420
+				 * @param array $type The array of field values.
1421
+				 */
1422
+				$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1423
+
1424
+				$variables_array = array();
1425
+
1426
+
1427
+				if ($type['type'] != 'fieldset'):
1428
+					$variables_array['post_id'] = $post->ID;
1429
+					$variables_array['label'] = __($type['site_title'], 'geodirectory');
1430
+					$variables_array['value'] = '';
1431
+					if (isset($post->{$type['htmlvar_name']}))
1432
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
1433
+				endif;
1434
+
1435
+
1436
+				if ($html):
1437
+
1438
+					/**
1439
+					 * Called before a custom fields is output on the frontend.
1440
+					 *
1441
+					 * @since 1.0.0
1442
+					 * @param string $html_var The HTML variable name for the field.
1443
+					 */
1444
+					do_action("geodir_before_show_{$html_var}");
1445
+					/**
1446
+					 * Filter custom field output.
1447
+					 *
1448
+					 * @since 1.0.0
1449
+					 *
1450
+					 * @param string $html_var The HTML variable name for the field.
1451
+					 * @param string $html Custom field unfiltered HTML.
1452
+					 * @param array $variables_array Custom field variables array.
1453
+					 */
1454
+					if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1455
+
1456
+					/**
1457
+					 * Called after a custom fields is output on the frontend.
1458
+					 *
1459
+					 * @since 1.0.0
1460
+					 * @param string $html_var The HTML variable name for the field.
1461
+					 */
1462
+					do_action("geodir_after_show_{$html_var}");
1463
+
1464
+				endif;
1465
+
1466
+			}
1467
+
1468
+			//echo '</div>';
1469
+
1470
+		}
1471
+
1472
+
1473
+		$html = ob_get_clean();
1474
+
1475
+		/**
1476
+		 * Filter the custom fields over all output.
1477
+		 *
1478
+		 * @param string $html The html of the custom fields.
1479
+		 * @param string $fields_location The location the fields are being output.
1480
+		 * @since 1.6.9
1481
+		 */
1482
+		return apply_filters('geodir_show_listing_info',$html,$fields_location);
1483
+
1484
+	}
1485 1485
 }
1486 1486
 
1487 1487
 if (!function_exists('geodir_default_date_format')) {
1488
-    /**
1489
-     * Returns default date format.
1490
-     *
1491
-     * @since 1.0.0
1492
-     * @package GeoDirectory
1493
-     * @return mixed|string|void Returns default date format.
1494
-     */
1495
-    function geodir_default_date_format()
1496
-    {
1497
-        if ($format = get_option('date_format'))
1498
-            return $format;
1499
-        else
1500
-            return 'dd-mm-yy';
1501
-    }
1488
+	/**
1489
+	 * Returns default date format.
1490
+	 *
1491
+	 * @since 1.0.0
1492
+	 * @package GeoDirectory
1493
+	 * @return mixed|string|void Returns default date format.
1494
+	 */
1495
+	function geodir_default_date_format()
1496
+	{
1497
+		if ($format = get_option('date_format'))
1498
+			return $format;
1499
+		else
1500
+			return 'dd-mm-yy';
1501
+	}
1502 1502
 }
1503 1503
 
1504 1504
 if (!function_exists('geodir_get_formated_date')) {
1505
-    /**
1506
-     * Returns formatted date.
1507
-     *
1508
-     * @since 1.0.0
1509
-     * @package GeoDirectory
1510
-     * @param string $date Date string to convert.
1511
-     * @return bool|int|string Returns formatted date.
1512
-     */
1513
-    function geodir_get_formated_date($date)
1514
-    {
1515
-        return mysql2date(get_option('date_format'), $date);
1516
-    }
1505
+	/**
1506
+	 * Returns formatted date.
1507
+	 *
1508
+	 * @since 1.0.0
1509
+	 * @package GeoDirectory
1510
+	 * @param string $date Date string to convert.
1511
+	 * @return bool|int|string Returns formatted date.
1512
+	 */
1513
+	function geodir_get_formated_date($date)
1514
+	{
1515
+		return mysql2date(get_option('date_format'), $date);
1516
+	}
1517 1517
 }
1518 1518
 
1519 1519
 if (!function_exists('geodir_get_formated_time')) {
1520
-    /**
1521
-     * Returns formatted time.
1522
-     *
1523
-     * @since 1.0.0
1524
-     * @package GeoDirectory
1525
-     * @param string $time Time string to convert.
1526
-     * @return bool|int|string Returns formatted time.
1527
-     */
1528
-    function geodir_get_formated_time($time)
1529
-    {
1530
-        return mysql2date(get_option('time_format'), $time, $translate = true);
1531
-    }
1520
+	/**
1521
+	 * Returns formatted time.
1522
+	 *
1523
+	 * @since 1.0.0
1524
+	 * @package GeoDirectory
1525
+	 * @param string $time Time string to convert.
1526
+	 * @return bool|int|string Returns formatted time.
1527
+	 */
1528
+	function geodir_get_formated_time($time)
1529
+	{
1530
+		return mysql2date(get_option('time_format'), $time, $translate = true);
1531
+	}
1532 1532
 }
1533 1533
 
1534 1534
 
1535 1535
 if (!function_exists('geodir_save_post_file_fields')) {
1536
-    /**
1537
-     * Save post file fields
1538
-     *
1539
-     * @since 1.0.0
1540
-     * @since 1.4.7 Added `$extra_fields` parameter.
1541
-     * @package GeoDirectory
1542
-     * @global object $wpdb WordPress Database object.
1543
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1544
-     * @global object $current_user Current user object.
1545
-     * @param int $post_id
1546
-     * @param string $field_id
1547
-     * @param array $post_image
1548
-     * @param array $extra_fields Array of extra fields.
1549
-     */
1550
-    function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1551
-    {
1536
+	/**
1537
+	 * Save post file fields
1538
+	 *
1539
+	 * @since 1.0.0
1540
+	 * @since 1.4.7 Added `$extra_fields` parameter.
1541
+	 * @package GeoDirectory
1542
+	 * @global object $wpdb WordPress Database object.
1543
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1544
+	 * @global object $current_user Current user object.
1545
+	 * @param int $post_id
1546
+	 * @param string $field_id
1547
+	 * @param array $post_image
1548
+	 * @param array $extra_fields Array of extra fields.
1549
+	 */
1550
+	function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1551
+	{
1552 1552
 
1553
-        global $wpdb, $plugin_prefix, $current_user;
1553
+		global $wpdb, $plugin_prefix, $current_user;
1554 1554
 
1555
-        $post_type = get_post_type($post_id);
1556
-        //echo $field_id; exit;
1557
-        $table = $plugin_prefix . $post_type . '_detail';
1555
+		$post_type = get_post_type($post_id);
1556
+		//echo $field_id; exit;
1557
+		$table = $plugin_prefix . $post_type . '_detail';
1558 1558
 
1559
-        $postcurr_images = array();
1560
-        $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1561
-        $file_urls = '';
1559
+		$postcurr_images = array();
1560
+		$postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1561
+		$file_urls = '';
1562 1562
 
1563
-        if (!empty($post_image)) {
1563
+		if (!empty($post_image)) {
1564 1564
 
1565
-            $invalid_files = array();
1565
+			$invalid_files = array();
1566 1566
 
1567
-            //Get and remove all old images of post from database to set by new order
1568
-            $geodir_uploaddir = '';
1569
-            $uploads = wp_upload_dir();
1570
-            $uploads_dir = $uploads['path'];
1567
+			//Get and remove all old images of post from database to set by new order
1568
+			$geodir_uploaddir = '';
1569
+			$uploads = wp_upload_dir();
1570
+			$uploads_dir = $uploads['path'];
1571 1571
 
1572
-            $geodir_uploadpath = $uploads['path'];
1573
-            $geodir_uploadurl = $uploads['url'];
1574
-            $sub_dir = $uploads['subdir'];
1572
+			$geodir_uploadpath = $uploads['path'];
1573
+			$geodir_uploadurl = $uploads['url'];
1574
+			$sub_dir = $uploads['subdir'];
1575 1575
 
1576
-            $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'] : '';
1576
+			$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'] : '';
1577 1577
 
1578
-            for ($m = 0; $m < count($post_image); $m++) {
1578
+			for ($m = 0; $m < count($post_image); $m++) {
1579 1579
 
1580
-                /* --------- start ------- */
1580
+				/* --------- start ------- */
1581 1581
 
1582
-                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)))) {
1582
+				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)))) {
1583 1583
 
1584 1584
 
1585
-                    $curr_img_url = $post_image[$m];
1586
-                    $image_name_arr = explode('/', $curr_img_url);
1587
-                    $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1588
-                    $filename = end($image_name_arr);
1589
-                    $img_name_arr = explode('.', $filename);
1585
+					$curr_img_url = $post_image[$m];
1586
+					$image_name_arr = explode('/', $curr_img_url);
1587
+					$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1588
+					$filename = end($image_name_arr);
1589
+					$img_name_arr = explode('.', $filename);
1590 1590
 
1591
-                    $arr_file_type = wp_check_filetype($filename);
1591
+					$arr_file_type = wp_check_filetype($filename);
1592 1592
 
1593
-                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1594
-                        continue;
1595
-                    }
1593
+					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1594
+						continue;
1595
+					}
1596 1596
 
1597
-                    $uploaded_file_type = $arr_file_type['type'];
1598
-                    $uploaded_file_ext = $arr_file_type['ext'];
1597
+					$uploaded_file_type = $arr_file_type['type'];
1598
+					$uploaded_file_ext = $arr_file_type['ext'];
1599 1599
 
1600
-                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1601
-                        continue; // Invalid file type.
1602
-                    }
1600
+					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1601
+						continue; // Invalid file type.
1602
+					}
1603 1603
 
1604
-                    // Set an array containing a list of acceptable formats
1605
-                    //$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');
1604
+					// Set an array containing a list of acceptable formats
1605
+					//$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1606 1606
 
1607
-                    if (!function_exists('wp_handle_upload'))
1608
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1607
+					if (!function_exists('wp_handle_upload'))
1608
+						require_once(ABSPATH . 'wp-admin/includes/file.php');
1609 1609
 
1610
-                    if (!is_dir($geodir_uploadpath))
1611
-                        mkdir($geodir_uploadpath);
1610
+					if (!is_dir($geodir_uploadpath))
1611
+						mkdir($geodir_uploadpath);
1612 1612
 
1613
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1614
-                    $explode_sub_dir = explode("/", $sub_dir);
1615
-                    if ($curr_img_dir == end($explode_sub_dir)) {
1616
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1617
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1618
-                    } else {
1619
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1620
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1621
-                    }
1613
+					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1614
+					$explode_sub_dir = explode("/", $sub_dir);
1615
+					if ($curr_img_dir == end($explode_sub_dir)) {
1616
+						$img_path = $geodir_uploadpath . '/' . $filename;
1617
+						$img_url = $geodir_uploadurl . '/' . $filename;
1618
+					} else {
1619
+						$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1620
+						$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1621
+					}
1622 1622
 
1623
-                    $uploaded_file = '';
1624
-                    if (file_exists($img_path))
1625
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1623
+					$uploaded_file = '';
1624
+					if (file_exists($img_path))
1625
+						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1626 1626
 
1627
-                    if ($curr_img_dir != $geodir_uploaddir) {
1628
-                        if (file_exists($img_path))
1629
-                            unlink($img_path);
1630
-                    }
1627
+					if ($curr_img_dir != $geodir_uploaddir) {
1628
+						if (file_exists($img_path))
1629
+							unlink($img_path);
1630
+					}
1631 1631
 
1632
-                    if (!empty($uploaded_file))
1633
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1632
+					if (!empty($uploaded_file))
1633
+						$file_urls = $geodir_uploadurl . '/' . $new_name;
1634 1634
 
1635
-                } else {
1636
-                    $file_urls = $post_image[$m];
1637
-                }
1638
-            }
1635
+				} else {
1636
+					$file_urls = $post_image[$m];
1637
+				}
1638
+			}
1639 1639
 
1640 1640
 
1641
-        }
1641
+		}
1642 1642
 
1643
-        //Remove all old attachments and temp images
1644
-        if (!empty($postcurr_images)) {
1643
+		//Remove all old attachments and temp images
1644
+		if (!empty($postcurr_images)) {
1645 1645
 
1646
-            if ($file_urls != $postcurr_images) {
1647
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1648
-                $invalid_files = (object)$invalid_files;
1649
-            }
1650
-        }
1646
+			if ($file_urls != $postcurr_images) {
1647
+				$invalid_files[] = (object)array('src' => $postcurr_images);
1648
+				$invalid_files = (object)$invalid_files;
1649
+			}
1650
+		}
1651 1651
 
1652
-        geodir_save_post_meta($post_id, $field_id, $file_urls);
1652
+		geodir_save_post_meta($post_id, $field_id, $file_urls);
1653 1653
 
1654
-        if (!empty($invalid_files))
1655
-            geodir_remove_attachments($invalid_files);
1654
+		if (!empty($invalid_files))
1655
+			geodir_remove_attachments($invalid_files);
1656 1656
 
1657
-    }
1657
+	}
1658 1658
 }
1659 1659
 
1660 1660
 
@@ -1669,76 +1669,76 @@  discard block
 block discarded – undo
1669 1669
  */
1670 1670
 function geodir_custom_upload_mimes($existing_mimes = array())
1671 1671
 {
1672
-    $existing_mimes['wif'] = 'text/plain';
1673
-    $existing_mimes['jpg|jpeg'] = 'image/jpeg';
1674
-    $existing_mimes['gif'] = 'image/gif';
1675
-    $existing_mimes['png'] = 'image/png';
1676
-    $existing_mimes['pdf'] = 'application/pdf';
1677
-    $existing_mimes['txt'] = 'text/text';
1678
-    $existing_mimes['csv'] = 'application/octet-stream';
1679
-    $existing_mimes['doc'] = 'application/msword';
1680
-    $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1681
-    $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1682
-    $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1683
-    return $existing_mimes;
1672
+	$existing_mimes['wif'] = 'text/plain';
1673
+	$existing_mimes['jpg|jpeg'] = 'image/jpeg';
1674
+	$existing_mimes['gif'] = 'image/gif';
1675
+	$existing_mimes['png'] = 'image/png';
1676
+	$existing_mimes['pdf'] = 'application/pdf';
1677
+	$existing_mimes['txt'] = 'text/text';
1678
+	$existing_mimes['csv'] = 'application/octet-stream';
1679
+	$existing_mimes['doc'] = 'application/msword';
1680
+	$existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1681
+	$existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1682
+	$existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1683
+	return $existing_mimes;
1684 1684
 }
1685 1685
 
1686 1686
 if (!function_exists('geodir_plupload_action')) {
1687 1687
 
1688
-    /**
1689
-     * Get upload directory path details
1690
-     *
1691
-     * @since 1.0.0
1692
-     * @package GeoDirectory
1693
-     * @global object $current_user Current user object.
1694
-     * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1695
-     * @return mixed Returns upload directory details as an array.
1696
-     */
1697
-    function geodir_upload_dir($upload)
1698
-    {
1699
-        global $current_user;
1700
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1701
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1702
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1703
-        return $upload;
1704
-    }
1705
-
1706
-    /**
1707
-     * Handles place file and image upload.
1708
-     *
1709
-     * @since 1.0.0
1710
-     * @package GeoDirectory
1711
-     */
1712
-    function geodir_plupload_action()
1713
-    {
1714
-        // check ajax nonce
1715
-        $imgid = $_POST["imgid"];
1716
-
1717
-        check_ajax_referer($imgid . 'pluploadan');
1718
-
1719
-        // handle custom file uploaddir
1720
-        add_filter('upload_dir', 'geodir_upload_dir');
1721
-
1722
-        // change file orientation if needed
1723
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1724
-
1725
-        // handle file upload
1726
-        $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1727
-        // remove handle custom file uploaddir
1728
-        remove_filter('upload_dir', 'geodir_upload_dir');
1729
-
1730
-        if(!isset($status['url']) && isset($status['error'])){
1731
-            print_r($status);
1732
-        }
1733
-
1734
-        // send the uploaded file url in response
1735
-        if (isset($status['url'])) {
1736
-            echo $status['url'];
1737
-        } else {
1738
-            echo 'x';
1739
-        }
1740
-        exit;
1741
-    }
1688
+	/**
1689
+	 * Get upload directory path details
1690
+	 *
1691
+	 * @since 1.0.0
1692
+	 * @package GeoDirectory
1693
+	 * @global object $current_user Current user object.
1694
+	 * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1695
+	 * @return mixed Returns upload directory details as an array.
1696
+	 */
1697
+	function geodir_upload_dir($upload)
1698
+	{
1699
+		global $current_user;
1700
+		$upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1701
+		$upload['path'] = $upload['basedir'] . $upload['subdir'];
1702
+		$upload['url'] = $upload['baseurl'] . $upload['subdir'];
1703
+		return $upload;
1704
+	}
1705
+
1706
+	/**
1707
+	 * Handles place file and image upload.
1708
+	 *
1709
+	 * @since 1.0.0
1710
+	 * @package GeoDirectory
1711
+	 */
1712
+	function geodir_plupload_action()
1713
+	{
1714
+		// check ajax nonce
1715
+		$imgid = $_POST["imgid"];
1716
+
1717
+		check_ajax_referer($imgid . 'pluploadan');
1718
+
1719
+		// handle custom file uploaddir
1720
+		add_filter('upload_dir', 'geodir_upload_dir');
1721
+
1722
+		// change file orientation if needed
1723
+		$fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1724
+
1725
+		// handle file upload
1726
+		$status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1727
+		// remove handle custom file uploaddir
1728
+		remove_filter('upload_dir', 'geodir_upload_dir');
1729
+
1730
+		if(!isset($status['url']) && isset($status['error'])){
1731
+			print_r($status);
1732
+		}
1733
+
1734
+		// send the uploaded file url in response
1735
+		if (isset($status['url'])) {
1736
+			echo $status['url'];
1737
+		} else {
1738
+			echo 'x';
1739
+		}
1740
+		exit;
1741
+	}
1742 1742
 }
1743 1743
 
1744 1744
 /**
@@ -1753,17 +1753,17 @@  discard block
 block discarded – undo
1753 1753
  */
1754 1754
 function geodir_get_video($post_id)
1755 1755
 {
1756
-    global $wpdb, $plugin_prefix;
1756
+	global $wpdb, $plugin_prefix;
1757 1757
 
1758
-    $post_type = get_post_type($post_id);
1758
+	$post_type = get_post_type($post_id);
1759 1759
 
1760
-    $table = $plugin_prefix . $post_type . '_detail';
1760
+	$table = $plugin_prefix . $post_type . '_detail';
1761 1761
 
1762
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1762
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1763 1763
 
1764
-    if ($results) {
1765
-        return $results[0]->geodir_video;
1766
-    }
1764
+	if ($results) {
1765
+		return $results[0]->geodir_video;
1766
+	}
1767 1767
 
1768 1768
 }
1769 1769
 
@@ -1779,40 +1779,40 @@  discard block
 block discarded – undo
1779 1779
  */
1780 1780
 function geodir_get_special_offers($post_id)
1781 1781
 {
1782
-    global $wpdb, $plugin_prefix;
1782
+	global $wpdb, $plugin_prefix;
1783 1783
 
1784
-    $post_type = get_post_type($post_id);
1784
+	$post_type = get_post_type($post_id);
1785 1785
 
1786
-    $table = $plugin_prefix . $post_type . '_detail';
1786
+	$table = $plugin_prefix . $post_type . '_detail';
1787 1787
 
1788
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1788
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1789 1789
 
1790
-    if ($results) {
1791
-        return $results[0]->geodir_special_offers;
1792
-    }
1790
+	if ($results) {
1791
+		return $results[0]->geodir_special_offers;
1792
+	}
1793 1793
 
1794 1794
 }
1795 1795
 
1796 1796
 if (!function_exists('geodir_max_upload_size')) {
1797
-    /**
1798
-     * Get max upload file size
1799
-     *
1800
-     * @since 1.0.0
1801
-     * @package GeoDirectory
1802
-     * @return mixed|void Returns max upload file size.
1803
-     */
1804
-    function geodir_max_upload_size()
1805
-    {
1806
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1807
-
1808
-        if ($max_filesize > 0 && $max_filesize < 1) {
1809
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1810
-        } else {
1811
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1812
-        }
1813
-        /** Filter documented in geodirectory-functions/general_functions.php **/
1814
-        return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1815
-    }
1797
+	/**
1798
+	 * Get max upload file size
1799
+	 *
1800
+	 * @since 1.0.0
1801
+	 * @package GeoDirectory
1802
+	 * @return mixed|void Returns max upload file size.
1803
+	 */
1804
+	function geodir_max_upload_size()
1805
+	{
1806
+		$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1807
+
1808
+		if ($max_filesize > 0 && $max_filesize < 1) {
1809
+			$max_filesize = (int)($max_filesize * 1024) . 'kb';
1810
+		} else {
1811
+			$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1812
+		}
1813
+		/** Filter documented in geodirectory-functions/general_functions.php **/
1814
+		return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1815
+	}
1816 1816
 }
1817 1817
 
1818 1818
 
@@ -1830,33 +1830,33 @@  discard block
 block discarded – undo
1830 1830
  */
1831 1831
 function geodir_add_custom_sort_options($fields, $post_type)
1832 1832
 {
1833
-    global $wpdb;
1833
+	global $wpdb;
1834 1834
 
1835
-    if ($post_type != '') {
1835
+	if ($post_type != '') {
1836 1836
 
1837
-        $all_postypes = geodir_get_posttypes();
1837
+		$all_postypes = geodir_get_posttypes();
1838 1838
 
1839
-        if (in_array($post_type, $all_postypes)) {
1839
+		if (in_array($post_type, $all_postypes)) {
1840 1840
 
1841
-            $custom_fields = $wpdb->get_results(
1842
-                $wpdb->prepare(
1843
-                    "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",
1844
-                    array($post_type)
1845
-                ), 'ARRAY_A'
1846
-            );
1841
+			$custom_fields = $wpdb->get_results(
1842
+				$wpdb->prepare(
1843
+					"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",
1844
+					array($post_type)
1845
+				), 'ARRAY_A'
1846
+			);
1847 1847
 
1848
-            if (!empty($custom_fields)) {
1848
+			if (!empty($custom_fields)) {
1849 1849
 
1850
-                foreach ($custom_fields as $val) {
1851
-                    $fields[] = $val;
1852
-                }
1853
-            }
1850
+				foreach ($custom_fields as $val) {
1851
+					$fields[] = $val;
1852
+				}
1853
+			}
1854 1854
 
1855
-        }
1855
+		}
1856 1856
 
1857
-    }
1857
+	}
1858 1858
 
1859
-    return $fields;
1859
+	return $fields;
1860 1860
 }
1861 1861
 
1862 1862
 
@@ -1872,76 +1872,76 @@  discard block
 block discarded – undo
1872 1872
 function geodir_get_custom_sort_options($post_type = '')
1873 1873
 {
1874 1874
 
1875
-    global $wpdb;
1876
-
1877
-    if ($post_type != '') {
1878
-
1879
-        $all_postypes = geodir_get_posttypes();
1880
-
1881
-        if (!in_array($post_type, $all_postypes))
1882
-            return false;
1883
-
1884
-        $fields = array();
1885
-
1886
-        $fields[] = array(
1887
-            'post_type' => $post_type,
1888
-            'data_type' => '',
1889
-            'field_type' => 'random',
1890
-            'site_title' => 'Random',
1891
-            'htmlvar_name' => 'post_title',
1892
-            'field_icon' =>  'fa fa-random',
1893
-            'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1894
-        );
1895
-
1896
-        $fields[] = array(
1897
-            'post_type' => $post_type,
1898
-            'data_type' => '',
1899
-            'field_type' => 'datetime',
1900
-            'site_title' => __('Add date', 'geodirectory'),
1901
-            'htmlvar_name' => 'post_date',
1902
-            'field_icon' =>  'fa fa-calendar',
1903
-            'description' =>  __('Sort by date added', 'geodirectory')
1904
-        );
1905
-        $fields[] = array(
1906
-            'post_type' => $post_type,
1907
-            'data_type' => '',
1908
-            'field_type' => 'bigint',
1909
-            'site_title' => __('Review', 'geodirectory'),
1910
-            'htmlvar_name' => 'comment_count',
1911
-            'field_icon' =>  'fa fa-commenting-o',
1912
-            'description' =>  __('Sort by the number of reviews', 'geodirectory')
1913
-        );
1914
-        $fields[] = array(
1915
-            'post_type' => $post_type,
1916
-            'data_type' => '',
1917
-            'field_type' => 'float',
1918
-            'site_title' => __('Rating', 'geodirectory'),
1919
-            'htmlvar_name' => 'overall_rating',
1920
-            'field_icon' =>  'fa fa-star-o',
1921
-            'description' =>  __('Sort by the overall rating value', 'geodirectory')
1922
-        );
1923
-        $fields[] = array(
1924
-            'post_type' => $post_type,
1925
-            'data_type' => '',
1926
-            'field_type' => 'text',
1927
-            'site_title' => __('Title', 'geodirectory'),
1928
-            'htmlvar_name' => 'post_title',
1929
-            'field_icon' =>  'fa fa-sort-alpha-desc',
1930
-            'description' =>  __('Sort alphabetically by title', 'geodirectory')
1931
-        );
1932
-
1933
-        /**
1934
-         * Hook to add custom sort options.
1935
-         *
1936
-         * @since 1.0.0
1937
-         * @param array $fields Unmodified sort options array.
1938
-         * @param string $post_type Post type.
1939
-         */
1940
-        return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1941
-
1942
-    }
1943
-
1944
-    return false;
1875
+	global $wpdb;
1876
+
1877
+	if ($post_type != '') {
1878
+
1879
+		$all_postypes = geodir_get_posttypes();
1880
+
1881
+		if (!in_array($post_type, $all_postypes))
1882
+			return false;
1883
+
1884
+		$fields = array();
1885
+
1886
+		$fields[] = array(
1887
+			'post_type' => $post_type,
1888
+			'data_type' => '',
1889
+			'field_type' => 'random',
1890
+			'site_title' => 'Random',
1891
+			'htmlvar_name' => 'post_title',
1892
+			'field_icon' =>  'fa fa-random',
1893
+			'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1894
+		);
1895
+
1896
+		$fields[] = array(
1897
+			'post_type' => $post_type,
1898
+			'data_type' => '',
1899
+			'field_type' => 'datetime',
1900
+			'site_title' => __('Add date', 'geodirectory'),
1901
+			'htmlvar_name' => 'post_date',
1902
+			'field_icon' =>  'fa fa-calendar',
1903
+			'description' =>  __('Sort by date added', 'geodirectory')
1904
+		);
1905
+		$fields[] = array(
1906
+			'post_type' => $post_type,
1907
+			'data_type' => '',
1908
+			'field_type' => 'bigint',
1909
+			'site_title' => __('Review', 'geodirectory'),
1910
+			'htmlvar_name' => 'comment_count',
1911
+			'field_icon' =>  'fa fa-commenting-o',
1912
+			'description' =>  __('Sort by the number of reviews', 'geodirectory')
1913
+		);
1914
+		$fields[] = array(
1915
+			'post_type' => $post_type,
1916
+			'data_type' => '',
1917
+			'field_type' => 'float',
1918
+			'site_title' => __('Rating', 'geodirectory'),
1919
+			'htmlvar_name' => 'overall_rating',
1920
+			'field_icon' =>  'fa fa-star-o',
1921
+			'description' =>  __('Sort by the overall rating value', 'geodirectory')
1922
+		);
1923
+		$fields[] = array(
1924
+			'post_type' => $post_type,
1925
+			'data_type' => '',
1926
+			'field_type' => 'text',
1927
+			'site_title' => __('Title', 'geodirectory'),
1928
+			'htmlvar_name' => 'post_title',
1929
+			'field_icon' =>  'fa fa-sort-alpha-desc',
1930
+			'description' =>  __('Sort alphabetically by title', 'geodirectory')
1931
+		);
1932
+
1933
+		/**
1934
+		 * Hook to add custom sort options.
1935
+		 *
1936
+		 * @since 1.0.0
1937
+		 * @param array $fields Unmodified sort options array.
1938
+		 * @param string $post_type Post type.
1939
+		 */
1940
+		return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1941
+
1942
+	}
1943
+
1944
+	return false;
1945 1945
 }
1946 1946
 
1947 1947
 
@@ -1957,117 +1957,117 @@  discard block
 block discarded – undo
1957 1957
 function godir_set_sort_field_order($field_ids = array())
1958 1958
 {
1959 1959
 
1960
-    global $wpdb;
1960
+	global $wpdb;
1961 1961
 
1962
-    $count = 0;
1963
-    if (!empty($field_ids)):
1964
-        foreach ($field_ids as $id) {
1962
+	$count = 0;
1963
+	if (!empty($field_ids)):
1964
+		foreach ($field_ids as $id) {
1965 1965
 
1966
-            $cf = trim($id, '_');
1966
+			$cf = trim($id, '_');
1967 1967
 
1968
-            $post_meta_info = $wpdb->query(
1969
-                $wpdb->prepare(
1970
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1968
+			$post_meta_info = $wpdb->query(
1969
+				$wpdb->prepare(
1970
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1971 1971
 															sort_order=%d 
1972 1972
 															where id= %d",
1973
-                    array($count, $cf)
1974
-                )
1975
-            );
1976
-            $count++;
1977
-        }
1978
-
1979
-        return $field_ids;
1980
-    else:
1981
-        return false;
1982
-    endif;
1973
+					array($count, $cf)
1974
+				)
1975
+			);
1976
+			$count++;
1977
+		}
1978
+
1979
+		return $field_ids;
1980
+	else:
1981
+		return false;
1982
+	endif;
1983 1983
 }
1984 1984
 
1985 1985
 
1986 1986
 if (!function_exists('geodir_custom_sort_field_save')) {
1987
-    /**
1988
-     * Save or Update custom sort fields into the database.
1989
-     *
1990
-     * @since 1.0.0
1991
-     * @package GeoDirectory
1992
-     * @global object $wpdb WordPress Database object.
1993
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1994
-     * @param array $request_field {
1995
-     *    Attributes of the Request field.
1996
-     *
1997
-     *    @type string $action Ajax action name.
1998
-     *    @type string $manage_field_type Manage field type Default "sorting_options".
1999
-     *    @type string $create_field Do you want to create this field?.
2000
-     *    @type string $field_ins_upd Field created or updated?.
2001
-     *    @type string $_wpnonce Nonce value.
2002
-     *    @type string $listing_type The Post type.
2003
-     *    @type string $field_type Field Type.
2004
-     *    @type string $field_id Field ID.
2005
-     *    @type string $data_type Data Type.
2006
-     *    @type string $htmlvar_name HTML variable name.
2007
-     *    @type string $site_title Section title which you wish to display in frontend.
2008
-     *    @type string $is_default Is this default sorting?.
2009
-     *    @type string $is_active If not active then the field will not be displayed anywhere.
2010
-     *    @type string $sort_order Sort Order.
2011
-     *
2012
-     * }
2013
-     * @param bool $default Not yet implemented.
2014
-     * @return int Returns the last affected db table row id.
2015
-     */
2016
-    function geodir_custom_sort_field_save($request_field = array(), $default = false)
2017
-    {
2018
-
2019
-        global $wpdb, $plugin_prefix;
2020
-
2021
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2022
-
2023
-        $cf = trim($result_str, '_');
2024
-
2025
-        /*-------- check duplicate validation --------*/
2026
-
2027
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2028
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2029
-
2030
-        $post_type = $request_field['listing_type'];
2031
-        $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2032
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2033
-        $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2034
-        $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2035
-        $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2036
-        $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2037
-        $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2038
-        $asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2039
-        $desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2040
-        $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2041
-        $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2042
-
2043
-        $default_order = '';
2044
-        if ($is_default != '') {
2045
-            $default_order = $is_default;
2046
-            $is_default = '1';
2047
-        }
2048
-
2049
-
2050
-        $check_html_variable = $wpdb->get_var(
2051
-            $wpdb->prepare(
2052
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2053
-                array($cehhtmlvar_name, $post_type, $field_type)
2054
-            )
2055
-        );
2056
-
2057
-        if ($is_default == 1) {
2058
-
2059
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2060
-
2061
-        }
2062
-
2063
-
2064
-        if (!$check_html_variable) {
2065
-
2066
-            $wpdb->query(
2067
-
2068
-                $wpdb->prepare(
2069
-
2070
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1987
+	/**
1988
+	 * Save or Update custom sort fields into the database.
1989
+	 *
1990
+	 * @since 1.0.0
1991
+	 * @package GeoDirectory
1992
+	 * @global object $wpdb WordPress Database object.
1993
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1994
+	 * @param array $request_field {
1995
+	 *    Attributes of the Request field.
1996
+	 *
1997
+	 *    @type string $action Ajax action name.
1998
+	 *    @type string $manage_field_type Manage field type Default "sorting_options".
1999
+	 *    @type string $create_field Do you want to create this field?.
2000
+	 *    @type string $field_ins_upd Field created or updated?.
2001
+	 *    @type string $_wpnonce Nonce value.
2002
+	 *    @type string $listing_type The Post type.
2003
+	 *    @type string $field_type Field Type.
2004
+	 *    @type string $field_id Field ID.
2005
+	 *    @type string $data_type Data Type.
2006
+	 *    @type string $htmlvar_name HTML variable name.
2007
+	 *    @type string $site_title Section title which you wish to display in frontend.
2008
+	 *    @type string $is_default Is this default sorting?.
2009
+	 *    @type string $is_active If not active then the field will not be displayed anywhere.
2010
+	 *    @type string $sort_order Sort Order.
2011
+	 *
2012
+	 * }
2013
+	 * @param bool $default Not yet implemented.
2014
+	 * @return int Returns the last affected db table row id.
2015
+	 */
2016
+	function geodir_custom_sort_field_save($request_field = array(), $default = false)
2017
+	{
2018
+
2019
+		global $wpdb, $plugin_prefix;
2020
+
2021
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2022
+
2023
+		$cf = trim($result_str, '_');
2024
+
2025
+		/*-------- check duplicate validation --------*/
2026
+
2027
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2028
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2029
+
2030
+		$post_type = $request_field['listing_type'];
2031
+		$data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2032
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2033
+		$site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2034
+		$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2035
+		$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2036
+		$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2037
+		$is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2038
+		$asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2039
+		$desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2040
+		$asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2041
+		$desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2042
+
2043
+		$default_order = '';
2044
+		if ($is_default != '') {
2045
+			$default_order = $is_default;
2046
+			$is_default = '1';
2047
+		}
2048
+
2049
+
2050
+		$check_html_variable = $wpdb->get_var(
2051
+			$wpdb->prepare(
2052
+				"select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2053
+				array($cehhtmlvar_name, $post_type, $field_type)
2054
+			)
2055
+		);
2056
+
2057
+		if ($is_default == 1) {
2058
+
2059
+			$wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2060
+
2061
+		}
2062
+
2063
+
2064
+		if (!$check_html_variable) {
2065
+
2066
+			$wpdb->query(
2067
+
2068
+				$wpdb->prepare(
2069
+
2070
+					"insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2071 2071
 				post_type = %s,
2072 2072
 				data_type = %s,
2073 2073
 				field_type = %s,
@@ -2082,23 +2082,23 @@  discard block
 block discarded – undo
2082 2082
 				asc_title = %s,
2083 2083
 				desc_title = %s",
2084 2084
 
2085
-                    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)
2086
-                )
2085
+					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)
2086
+				)
2087 2087
 
2088
-            );
2088
+			);
2089 2089
 
2090 2090
 
2091
-            $lastid = $wpdb->insert_id;
2091
+			$lastid = $wpdb->insert_id;
2092 2092
 
2093
-            $lastid = trim($lastid);
2093
+			$lastid = trim($lastid);
2094 2094
 
2095
-        } else {
2095
+		} else {
2096 2096
 
2097
-            $wpdb->query(
2097
+			$wpdb->query(
2098 2098
 
2099
-                $wpdb->prepare(
2099
+				$wpdb->prepare(
2100 2100
 
2101
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2101
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2102 2102
 				post_type = %s,
2103 2103
 				data_type = %s,
2104 2104
 				field_type = %s,
@@ -2114,123 +2114,123 @@  discard block
 block discarded – undo
2114 2114
 				desc_title = %s
2115 2115
 				where id = %d",
2116 2116
 
2117
-                    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)
2118
-                )
2117
+					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)
2118
+				)
2119 2119
 
2120
-            );
2120
+			);
2121 2121
 
2122
-            $lastid = trim($cf);
2122
+			$lastid = trim($cf);
2123 2123
 
2124
-        }
2124
+		}
2125 2125
 
2126 2126
 
2127
-        return (int)$lastid;
2127
+		return (int)$lastid;
2128 2128
 
2129
-    }
2129
+	}
2130 2130
 }
2131 2131
 
2132 2132
 
2133 2133
 if (!function_exists('geodir_custom_sort_field_delete')) {
2134
-    /**
2135
-     * Delete a custom sort field using field id.
2136
-     * @since 1.0.0
2137
-     * @package GeoDirectory
2138
-     * @global object $wpdb WordPress Database object.
2139
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2140
-     * @param string $field_id The field ID.
2141
-     * @return int|string Returns field id when successful deletion, else returns 0.
2142
-     */
2143
-    function geodir_custom_sort_field_delete($field_id = '')
2144
-    {
2145
-
2146
-        global $wpdb, $plugin_prefix;
2147
-        if ($field_id != '') {
2148
-            $cf = trim($field_id, '_');
2149
-
2150
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2151
-
2152
-            return $field_id;
2153
-
2154
-        } else
2155
-            return 0;
2156
-
2157
-    }
2134
+	/**
2135
+	 * Delete a custom sort field using field id.
2136
+	 * @since 1.0.0
2137
+	 * @package GeoDirectory
2138
+	 * @global object $wpdb WordPress Database object.
2139
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2140
+	 * @param string $field_id The field ID.
2141
+	 * @return int|string Returns field id when successful deletion, else returns 0.
2142
+	 */
2143
+	function geodir_custom_sort_field_delete($field_id = '')
2144
+	{
2145
+
2146
+		global $wpdb, $plugin_prefix;
2147
+		if ($field_id != '') {
2148
+			$cf = trim($field_id, '_');
2149
+
2150
+			$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2151
+
2152
+			return $field_id;
2153
+
2154
+		} else
2155
+			return 0;
2156
+
2157
+	}
2158 2158
 }
2159 2159
 
2160 2160
 
2161 2161
 if (!function_exists('geodir_custom_sort_field_adminhtml')) {
2162
-    /**
2163
-     * Custom sort field admin html.
2164
-     *
2165
-     * @since 1.0.0
2166
-     * @package GeoDirectory
2167
-     * @global object $wpdb WordPress Database object.
2168
-     * @param string $field_type The form field type.
2169
-     * @param object|int $result_str The custom field results object or row id.
2170
-     * @param string $field_ins_upd When set to "submit" displays form.
2171
-     * @param bool $default when set to true field will be for admin use only.
2172
-     */
2173
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2174
-    {
2175
-        global $wpdb;
2176
-        $cf = $result_str;
2177
-        if (!is_object($cf)) {
2178
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2179
-        } else {
2180
-            $field_info = $cf;
2181
-            $result_str = $cf->id;
2182
-        }
2183
-
2184
-        $field_info = stripslashes_deep($field_info); // strip slashes
2185
-
2186
-        if (!isset($field_info->post_type)) {
2187
-            $post_type = sanitize_text_field($_REQUEST['listing_type']);
2188
-        } else {
2189
-            $post_type = $field_info->post_type;
2190
-        }
2191
-
2192
-
2193
-        $htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2194
-
2195
-        $site_title = '';
2196
-        if ($site_title == '')
2197
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2198
-
2199
-        if ($site_title == '') {
2200
-            $fields = geodir_get_custom_sort_options($post_type);
2201
-
2202
-            foreach ($fields as $val) {
2203
-                $val = stripslashes_deep($val); // strip slashes
2204
-
2205
-                if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2206
-                    $site_title = isset($val['site_title']) ? $val['site_title'] : '';
2207
-                }
2208
-            }
2209
-        }
2210
-
2211
-        if ($htmlvar_name == '')
2212
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2213
-
2214
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2215
-
2216
-        $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2217
-        $cso_arr = geodir_get_custom_sort_options($post_type);
2218
-
2219
-        $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2220
-        foreach($cso_arr as $cso){
2221
-            if($cur_field_type==$cso['field_type']){
2222
-
2223
-                if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2224
-                    $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2225
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2226
-                    $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2227
-                }
2228
-
2229
-            }
2230
-        }
2231
-
2232
-        $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2233
-        ?>
2162
+	/**
2163
+	 * Custom sort field admin html.
2164
+	 *
2165
+	 * @since 1.0.0
2166
+	 * @package GeoDirectory
2167
+	 * @global object $wpdb WordPress Database object.
2168
+	 * @param string $field_type The form field type.
2169
+	 * @param object|int $result_str The custom field results object or row id.
2170
+	 * @param string $field_ins_upd When set to "submit" displays form.
2171
+	 * @param bool $default when set to true field will be for admin use only.
2172
+	 */
2173
+	function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2174
+	{
2175
+		global $wpdb;
2176
+		$cf = $result_str;
2177
+		if (!is_object($cf)) {
2178
+			$field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2179
+		} else {
2180
+			$field_info = $cf;
2181
+			$result_str = $cf->id;
2182
+		}
2183
+
2184
+		$field_info = stripslashes_deep($field_info); // strip slashes
2185
+
2186
+		if (!isset($field_info->post_type)) {
2187
+			$post_type = sanitize_text_field($_REQUEST['listing_type']);
2188
+		} else {
2189
+			$post_type = $field_info->post_type;
2190
+		}
2191
+
2192
+
2193
+		$htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2194
+
2195
+		$site_title = '';
2196
+		if ($site_title == '')
2197
+			$site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2198
+
2199
+		if ($site_title == '') {
2200
+			$fields = geodir_get_custom_sort_options($post_type);
2201
+
2202
+			foreach ($fields as $val) {
2203
+				$val = stripslashes_deep($val); // strip slashes
2204
+
2205
+				if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2206
+					$site_title = isset($val['site_title']) ? $val['site_title'] : '';
2207
+				}
2208
+			}
2209
+		}
2210
+
2211
+		if ($htmlvar_name == '')
2212
+			$htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2213
+
2214
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
2215
+
2216
+		$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2217
+		$cso_arr = geodir_get_custom_sort_options($post_type);
2218
+
2219
+		$cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2220
+		foreach($cso_arr as $cso){
2221
+			if($cur_field_type==$cso['field_type']){
2222
+
2223
+				if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2224
+					$field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2225
+				}elseif(isset($cso['field_icon']) && $cso['field_icon']){
2226
+					$field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2227
+				}
2228
+
2229
+			}
2230
+		}
2231
+
2232
+		$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2233
+		?>
2234 2234
 
2235 2235
         <li class="text" id="licontainer_<?php echo $result_str;?>">
2236 2236
             <form><!-- we need to wrap in a form so we can use radio buttons with same name -->
@@ -2239,7 +2239,7 @@  discard block
 block discarded – undo
2239 2239
                  ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2240 2240
                 <?php
2241 2241
 
2242
-                ?>
2242
+				?>
2243 2243
 
2244 2244
                 <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2245 2245
                      onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
@@ -2254,17 +2254,17 @@  discard block
 block discarded – undo
2254 2254
 
2255 2255
             <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2256 2256
                  style="display:<?php if ($field_ins_upd == 'submit') {
2257
-                     echo 'block;';
2258
-                 } else {
2259
-                     echo 'none;';
2260
-                 } ?>">
2257
+					 echo 'block;';
2258
+				 } else {
2259
+					 echo 'none;';
2260
+				 } ?>">
2261 2261
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2262 2262
                 <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2263 2263
                 <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2264 2264
                 <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2265 2265
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2266
-                    echo $field_info->data_type;
2267
-                }?>"/>
2266
+					echo $field_info->data_type;
2267
+				}?>"/>
2268 2268
                 <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2269 2269
 
2270 2270
 
@@ -2287,14 +2287,14 @@  discard block
 block discarded – undo
2287 2287
 
2288 2288
                                 <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled"  value="1"
2289 2289
                                     <?php if ($value == '1') {
2290
-                                        echo 'checked';
2291
-                                    } ?>/>
2290
+										echo 'checked';
2291
+									} ?>/>
2292 2292
                                 <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>
2293 2293
 
2294 2294
                                 <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0"
2295 2295
                                     <?php if ($value == '0' || !$value) {
2296
-                                        echo 'checked';
2297
-                                    } ?>/>
2296
+										echo 'checked';
2297
+									} ?>/>
2298 2298
                                 <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>
2299 2299
 
2300 2300
                             </div>
@@ -2331,8 +2331,8 @@  discard block
 block discarded – undo
2331 2331
 
2332 2332
                                 <input type="radio" name="is_default"
2333 2333
                                        value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2334
-                                    echo 'checked="checked"';
2335
-                                } ?>/>
2334
+									echo 'checked="checked"';
2335
+								} ?>/>
2336 2336
                             </div>
2337 2337
 
2338 2338
                         </li>
@@ -2352,14 +2352,14 @@  discard block
 block discarded – undo
2352 2352
 
2353 2353
                                 <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled"  value="1"
2354 2354
                                     <?php if ($value == '1') {
2355
-                                        echo 'checked';
2356
-                                    } ?>/>
2355
+										echo 'checked';
2356
+									} ?>/>
2357 2357
                                 <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>
2358 2358
 
2359 2359
                                 <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0"
2360 2360
                                     <?php if ($value == '0' || !$value) {
2361
-                                        echo 'checked';
2362
-                                    } ?>/>
2361
+										echo 'checked';
2362
+									} ?>/>
2363 2363
                                 <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>
2364 2364
 
2365 2365
                             </div>
@@ -2395,8 +2395,8 @@  discard block
 block discarded – undo
2395 2395
 
2396 2396
                                 <input type="radio" name="is_default"
2397 2397
                                        value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2398
-                                    echo 'checked="checked"';
2399
-                                } ?>/>
2398
+									echo 'checked="checked"';
2399
+								} ?>/>
2400 2400
                             </div>
2401 2401
 
2402 2402
                         </li>
@@ -2438,8 +2438,8 @@  discard block
 block discarded – undo
2438 2438
 
2439 2439
                                 <input type="checkbox" name="is_default"
2440 2440
                                        value="<?php echo $field_type; ?>"  <?php if (isset($value) && $value == '1') {
2441
-                                    echo 'checked="checked"';
2442
-                                } ?>/>
2441
+									echo 'checked="checked"';
2442
+								} ?>/>
2443 2443
                             </div>
2444 2444
 
2445 2445
 
@@ -2462,14 +2462,14 @@  discard block
 block discarded – undo
2462 2462
 
2463 2463
                             <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
2464 2464
                                 <?php if ($value == '1') {
2465
-                                    echo 'checked';
2466
-                                } ?>/>
2465
+									echo 'checked';
2466
+								} ?>/>
2467 2467
                             <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2468 2468
 
2469 2469
                             <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
2470 2470
                                 <?php if ($value == '0' || !$value) {
2471
-                                    echo 'checked';
2472
-                                } ?>/>
2471
+									echo 'checked';
2472
+								} ?>/>
2473 2473
                             <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2474 2474
 
2475 2475
                         </div>
@@ -2479,8 +2479,8 @@  discard block
 block discarded – undo
2479 2479
 
2480 2480
                     <input type="hidden" readonly="readonly" name="sort_order" id="sort_order"
2481 2481
                                                 value="<?php if (isset($field_info->sort_order)) {
2482
-                                                    echo esc_attr($field_info->sort_order);
2483
-                                                }?>" size="50"/>
2482
+													echo esc_attr($field_info->sort_order);
2483
+												}?>" size="50"/>
2484 2484
 
2485 2485
 
2486 2486
 
@@ -2504,38 +2504,38 @@  discard block
 block discarded – undo
2504 2504
             </form>
2505 2505
         </li> <?php
2506 2506
 
2507
-    }
2507
+	}
2508 2508
 }
2509 2509
 
2510 2510
 if (!function_exists('check_field_visibility')) {
2511
-    /**
2512
-     * Check field visibility as per price package.
2513
-     *
2514
-     * @since 1.0.0
2515
-     * @package GeoDirectory
2516
-     * @global object $wpdb WordPress Database object.
2517
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
2518
-     * @param int|string $package_id The package ID.
2519
-     * @param string $field_name The field name.
2520
-     * @param string $post_type Optional. The wordpress post type.
2521
-     * @return bool Returns true when field visible, otherwise false.
2522
-     */
2523
-    function check_field_visibility($package_id, $field_name, $post_type)
2524
-    {
2525
-        global $wpdb, $geodir_addon_list;
2526
-        if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2527
-            return true;
2528
-        }
2529
-        if (!$package_id || !$field_name || !$post_type) {
2530
-            return true;
2531
-        }
2532
-        $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));
2533
-
2534
-        if ($wpdb->get_var($sql)) {
2535
-            return true;
2536
-        }
2537
-        return false;
2538
-    }
2511
+	/**
2512
+	 * Check field visibility as per price package.
2513
+	 *
2514
+	 * @since 1.0.0
2515
+	 * @package GeoDirectory
2516
+	 * @global object $wpdb WordPress Database object.
2517
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
2518
+	 * @param int|string $package_id The package ID.
2519
+	 * @param string $field_name The field name.
2520
+	 * @param string $post_type Optional. The wordpress post type.
2521
+	 * @return bool Returns true when field visible, otherwise false.
2522
+	 */
2523
+	function check_field_visibility($package_id, $field_name, $post_type)
2524
+	{
2525
+		global $wpdb, $geodir_addon_list;
2526
+		if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2527
+			return true;
2528
+		}
2529
+		if (!$package_id || !$field_name || !$post_type) {
2530
+			return true;
2531
+		}
2532
+		$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));
2533
+
2534
+		if ($wpdb->get_var($sql)) {
2535
+			return true;
2536
+		}
2537
+		return false;
2538
+	}
2539 2539
 }
2540 2540
 
2541 2541
 /**
@@ -2551,43 +2551,43 @@  discard block
 block discarded – undo
2551 2551
  */
2552 2552
 function geodir_string_to_options($input = '', $translated = false)
2553 2553
 {
2554
-    $return = array();
2555
-    if ($input != '') {
2556
-        $input = trim($input);
2557
-        $input = rtrim($input, ",");
2558
-        $input = ltrim($input, ",");
2559
-        $input = trim($input);
2560
-    }
2561
-
2562
-    $input_arr = explode(',', $input);
2563
-
2564
-    if (!empty($input_arr)) {
2565
-        foreach ($input_arr as $input_str) {
2566
-            $input_str = trim($input_str);
2567
-
2568
-            if (strpos($input_str, "/") !== false) {
2569
-                $input_str = explode("/", $input_str, 2);
2570
-                $label = trim($input_str[0]);
2571
-                if ($translated && $label != '') {
2572
-                    $label = __($label, 'geodirectory');
2573
-                }
2574
-                $label = ucfirst($label);
2575
-                $value = trim($input_str[1]);
2576
-            } else {
2577
-                $value = $input_str;
2578
-                if ($translated && $input_str != '') {
2579
-                    $input_str = __($input_str, 'geodirectory');
2580
-                }
2581
-                $label = ucfirst($input_str);
2582
-            }
2583
-
2584
-            if ($label != '') {
2585
-                $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2586
-            }
2587
-        }
2588
-    }
2589
-
2590
-    return $return;
2554
+	$return = array();
2555
+	if ($input != '') {
2556
+		$input = trim($input);
2557
+		$input = rtrim($input, ",");
2558
+		$input = ltrim($input, ",");
2559
+		$input = trim($input);
2560
+	}
2561
+
2562
+	$input_arr = explode(',', $input);
2563
+
2564
+	if (!empty($input_arr)) {
2565
+		foreach ($input_arr as $input_str) {
2566
+			$input_str = trim($input_str);
2567
+
2568
+			if (strpos($input_str, "/") !== false) {
2569
+				$input_str = explode("/", $input_str, 2);
2570
+				$label = trim($input_str[0]);
2571
+				if ($translated && $label != '') {
2572
+					$label = __($label, 'geodirectory');
2573
+				}
2574
+				$label = ucfirst($label);
2575
+				$value = trim($input_str[1]);
2576
+			} else {
2577
+				$value = $input_str;
2578
+				if ($translated && $input_str != '') {
2579
+					$input_str = __($input_str, 'geodirectory');
2580
+				}
2581
+				$label = ucfirst($input_str);
2582
+			}
2583
+
2584
+			if ($label != '') {
2585
+				$return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2586
+			}
2587
+		}
2588
+	}
2589
+
2590
+	return $return;
2591 2591
 }
2592 2592
 
2593 2593
 /**
@@ -2602,66 +2602,66 @@  discard block
 block discarded – undo
2602 2602
  */
2603 2603
 function geodir_string_values_to_options($option_values = '', $translated = false)
2604 2604
 {
2605
-    $options = array();
2606
-    if ($option_values == '') {
2607
-        return NULL;
2608
-    }
2609
-
2610
-    if (strpos($option_values, "{/optgroup}") !== false) {
2611
-        $option_values_arr = explode("{/optgroup}", $option_values);
2612
-
2613
-        foreach ($option_values_arr as $optgroup) {
2614
-            if (strpos($optgroup, "{optgroup}") !== false) {
2615
-                $optgroup_arr = explode("{optgroup}", $optgroup);
2616
-
2617
-                $count = 0;
2618
-                foreach ($optgroup_arr as $optgroup_str) {
2619
-                    $count++;
2620
-                    $optgroup_str = trim($optgroup_str);
2621
-
2622
-                    $optgroup_label = '';
2623
-                    if (strpos($optgroup_str, "|") !== false) {
2624
-                        $optgroup_str_arr = explode("|", $optgroup_str, 2);
2625
-                        $optgroup_label = trim($optgroup_str_arr[0]);
2626
-                        if ($translated && $optgroup_label != '') {
2627
-                            $optgroup_label = __($optgroup_label, 'geodirectory');
2628
-                        }
2629
-                        $optgroup_label = ucfirst($optgroup_label);
2630
-                        $optgroup_str = $optgroup_str_arr[1];
2631
-                    }
2632
-
2633
-                    $optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2634
-
2635
-                    if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2636
-                        $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2637
-                        $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2638
-                        $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2639
-                    }
2640
-                    $options = array_merge($options, $optgroup3);
2641
-                }
2642
-            } else {
2643
-                $optgroup1 = geodir_string_to_options($optgroup, $translated);
2644
-                $options = array_merge($options, $optgroup1);
2645
-            }
2646
-        }
2647
-    } else {
2648
-        $options = geodir_string_to_options($option_values, $translated);
2649
-    }
2650
-
2651
-    return $options;
2605
+	$options = array();
2606
+	if ($option_values == '') {
2607
+		return NULL;
2608
+	}
2609
+
2610
+	if (strpos($option_values, "{/optgroup}") !== false) {
2611
+		$option_values_arr = explode("{/optgroup}", $option_values);
2612
+
2613
+		foreach ($option_values_arr as $optgroup) {
2614
+			if (strpos($optgroup, "{optgroup}") !== false) {
2615
+				$optgroup_arr = explode("{optgroup}", $optgroup);
2616
+
2617
+				$count = 0;
2618
+				foreach ($optgroup_arr as $optgroup_str) {
2619
+					$count++;
2620
+					$optgroup_str = trim($optgroup_str);
2621
+
2622
+					$optgroup_label = '';
2623
+					if (strpos($optgroup_str, "|") !== false) {
2624
+						$optgroup_str_arr = explode("|", $optgroup_str, 2);
2625
+						$optgroup_label = trim($optgroup_str_arr[0]);
2626
+						if ($translated && $optgroup_label != '') {
2627
+							$optgroup_label = __($optgroup_label, 'geodirectory');
2628
+						}
2629
+						$optgroup_label = ucfirst($optgroup_label);
2630
+						$optgroup_str = $optgroup_str_arr[1];
2631
+					}
2632
+
2633
+					$optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2634
+
2635
+					if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2636
+						$optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2637
+						$optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2638
+						$optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2639
+					}
2640
+					$options = array_merge($options, $optgroup3);
2641
+				}
2642
+			} else {
2643
+				$optgroup1 = geodir_string_to_options($optgroup, $translated);
2644
+				$options = array_merge($options, $optgroup1);
2645
+			}
2646
+		}
2647
+	} else {
2648
+		$options = geodir_string_to_options($option_values, $translated);
2649
+	}
2650
+
2651
+	return $options;
2652 2652
 }
2653 2653
 
2654 2654
 
2655 2655
 function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2656
-    ob_start();
2657
-
2658
-    $dt_value = '';
2659
-    if (isset($field_info->data_type)) {
2660
-        $dt_value  = esc_attr($field_info->data_type);
2661
-    }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2662
-        $dt_value  = $cf['defaults']['data_type'];
2663
-    }
2664
-    ?>
2656
+	ob_start();
2657
+
2658
+	$dt_value = '';
2659
+	if (isset($field_info->data_type)) {
2660
+		$dt_value  = esc_attr($field_info->data_type);
2661
+	}elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2662
+		$dt_value  = $cf['defaults']['data_type'];
2663
+	}
2664
+	?>
2665 2665
     <li>
2666 2666
         <label for="data_type"><?php _e('Field Data Type ? :', 'geodirectory'); ?></label>
2667 2667
         <div class="gd-cf-input-wrap">
@@ -2670,16 +2670,16 @@  discard block
 block discarded – undo
2670 2670
                     onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');">
2671 2671
                 <option
2672 2672
                     value="XVARCHAR" <?php if ($dt_value  == 'VARCHAR') {
2673
-                    echo 'selected="selected"';
2674
-                } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2673
+					echo 'selected="selected"';
2674
+				} ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2675 2675
                 <option
2676 2676
                     value="INT" <?php if ($dt_value   == 'INT') {
2677
-                    echo 'selected="selected"';
2678
-                } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2677
+					echo 'selected="selected"';
2678
+				} ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2679 2679
                 <option
2680 2680
                     value="FLOAT" <?php if ($dt_value   == 'FLOAT') {
2681
-                    echo 'selected="selected"';
2682
-                } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2681
+					echo 'selected="selected"';
2682
+				} ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2683 2683
             </select>
2684 2684
             <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
2685 2685
 
@@ -2687,13 +2687,13 @@  discard block
 block discarded – undo
2687 2687
     </li>
2688 2688
 
2689 2689
     <?php
2690
-    $value = '';
2691
-    if (isset($field_info->decimal_point)) {
2692
-        $value = esc_attr($field_info->decimal_point);
2693
-    }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2694
-        $value = $cf['defaults']['decimal_point'];
2695
-    }
2696
-    ?>
2690
+	$value = '';
2691
+	if (isset($field_info->decimal_point)) {
2692
+		$value = esc_attr($field_info->decimal_point);
2693
+	}elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2694
+		$value = $cf['defaults']['decimal_point'];
2695
+	}
2696
+	?>
2697 2697
 
2698 2698
     <li class="decimal-point-wrapper"
2699 2699
         style="<?php echo ($dt_value  == 'FLOAT') ? '' : 'display:none' ?>">
@@ -2702,7 +2702,7 @@  discard block
 block discarded – undo
2702 2702
             <select name="decimal_point" id="decimal_point">
2703 2703
                 <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
2704 2704
                 <?php for ($i = 1; $i <= 10; $i++) {
2705
-                    $selected = $i == $value ? 'selected="selected"' : ''; ?>
2705
+					$selected = $i == $value ? 'selected="selected"' : ''; ?>
2706 2706
                     <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
2707 2707
                 <?php } ?>
2708 2708
             </select>
@@ -2711,8 +2711,8 @@  discard block
 block discarded – undo
2711 2711
     </li>
2712 2712
 <?php
2713 2713
 
2714
-    $output = ob_get_clean();
2715
-    return $output;
2714
+	$output = ob_get_clean();
2715
+	return $output;
2716 2716
 }
2717 2717
 add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2718 2718
 
@@ -2750,9 +2750,9 @@  discard block
 block discarded – undo
2750 2750
 
2751 2751
 
2752 2752
 function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2753
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2754
-    ob_start();
2755
-    ?>
2753
+	if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2754
+	ob_start();
2755
+	?>
2756 2756
     <li>
2757 2757
         <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'); ?>
2758 2758
             <div class="gdcf-tooltip">
@@ -2763,13 +2763,13 @@  discard block
 block discarded – undo
2763 2763
         <div class="gd-cf-input-wrap">
2764 2764
 
2765 2765
             <?php
2766
-            $selected = '';
2767
-            if (isset($field_info->extra_fields))
2768
-                $advanced_editor = unserialize($field_info->extra_fields);
2766
+			$selected = '';
2767
+			if (isset($field_info->extra_fields))
2768
+				$advanced_editor = unserialize($field_info->extra_fields);
2769 2769
 
2770
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2771
-                $selected = 'checked="checked"';
2772
-            ?>
2770
+			if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2771
+				$selected = 'checked="checked"';
2772
+			?>
2773 2773
 
2774 2774
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
2775 2775
                    value="1" <?php echo $selected; ?>/>
@@ -2778,22 +2778,22 @@  discard block
 block discarded – undo
2778 2778
     </li>
2779 2779
     <?php
2780 2780
 
2781
-    $output = ob_get_clean();
2782
-    return $output;
2781
+	$output = ob_get_clean();
2782
+	return $output;
2783 2783
 }
2784 2784
 add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2785 2785
 
2786 2786
 
2787 2787
 function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2788
-    ob_start();
2789
-
2790
-    $value = '';
2791
-    if (isset($field_info->validation_pattern)) {
2792
-        $value = esc_attr($field_info->validation_pattern);
2793
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2794
-        $value = esc_attr($cf['defaults']['validation_pattern']);
2795
-    }
2796
-    ?>
2788
+	ob_start();
2789
+
2790
+	$value = '';
2791
+	if (isset($field_info->validation_pattern)) {
2792
+		$value = esc_attr($field_info->validation_pattern);
2793
+	}elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2794
+		$value = esc_attr($cf['defaults']['validation_pattern']);
2795
+	}
2796
+	?>
2797 2797
     <li>
2798 2798
         <label for="validation_pattern" class="gd-cf-tooltip-wrap">
2799 2799
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Pattern:', 'geodirectory'); ?>
@@ -2807,13 +2807,13 @@  discard block
 block discarded – undo
2807 2807
         </div>
2808 2808
     </li>
2809 2809
     <?php
2810
-    $value = '';
2811
-    if (isset($field_info->validation_msg)) {
2812
-        $value = esc_attr($field_info->validation_msg);
2813
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2814
-        $value = esc_attr($cf['defaults']['validation_msg']);
2815
-    }
2816
-    ?>
2810
+	$value = '';
2811
+	if (isset($field_info->validation_msg)) {
2812
+		$value = esc_attr($field_info->validation_msg);
2813
+	}elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2814
+		$value = esc_attr($cf['defaults']['validation_msg']);
2815
+	}
2816
+	?>
2817 2817
     <li>
2818 2818
         <label for="validation_msg" class="gd-cf-tooltip-wrap">
2819 2819
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Message:', 'geodirectory'); ?>
@@ -2828,21 +2828,21 @@  discard block
 block discarded – undo
2828 2828
     </li>
2829 2829
     <?php
2830 2830
 
2831
-    $output = ob_get_clean();
2832
-    return $output;
2831
+	$output = ob_get_clean();
2832
+	return $output;
2833 2833
 }
2834 2834
 add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2835 2835
 
2836 2836
 
2837 2837
 function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2838
-    ob_start();
2839
-    global $post_type;
2840
-
2841
-    if (!isset($field_info->post_type)) {
2842
-        $post_type = sanitize_text_field($_REQUEST['listing_type']);
2843
-    } else
2844
-        $post_type = $field_info->post_type;
2845
-    ?>
2838
+	ob_start();
2839
+	global $post_type;
2840
+
2841
+	if (!isset($field_info->post_type)) {
2842
+		$post_type = sanitize_text_field($_REQUEST['listing_type']);
2843
+	} else
2844
+		$post_type = $field_info->post_type;
2845
+	?>
2846 2846
     <li style="display: none;">
2847 2847
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
2848 2848
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Select taxonomy:', 'geodirectory'); ?>
@@ -2853,15 +2853,15 @@  discard block
 block discarded – undo
2853 2853
         <div class="gd-cf-input-wrap">
2854 2854
             <select name="htmlvar_name" id="htmlvar_name">
2855 2855
                 <?php
2856
-                $gd_taxonomy = geodir_get_taxonomies($post_type);
2856
+				$gd_taxonomy = geodir_get_taxonomies($post_type);
2857 2857
 
2858
-                foreach ($gd_taxonomy as $gd_tax) {
2859
-                    ?>
2858
+				foreach ($gd_taxonomy as $gd_tax) {
2859
+					?>
2860 2860
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2861
-                        echo 'selected="selected"';
2862
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2863
-                }
2864
-                ?>
2861
+						echo 'selected="selected"';
2862
+					}?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2863
+				}
2864
+				?>
2865 2865
             </select>
2866 2866
         </div>
2867 2867
     </li>
@@ -2877,49 +2877,49 @@  discard block
 block discarded – undo
2877 2877
 
2878 2878
             <select name="cat_display_type" id="cat_display_type">
2879 2879
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2880
-                    echo 'selected="selected"';
2881
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2880
+					echo 'selected="selected"';
2881
+				}?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2882 2882
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2883
-                    echo 'selected="selected"';
2884
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2883
+					echo 'selected="selected"';
2884
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
2885 2885
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2886
-                    echo 'selected="selected"';
2887
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2886
+					echo 'selected="selected"';
2887
+				}?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2888 2888
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2889
-                    echo 'selected="selected"';
2890
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2889
+					echo 'selected="selected"';
2890
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2891 2891
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2892
-                    echo 'selected="selected"';
2893
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2892
+					echo 'selected="selected"';
2893
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2894 2894
             </select>
2895 2895
         </div>
2896 2896
     </li>
2897 2897
     <?php
2898 2898
 
2899
-    $output = ob_get_clean();
2900
-    return $output;
2899
+	$output = ob_get_clean();
2900
+	return $output;
2901 2901
 }
2902 2902
 add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2903 2903
 
2904 2904
 
2905 2905
 function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2906 2906
 
2907
-    ob_start();
2908
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2909
-        $address = stripslashes_deep(unserialize($field_info->extra_fields));
2910
-    }
2907
+	ob_start();
2908
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2909
+		$address = stripslashes_deep(unserialize($field_info->extra_fields));
2910
+	}
2911 2911
 
2912
-    $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2913
-    ?>
2912
+	$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2913
+	?>
2914 2914
     <?php
2915
-    /**
2916
-     * Called on the add custom fields settings page before the address field is output.
2917
-     *
2918
-     * @since 1.0.0
2919
-     * @param array $address The address settings array.
2920
-     * @param object $field_info Extra fields info.
2921
-     */
2922
-    do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2915
+	/**
2916
+	 * Called on the add custom fields settings page before the address field is output.
2917
+	 *
2918
+	 * @since 1.0.0
2919
+	 * @param array $address The address settings array.
2920
+	 * @param object $field_info Extra fields info.
2921
+	 */
2922
+	do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2923 2923
 
2924 2924
     <li>
2925 2925
         <label for="show_zip" class="gd-cf-tooltip-wrap">
@@ -2932,14 +2932,14 @@  discard block
 block discarded – undo
2932 2932
 
2933 2933
             <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2934 2934
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2935
-                    echo 'checked';
2936
-                } ?>/>
2935
+					echo 'checked';
2936
+				} ?>/>
2937 2937
             <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>
2938 2938
 
2939 2939
             <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2940 2940
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2941
-                    echo 'checked';
2942
-                } ?>/>
2941
+					echo 'checked';
2942
+				} ?>/>
2943 2943
             <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>
2944 2944
 
2945 2945
 
@@ -2956,8 +2956,8 @@  discard block
 block discarded – undo
2956 2956
         <div class="gd-cf-input-wrap">
2957 2957
             <input type="text" name="extra[zip_lable]" id="zip_lable"
2958 2958
                    value="<?php if (isset($address['zip_lable'])) {
2959
-                       echo esc_attr($address['zip_lable']);
2960
-                   }?>"/>
2959
+					   echo esc_attr($address['zip_lable']);
2960
+				   }?>"/>
2961 2961
         </div>
2962 2962
     </li>
2963 2963
 
@@ -2974,8 +2974,8 @@  discard block
 block discarded – undo
2974 2974
         <div class="gd-cf-input-wrap">
2975 2975
             <input type="text" name="extra[map_lable]" id="map_lable"
2976 2976
                    value="<?php if (isset($address['map_lable'])) {
2977
-                       echo esc_attr($address['map_lable']);
2978
-                   }?>"/>
2977
+					   echo esc_attr($address['map_lable']);
2978
+				   }?>"/>
2979 2979
         </div>
2980 2980
     </li>
2981 2981
 
@@ -2990,14 +2990,14 @@  discard block
 block discarded – undo
2990 2990
 
2991 2991
             <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2992 2992
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
2993
-                    echo 'checked';
2994
-                } ?>/>
2993
+					echo 'checked';
2994
+				} ?>/>
2995 2995
             <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2996 2996
 
2997 2997
             <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2998 2998
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
2999
-                    echo 'checked';
3000
-                } ?>/>
2999
+					echo 'checked';
3000
+				} ?>/>
3001 3001
             <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3002 3002
 
3003 3003
         </div>
@@ -3014,14 +3014,14 @@  discard block
 block discarded – undo
3014 3014
 
3015 3015
             <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
3016 3016
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
3017
-                    echo 'checked';
3018
-                } ?>/>
3017
+					echo 'checked';
3018
+				} ?>/>
3019 3019
             <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3020 3020
 
3021 3021
             <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
3022 3022
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
3023
-                    echo 'checked';
3024
-                } ?>/>
3023
+					echo 'checked';
3024
+				} ?>/>
3025 3025
             <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3026 3026
 
3027 3027
         </div>
@@ -3038,8 +3038,8 @@  discard block
 block discarded – undo
3038 3038
         <div class="gd-cf-input-wrap">
3039 3039
             <input type="text" name="extra[mapview_lable]" id="mapview_lable"
3040 3040
                    value="<?php if (isset($address['mapview_lable'])) {
3041
-                       echo esc_attr($address['mapview_lable']);
3042
-                   }?>"/>
3041
+					   echo esc_attr($address['mapview_lable']);
3042
+				   }?>"/>
3043 3043
         </div>
3044 3044
     </li>
3045 3045
     <li>
@@ -3053,29 +3053,29 @@  discard block
 block discarded – undo
3053 3053
 
3054 3054
             <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3055 3055
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
3056
-                    echo 'checked';
3057
-                } ?>/>
3056
+					echo 'checked';
3057
+				} ?>/>
3058 3058
             <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3059 3059
 
3060 3060
             <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3061 3061
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
3062
-                    echo 'checked';
3063
-                } ?>/>
3062
+					echo 'checked';
3063
+				} ?>/>
3064 3064
             <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3065 3065
 
3066 3066
         </div>
3067 3067
     </li>
3068 3068
     <?php
3069 3069
 
3070
-    $html = ob_get_clean();
3071
-    return $output.$html;
3070
+	$html = ob_get_clean();
3071
+	return $output.$html;
3072 3072
 }
3073 3073
 add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
3074 3074
 
3075 3075
 
3076 3076
 function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
3077
-    ob_start();
3078
-    ?>
3077
+	ob_start();
3078
+	?>
3079 3079
     <li>
3080 3080
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
3081 3081
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
@@ -3087,14 +3087,14 @@  discard block
 block discarded – undo
3087 3087
 
3088 3088
             <select name="multi_display_type" id="multi_display_type">
3089 3089
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
3090
-                    echo 'selected="selected"';
3091
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
3090
+					echo 'selected="selected"';
3091
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
3092 3092
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
3093
-                    echo 'selected="selected"';
3094
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3093
+					echo 'selected="selected"';
3094
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3095 3095
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
3096
-                    echo 'selected="selected"';
3097
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3096
+					echo 'selected="selected"';
3097
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3098 3098
             </select>
3099 3099
 
3100 3100
             <br/>
@@ -3102,25 +3102,25 @@  discard block
 block discarded – undo
3102 3102
     </li>
3103 3103
     <?php
3104 3104
 
3105
-    $html = ob_get_clean();
3106
-    return $output.$html;
3105
+	$html = ob_get_clean();
3106
+	return $output.$html;
3107 3107
 }
3108 3108
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
3109 3109
 
3110 3110
 
3111 3111
 function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
3112 3112
 
3113
-    ob_start();
3113
+	ob_start();
3114 3114
 
3115
-    $value = '';
3116
-    if (isset($field_info->option_values)) {
3117
-        $value = esc_attr($field_info->option_values);
3118
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3119
-        $value = esc_attr($cf['defaults']['option_values']);
3120
-    }
3115
+	$value = '';
3116
+	if (isset($field_info->option_values)) {
3117
+		$value = esc_attr($field_info->option_values);
3118
+	}elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3119
+		$value = esc_attr($cf['defaults']['option_values']);
3120
+	}
3121 3121
 
3122
-    $field_type = isset($field_info->field_type) ? $field_info->field_type : '';
3123
-    ?>
3122
+	$field_type = isset($field_info->field_type) ? $field_info->field_type : '';
3123
+	?>
3124 3124
     <li>
3125 3125
         <label for="option_values" class="gd-cf-tooltip-wrap">
3126 3126
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
@@ -3147,8 +3147,8 @@  discard block
 block discarded – undo
3147 3147
     </li>
3148 3148
     <?php
3149 3149
 
3150
-    $html = ob_get_clean();
3151
-    return $output.$html;
3150
+	$html = ob_get_clean();
3151
+	return $output.$html;
3152 3152
 }
3153 3153
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
3154 3154
 add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
@@ -3156,12 +3156,12 @@  discard block
 block discarded – undo
3156 3156
 
3157 3157
 
3158 3158
 function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
3159
-    ob_start();
3160
-    $extra = array();
3161
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3162
-        $extra = unserialize($field_info->extra_fields);
3163
-    }
3164
-    ?>
3159
+	ob_start();
3160
+	$extra = array();
3161
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3162
+		$extra = unserialize($field_info->extra_fields);
3163
+	}
3164
+	?>
3165 3165
     <li>
3166 3166
         <label for="date_format" class="gd-cf-tooltip-wrap">
3167 3167
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
@@ -3171,52 +3171,52 @@  discard block
 block discarded – undo
3171 3171
         </label>
3172 3172
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
3173 3173
             <?php
3174
-            $date_formats = array(
3175
-                'm/d/Y',
3176
-                'd/m/Y',
3177
-                'Y/m/d',
3178
-                'm-d-Y',
3179
-                'd-m-Y',
3180
-                'Y-m-d',
3181
-                'F j, Y',
3182
-            );
3183
-            /**
3184
-             * Filter the custom field date format options.
3185
-             *
3186
-             * @since 1.6.5
3187
-             * @param array $date_formats The PHP date format array.
3188
-             */
3189
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
3190
-            ?>
3174
+			$date_formats = array(
3175
+				'm/d/Y',
3176
+				'd/m/Y',
3177
+				'Y/m/d',
3178
+				'm-d-Y',
3179
+				'd-m-Y',
3180
+				'Y-m-d',
3181
+				'F j, Y',
3182
+			);
3183
+			/**
3184
+			 * Filter the custom field date format options.
3185
+			 *
3186
+			 * @since 1.6.5
3187
+			 * @param array $date_formats The PHP date format array.
3188
+			 */
3189
+			$date_formats = apply_filters('geodir_date_formats',$date_formats);
3190
+			?>
3191 3191
             <select name="extra[date_format]" id="date_format">
3192 3192
                 <?php
3193
-                foreach($date_formats as $format){
3194
-                    $selected = '';
3195
-                    if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3196
-                        $selected = "selected='selected'";
3197
-                    }
3198
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3199
-                }
3200
-                ?>
3193
+				foreach($date_formats as $format){
3194
+					$selected = '';
3195
+					if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3196
+						$selected = "selected='selected'";
3197
+					}
3198
+					echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3199
+				}
3200
+				?>
3201 3201
             </select>
3202 3202
 
3203 3203
         </div>
3204 3204
     </li>
3205 3205
     <?php
3206 3206
 
3207
-    $html = ob_get_clean();
3208
-    return $output.$html;
3207
+	$html = ob_get_clean();
3208
+	return $output.$html;
3209 3209
 }
3210 3210
 add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3211 3211
 
3212 3212
 
3213 3213
 function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3214
-    ob_start();
3215
-    $allowed_file_types = geodir_allowed_mime_types();
3214
+	ob_start();
3215
+	$allowed_file_types = geodir_allowed_mime_types();
3216 3216
 
3217
-    $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3218
-    $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3219
-    ?>
3217
+	$extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3218
+	$gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3219
+	?>
3220 3220
     <li>
3221 3221
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3222 3222
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
@@ -3239,33 +3239,33 @@  discard block
 block discarded – undo
3239 3239
     </li>
3240 3240
     <?php
3241 3241
 
3242
-    $html = ob_get_clean();
3243
-    return $output.$html;
3242
+	$html = ob_get_clean();
3243
+	return $output.$html;
3244 3244
 }
3245 3245
 add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3246 3246
 
3247 3247
 function geodir_cfa_extra_fields_text($output,$result_str,$cf,$field_info){
3248
-    ob_start();
3248
+	ob_start();
3249 3249
 
3250
-    $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3250
+	$extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3251 3251
    // print_r($cf);echo '###';
3252 3252
 
3253 3253
 
3254 3254
 
3255
-    $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
3255
+	$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
3256 3256
 
3257 3257
 
3258
-    $value = '';
3259
-    if ($extra_fields && isset($extra_fields['is_price'])) {
3260
-    $value = esc_attr($extra_fields['is_price']);
3261
-    }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3262
-    $value = esc_attr($cf['defaults']['extra_fields']['is_price']);
3263
-    }
3258
+	$value = '';
3259
+	if ($extra_fields && isset($extra_fields['is_price'])) {
3260
+	$value = esc_attr($extra_fields['is_price']);
3261
+	}elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3262
+	$value = esc_attr($cf['defaults']['extra_fields']['is_price']);
3263
+	}
3264 3264
 
3265
-    $show_price_extra = ($value==1) ? 1 : 0;
3265
+	$show_price_extra = ($value==1) ? 1 : 0;
3266 3266
 
3267
-    $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0;
3268
-    ?>
3267
+	$show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0;
3268
+	?>
3269 3269
     <li class="gdcf-price-extra-set" <?php if(!$show_price){ echo "style='display:none;'";}?>>
3270 3270
         <label for="is_price" class="gd-cf-tooltip-wrap">
3271 3271
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display as price? :', 'geodirectory'); ?>
@@ -3277,14 +3277,14 @@  discard block
 block discarded – undo
3277 3277
 
3278 3278
             <input type="radio" id="is_price_yes<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-enabled"  value="1"
3279 3279
                 <?php if ($value == '1') {
3280
-                    echo 'checked';
3281
-                } ?>/>
3280
+					echo 'checked';
3281
+				} ?>/>
3282 3282
             <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3283 3283
 
3284 3284
             <input type="radio" id="is_price_no<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-disabled" value="0"
3285 3285
                 <?php if ($value == '0' || !$value) {
3286
-                    echo 'checked';
3287
-                } ?>/>
3286
+					echo 'checked';
3287
+				} ?>/>
3288 3288
             <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3289 3289
 
3290 3290
         </div>
@@ -3292,13 +3292,13 @@  discard block
 block discarded – undo
3292 3292
 
3293 3293
     <?php
3294 3294
 
3295
-    $value = '';
3296
-    if ($extra_fields && isset($extra_fields['thousand_separator'])) {
3297
-        $value = esc_attr($extra_fields['thousand_separator']);
3298
-    }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3299
-        $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']);
3300
-    }
3301
-    ?>
3295
+	$value = '';
3296
+	if ($extra_fields && isset($extra_fields['thousand_separator'])) {
3297
+		$value = esc_attr($extra_fields['thousand_separator']);
3298
+	}elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3299
+		$value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']);
3300
+	}
3301
+	?>
3302 3302
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3303 3303
         <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory');?>
3304 3304
             <div class="gdcf-tooltip">
@@ -3319,13 +3319,13 @@  discard block
 block discarded – undo
3319 3319
 
3320 3320
     <?php
3321 3321
 
3322
-    $value = '';
3323
-    if ($extra_fields && isset($extra_fields['decimal_separator'])) {
3324
-        $value = esc_attr($extra_fields['decimal_separator']);
3325
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3326
-        $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']);
3327
-    }
3328
-    ?>
3322
+	$value = '';
3323
+	if ($extra_fields && isset($extra_fields['decimal_separator'])) {
3324
+		$value = esc_attr($extra_fields['decimal_separator']);
3325
+	}elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3326
+		$value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']);
3327
+	}
3328
+	?>
3329 3329
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3330 3330
         <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory');?>
3331 3331
             <div class="gdcf-tooltip">
@@ -3342,13 +3342,13 @@  discard block
 block discarded – undo
3342 3342
 
3343 3343
     <?php
3344 3344
 
3345
-    $value = '';
3346
-    if ($extra_fields && isset($extra_fields['decimal_display'])) {
3347
-        $value = esc_attr($extra_fields['decimal_display']);
3348
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3349
-        $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']);
3350
-    }
3351
-    ?>
3345
+	$value = '';
3346
+	if ($extra_fields && isset($extra_fields['decimal_display'])) {
3347
+		$value = esc_attr($extra_fields['decimal_display']);
3348
+	}elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3349
+		$value = esc_attr($cf['defaults']['extra_fields']['decimal_display']);
3350
+	}
3351
+	?>
3352 3352
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3353 3353
         <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory');?>
3354 3354
             <div class="gdcf-tooltip">
@@ -3365,13 +3365,13 @@  discard block
 block discarded – undo
3365 3365
 
3366 3366
     <?php
3367 3367
 
3368
-    $value = '';
3369
-    if ($extra_fields && isset($extra_fields['currency_symbol'])) {
3370
-        $value = esc_attr($extra_fields['currency_symbol']);
3371
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3372
-        $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']);
3373
-    }
3374
-    ?>
3368
+	$value = '';
3369
+	if ($extra_fields && isset($extra_fields['currency_symbol'])) {
3370
+		$value = esc_attr($extra_fields['currency_symbol']);
3371
+	}elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3372
+		$value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']);
3373
+	}
3374
+	?>
3375 3375
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3376 3376
         <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory');?>
3377 3377
             <div class="gdcf-tooltip">
@@ -3386,13 +3386,13 @@  discard block
 block discarded – undo
3386 3386
 
3387 3387
     <?php
3388 3388
 
3389
-    $value = '';
3390
-    if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
3391
-        $value = esc_attr($extra_fields['currency_symbol_placement']);
3392
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3393
-        $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']);
3394
-    }
3395
-    ?>
3389
+	$value = '';
3390
+	if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
3391
+		$value = esc_attr($extra_fields['currency_symbol_placement']);
3392
+	}elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3393
+		$value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']);
3394
+	}
3395
+	?>
3396 3396
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3397 3397
         <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory');?>
3398 3398
             <div class="gdcf-tooltip">
@@ -3410,225 +3410,225 @@  discard block
 block discarded – undo
3410 3410
 
3411 3411
     <?php
3412 3412
 
3413
-    $html = ob_get_clean();
3414
-    return $output.$html;
3413
+	$html = ob_get_clean();
3414
+	return $output.$html;
3415 3415
 }
3416 3416
 add_filter('geodir_cfa_extra_fields_text','geodir_cfa_extra_fields_text',10,4);
3417 3417
 
3418 3418
 function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
3419
-    $fields = array();
3420
-    $package = ($package_id=='') ? '' : array($package_id);
3421
-
3422
-    $fields[] = array('listing_type' => $post_type,
3423
-                      'data_type' => 'VARCHAR',
3424
-                      'field_type' => 'taxonomy',
3425
-                      'admin_title' => __('Category', 'geodirectory'),
3426
-                      'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
3427
-                      'site_title' => __('Category', 'geodirectory'),
3428
-                      'htmlvar_name' => $post_type.'category',
3429
-                      'default_value' => '',
3430
-                      'is_default' => '1',
3431
-                      'is_admin' => '1',
3432
-                      'is_required' => '1',
3433
-                      'show_in'   =>  '[detail]',
3434
-                      'show_on_pkg' => $package,
3435
-                      'clabels' => __('Category', 'geodirectory'));
3436
-
3437
-    $fields[] = array('listing_type' => $post_type,
3438
-                      'data_type' => 'VARCHAR',
3439
-                      'field_type' => 'address',
3440
-                      'admin_title' => __('Address', 'geodirectory'),
3441
-                      'admin_desc' => ADDRESS_MSG,
3442
-                      'site_title' => __('Address', 'geodirectory'),
3443
-                      'htmlvar_name' => 'post',
3444
-                      'default_value' => '',
3445
-                      'option_values' => '',
3446
-                      'is_default' => '1',
3447
-                      'is_admin' => '1',
3448
-                      'is_required' => '1',
3449
-                      'show_in'   =>  '[detail],[mapbubble]',
3450
-                      'show_on_pkg' => $package,
3451
-                      'required_msg' => __('Address fields are required', 'geodirectory'),
3452
-                      'clabels' => __('Address', 'geodirectory'),
3453
-                      'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
3454
-                                       'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
3455
-                                       'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
3456
-                                       'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
3457
-                                       'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
3458
-                                       'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
3459
-                                       'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
3460
-                                       'show_latlng' => 1));
3461
-
3462
-    $fields[] = array('listing_type' => $post_type,
3463
-                      'data_type' => 'VARCHAR',
3464
-                      'field_type' => 'text',
3465
-                      'admin_title' => __('Time', 'geodirectory'),
3466
-                      'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
3467
-                      'site_title' => __('Time', 'geodirectory'),
3468
-                      'htmlvar_name' => 'timing',
3469
-                      'default_value' => '',
3470
-                      'option_values' => '',
3471
-                      'is_default' => '1',
3472
-                      'is_admin' => '1',
3473
-                      'show_in' =>  '[detail],[mapbubble]',
3474
-                      'show_on_pkg' => $package,
3475
-                      'clabels' => __('Time', 'geodirectory'));
3476
-
3477
-    $fields[] = array('listing_type' => $post_type,
3478
-                      'data_type' => 'VARCHAR',
3479
-                      'field_type' => 'phone',
3480
-                      'admin_title' => __('Phone', 'geodirectory'),
3481
-                      'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
3482
-                      'site_title' => __('Phone', 'geodirectory'),
3483
-                      'htmlvar_name' => 'contact',
3484
-                      'default_value' => '',
3485
-                      'option_values' => '',
3486
-                      'is_default' => '1',
3487
-                      'is_admin' => '1',
3488
-                      'show_in' =>  '[detail],[mapbubble]',
3489
-                      'show_on_pkg' => $package,
3490
-                      'clabels' => __('Phone', 'geodirectory'));
3491
-
3492
-    $fields[] = array('listing_type' => $post_type,
3493
-                      'data_type' => 'VARCHAR',
3494
-                      'field_type' => 'email',
3495
-                      'admin_title' => __('Email', 'geodirectory'),
3496
-                      'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
3497
-                      'site_title' => __('Email', 'geodirectory'),
3498
-                      'htmlvar_name' => 'email',
3499
-                      'default_value' => '',
3500
-                      'option_values' => '',
3501
-                      'is_default' => '1',
3502
-                      'is_admin' => '1',
3503
-                      'show_in' => '[detail]',
3504
-                      'show_on_pkg' => $package,
3505
-                      'clabels' => __('Email', 'geodirectory'));
3506
-
3507
-    $fields[] = array('listing_type' => $post_type,
3508
-                      'data_type' => 'VARCHAR',
3509
-                      'field_type' => 'url',
3510
-                      'admin_title' => __('Website', 'geodirectory'),
3511
-                      'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
3512
-                      'site_title' => __('Website', 'geodirectory'),
3513
-                      'htmlvar_name' => 'website',
3514
-                      'default_value' => '',
3515
-                      'option_values' => '',
3516
-                      'is_default' => '1',
3517
-                      'is_admin' => '1',
3518
-                      'show_in' => '[detail]',
3519
-                      'show_on_pkg' => $package,
3520
-                      'clabels' => __('Website', 'geodirectory'));
3521
-
3522
-    $fields[] = array('listing_type' => $post_type,
3523
-                      'data_type' => 'VARCHAR',
3524
-                      'field_type' => 'url',
3525
-                      'admin_title' => __('Twitter', 'geodirectory'),
3526
-                      'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
3527
-                      'site_title' => __('Twitter', 'geodirectory'),
3528
-                      'htmlvar_name' => 'twitter',
3529
-                      'default_value' => '',
3530
-                      'option_values' => '',
3531
-                      'is_default' => '1',
3532
-                      'is_admin' => '1',
3533
-                      'show_in' => '[detail]',
3534
-                      'show_on_pkg' => $package,
3535
-                      'clabels' => __('Twitter', 'geodirectory'));
3536
-
3537
-    $fields[] = array('listing_type' => $post_type,
3538
-                      'data_type' => 'VARCHAR',
3539
-                      'field_type' => 'url',
3540
-                      'admin_title' => __('Facebook', 'geodirectory'),
3541
-                      'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
3542
-                      'site_title' => __('Facebook', 'geodirectory'),
3543
-                      'htmlvar_name' => 'facebook',
3544
-                      'default_value' => '',
3545
-                      'option_values' => '',
3546
-                      'is_default' => '1',
3547
-                      'is_admin' => '1',
3548
-                      'show_in' => '[detail]',
3549
-                      'show_on_pkg' => $package,
3550
-                      'clabels' => __('Facebook', 'geodirectory'));
3551
-
3552
-    $fields[] = array('listing_type' => $post_type,
3553
-                      'data_type' => 'TEXT',
3554
-                      'field_type' => 'textarea',
3555
-                      'admin_title' => __('Video', 'geodirectory'),
3556
-                      'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
3557
-                      'site_title' => __('Video', 'geodirectory'),
3558
-                      'htmlvar_name' => 'video',
3559
-                      'default_value' => '',
3560
-                      'option_values' => '',
3561
-                      'is_default' => '0',
3562
-                      'is_admin' => '1',
3563
-                      'show_in' => '[owntab]',
3564
-                      'show_on_pkg' => $package,
3565
-                      'clabels' => __('Video', 'geodirectory'));
3566
-
3567
-    $fields[] = array('listing_type' => $post_type,
3568
-                      'data_type' => 'TEXT',
3569
-                      'field_type' => 'textarea',
3570
-                      'admin_title' => __('Special Offers', 'geodirectory'),
3571
-                      'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
3572
-                      'site_title' => __('Special Offers', 'geodirectory'),
3573
-                      'htmlvar_name' => 'special_offers',
3574
-                      'default_value' => '',
3575
-                      'option_values' => '',
3576
-                      'is_default' => '0',
3577
-                      'is_admin' => '1',
3578
-                      'show_in' => '[owntab]',
3579
-                      'show_on_pkg' => $package,
3580
-                      'clabels' => __('Special Offers', 'geodirectory'));
3581
-
3582
-    /**
3583
-     * Filter the array of default custom fields DB table data.
3584
-     *
3585
-     * @since 1.6.6
3586
-     * @param string $fields The default custom fields as an array.
3587
-     */
3588
-    $fields = apply_filters('geodir_default_custom_fields', $fields);
3589
-
3590
-    return  $fields;
3419
+	$fields = array();
3420
+	$package = ($package_id=='') ? '' : array($package_id);
3421
+
3422
+	$fields[] = array('listing_type' => $post_type,
3423
+					  'data_type' => 'VARCHAR',
3424
+					  'field_type' => 'taxonomy',
3425
+					  'admin_title' => __('Category', 'geodirectory'),
3426
+					  'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
3427
+					  'site_title' => __('Category', 'geodirectory'),
3428
+					  'htmlvar_name' => $post_type.'category',
3429
+					  'default_value' => '',
3430
+					  'is_default' => '1',
3431
+					  'is_admin' => '1',
3432
+					  'is_required' => '1',
3433
+					  'show_in'   =>  '[detail]',
3434
+					  'show_on_pkg' => $package,
3435
+					  'clabels' => __('Category', 'geodirectory'));
3436
+
3437
+	$fields[] = array('listing_type' => $post_type,
3438
+					  'data_type' => 'VARCHAR',
3439
+					  'field_type' => 'address',
3440
+					  'admin_title' => __('Address', 'geodirectory'),
3441
+					  'admin_desc' => ADDRESS_MSG,
3442
+					  'site_title' => __('Address', 'geodirectory'),
3443
+					  'htmlvar_name' => 'post',
3444
+					  'default_value' => '',
3445
+					  'option_values' => '',
3446
+					  'is_default' => '1',
3447
+					  'is_admin' => '1',
3448
+					  'is_required' => '1',
3449
+					  'show_in'   =>  '[detail],[mapbubble]',
3450
+					  'show_on_pkg' => $package,
3451
+					  'required_msg' => __('Address fields are required', 'geodirectory'),
3452
+					  'clabels' => __('Address', 'geodirectory'),
3453
+					  'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
3454
+									   'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
3455
+									   'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
3456
+									   'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
3457
+									   'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
3458
+									   'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
3459
+									   'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
3460
+									   'show_latlng' => 1));
3461
+
3462
+	$fields[] = array('listing_type' => $post_type,
3463
+					  'data_type' => 'VARCHAR',
3464
+					  'field_type' => 'text',
3465
+					  'admin_title' => __('Time', 'geodirectory'),
3466
+					  'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
3467
+					  'site_title' => __('Time', 'geodirectory'),
3468
+					  'htmlvar_name' => 'timing',
3469
+					  'default_value' => '',
3470
+					  'option_values' => '',
3471
+					  'is_default' => '1',
3472
+					  'is_admin' => '1',
3473
+					  'show_in' =>  '[detail],[mapbubble]',
3474
+					  'show_on_pkg' => $package,
3475
+					  'clabels' => __('Time', 'geodirectory'));
3476
+
3477
+	$fields[] = array('listing_type' => $post_type,
3478
+					  'data_type' => 'VARCHAR',
3479
+					  'field_type' => 'phone',
3480
+					  'admin_title' => __('Phone', 'geodirectory'),
3481
+					  'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
3482
+					  'site_title' => __('Phone', 'geodirectory'),
3483
+					  'htmlvar_name' => 'contact',
3484
+					  'default_value' => '',
3485
+					  'option_values' => '',
3486
+					  'is_default' => '1',
3487
+					  'is_admin' => '1',
3488
+					  'show_in' =>  '[detail],[mapbubble]',
3489
+					  'show_on_pkg' => $package,
3490
+					  'clabels' => __('Phone', 'geodirectory'));
3491
+
3492
+	$fields[] = array('listing_type' => $post_type,
3493
+					  'data_type' => 'VARCHAR',
3494
+					  'field_type' => 'email',
3495
+					  'admin_title' => __('Email', 'geodirectory'),
3496
+					  'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
3497
+					  'site_title' => __('Email', 'geodirectory'),
3498
+					  'htmlvar_name' => 'email',
3499
+					  'default_value' => '',
3500
+					  'option_values' => '',
3501
+					  'is_default' => '1',
3502
+					  'is_admin' => '1',
3503
+					  'show_in' => '[detail]',
3504
+					  'show_on_pkg' => $package,
3505
+					  'clabels' => __('Email', 'geodirectory'));
3506
+
3507
+	$fields[] = array('listing_type' => $post_type,
3508
+					  'data_type' => 'VARCHAR',
3509
+					  'field_type' => 'url',
3510
+					  'admin_title' => __('Website', 'geodirectory'),
3511
+					  'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
3512
+					  'site_title' => __('Website', 'geodirectory'),
3513
+					  'htmlvar_name' => 'website',
3514
+					  'default_value' => '',
3515
+					  'option_values' => '',
3516
+					  'is_default' => '1',
3517
+					  'is_admin' => '1',
3518
+					  'show_in' => '[detail]',
3519
+					  'show_on_pkg' => $package,
3520
+					  'clabels' => __('Website', 'geodirectory'));
3521
+
3522
+	$fields[] = array('listing_type' => $post_type,
3523
+					  'data_type' => 'VARCHAR',
3524
+					  'field_type' => 'url',
3525
+					  'admin_title' => __('Twitter', 'geodirectory'),
3526
+					  'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
3527
+					  'site_title' => __('Twitter', 'geodirectory'),
3528
+					  'htmlvar_name' => 'twitter',
3529
+					  'default_value' => '',
3530
+					  'option_values' => '',
3531
+					  'is_default' => '1',
3532
+					  'is_admin' => '1',
3533
+					  'show_in' => '[detail]',
3534
+					  'show_on_pkg' => $package,
3535
+					  'clabels' => __('Twitter', 'geodirectory'));
3536
+
3537
+	$fields[] = array('listing_type' => $post_type,
3538
+					  'data_type' => 'VARCHAR',
3539
+					  'field_type' => 'url',
3540
+					  'admin_title' => __('Facebook', 'geodirectory'),
3541
+					  'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
3542
+					  'site_title' => __('Facebook', 'geodirectory'),
3543
+					  'htmlvar_name' => 'facebook',
3544
+					  'default_value' => '',
3545
+					  'option_values' => '',
3546
+					  'is_default' => '1',
3547
+					  'is_admin' => '1',
3548
+					  'show_in' => '[detail]',
3549
+					  'show_on_pkg' => $package,
3550
+					  'clabels' => __('Facebook', 'geodirectory'));
3551
+
3552
+	$fields[] = array('listing_type' => $post_type,
3553
+					  'data_type' => 'TEXT',
3554
+					  'field_type' => 'textarea',
3555
+					  'admin_title' => __('Video', 'geodirectory'),
3556
+					  'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
3557
+					  'site_title' => __('Video', 'geodirectory'),
3558
+					  'htmlvar_name' => 'video',
3559
+					  'default_value' => '',
3560
+					  'option_values' => '',
3561
+					  'is_default' => '0',
3562
+					  'is_admin' => '1',
3563
+					  'show_in' => '[owntab]',
3564
+					  'show_on_pkg' => $package,
3565
+					  'clabels' => __('Video', 'geodirectory'));
3566
+
3567
+	$fields[] = array('listing_type' => $post_type,
3568
+					  'data_type' => 'TEXT',
3569
+					  'field_type' => 'textarea',
3570
+					  'admin_title' => __('Special Offers', 'geodirectory'),
3571
+					  'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
3572
+					  'site_title' => __('Special Offers', 'geodirectory'),
3573
+					  'htmlvar_name' => 'special_offers',
3574
+					  'default_value' => '',
3575
+					  'option_values' => '',
3576
+					  'is_default' => '0',
3577
+					  'is_admin' => '1',
3578
+					  'show_in' => '[owntab]',
3579
+					  'show_on_pkg' => $package,
3580
+					  'clabels' => __('Special Offers', 'geodirectory'));
3581
+
3582
+	/**
3583
+	 * Filter the array of default custom fields DB table data.
3584
+	 *
3585
+	 * @since 1.6.6
3586
+	 * @param string $fields The default custom fields as an array.
3587
+	 */
3588
+	$fields = apply_filters('geodir_default_custom_fields', $fields);
3589
+
3590
+	return  $fields;
3591 3591
 }
3592 3592
 
3593 3593
 function geodir_currency_format_number($number='',$cf=''){
3594 3594
 
3595
-    $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : '';
3595
+	$cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : '';
3596 3596
 
3597
-    $symbol = isset($cs['currency_symbol']) ? $cs['currency_symbol'] : '$';
3598
-    $decimals = isset($cf['decimal_point']) && $cf['decimal_point'] ? $cf['decimal_point'] : 2;
3599
-    $decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if';
3600
-    $decimalpoint = '.';
3597
+	$symbol = isset($cs['currency_symbol']) ? $cs['currency_symbol'] : '$';
3598
+	$decimals = isset($cf['decimal_point']) && $cf['decimal_point'] ? $cf['decimal_point'] : 2;
3599
+	$decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if';
3600
+	$decimalpoint = '.';
3601 3601
 
3602
-    if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
3603
-        $decimalpoint = ',';
3604
-    }
3602
+	if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
3603
+		$decimalpoint = ',';
3604
+	}
3605 3605
 
3606
-    $separator = ',';
3606
+	$separator = ',';
3607 3607
 
3608
-    if(isset($cs['thousand_separator'])){
3609
-        if($cs['thousand_separator']=='comma'){$separator = ',';}
3610
-        if($cs['thousand_separator']=='slash'){$separator = '\\';}
3611
-        if($cs['thousand_separator']=='period'){$separator = '.';}
3612
-        if($cs['thousand_separator']=='space'){$separator = ' ';}
3613
-        if($cs['thousand_separator']=='none'){$separator = '';}
3614
-    }
3608
+	if(isset($cs['thousand_separator'])){
3609
+		if($cs['thousand_separator']=='comma'){$separator = ',';}
3610
+		if($cs['thousand_separator']=='slash'){$separator = '\\';}
3611
+		if($cs['thousand_separator']=='period'){$separator = '.';}
3612
+		if($cs['thousand_separator']=='space'){$separator = ' ';}
3613
+		if($cs['thousand_separator']=='none'){$separator = '';}
3614
+	}
3615 3615
 
3616
-    $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left';
3616
+	$currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left';
3617 3617
 
3618
-    if($decimals>0 && $decimal_display=='if'){
3619
-        if(is_int($number) || floor( $number ) == $number)
3620
-            $decimals = 0;
3621
-    }
3618
+	if($decimals>0 && $decimal_display=='if'){
3619
+		if(is_int($number) || floor( $number ) == $number)
3620
+			$decimals = 0;
3621
+	}
3622 3622
 
3623
-    $number = number_format($number,$decimals,$decimalpoint,$separator);
3623
+	$number = number_format($number,$decimals,$decimalpoint,$separator);
3624 3624
 
3625 3625
 
3626 3626
 
3627
-    if($currency_symbol_placement=='left'){
3628
-        $number = $symbol . $number;
3629
-    }else{
3630
-        $number = $number . $symbol;
3631
-    }
3627
+	if($currency_symbol_placement=='left'){
3628
+		$number = $symbol . $number;
3629
+	}else{
3630
+		$number = $number . $symbol;
3631
+	}
3632 3632
 
3633 3633
 
3634 3634
    return $number;
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-admin/admin_hooks_actions.php 4 patches
Braces   +63 added lines, -55 removed lines patch added patch discarded remove patch
@@ -24,8 +24,11 @@  discard block
 block discarded – undo
24 24
             global $current_tab;
25 25
             geodir_redirect_to_admin_panel_on_installed();
26 26
             $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings';
27
-            if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests
28
-                geodir_handle_option_form_submit($current_tab); // located in admin function.php
27
+            if (!(isset($_REQUEST['action']))) {
28
+            	// this will avoid Ajax requests
29
+                geodir_handle_option_form_submit($current_tab);
30
+            }
31
+            // located in admin function.php
29 32
             /**
30 33
              * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area.
31 34
              *
@@ -316,8 +319,9 @@  discard block
 block discarded – undo
316 319
     if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
317 320
 
318 321
         foreach ($notification as $key => $value) {
319
-            if ($value['type'] == 'textarea')
320
-                $notification[$key]['type'] = 'editor';
322
+            if ($value['type'] == 'textarea') {
323
+                            $notification[$key]['type'] = 'editor';
324
+            }
321 325
         }
322 326
 
323 327
     }
@@ -342,8 +346,9 @@  discard block
 block discarded – undo
342 346
     if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
343 347
 
344 348
         foreach ($design_setting as $key => $value) {
345
-            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
346
-                $design_setting[$key]['type'] = 'editor';
349
+            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') {
350
+                            $design_setting[$key]['type'] = 'editor';
351
+            }
347 352
         }
348 353
 
349 354
     }
@@ -462,9 +467,9 @@  discard block
 block discarded – undo
462 467
                    class="gd-draggable-form-items  gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);">
463 468
                     <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
464 469
                         echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
465
-                    }elseif(isset($val['field_icon']) && $val['field_icon'] ){
470
+                    } elseif(isset($val['field_icon']) && $val['field_icon'] ){
466 471
                         echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
467
-                    }else{
472
+                    } else{
468 473
                         echo '<i class="fa fa-cog" aria-hidden="true"></i>';
469 474
                     }?>
470 475
                     <?php echo $val['site_title'];?>
@@ -693,9 +698,9 @@  discard block
 block discarded – undo
693 698
         <?php
694 699
         if($type=='predefined'){
695 700
             $cfs = geodir_custom_fields_predefined($listing_type);
696
-        }elseif($type=='custom'){
701
+        } elseif($type=='custom'){
697 702
             $cfs = geodir_custom_fields_custom($listing_type);
698
-        }else{
703
+        } else{
699 704
             $cfs = geodir_custom_fields($listing_type);
700 705
             ?>
701 706
             <ul class="full gd-cf-tooltip-wrap">
@@ -750,7 +755,7 @@  discard block
 block discarded – undo
750 755
             </li>
751 756
             <?php
752 757
         }
753
-    }else{
758
+    } else{
754 759
         _e('There are no custom fields here yet.', 'geodirectory');
755 760
     }
756 761
         ?>
@@ -947,8 +952,9 @@  discard block
 block discarded – undo
947 952
 
948 953
     if (!get_option('geodir_remove_unnecessary_fields')) {
949 954
 
950
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
951
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
955
+        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) {
956
+                    $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
957
+        }
952 958
 
953 959
         update_option('geodir_remove_unnecessary_fields', '1');
954 960
 
@@ -974,15 +980,17 @@  discard block
 block discarded – undo
974 980
         $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action'];
975 981
         switch ($geodir_admin_ajax_action) {
976 982
             case 'diagnosis' :
977
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
978
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
983
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
984
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
985
+                }
979 986
                 call_user_func('geodir_diagnose_' . $diagnose_this);
980 987
                 exit();
981 988
                 break;
982 989
 
983 990
             case 'diagnosis-fix' :
984
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
985
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
991
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
992
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
993
+                }
986 994
                 call_user_func('geodir_diagnose_' . $diagnose_this);
987 995
                 exit();
988 996
                 break;
@@ -1540,11 +1548,11 @@  discard block
 block discarded – undo
1540 1548
     //////////////////////////////////
1541 1549
     $option_value = get_option('geodir_home_page');
1542 1550
     $page = get_post($option_value);
1543
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1551
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1544 1552
 
1545
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1546
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1547
-    else {
1553
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1554
+            $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1555
+    } else {
1548 1556
         $is_error_during_diagnose = true;
1549 1557
         $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1550 1558
         if ($fix) {
@@ -1565,11 +1573,11 @@  discard block
 block discarded – undo
1565 1573
     //////////////////////////////////
1566 1574
     $option_value = get_option('geodir_add_listing_page');
1567 1575
     $page = get_post($option_value);
1568
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1576
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1569 1577
 
1570
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1571
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1572
-    else {
1578
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1579
+            $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1580
+    } else {
1573 1581
         $is_error_during_diagnose = true;
1574 1582
         $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1575 1583
         if ($fix) {
@@ -1591,11 +1599,11 @@  discard block
 block discarded – undo
1591 1599
     //////////////////////////////////
1592 1600
     $option_value = get_option('geodir_preview_page');
1593 1601
     $page = get_post($option_value);
1594
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1602
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1595 1603
 
1596
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1597
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1598
-    else {
1604
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1605
+            $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1606
+    } else {
1599 1607
         $is_error_during_diagnose = true;
1600 1608
         $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1601 1609
         if ($fix) {
@@ -1616,11 +1624,11 @@  discard block
 block discarded – undo
1616 1624
     //////////////////////////////////
1617 1625
     $option_value = get_option('geodir_success_page');
1618 1626
     $page = get_post($option_value);
1619
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1627
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1620 1628
 
1621
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1622
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1623
-    else {
1629
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1630
+            $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1631
+    } else {
1624 1632
         $is_error_during_diagnose = true;
1625 1633
         $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1626 1634
         if ($fix) {
@@ -1641,11 +1649,11 @@  discard block
 block discarded – undo
1641 1649
     //////////////////////////////////
1642 1650
     $option_value = get_option('geodir_info_page');
1643 1651
     $page = get_post($option_value);
1644
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1652
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1645 1653
 
1646
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1647
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1648
-    else {
1654
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1655
+            $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1656
+    } else {
1649 1657
         $is_error_during_diagnose = true;
1650 1658
         $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1651 1659
         if ($fix) {
@@ -1666,11 +1674,11 @@  discard block
 block discarded – undo
1666 1674
     //////////////////////////////////
1667 1675
     $option_value = get_option('geodir_login_page');
1668 1676
     $page = get_post($option_value);
1669
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1677
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1670 1678
 
1671
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1672
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1673
-    else {
1679
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1680
+            $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1681
+    } else {
1674 1682
         $is_error_during_diagnose = true;
1675 1683
         $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1676 1684
         if ($fix) {
@@ -1691,11 +1699,11 @@  discard block
 block discarded – undo
1691 1699
     //////////////////////////////////
1692 1700
     $option_value = get_option('geodir_location_page');
1693 1701
     $page = get_post($option_value);
1694
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1702
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1695 1703
 
1696
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1697
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1698
-    else {
1704
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1705
+            $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1706
+    } else {
1699 1707
         $is_error_during_diagnose = true;
1700 1708
         $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1701 1709
         if ($fix) {
@@ -2140,8 +2148,9 @@  discard block
 block discarded – undo
2140 2148
                             );
2141 2149
 
2142 2150
                             $post_location_info = $request_info['post_location'];
2143
-                            if ($location_id = geodir_add_new_location($post_location_info))
2144
-                                $post_location_id = $location_id;
2151
+                            if ($location_id = geodir_add_new_location($post_location_info)) {
2152
+                                                            $post_location_id = $location_id;
2153
+                            }
2145 2154
                         } else {
2146 2155
                             $post_location_id = 0;
2147 2156
                         }
@@ -2204,8 +2213,9 @@  discard block
 block discarded – undo
2204 2213
                             $attachment_set = '';
2205 2214
 
2206 2215
                             foreach ($attachment as $key => $val) {
2207
-                                if ($val != '')
2208
-                                    $attachment_set .= $key . " = '" . $val . "', ";
2216
+                                if ($val != '') {
2217
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
2218
+                                }
2209 2219
                             }
2210 2220
                             $attachment_set = trim($attachment_set, ", ");
2211 2221
 
@@ -2301,8 +2311,7 @@  discard block
 block discarded – undo
2301 2311
 
2302 2312
         $parts = json_decode($response['body']);
2303 2313
         //print_r($parts);
2304
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2305
-        else{
2314
+        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} else{
2306 2315
 
2307 2316
             update_option('gd_ga_access_token', $parts->access_token);
2308 2317
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2310,17 +2319,16 @@  discard block
 block discarded – undo
2310 2319
         }
2311 2320
 
2312 2321
 
2313
-    }
2314
-    elseif(!empty($response['response']['code'])) {
2322
+    } elseif(!empty($response['response']['code'])) {
2315 2323
         $parts = json_decode($response['body']);
2316 2324
 
2317 2325
         if(isset($parts->error)){
2318 2326
             echo $parts->error.": ".$parts->error_description;exit;
2319
-        }else{
2327
+        } else{
2320 2328
             echo $error_msg." - #2";exit;
2321 2329
         }
2322 2330
 
2323
-    }else{
2331
+    } else{
2324 2332
 
2325 2333
         echo $error_msg." - #3";exit;
2326 2334
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1844,6 +1844,7 @@  discard block
 block discarded – undo
1844 1844
  * @since 1.0.0
1845 1845
  * @package GeoDirectory
1846 1846
  * @global object $current_user Current user object.
1847
+ * @param string|null $input
1847 1848
  * @return array Returns parsed data as array.
1848 1849
  */
1849 1850
 function geodir_str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\")
@@ -2373,7 +2374,6 @@  discard block
 block discarded – undo
2373 2374
  *
2374 2375
  * @since 1.6.9
2375 2376
  *
2376
- * @param array $settings Array of GeoDirectory general settings.
2377 2377
  * @return array Array of settings.
2378 2378
  */
2379 2379
 function geodir_uninstall_settings($general_settings) {
Please login to merge, or discard this patch.
Indentation   +1526 added lines, -1526 removed lines patch added patch discarded remove patch
@@ -10,33 +10,33 @@  discard block
 block discarded – undo
10 10
 
11 11
 add_action('admin_init', 'geodir_admin_init');
12 12
 if (!function_exists('geodir_admin_init')) {
13
-    /**
14
-     * Adds GD setting pages in admin.
15
-     *
16
-     * @since 1.0.0
17
-     * @package GeoDirectory
18
-     * @global string $current_tab The current settings tab name.
19
-     */
20
-    function geodir_admin_init()
21
-    {
22
-
23
-        if (is_admin()):
24
-            global $current_tab;
25
-            geodir_redirect_to_admin_panel_on_installed();
26
-            $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings';
27
-            if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests
28
-                geodir_handle_option_form_submit($current_tab); // located in admin function.php
29
-            /**
30
-             * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area.
31
-             *
32
-             * @since 1.0.0
33
-             */
34
-            do_action('admin_panel_init');
35
-            add_action('geodir_admin_option_form', 'geodir_get_admin_option_form', 1);
36
-
37
-
38
-        endif;
39
-    }
13
+	/**
14
+	 * Adds GD setting pages in admin.
15
+	 *
16
+	 * @since 1.0.0
17
+	 * @package GeoDirectory
18
+	 * @global string $current_tab The current settings tab name.
19
+	 */
20
+	function geodir_admin_init()
21
+	{
22
+
23
+		if (is_admin()):
24
+			global $current_tab;
25
+			geodir_redirect_to_admin_panel_on_installed();
26
+			$current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings';
27
+			if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests
28
+				geodir_handle_option_form_submit($current_tab); // located in admin function.php
29
+			/**
30
+			 * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area.
31
+			 *
32
+			 * @since 1.0.0
33
+			 */
34
+			do_action('admin_panel_init');
35
+			add_action('geodir_admin_option_form', 'geodir_get_admin_option_form', 1);
36
+
37
+
38
+		endif;
39
+	}
40 40
 }
41 41
 
42 42
 /**
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_redirect_to_admin_panel_on_installed()
49 49
 {
50
-    if (get_option('geodir_installation_redirect', false)) {
51
-        delete_option('geodir_installation_redirect');
52
-        wp_redirect(admin_url('admin.php?page=geodirectory&installed=yes'));
53
-    }
50
+	if (get_option('geodir_installation_redirect', false)) {
51
+		delete_option('geodir_installation_redirect');
52
+		wp_redirect(admin_url('admin.php?page=geodirectory&installed=yes'));
53
+	}
54 54
 }
55 55
 
56 56
 /**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  */
63 63
 function geodir_get_admin_option_form($current_tab)
64 64
 {
65
-    geodir_admin_option_form($current_tab);// defined in admin template tags.php
65
+	geodir_admin_option_form($current_tab);// defined in admin template tags.php
66 66
 }
67 67
 
68 68
 
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
  */
86 86
 function geodir_conditional_admin_script_load()
87 87
 {
88
-    global $pagenow;
88
+	global $pagenow;
89 89
 	
90 90
 	// Get the current post type
91 91
 	$post_type = geodir_admin_current_post_type();
92 92
 	$geodir_post_types = geodir_get_posttypes();
93 93
     
94 94
 	if ((isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') || (($pagenow == 'post.php' || $pagenow == 'post-new.php' || $pagenow == 'edit.php') && $post_type && in_array($post_type, $geodir_post_types)) || ($pagenow == 'edit-tags.php' || $pagenow == 'term.php' || $pagenow == 'edit-comments.php' || $pagenow == 'comment.php')) {
95
-        add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
96
-        add_action('admin_enqueue_scripts', 'geodir_admin_styles');
97
-        add_action('admin_enqueue_scripts', 'geodir_admin_dequeue_scripts', 100);
98
-    }
95
+		add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
96
+		add_action('admin_enqueue_scripts', 'geodir_admin_styles');
97
+		add_action('admin_enqueue_scripts', 'geodir_admin_dequeue_scripts', 100);
98
+	}
99 99
 
100
-    add_action('admin_enqueue_scripts', 'geodir_admin_styles_req');
100
+	add_action('admin_enqueue_scripts', 'geodir_admin_styles_req');
101 101
 
102 102
 }
103 103
 
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
  */
132 132
 function create_default_admin_main_nav()
133 133
 {
134
-    add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1);
135
-    add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2);
136
-    add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90);
137
-    add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95);
138
-    add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100);
139
-    //add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3);
134
+	add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1);
135
+	add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2);
136
+	add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90);
137
+	add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95);
138
+	add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100);
139
+	//add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3);
140 140
 
141 141
 }
142 142
 
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
  */
150 150
 function geodir_admin_list_columns()
151 151
 {
152
-    if ($post_types = geodir_get_posttypes()) {
152
+	if ($post_types = geodir_get_posttypes()) {
153 153
 
154
-        foreach ($post_types as $post_type):
155
-            add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100);
156
-            //Filter-Payment-Manager to show Package
157
-            add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2);
154
+		foreach ($post_types as $post_type):
155
+			add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100);
156
+			//Filter-Payment-Manager to show Package
157
+			add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2);
158 158
 
159
-            add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns');
160
-        endforeach;
161
-    }
159
+			add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns');
160
+		endforeach;
161
+	}
162 162
 }
163 163
 
164 164
 /**
@@ -171,15 +171,15 @@  discard block
 block discarded – undo
171 171
  */
172 172
 function geodir_default_admin_main_tabs($tabs)
173 173
 {
174
-    return $tabs = array(
175
-        'general_settings' => array('label' => __('General', 'geodirectory')),
176
-        'design_settings' => array('label' => __('Design', 'geodirectory')),
177
-        'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')),
178
-        'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')),
179
-        'notifications_settings' => array('label' => __('Notifications', 'geodirectory')),
180
-        'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')),
181
-
182
-    );
174
+	return $tabs = array(
175
+		'general_settings' => array('label' => __('General', 'geodirectory')),
176
+		'design_settings' => array('label' => __('Design', 'geodirectory')),
177
+		'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')),
178
+		'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')),
179
+		'notifications_settings' => array('label' => __('Notifications', 'geodirectory')),
180
+		'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')),
181
+
182
+	);
183 183
 }
184 184
 
185 185
 add_action('do_meta_boxes', 'geodir_remove_image_box');
@@ -192,16 +192,16 @@  discard block
 block discarded – undo
192 192
  */
193 193
 function geodir_remove_image_box()
194 194
 {
195
-    global $post;
195
+	global $post;
196 196
 
197
-    $geodir_posttypes = geodir_get_posttypes();
197
+	$geodir_posttypes = geodir_get_posttypes();
198 198
 
199
-    if (isset($post) && in_array($post->post_type, $geodir_posttypes)):
199
+	if (isset($post) && in_array($post->post_type, $geodir_posttypes)):
200 200
 
201
-        remove_meta_box('postimagediv', $post->post_type, 'side');
202
-        remove_meta_box('revisionsdiv', $post->post_type, 'normal');
201
+		remove_meta_box('postimagediv', $post->post_type, 'side');
202
+		remove_meta_box('revisionsdiv', $post->post_type, 'normal');
203 203
 
204
-    endif;
204
+	endif;
205 205
 
206 206
 }
207 207
 
@@ -216,26 +216,26 @@  discard block
 block discarded – undo
216 216
  */
217 217
 function geodir_meta_box_add()
218 218
 {
219
-    global $post;
219
+	global $post;
220 220
 
221
-    $geodir_post_types = geodir_get_posttypes('array');
222
-    $geodir_posttypes = array_keys($geodir_post_types);
221
+	$geodir_post_types = geodir_get_posttypes('array');
222
+	$geodir_posttypes = array_keys($geodir_post_types);
223 223
 
224
-    if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)):
224
+	if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)):
225 225
 
226
-        $geodir_posttype = $post->post_type;
227
-        $post_typename = geodir_ucwords($geodir_post_types[$geodir_posttype]['labels']['singular_name']);
226
+		$geodir_posttype = $post->post_type;
227
+		$post_typename = geodir_ucwords($geodir_post_types[$geodir_posttype]['labels']['singular_name']);
228 228
 
229
-        // Filter-Payment-Manager
229
+		// Filter-Payment-Manager
230 230
 
231
-        add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
231
+		add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
232 232
 
233
-        add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
233
+		add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
234 234
 
235
-        // no need of this box as all fields moved to main information box
236
-        //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
235
+		// no need of this box as all fields moved to main information box
236
+		//add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
237 237
 
238
-    endif;
238
+	endif;
239 239
 
240 240
 }
241 241
 
@@ -259,23 +259,23 @@  discard block
 block discarded – undo
259 259
 function geodir_hide_post_taxonomy_meta_boxes()
260 260
 {
261 261
 
262
-    $geodir_post_types = get_option('geodir_post_types');
262
+	$geodir_post_types = get_option('geodir_post_types');
263 263
 
264
-    if (!empty($geodir_post_types)) {
265
-        foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) {
264
+	if (!empty($geodir_post_types)) {
265
+		foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) {
266 266
 
267
-            $gd_taxonomy = geodir_get_taxonomies($geodir_post_type);
267
+			$gd_taxonomy = geodir_get_taxonomies($geodir_post_type);
268 268
 
269
-            if(!empty($gd_taxonomy)) {
270
-                foreach ($gd_taxonomy as $tax) {
269
+			if(!empty($gd_taxonomy)) {
270
+				foreach ($gd_taxonomy as $tax) {
271 271
 
272
-                    remove_meta_box($tax . 'div', $geodir_post_type, 'normal');
272
+					remove_meta_box($tax . 'div', $geodir_post_type, 'normal');
273 273
 
274
-                }
275
-            }
274
+				}
275
+			}
276 276
 
277
-        }
278
-    }
277
+		}
278
+	}
279 279
 }
280 280
 
281 281
 add_filter('geodir_add_listing_map_restrict', 'geodir_add_listing_map_restrict');
@@ -289,12 +289,12 @@  discard block
 block discarded – undo
289 289
  */
290 290
 function geodir_add_listing_map_restrict($map_restirct)
291 291
 {
292
-    if (is_admin()) {
293
-        if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') {
294
-            $map_restirct = false;
295
-        }
296
-    }
297
-    return $map_restirct;
292
+	if (is_admin()) {
293
+		if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') {
294
+			$map_restirct = false;
295
+		}
296
+	}
297
+	return $map_restirct;
298 298
 }
299 299
 
300 300
 
@@ -313,16 +313,16 @@  discard block
 block discarded – undo
313 313
 function geodir_enable_editor_on_notifications($notification)
314 314
 {
315 315
 
316
-    if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
316
+	if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
317 317
 
318
-        foreach ($notification as $key => $value) {
319
-            if ($value['type'] == 'textarea')
320
-                $notification[$key]['type'] = 'editor';
321
-        }
318
+		foreach ($notification as $key => $value) {
319
+			if ($value['type'] == 'textarea')
320
+				$notification[$key]['type'] = 'editor';
321
+		}
322 322
 
323
-    }
323
+	}
324 324
 
325
-    return $notification;
325
+	return $notification;
326 326
 }
327 327
 
328 328
 
@@ -339,16 +339,16 @@  discard block
 block discarded – undo
339 339
 function geodir_enable_editor_on_design_settings($design_setting)
340 340
 {
341 341
 
342
-    if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
342
+	if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
343 343
 
344
-        foreach ($design_setting as $key => $value) {
345
-            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
346
-                $design_setting[$key]['type'] = 'editor';
347
-        }
344
+		foreach ($design_setting as $key => $value) {
345
+			if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
346
+				$design_setting[$key]['type'] = 'editor';
347
+		}
348 348
 
349
-    }
349
+	}
350 350
 
351
-    return $design_setting;
351
+	return $design_setting;
352 352
 }
353 353
 
354 354
 /* ----------- START MANAGE CUSTOM FIELDS ---------------- */
@@ -356,15 +356,15 @@  discard block
 block discarded – undo
356 356
 add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom');
357 357
 
358 358
 function geodir_manage_available_fields_predefined($sub_tab){
359
-    if($sub_tab=='custom_fields'){
360
-        geodir_custom_available_fields('predefined');
361
-    }
359
+	if($sub_tab=='custom_fields'){
360
+		geodir_custom_available_fields('predefined');
361
+	}
362 362
 }
363 363
 
364 364
 function geodir_manage_available_fields_custom($sub_tab){
365
-    if($sub_tab=='custom_fields'){
366
-        geodir_custom_available_fields('custom');
367
-    }
365
+	if($sub_tab=='custom_fields'){
366
+		geodir_custom_available_fields('custom');
367
+	}
368 368
 }
369 369
 
370 370
 
@@ -383,16 +383,16 @@  discard block
 block discarded – undo
383 383
 function geodir_manage_available_fields($sub_tab)
384 384
 {
385 385
 
386
-    switch ($sub_tab) {
387
-        case 'custom_fields':
388
-            geodir_custom_available_fields();
389
-            break;
386
+	switch ($sub_tab) {
387
+		case 'custom_fields':
388
+			geodir_custom_available_fields();
389
+			break;
390 390
 
391
-        case 'sorting_options':
392
-            geodir_sorting_options_available_fields();
393
-            break;
391
+		case 'sorting_options':
392
+			geodir_sorting_options_available_fields();
393
+			break;
394 394
 
395
-    }
395
+	}
396 396
 }
397 397
 
398 398
 
@@ -408,16 +408,16 @@  discard block
 block discarded – undo
408 408
 function geodir_manage_selected_fields($sub_tab)
409 409
 {
410 410
 
411
-    switch ($sub_tab) {
412
-        case 'custom_fields':
413
-            geodir_custom_selected_fields();
414
-            break;
411
+	switch ($sub_tab) {
412
+		case 'custom_fields':
413
+			geodir_custom_selected_fields();
414
+			break;
415 415
 
416
-        case 'sorting_options':
417
-            geodir_sorting_options_selected_fields();
418
-            break;
416
+		case 'sorting_options':
417
+			geodir_sorting_options_selected_fields();
418
+			break;
419 419
 
420
-    }
420
+	}
421 421
 }
422 422
 
423 423
 /**
@@ -429,52 +429,52 @@  discard block
 block discarded – undo
429 429
  */
430 430
 function geodir_sorting_options_available_fields()
431 431
 {
432
-    global $wpdb;
433
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
434
-    ?>
432
+	global $wpdb;
433
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
434
+	?>
435 435
     <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
436 436
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
437 437
     <ul>
438 438
     <?php
439
-        $sort_options = geodir_get_custom_sort_options($listing_type);
439
+		$sort_options = geodir_get_custom_sort_options($listing_type);
440 440
         
441
-        foreach ($sort_options as $key => $val) {
442
-            $val = stripslashes_deep($val); // strip slashes
443
-
444
-            $check_html_variable = $wpdb->get_var(
445
-                $wpdb->prepare(
446
-                    "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
447
-                    array($val['htmlvar_name'], $listing_type, $val['field_type'])
448
-                )
449
-            );
441
+		foreach ($sort_options as $key => $val) {
442
+			$val = stripslashes_deep($val); // strip slashes
443
+
444
+			$check_html_variable = $wpdb->get_var(
445
+				$wpdb->prepare(
446
+					"SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
447
+					array($val['htmlvar_name'], $listing_type, $val['field_type'])
448
+				)
449
+			);
450 450
             
451
-            $display = $check_html_variable ? ' style="display:none;"' : '';
452
-           ?>
451
+			$display = $check_html_variable ? ' style="display:none;"' : '';
452
+		   ?>
453 453
 
454 454
             <li   class="gd-cf-tooltip-wrap" <?php echo $display;?>>
455 455
                 <?php
456
-                if(isset($val['description']) && $val['description']){
457
-                    echo '<div class="gdcf-tooltip">'.$val['description'].'</div>';
458
-                }?>
456
+				if(isset($val['description']) && $val['description']){
457
+					echo '<div class="gdcf-tooltip">'.$val['description'].'</div>';
458
+				}?>
459 459
 
460 460
                 <a id="gd-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" data-field-type-key="<?php echo $val['htmlvar_name'];?>"  data-field-type="<?php echo $val['field_type'];?>"
461 461
                    title="<?php echo $val['site_title'];?>"
462 462
                    class="gd-draggable-form-items  gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);">
463 463
                     <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
464
-                        echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
465
-                    }elseif(isset($val['field_icon']) && $val['field_icon'] ){
466
-                        echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
467
-                    }else{
468
-                        echo '<i class="fa fa-cog" aria-hidden="true"></i>';
469
-                    }?>
464
+						echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
465
+					}elseif(isset($val['field_icon']) && $val['field_icon'] ){
466
+						echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
467
+					}else{
468
+						echo '<i class="fa fa-cog" aria-hidden="true"></i>';
469
+					}?>
470 470
                     <?php echo $val['site_title'];?>
471 471
                 </a>
472 472
             </li>
473 473
 
474 474
 
475 475
             <?php
476
-        }
477
-    ?>
476
+		}
477
+	?>
478 478
     </ul>
479 479
     <?php
480 480
 }
@@ -488,28 +488,28 @@  discard block
 block discarded – undo
488 488
  */
489 489
 function geodir_sorting_options_selected_fields()
490 490
 {
491
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
492
-    ?>
491
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
492
+	?>
493 493
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
494 494
     <ul class="core">
495 495
     <?php 
496
-        global $wpdb;
496
+		global $wpdb;
497 497
         
498
-        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
498
+		$fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
499 499
 
500
-        if (!empty($fields)) {
501
-            foreach ($fields as $field) {
502
-                //$result_str = $field->id;
503
-                $result_str = $field;
504
-                $field_type = $field->field_type;
505
-                $field_ins_upd = 'display';
500
+		if (!empty($fields)) {
501
+			foreach ($fields as $field) {
502
+				//$result_str = $field->id;
503
+				$result_str = $field;
504
+				$field_type = $field->field_type;
505
+				$field_ins_upd = 'display';
506 506
 
507
-                $default = false;
507
+				$default = false;
508 508
 
509
-                geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default);
510
-            }
511
-        }
512
-    ?>
509
+				geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default);
510
+			}
511
+		}
512
+	?>
513 513
     </ul>
514 514
     <?php
515 515
 }
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
  */
523 523
 function geodir_custom_fields_custom($post_type=''){
524 524
 
525
-    $custom_fields = array();
525
+	$custom_fields = array();
526 526
 
527
-    /**
528
-     * @see `geodir_custom_fields`
529
-     */
530
-    return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
527
+	/**
528
+	 * @see `geodir_custom_fields`
529
+	 */
530
+	return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
531 531
 }
532 532
 
533 533
 
@@ -540,140 +540,140 @@  discard block
 block discarded – undo
540 540
  */
541 541
 function geodir_custom_fields($post_type=''){
542 542
     
543
-    $custom_fields = array(
544
-        'text' => array(
545
-            'field_type'  =>  'text',
546
-            'class' =>  'gd-text',
547
-            'icon'  =>  'fa fa-minus',
548
-            'name'  =>  __('Text', 'geodirectory'),
549
-            'description' =>  __('Add any sort of text field, text or numbers', 'geodirectory')
550
-        ),
551
-        'datepicker' => array(
552
-            'field_type'  =>  'datepicker',
553
-            'class' =>  'gd-datepicker',
554
-            'icon'  =>  'fa fa-calendar',
555
-            'name'  =>  __('Date', 'geodirectory'),
556
-            'description' =>  __('Adds a date picker.', 'geodirectory')
557
-        ),
558
-        'textarea' => array(
559
-            'field_type'  =>  'textarea',
560
-            'class' =>  'gd-textarea',
561
-            'icon'  =>  'fa fa-bars',
562
-            'name'  =>  __('Textarea', 'geodirectory'),
563
-            'description' =>  __('Adds a textarea', 'geodirectory')
564
-        ),
565
-        'time' => array(
566
-            'field_type'  =>  'time',
567
-            'class' =>  'gd-time',
568
-            'icon' =>  'fa fa-clock-o',
569
-            'name'  =>  __('Time', 'geodirectory'),
570
-            'description' =>  __('Adds a time picker', 'geodirectory')
571
-        ),
572
-        'checkbox' => array(
573
-            'field_type'  =>  'checkbox',
574
-            'class' =>  'gd-checkbox',
575
-            'icon' =>  'fa fa-check-square-o',
576
-            'name'  =>  __('Checkbox', 'geodirectory'),
577
-            'description' =>  __('Adds a checkbox', 'geodirectory')
578
-        ),
579
-        'phone' => array(
580
-            'field_type'  =>  'phone',
581
-            'class' =>  'gd-phone',
582
-            'icon' =>  'fa fa-phone',
583
-            'name'  =>  __('Phone', 'geodirectory'),
584
-            'description' =>  __('Adds a phone input', 'geodirectory')
585
-        ),
586
-        'radio' => array(
587
-            'field_type'  =>  'radio',
588
-            'class' =>  'gd-radio',
589
-            'icon' =>  'fa fa-dot-circle-o',
590
-            'name'  =>  __('Radio', 'geodirectory'),
591
-            'description' =>  __('Adds a radio input', 'geodirectory')
592
-        ),
593
-        'email' => array(
594
-            'field_type'  =>  'email',
595
-            'class' =>  'gd-email',
596
-            'icon' =>  'fa fa-envelope-o',
597
-            'name'  =>  __('Email', 'geodirectory'),
598
-            'description' =>  __('Adds a email input', 'geodirectory')
599
-        ),
600
-        'select' => array(
601
-            'field_type'  =>  'select',
602
-            'class' =>  'gd-select',
603
-            'icon' =>  'fa fa-caret-square-o-down',
604
-            'name'  =>  __('Select', 'geodirectory'),
605
-            'description' =>  __('Adds a select input', 'geodirectory')
606
-        ),
607
-        'multiselect' => array(
608
-            'field_type'  =>  'multiselect',
609
-            'class' =>  'gd-multiselect',
610
-            'icon' =>  'fa fa-caret-square-o-down',
611
-            'name'  =>  __('Multi Select', 'geodirectory'),
612
-            'description' =>  __('Adds a multiselect input', 'geodirectory')
613
-        ),
614
-        'url' => array(
615
-            'field_type'  =>  'url',
616
-            'class' =>  'gd-url',
617
-            'icon' =>  'fa fa-link',
618
-            'name'  =>  __('URL', 'geodirectory'),
619
-            'description' =>  __('Adds a url input', 'geodirectory')
620
-        ),
621
-        'html' => array(
622
-            'field_type'  =>  'html',
623
-            'class' =>  'gd-html',
624
-            'icon' =>  'fa fa-code',
625
-            'name'  =>  __('HTML', 'geodirectory'),
626
-            'description' =>  __('Adds a html input textarea', 'geodirectory')
627
-        ),
628
-        'file' => array(
629
-            'field_type'  =>  'file',
630
-            'class' =>  'gd-file',
631
-            'icon' =>  'fa fa-file',
632
-            'name'  =>  __('File Upload', 'geodirectory'),
633
-            'description' =>  __('Adds a file input', 'geodirectory')
634
-        )
635
-    );
636
-
637
-    /**
638
-     * Filter the custom fields array to be able to add or remove items.
639
-     * 
640
-     * @since 1.6.6
641
-     *
642
-     * @param array $custom_fields {
643
-     *     The custom fields array to be filtered.
644
-     *
645
-     *     @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file.
646
-     *     @type string $class The class for the field in backend.
647
-     *     @type string $icon Can be font-awesome class name or icon image url.
648
-     *     @type string $name The name of the field.
649
-     *     @type string $description A short description about the field.
650
-     *     @type array $defaults {
651
-     *                    Optional. Used to set the default value of the field.
652
-     *
653
-     *                    @type string data_type The SQL data type for the field. VARCHAR, TEXT, TIME, TINYINT, INT, FLOAT, DATE
654
-     *                    @type int decimal_point limit if using FLOAT data_type
655
-     *                    @type string admin_title The admin title for the field.
656
-     *                    @type string site_title This will be the title for the field on the frontend.
657
-     *                    @type string admin_desc This will be shown below the field on the add listing form.
658
-     *                    @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.
659
-     *                    @type bool is_active If false the field will not be displayed anywhere.
660
-     *                    @type bool for_admin_use If true then only site admin can see and edit this field.
661
-     *                    @type string default_value The default value for the input on the add listing page.
662
-     *                    @type string show_in The locations to show in. [detail],[moreinfo],[listing],[owntab],[mapbubble]
663
-     *                    @type bool is_required If true the field will be required on the add listing page.
664
-     *                    @type string option_values The option values for select and multiselect only
665
-     *                    @type string validation_pattern HTML5 validation pattern (text input only by default).
666
-     *                    @type string validation_msg HTML5 validation message (text input only by default).
667
-     *                    @type string required_msg Required warning message.
668
-     *                    @type string field_icon Icon url or font awesome class.
669
-     *                    @type string css_class Field custom css class for field custom style.
670
-     *                    @type bool cat_sort If true the field will appear in the category sort options, if false the field will be hidden, leave blank to show option.
671
-     *                    @type bool cat_sort If true the field will appear in the advanced search sort options, if false the field will be hidden, leave blank to show option. (advanced search addon required)
672
-     *     }
673
-     * }
674
-     * @param string $post_type The post type requested.
675
-     */
676
-    return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
543
+	$custom_fields = array(
544
+		'text' => array(
545
+			'field_type'  =>  'text',
546
+			'class' =>  'gd-text',
547
+			'icon'  =>  'fa fa-minus',
548
+			'name'  =>  __('Text', 'geodirectory'),
549
+			'description' =>  __('Add any sort of text field, text or numbers', 'geodirectory')
550
+		),
551
+		'datepicker' => array(
552
+			'field_type'  =>  'datepicker',
553
+			'class' =>  'gd-datepicker',
554
+			'icon'  =>  'fa fa-calendar',
555
+			'name'  =>  __('Date', 'geodirectory'),
556
+			'description' =>  __('Adds a date picker.', 'geodirectory')
557
+		),
558
+		'textarea' => array(
559
+			'field_type'  =>  'textarea',
560
+			'class' =>  'gd-textarea',
561
+			'icon'  =>  'fa fa-bars',
562
+			'name'  =>  __('Textarea', 'geodirectory'),
563
+			'description' =>  __('Adds a textarea', 'geodirectory')
564
+		),
565
+		'time' => array(
566
+			'field_type'  =>  'time',
567
+			'class' =>  'gd-time',
568
+			'icon' =>  'fa fa-clock-o',
569
+			'name'  =>  __('Time', 'geodirectory'),
570
+			'description' =>  __('Adds a time picker', 'geodirectory')
571
+		),
572
+		'checkbox' => array(
573
+			'field_type'  =>  'checkbox',
574
+			'class' =>  'gd-checkbox',
575
+			'icon' =>  'fa fa-check-square-o',
576
+			'name'  =>  __('Checkbox', 'geodirectory'),
577
+			'description' =>  __('Adds a checkbox', 'geodirectory')
578
+		),
579
+		'phone' => array(
580
+			'field_type'  =>  'phone',
581
+			'class' =>  'gd-phone',
582
+			'icon' =>  'fa fa-phone',
583
+			'name'  =>  __('Phone', 'geodirectory'),
584
+			'description' =>  __('Adds a phone input', 'geodirectory')
585
+		),
586
+		'radio' => array(
587
+			'field_type'  =>  'radio',
588
+			'class' =>  'gd-radio',
589
+			'icon' =>  'fa fa-dot-circle-o',
590
+			'name'  =>  __('Radio', 'geodirectory'),
591
+			'description' =>  __('Adds a radio input', 'geodirectory')
592
+		),
593
+		'email' => array(
594
+			'field_type'  =>  'email',
595
+			'class' =>  'gd-email',
596
+			'icon' =>  'fa fa-envelope-o',
597
+			'name'  =>  __('Email', 'geodirectory'),
598
+			'description' =>  __('Adds a email input', 'geodirectory')
599
+		),
600
+		'select' => array(
601
+			'field_type'  =>  'select',
602
+			'class' =>  'gd-select',
603
+			'icon' =>  'fa fa-caret-square-o-down',
604
+			'name'  =>  __('Select', 'geodirectory'),
605
+			'description' =>  __('Adds a select input', 'geodirectory')
606
+		),
607
+		'multiselect' => array(
608
+			'field_type'  =>  'multiselect',
609
+			'class' =>  'gd-multiselect',
610
+			'icon' =>  'fa fa-caret-square-o-down',
611
+			'name'  =>  __('Multi Select', 'geodirectory'),
612
+			'description' =>  __('Adds a multiselect input', 'geodirectory')
613
+		),
614
+		'url' => array(
615
+			'field_type'  =>  'url',
616
+			'class' =>  'gd-url',
617
+			'icon' =>  'fa fa-link',
618
+			'name'  =>  __('URL', 'geodirectory'),
619
+			'description' =>  __('Adds a url input', 'geodirectory')
620
+		),
621
+		'html' => array(
622
+			'field_type'  =>  'html',
623
+			'class' =>  'gd-html',
624
+			'icon' =>  'fa fa-code',
625
+			'name'  =>  __('HTML', 'geodirectory'),
626
+			'description' =>  __('Adds a html input textarea', 'geodirectory')
627
+		),
628
+		'file' => array(
629
+			'field_type'  =>  'file',
630
+			'class' =>  'gd-file',
631
+			'icon' =>  'fa fa-file',
632
+			'name'  =>  __('File Upload', 'geodirectory'),
633
+			'description' =>  __('Adds a file input', 'geodirectory')
634
+		)
635
+	);
636
+
637
+	/**
638
+	 * Filter the custom fields array to be able to add or remove items.
639
+	 * 
640
+	 * @since 1.6.6
641
+	 *
642
+	 * @param array $custom_fields {
643
+	 *     The custom fields array to be filtered.
644
+	 *
645
+	 *     @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file.
646
+	 *     @type string $class The class for the field in backend.
647
+	 *     @type string $icon Can be font-awesome class name or icon image url.
648
+	 *     @type string $name The name of the field.
649
+	 *     @type string $description A short description about the field.
650
+	 *     @type array $defaults {
651
+	 *                    Optional. Used to set the default value of the field.
652
+	 *
653
+	 *                    @type string data_type The SQL data type for the field. VARCHAR, TEXT, TIME, TINYINT, INT, FLOAT, DATE
654
+	 *                    @type int decimal_point limit if using FLOAT data_type
655
+	 *                    @type string admin_title The admin title for the field.
656
+	 *                    @type string site_title This will be the title for the field on the frontend.
657
+	 *                    @type string admin_desc This will be shown below the field on the add listing form.
658
+	 *                    @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.
659
+	 *                    @type bool is_active If false the field will not be displayed anywhere.
660
+	 *                    @type bool for_admin_use If true then only site admin can see and edit this field.
661
+	 *                    @type string default_value The default value for the input on the add listing page.
662
+	 *                    @type string show_in The locations to show in. [detail],[moreinfo],[listing],[owntab],[mapbubble]
663
+	 *                    @type bool is_required If true the field will be required on the add listing page.
664
+	 *                    @type string option_values The option values for select and multiselect only
665
+	 *                    @type string validation_pattern HTML5 validation pattern (text input only by default).
666
+	 *                    @type string validation_msg HTML5 validation message (text input only by default).
667
+	 *                    @type string required_msg Required warning message.
668
+	 *                    @type string field_icon Icon url or font awesome class.
669
+	 *                    @type string css_class Field custom css class for field custom style.
670
+	 *                    @type bool cat_sort If true the field will appear in the category sort options, if false the field will be hidden, leave blank to show option.
671
+	 *                    @type bool cat_sort If true the field will appear in the advanced search sort options, if false the field will be hidden, leave blank to show option. (advanced search addon required)
672
+	 *     }
673
+	 * }
674
+	 * @param string $post_type The post type requested.
675
+	 */
676
+	return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
677 677
 }
678 678
 
679 679
 /**
@@ -686,19 +686,19 @@  discard block
 block discarded – undo
686 686
  */
687 687
 function geodir_custom_available_fields($type='')
688 688
 {
689
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
690
-    ?>
689
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
690
+	?>
691 691
     <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
692 692
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" />
693 693
 
694 694
         <?php
695
-        if($type=='predefined'){
696
-            $cfs = geodir_custom_fields_predefined($listing_type);
697
-        }elseif($type=='custom'){
698
-            $cfs = geodir_custom_fields_custom($listing_type);
699
-        }else{
700
-            $cfs = geodir_custom_fields($listing_type);
701
-            ?>
695
+		if($type=='predefined'){
696
+			$cfs = geodir_custom_fields_predefined($listing_type);
697
+		}elseif($type=='custom'){
698
+			$cfs = geodir_custom_fields_custom($listing_type);
699
+		}else{
700
+			$cfs = geodir_custom_fields($listing_type);
701
+			?>
702 702
             <ul class="full gd-cf-tooltip-wrap">
703 703
                 <li>
704 704
                     <div class="gdcf-tooltip">
@@ -719,18 +719,18 @@  discard block
 block discarded – undo
719 719
             </ul>
720 720
 
721 721
             <?php
722
-        }
722
+		}
723 723
 
724
-    if(!empty($cfs)) {
724
+	if(!empty($cfs)) {
725 725
 
726
-        foreach ( $cfs as $id => $cf ) {
727
-            ?>
726
+		foreach ( $cfs as $id => $cf ) {
727
+			?>
728 728
             <ul>
729 729
             <li class="gd-cf-tooltip-wrap">
730 730
                 <?php
731
-                if ( isset( $cf['description'] ) && $cf['description'] ) {
732
-                    echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>';
733
-                } ?>
731
+				if ( isset( $cf['description'] ) && $cf['description'] ) {
732
+					echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>';
733
+				} ?>
734 734
 
735 735
                 <a id="gd-<?php echo $id; ?>"
736 736
                    data-field-custom-type="<?php echo $type; ?>"
@@ -740,21 +740,21 @@  discard block
 block discarded – undo
740 740
                    href="javascript:void(0);">
741 741
 
742 742
                     <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) {
743
-                        echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>';
744
-                    } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
745
-                        echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
746
-                    } else {
747
-                        echo '<i class="fa fa-cog" aria-hidden="true"></i>';
748
-                    } ?>
743
+						echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>';
744
+					} elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
745
+						echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
746
+					} else {
747
+						echo '<i class="fa fa-cog" aria-hidden="true"></i>';
748
+					} ?>
749 749
                     <?php echo $cf['name']; ?>
750 750
                 </a>
751 751
             </li>
752 752
             <?php
753
-        }
754
-    }else{
755
-        _e('There are no custom fields here yet.', 'geodirectory');
756
-    }
757
-        ?>
753
+		}
754
+	}else{
755
+		_e('There are no custom fields here yet.', 'geodirectory');
756
+	}
757
+		?>
758 758
 
759 759
 
760 760
     </ul>
@@ -773,26 +773,26 @@  discard block
 block discarded – undo
773 773
  */
774 774
 function geodir_custom_selected_fields()
775 775
 {
776
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
777
-    ?>
776
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
777
+	?>
778 778
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
779 779
     <ul class="core">
780 780
     <?php 
781
-        global $wpdb;
782
-        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
783
-
784
-        if (!empty($fields)) {
785
-            foreach ($fields as $field) {
786
-                //$result_str = $field->id;
787
-                $result_str = $field;
788
-                $field_type = $field->field_type;
789
-                $field_type_key = $field->field_type_key;
790
-                $field_ins_upd = 'display';
791
-
792
-                geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key);
793
-            }
794
-        }
795
-        ?></ul>
781
+		global $wpdb;
782
+		$fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
783
+
784
+		if (!empty($fields)) {
785
+			foreach ($fields as $field) {
786
+				//$result_str = $field->id;
787
+				$result_str = $field;
788
+				$field_type = $field->field_type;
789
+				$field_type_key = $field->field_type_key;
790
+				$field_ins_upd = 'display';
791
+
792
+				geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key);
793
+			}
794
+		}
795
+		?></ul>
796 796
 <?php
797 797
 
798 798
 }
@@ -811,16 +811,16 @@  discard block
 block discarded – undo
811 811
 function geodir_custom_fields_panel_head($heading, $sub_tab, $listing_type)
812 812
 {
813 813
 
814
-    switch ($sub_tab) {
815
-        case 'custom_fields':
816
-            $heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
817
-            break;
814
+	switch ($sub_tab) {
815
+		case 'custom_fields':
816
+			$heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
817
+			break;
818 818
 
819
-        case 'sorting_options':
820
-            $heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
821
-            break;
822
-    }
823
-    return $heading;
819
+		case 'sorting_options':
820
+			$heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
821
+			break;
822
+	}
823
+	return $heading;
824 824
 }
825 825
 
826 826
 
@@ -838,16 +838,16 @@  discard block
 block discarded – undo
838 838
 function geodir_cf_panel_available_fields_head($heading, $sub_tab, $listing_type)
839 839
 {
840 840
 
841
-    switch ($sub_tab) {
842
-        case 'custom_fields':
843
-            $heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type));
844
-            break;
841
+	switch ($sub_tab) {
842
+		case 'custom_fields':
843
+			$heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type));
844
+			break;
845 845
 
846
-        case 'sorting_options':
847
-            $heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type));
848
-            break;
849
-    }
850
-    return $heading;
846
+		case 'sorting_options':
847
+			$heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type));
848
+			break;
849
+	}
850
+	return $heading;
851 851
 }
852 852
 
853 853
 
@@ -865,16 +865,16 @@  discard block
 block discarded – undo
865 865
 function geodir_cf_panel_available_fields_note($note, $sub_tab, $listing_type)
866 866
 {
867 867
 
868
-    switch ($sub_tab) {
869
-        case 'custom_fields':
870
-            $note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));;
871
-            break;
868
+	switch ($sub_tab) {
869
+		case 'custom_fields':
870
+			$note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));;
871
+			break;
872 872
 
873
-        case 'sorting_options':
874
-            $note = sprintf(__('Click on any box below to make it appear in the sorting option dropdown on %s listing and search results.<br />To make a field available here, go to custom fields tab and expand any field from selected fields panel and tick the checkbox saying \'Include this field in sort option\'.', 'geodirectory'), get_post_type_singular_label($listing_type));
875
-            break;
876
-    }
877
-    return $note;
873
+		case 'sorting_options':
874
+			$note = sprintf(__('Click on any box below to make it appear in the sorting option dropdown on %s listing and search results.<br />To make a field available here, go to custom fields tab and expand any field from selected fields panel and tick the checkbox saying \'Include this field in sort option\'.', 'geodirectory'), get_post_type_singular_label($listing_type));
875
+			break;
876
+	}
877
+	return $note;
878 878
 }
879 879
 
880 880
 
@@ -892,16 +892,16 @@  discard block
 block discarded – undo
892 892
 function geodir_cf_panel_selected_fields_head($heading, $sub_tab, $listing_type)
893 893
 {
894 894
 
895
-    switch ($sub_tab) {
896
-        case 'custom_fields':
897
-            $heading = sprintf(__('List of fields that will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type));
898
-            break;
895
+	switch ($sub_tab) {
896
+		case 'custom_fields':
897
+			$heading = sprintf(__('List of fields that will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type));
898
+			break;
899 899
 
900
-        case 'sorting_options':
901
-            $heading = sprintf(__('List of fields that will appear in %s listing and search results sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type));
902
-            break;
903
-    }
904
-    return $heading;
900
+		case 'sorting_options':
901
+			$heading = sprintf(__('List of fields that will appear in %s listing and search results sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type));
902
+			break;
903
+	}
904
+	return $heading;
905 905
 }
906 906
 
907 907
 
@@ -919,16 +919,16 @@  discard block
 block discarded – undo
919 919
 function geodir_cf_panel_selected_fields_note($note, $sub_tab, $listing_type)
920 920
 {
921 921
 
922
-    switch ($sub_tab) {
923
-        case 'custom_fields':
924
-            $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));;
925
-            break;
922
+	switch ($sub_tab) {
923
+		case 'custom_fields':
924
+			$note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));;
925
+			break;
926 926
 
927
-        case 'sorting_options':
928
-            $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order in sorting option dropdown box on %s listing and search results page.', 'geodirectory'), get_post_type_singular_label($listing_type));
929
-            break;
930
-    }
931
-    return $note;
927
+		case 'sorting_options':
928
+			$note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order in sorting option dropdown box on %s listing and search results page.', 'geodirectory'), get_post_type_singular_label($listing_type));
929
+			break;
930
+	}
931
+	return $note;
932 932
 }
933 933
 
934 934
 
@@ -944,16 +944,16 @@  discard block
 block discarded – undo
944 944
  */
945 945
 function geodir_remove_unnecessary_fields()
946 946
 {
947
-    global $wpdb, $plugin_prefix;
947
+	global $wpdb, $plugin_prefix;
948 948
 
949
-    if (!get_option('geodir_remove_unnecessary_fields')) {
949
+	if (!get_option('geodir_remove_unnecessary_fields')) {
950 950
 
951
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
952
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
951
+		if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
952
+			$wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
953 953
 
954
-        update_option('geodir_remove_unnecessary_fields', '1');
954
+		update_option('geodir_remove_unnecessary_fields', '1');
955 955
 
956
-    }
956
+	}
957 957
 
958 958
 }
959 959
 
@@ -971,25 +971,25 @@  discard block
 block discarded – undo
971 971
  */
972 972
 function geodir_admin_ajax_handler()
973 973
 {
974
-    if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') {
975
-        $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action'];
976
-        switch ($geodir_admin_ajax_action) {
977
-            case 'diagnosis' :
978
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
979
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
980
-                call_user_func('geodir_diagnose_' . $diagnose_this);
981
-                exit();
982
-                break;
983
-
984
-            case 'diagnosis-fix' :
985
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
986
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
987
-                call_user_func('geodir_diagnose_' . $diagnose_this);
988
-                exit();
989
-                break;
990
-        }
991
-    }
992
-    exit();
974
+	if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') {
975
+		$geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action'];
976
+		switch ($geodir_admin_ajax_action) {
977
+			case 'diagnosis' :
978
+				if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
979
+					$diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
980
+				call_user_func('geodir_diagnose_' . $diagnose_this);
981
+				exit();
982
+				break;
983
+
984
+			case 'diagnosis-fix' :
985
+				if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
986
+					$diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
987
+				call_user_func('geodir_diagnose_' . $diagnose_this);
988
+				exit();
989
+				break;
990
+		}
991
+	}
992
+	exit();
993 993
 }
994 994
 
995 995
 
@@ -1007,127 +1007,127 @@  discard block
 block discarded – undo
1007 1007
  */
1008 1008
 function geodir_diagnose_multisite_table($filter_arr, $table, $tabel_name, $fix)
1009 1009
 {
1010
-    global $wpdb;
1011
-    //$filter_arr['output_str'] .='###'.$table.'###';
1012
-    if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
1013
-        $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
1014
-        $filter_arr['is_error_during_diagnose'] = true;
1015
-
1016
-    } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1017
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
1018
-        $filter_arr['is_error_during_diagnose'] = true;
1019
-        $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
1020
-        $filter_arr['is_error_during_diagnose'] = true;
1021
-
1022
-        if ($fix) {
1023
-            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
1024
-            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
1025
-
1026
-            if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
1027
-                //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
1028
-
1029
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
1030
-
1031
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1032
-                    $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
1033
-                } else {
1034
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1035
-                }
1036
-
1037
-            } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
1038
-
1039
-                $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
1040
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
1041
-
1042
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1043
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
1044
-                } else {
1045
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1046
-                }
1047
-
1048
-            } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
1049
-
1050
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
1051
-
1052
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1053
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
1054
-                } else {
1055
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1056
-                }
1057
-
1058
-            }
1059
-
1060
-        }
1061
-
1062
-
1063
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1064
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
1065
-        $filter_arr['is_error_during_diagnose'] = true;
1066
-
1067
-        if ($fix) {
1068
-            if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
1069
-                if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
1070
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
1071
-                } else {
1072
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
1073
-                }
1074
-
1075
-            } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
1076
-                if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
1077
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1078
-                } else {
1079
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1080
-                }
1081
-                if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1082
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1083
-                } else {
1084
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1085
-                }
1086
-            } else {// else rename the original table to _ms_bak
1087
-                if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1088
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
1089
-                } else {
1090
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
1091
-                }
1092
-            }
1093
-        }
1094
-
1095
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1096
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
1097
-        $filter_arr['is_error_during_diagnose'] = true;
1098
-
1099
-        if ($fix) {
1100
-            // if original table exists but new does not, rename
1101
-            if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1102
-                $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1103
-            } else {
1104
-                $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1105
-            }
1106
-
1107
-        }
1108
-
1109
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1110
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
1111
-        $filter_arr['is_error_during_diagnose'] = true;
1112
-
1113
-        if ($fix) {
1114
-            // if original table does not exist try deleting db_vers of all addons so the initial db_install scripts run;
1115
-            delete_option('geodirlocation_db_version');
1116
-            delete_option('geodirevents_db_version');
1117
-            delete_option('geodir_reviewrating_db_version');
1118
-            delete_option('gdevents_db_version');
1119
-            delete_option('geodirectory_db_version');
1120
-            delete_option('geodirclaim_db_version');
1121
-            delete_option('geodir_custom_posts_db_version');
1122
-            delete_option('geodir_reviewratings_db_version');
1123
-            delete_option('geodiradvancesearch_db_version');
1124
-            $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
1125
-        }
1126
-
1127
-    } else {
1128
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
1129
-    }
1130
-    return $filter_arr;
1010
+	global $wpdb;
1011
+	//$filter_arr['output_str'] .='###'.$table.'###';
1012
+	if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
1013
+		$filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
1014
+		$filter_arr['is_error_during_diagnose'] = true;
1015
+
1016
+	} elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1017
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
1018
+		$filter_arr['is_error_during_diagnose'] = true;
1019
+		$filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
1020
+		$filter_arr['is_error_during_diagnose'] = true;
1021
+
1022
+		if ($fix) {
1023
+			$ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
1024
+			$new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
1025
+
1026
+			if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
1027
+				//$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
1028
+
1029
+				$wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
1030
+
1031
+				if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1032
+					$filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
1033
+				} else {
1034
+					$filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1035
+				}
1036
+
1037
+			} elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
1038
+
1039
+				$wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
1040
+				$wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
1041
+
1042
+				if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1043
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
1044
+				} else {
1045
+					$filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1046
+				}
1047
+
1048
+			} elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
1049
+
1050
+				$wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
1051
+
1052
+				if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1053
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
1054
+				} else {
1055
+					$filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1056
+				}
1057
+
1058
+			}
1059
+
1060
+		}
1061
+
1062
+
1063
+	} elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1064
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
1065
+		$filter_arr['is_error_during_diagnose'] = true;
1066
+
1067
+		if ($fix) {
1068
+			if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
1069
+				if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
1070
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
1071
+				} else {
1072
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
1073
+				}
1074
+
1075
+			} elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
1076
+				if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
1077
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1078
+				} else {
1079
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1080
+				}
1081
+				if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1082
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1083
+				} else {
1084
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1085
+				}
1086
+			} else {// else rename the original table to _ms_bak
1087
+				if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1088
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
1089
+				} else {
1090
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
1091
+				}
1092
+			}
1093
+		}
1094
+
1095
+	} elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1096
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
1097
+		$filter_arr['is_error_during_diagnose'] = true;
1098
+
1099
+		if ($fix) {
1100
+			// if original table exists but new does not, rename
1101
+			if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1102
+				$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1103
+			} else {
1104
+				$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1105
+			}
1106
+
1107
+		}
1108
+
1109
+	} elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1110
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
1111
+		$filter_arr['is_error_during_diagnose'] = true;
1112
+
1113
+		if ($fix) {
1114
+			// if original table does not exist try deleting db_vers of all addons so the initial db_install scripts run;
1115
+			delete_option('geodirlocation_db_version');
1116
+			delete_option('geodirevents_db_version');
1117
+			delete_option('geodir_reviewrating_db_version');
1118
+			delete_option('gdevents_db_version');
1119
+			delete_option('geodirectory_db_version');
1120
+			delete_option('geodirclaim_db_version');
1121
+			delete_option('geodir_custom_posts_db_version');
1122
+			delete_option('geodir_reviewratings_db_version');
1123
+			delete_option('geodiradvancesearch_db_version');
1124
+			$filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
1125
+		}
1126
+
1127
+	} else {
1128
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
1129
+	}
1130
+	return $filter_arr;
1131 1131
 }
1132 1132
 
1133 1133
 
@@ -1141,53 +1141,53 @@  discard block
 block discarded – undo
1141 1141
  */
1142 1142
 function geodir_diagnose_tags_sync()
1143 1143
 {
1144
-    global $wpdb, $plugin_prefix;
1145
-    $fix = isset($_POST['fix']) ? true : false;
1146
-
1147
-    //if($fix){echo 'true';}else{echo 'false';}
1148
-    $is_error_during_diagnose = false;
1149
-    $output_str = '';
1150
-
1151
-
1152
-    $all_postypes = geodir_get_posttypes();
1153
-
1154
-    if (!empty($all_postypes)) {
1155
-        foreach ($all_postypes as $key) {
1156
-            // update each GD CPT
1157
-            $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
1158
-
1159
-            if (!empty($posts)) {
1160
-
1161
-                foreach ($posts as $p) {
1162
-                    $p->post_type = $key;
1163
-                    $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
1164
-                    if (empty($raw_tags)) {
1165
-                        $post_tags = '';
1166
-                    } else {
1167
-                        $post_tags = implode(",", $raw_tags);
1168
-                    }
1169
-                    $tablename = $plugin_prefix . $p->post_type . '_detail';
1170
-                    $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1171
-
1172
-                }
1173
-                $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1174
-            }
1175
-
1176
-        }
1177
-
1178
-    }
1179
-
1180
-    if ($is_error_during_diagnose) {
1181
-        $info_div_class = "geodir_problem_info";
1182
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1183
-    } else {
1184
-        $info_div_class = "geodir_noproblem_info";
1185
-        $fix_button_txt = '';
1186
-    }
1187
-    echo "<ul class='$info_div_class'>";
1188
-    echo $output_str;
1189
-    echo $fix_button_txt;
1190
-    echo "</ul>";
1144
+	global $wpdb, $plugin_prefix;
1145
+	$fix = isset($_POST['fix']) ? true : false;
1146
+
1147
+	//if($fix){echo 'true';}else{echo 'false';}
1148
+	$is_error_during_diagnose = false;
1149
+	$output_str = '';
1150
+
1151
+
1152
+	$all_postypes = geodir_get_posttypes();
1153
+
1154
+	if (!empty($all_postypes)) {
1155
+		foreach ($all_postypes as $key) {
1156
+			// update each GD CPT
1157
+			$posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
1158
+
1159
+			if (!empty($posts)) {
1160
+
1161
+				foreach ($posts as $p) {
1162
+					$p->post_type = $key;
1163
+					$raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
1164
+					if (empty($raw_tags)) {
1165
+						$post_tags = '';
1166
+					} else {
1167
+						$post_tags = implode(",", $raw_tags);
1168
+					}
1169
+					$tablename = $plugin_prefix . $p->post_type . '_detail';
1170
+					$wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1171
+
1172
+				}
1173
+				$output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1174
+			}
1175
+
1176
+		}
1177
+
1178
+	}
1179
+
1180
+	if ($is_error_during_diagnose) {
1181
+		$info_div_class = "geodir_problem_info";
1182
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1183
+	} else {
1184
+		$info_div_class = "geodir_noproblem_info";
1185
+		$fix_button_txt = '';
1186
+	}
1187
+	echo "<ul class='$info_div_class'>";
1188
+	echo $output_str;
1189
+	echo $fix_button_txt;
1190
+	echo "</ul>";
1191 1191
 
1192 1192
 }
1193 1193
 
@@ -1203,75 +1203,75 @@  discard block
 block discarded – undo
1203 1203
  */
1204 1204
 function geodir_diagnose_cats_sync()
1205 1205
 {
1206
-    global $wpdb, $plugin_prefix;
1207
-    $fix = isset($_POST['fix']) ? true : false;
1206
+	global $wpdb, $plugin_prefix;
1207
+	$fix = isset($_POST['fix']) ? true : false;
1208 1208
 
1209
-    //if($fix){echo 'true';}else{echo 'false';}
1210
-    $is_error_during_diagnose = false;
1211
-    $output_str = '';
1209
+	//if($fix){echo 'true';}else{echo 'false';}
1210
+	$is_error_during_diagnose = false;
1211
+	$output_str = '';
1212 1212
 
1213 1213
 
1214
-    $all_postypes = geodir_get_posttypes();
1214
+	$all_postypes = geodir_get_posttypes();
1215 1215
 
1216
-    if (!empty($all_postypes)) {
1217
-        foreach ($all_postypes as $key) {
1218
-            // update each GD CTP
1219
-            $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
1216
+	if (!empty($all_postypes)) {
1217
+		foreach ($all_postypes as $key) {
1218
+			// update each GD CTP
1219
+			$posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
1220 1220
 
1221
-            if (!empty($posts)) {
1221
+			if (!empty($posts)) {
1222 1222
 
1223
-                foreach ($posts as $p) {
1224
-                    $p->post_type = $key;
1225
-                    $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
1223
+				foreach ($posts as $p) {
1224
+					$p->post_type = $key;
1225
+					$raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
1226 1226
 
1227
-                    if (empty($raw_cats)) {
1228
-                        $post_categories = get_post_meta($p->post_id, 'post_categories', true);
1227
+					if (empty($raw_cats)) {
1228
+						$post_categories = get_post_meta($p->post_id, 'post_categories', true);
1229 1229
 
1230
-                        if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
1231
-                            $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
1232
-                            foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
1233
-                                if (is_numeric($cat_part)) {
1234
-                                    $raw_cats[] = (int)$cat_part;
1235
-                                }
1236
-                            }
1230
+						if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
1231
+							$post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
1232
+							foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
1233
+								if (is_numeric($cat_part)) {
1234
+									$raw_cats[] = (int)$cat_part;
1235
+								}
1236
+							}
1237 1237
 
1238
-                        }
1238
+						}
1239 1239
 
1240
-                        if (!empty($raw_cats)) {
1241
-                            $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category');
1240
+						if (!empty($raw_cats)) {
1241
+							$term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category');
1242 1242
 
1243
-                        }
1243
+						}
1244 1244
 
1245
-                    }
1245
+					}
1246 1246
 
1247 1247
 
1248
-                    if (empty($raw_cats)) {
1249
-                        $post_cats = '';
1250
-                    } else {
1251
-                        $post_cats = ',' . implode(",", $raw_cats) . ',';
1252
-                    }
1253
-                    $tablename = $plugin_prefix . $p->post_type . '_detail';
1254
-                    $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1255
-                }
1248
+					if (empty($raw_cats)) {
1249
+						$post_cats = '';
1250
+					} else {
1251
+						$post_cats = ',' . implode(",", $raw_cats) . ',';
1252
+					}
1253
+					$tablename = $plugin_prefix . $p->post_type . '_detail';
1254
+					$wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1255
+				}
1256 1256
 
1257
-            }
1258
-            $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1257
+			}
1258
+			$output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1259 1259
 
1260
-        }
1260
+		}
1261 1261
 
1262
-    }
1262
+	}
1263 1263
 
1264
-    if ($is_error_during_diagnose) {
1265
-        $info_div_class = "geodir_problem_info";
1266
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1267
-    } else {
1268
-        $info_div_class = "geodir_noproblem_info";
1269
-        $fix_button_txt = '';
1270
-    }
1271
-    echo "<ul class='$info_div_class'>";
1272
-    echo $output_str;
1273
-    echo $fix_button_txt;
1274
-    echo "</ul>";
1264
+	if ($is_error_during_diagnose) {
1265
+		$info_div_class = "geodir_problem_info";
1266
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1267
+	} else {
1268
+		$info_div_class = "geodir_noproblem_info";
1269
+		$fix_button_txt = '';
1270
+	}
1271
+	echo "<ul class='$info_div_class'>";
1272
+	echo $output_str;
1273
+	echo $fix_button_txt;
1274
+	echo "</ul>";
1275 1275
 
1276 1276
 }
1277 1277
 
@@ -1285,61 +1285,61 @@  discard block
 block discarded – undo
1285 1285
  */
1286 1286
 function geodir_diagnose_version_clear()
1287 1287
 {
1288
-    global $wpdb, $plugin_prefix;
1289
-    $fix = isset($_POST['fix']) ? true : false;
1290
-
1291
-    //if($fix){echo 'true';}else{echo 'false';}
1292
-    $is_error_during_diagnose = false;
1293
-    $output_str = '';
1294
-
1295
-
1296
-    $gd_arr = array('GeoDirectory' => 'geodirectory_db_version',
1297
-        'Payment Manager' => 'geodir_payments_db_version',
1298
-        'GeoDirectory Framework' => 'gdf_db_version',
1299
-        'Advanced Search' => 'geodiradvancesearch_db_version',
1300
-        'Review Rating Manager' => 'geodir_reviewratings_db_version',
1301
-        'Claim Manager' => 'geodirclaim_db_version',
1302
-        'CPT Manager' => 'geodir_custom_posts_db_version',
1303
-        'Location Manager' => 'geodirlocation_db_version',
1304
-        'Payment Manager' => 'geodir_payments_db_version',
1305
-        'Events Manager' => 'geodirevents_db_version',
1306
-    );
1307
-
1308
-    /**
1309
-     * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers.
1310
-     *
1311
-     * @since 1.0.0
1312
-     * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',...
1313
-     */
1314
-    $ver_arr = apply_filters('geodir_db_version_name', $gd_arr);
1315
-
1316
-    if (!empty($ver_arr)) {
1317
-        foreach ($ver_arr as $key => $val) {
1318
-            if (delete_option($val)) {
1319
-                $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
1320
-            } else {
1321
-                $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
1322
-            }
1323
-
1324
-        }
1325
-
1326
-        if ($output_str) {
1327
-            $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
1328
-        }
1329
-
1330
-    }
1331
-
1332
-    if ($is_error_during_diagnose) {
1333
-        $info_div_class = "geodir_problem_info";
1334
-        $fix_button_txt = "";
1335
-    } else {
1336
-        $info_div_class = "geodir_noproblem_info";
1337
-        $fix_button_txt = '';
1338
-    }
1339
-    echo "<ul class='$info_div_class'>";
1340
-    echo $output_str;
1341
-    echo $fix_button_txt;
1342
-    echo "</ul>";
1288
+	global $wpdb, $plugin_prefix;
1289
+	$fix = isset($_POST['fix']) ? true : false;
1290
+
1291
+	//if($fix){echo 'true';}else{echo 'false';}
1292
+	$is_error_during_diagnose = false;
1293
+	$output_str = '';
1294
+
1295
+
1296
+	$gd_arr = array('GeoDirectory' => 'geodirectory_db_version',
1297
+		'Payment Manager' => 'geodir_payments_db_version',
1298
+		'GeoDirectory Framework' => 'gdf_db_version',
1299
+		'Advanced Search' => 'geodiradvancesearch_db_version',
1300
+		'Review Rating Manager' => 'geodir_reviewratings_db_version',
1301
+		'Claim Manager' => 'geodirclaim_db_version',
1302
+		'CPT Manager' => 'geodir_custom_posts_db_version',
1303
+		'Location Manager' => 'geodirlocation_db_version',
1304
+		'Payment Manager' => 'geodir_payments_db_version',
1305
+		'Events Manager' => 'geodirevents_db_version',
1306
+	);
1307
+
1308
+	/**
1309
+	 * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers.
1310
+	 *
1311
+	 * @since 1.0.0
1312
+	 * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',...
1313
+	 */
1314
+	$ver_arr = apply_filters('geodir_db_version_name', $gd_arr);
1315
+
1316
+	if (!empty($ver_arr)) {
1317
+		foreach ($ver_arr as $key => $val) {
1318
+			if (delete_option($val)) {
1319
+				$output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
1320
+			} else {
1321
+				$output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
1322
+			}
1323
+
1324
+		}
1325
+
1326
+		if ($output_str) {
1327
+			$output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
1328
+		}
1329
+
1330
+	}
1331
+
1332
+	if ($is_error_during_diagnose) {
1333
+		$info_div_class = "geodir_problem_info";
1334
+		$fix_button_txt = "";
1335
+	} else {
1336
+		$info_div_class = "geodir_noproblem_info";
1337
+		$fix_button_txt = '';
1338
+	}
1339
+	echo "<ul class='$info_div_class'>";
1340
+	echo $output_str;
1341
+	echo $fix_button_txt;
1342
+	echo "</ul>";
1343 1343
 
1344 1344
 }
1345 1345
 
@@ -1353,59 +1353,59 @@  discard block
 block discarded – undo
1353 1353
  */
1354 1354
 function geodir_diagnose_ratings()
1355 1355
 {
1356
-    global $wpdb;
1357
-    $fix = isset($_POST['fix']) ? true : false;
1358
-
1359
-    //if($fix){echo 'true';}else{echo 'false';}
1360
-    $is_error_during_diagnose = false;
1361
-    $output_str = '';
1362
-
1363
-    // check review locations
1364
-    if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
1365
-        $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
1366
-        $is_error_during_diagnose = true;
1367
-
1368
-        if ($fix) {
1369
-            if (geodir_fix_review_location()) {
1370
-                $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
1371
-            } else {
1372
-                $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
1373
-            }
1374
-        }
1375
-
1376
-    } else {
1377
-        $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
1378
-    }
1379
-
1380
-    // check review content
1381
-    if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
1382
-        $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
1383
-        $is_error_during_diagnose = true;
1384
-
1385
-        if ($fix) {
1386
-            if (geodir_fix_review_content()) {
1387
-                $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
1388
-            } else {
1389
-                $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
1390
-            }
1391
-        }
1392
-
1393
-    } else {
1394
-        $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
1395
-    }
1396
-
1397
-
1398
-    if ($is_error_during_diagnose) {
1399
-        $info_div_class = "geodir_problem_info";
1400
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1401
-    } else {
1402
-        $info_div_class = "geodir_noproblem_info";
1403
-        $fix_button_txt = '';
1404
-    }
1405
-    echo "<ul class='$info_div_class'>";
1406
-    echo $output_str;
1407
-    echo $fix_button_txt;
1408
-    echo "</ul>";
1356
+	global $wpdb;
1357
+	$fix = isset($_POST['fix']) ? true : false;
1358
+
1359
+	//if($fix){echo 'true';}else{echo 'false';}
1360
+	$is_error_during_diagnose = false;
1361
+	$output_str = '';
1362
+
1363
+	// check review locations
1364
+	if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
1365
+		$output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
1366
+		$is_error_during_diagnose = true;
1367
+
1368
+		if ($fix) {
1369
+			if (geodir_fix_review_location()) {
1370
+				$output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
1371
+			} else {
1372
+				$output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
1373
+			}
1374
+		}
1375
+
1376
+	} else {
1377
+		$output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
1378
+	}
1379
+
1380
+	// check review content
1381
+	if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
1382
+		$output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
1383
+		$is_error_during_diagnose = true;
1384
+
1385
+		if ($fix) {
1386
+			if (geodir_fix_review_content()) {
1387
+				$output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
1388
+			} else {
1389
+				$output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
1390
+			}
1391
+		}
1392
+
1393
+	} else {
1394
+		$output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
1395
+	}
1396
+
1397
+
1398
+	if ($is_error_during_diagnose) {
1399
+		$info_div_class = "geodir_problem_info";
1400
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1401
+	} else {
1402
+		$info_div_class = "geodir_noproblem_info";
1403
+		$fix_button_txt = '';
1404
+	}
1405
+	echo "<ul class='$info_div_class'>";
1406
+	echo $output_str;
1407
+	echo $fix_button_txt;
1408
+	echo "</ul>";
1409 1409
 
1410 1410
 }
1411 1411
 
@@ -1419,57 +1419,57 @@  discard block
 block discarded – undo
1419 1419
  */
1420 1420
 function geodir_diagnose_multisite_conversion()
1421 1421
 {
1422
-    global $wpdb;
1423
-    $fix = isset($_POST['fix']) ? true : false;
1424
-    //if($fix){echo 'true';}else{echo 'false';}
1425
-    $is_error_during_diagnose = false;
1426
-    $output_str = '';
1427
-
1428
-    $filter_arr = array();
1429
-    $filter_arr['output_str'] = $output_str;
1430
-    $filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose;
1431
-    $table_arr = array('geodir_countries' => __('Countries', 'geodirectory'),
1432
-        'geodir_custom_fields' => __('Custom fields', 'geodirectory'),
1433
-        'geodir_post_icon' => __('Post icon', 'geodirectory'),
1434
-        'geodir_attachments' => __('Attachments', 'geodirectory'),
1435
-        'geodir_post_review' => __('Reviews', 'geodirectory'),
1436
-        'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'),
1437
-        'geodir_gd_place_detail' => __('Place detail', 'geodirectory')
1438
-    );
1439
-
1440
-    // allow other addons to hook in and add their checks
1441
-
1442
-    /**
1443
-     * Filter the array of tables.
1444
-     *
1445
-     * Filter the array of tables to check during the GD>Tools multisite DB conversion tool check, this allows addons to add their DB tables to the checks.
1446
-     *
1447
-     * @since 1.0.0
1448
-     * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),...
1449
-     */
1450
-    $table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr);
1451
-
1452
-    foreach ($table_arr as $table => $table_name) {
1453
-        // Diagnose table
1454
-        $filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix);
1455
-    }
1456
-
1457
-
1458
-    $output_str = $filter_arr['output_str'];
1459
-    $is_error_during_diagnose = $filter_arr['is_error_during_diagnose'];
1460
-
1461
-
1462
-    if ($is_error_during_diagnose) {
1463
-        $info_div_class = "geodir_problem_info";
1464
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1465
-    } else {
1466
-        $info_div_class = "geodir_noproblem_info";
1467
-        $fix_button_txt = '';
1468
-    }
1469
-    echo "<ul class='$info_div_class'>";
1470
-    echo $output_str;
1471
-    echo $fix_button_txt;
1472
-    echo "</ul>";
1422
+	global $wpdb;
1423
+	$fix = isset($_POST['fix']) ? true : false;
1424
+	//if($fix){echo 'true';}else{echo 'false';}
1425
+	$is_error_during_diagnose = false;
1426
+	$output_str = '';
1427
+
1428
+	$filter_arr = array();
1429
+	$filter_arr['output_str'] = $output_str;
1430
+	$filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose;
1431
+	$table_arr = array('geodir_countries' => __('Countries', 'geodirectory'),
1432
+		'geodir_custom_fields' => __('Custom fields', 'geodirectory'),
1433
+		'geodir_post_icon' => __('Post icon', 'geodirectory'),
1434
+		'geodir_attachments' => __('Attachments', 'geodirectory'),
1435
+		'geodir_post_review' => __('Reviews', 'geodirectory'),
1436
+		'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'),
1437
+		'geodir_gd_place_detail' => __('Place detail', 'geodirectory')
1438
+	);
1439
+
1440
+	// allow other addons to hook in and add their checks
1441
+
1442
+	/**
1443
+	 * Filter the array of tables.
1444
+	 *
1445
+	 * Filter the array of tables to check during the GD>Tools multisite DB conversion tool check, this allows addons to add their DB tables to the checks.
1446
+	 *
1447
+	 * @since 1.0.0
1448
+	 * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),...
1449
+	 */
1450
+	$table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr);
1451
+
1452
+	foreach ($table_arr as $table => $table_name) {
1453
+		// Diagnose table
1454
+		$filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix);
1455
+	}
1456
+
1457
+
1458
+	$output_str = $filter_arr['output_str'];
1459
+	$is_error_during_diagnose = $filter_arr['is_error_during_diagnose'];
1460
+
1461
+
1462
+	if ($is_error_during_diagnose) {
1463
+		$info_div_class = "geodir_problem_info";
1464
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1465
+	} else {
1466
+		$info_div_class = "geodir_noproblem_info";
1467
+		$fix_button_txt = '';
1468
+	}
1469
+	echo "<ul class='$info_div_class'>";
1470
+	echo $output_str;
1471
+	echo $fix_button_txt;
1472
+	echo "</ul>";
1473 1473
 }
1474 1474
 
1475 1475
 /**
@@ -1487,39 +1487,39 @@  discard block
 block discarded – undo
1487 1487
  */
1488 1488
 function geodir_fix_virtual_page($slug, $page_title, $old_id, $option)
1489 1489
 {
1490
-    global $wpdb, $current_user;
1491
-
1492
-    if (!empty($old_id)) {
1493
-        wp_delete_post($old_id, true);
1494
-    }//delete post if already there
1495
-    else {
1496
-        $page_found = $wpdb->get_var(
1497
-            $wpdb->prepare(
1498
-                "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
1499
-                array($slug)
1500
-            )
1501
-        );
1502
-        wp_delete_post($page_found, true);
1503
-
1504
-    }
1505
-
1506
-    $page_data = array(
1507
-        'post_status' => 'publish',
1508
-        'post_type' => 'page',
1509
-        'post_author' => $current_user->ID,
1510
-        'post_name' => $slug,
1511
-        'post_title' => $page_title,
1512
-        'post_content' => '',
1513
-        'post_parent' => 0,
1514
-        'comment_status' => 'closed'
1515
-    );
1516
-    $page_id = wp_insert_post($page_data);
1517
-    update_option($option, $page_id);
1518
-    if ($page_id) {
1519
-        return true;
1520
-    } else {
1521
-        return false;
1522
-    }
1490
+	global $wpdb, $current_user;
1491
+
1492
+	if (!empty($old_id)) {
1493
+		wp_delete_post($old_id, true);
1494
+	}//delete post if already there
1495
+	else {
1496
+		$page_found = $wpdb->get_var(
1497
+			$wpdb->prepare(
1498
+				"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
1499
+				array($slug)
1500
+			)
1501
+		);
1502
+		wp_delete_post($page_found, true);
1503
+
1504
+	}
1505
+
1506
+	$page_data = array(
1507
+		'post_status' => 'publish',
1508
+		'post_type' => 'page',
1509
+		'post_author' => $current_user->ID,
1510
+		'post_name' => $slug,
1511
+		'post_title' => $page_title,
1512
+		'post_content' => '',
1513
+		'post_parent' => 0,
1514
+		'comment_status' => 'closed'
1515
+	);
1516
+	$page_id = wp_insert_post($page_data);
1517
+	update_option($option, $page_id);
1518
+	if ($page_id) {
1519
+		return true;
1520
+	} else {
1521
+		return false;
1522
+	}
1523 1523
 }
1524 1524
 
1525 1525
 /**
@@ -1531,212 +1531,212 @@  discard block
 block discarded – undo
1531 1531
  */
1532 1532
 function geodir_diagnose_default_pages()
1533 1533
 {
1534
-    global $wpdb;
1535
-    $is_error_during_diagnose = false;
1536
-    $output_str = '';
1537
-    $fix = isset($_POST['fix']) ? true : false;
1538
-
1539
-    //////////////////////////////////
1540
-    /* Diagnose GD Home Page Starts */
1541
-    //////////////////////////////////
1542
-    $option_value = get_option('geodir_home_page');
1543
-    $page = get_post($option_value);
1544
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1545
-
1546
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1547
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1548
-    else {
1549
-        $is_error_during_diagnose = true;
1550
-        $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1551
-        if ($fix) {
1552
-            if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
1553
-                $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
1554
-            } else {
1555
-                $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
1556
-            }
1557
-        }
1558
-    }
1559
-
1560
-    ////////////////////////////////
1561
-    /* Diagnose GD Home Page Ends */
1562
-    ////////////////////////////////
1563
-
1564
-    //////////////////////////////////
1565
-    /* Diagnose Add Listing Page Starts */
1566
-    //////////////////////////////////
1567
-    $option_value = get_option('geodir_add_listing_page');
1568
-    $page = get_post($option_value);
1569
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1570
-
1571
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1572
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1573
-    else {
1574
-        $is_error_during_diagnose = true;
1575
-        $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1576
-        if ($fix) {
1577
-            if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
1578
-                $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
1579
-            } else {
1580
-                $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
1581
-            }
1582
-        }
1583
-    }
1584
-
1585
-    ////////////////////////////////
1586
-    /* Diagnose Add Listing Page Ends */
1587
-    ////////////////////////////////
1588
-
1589
-
1590
-    //////////////////////////////////
1591
-    /* Diagnose Listing Preview Page Starts */
1592
-    //////////////////////////////////
1593
-    $option_value = get_option('geodir_preview_page');
1594
-    $page = get_post($option_value);
1595
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1596
-
1597
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1598
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1599
-    else {
1600
-        $is_error_during_diagnose = true;
1601
-        $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1602
-        if ($fix) {
1603
-            if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
1604
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
1605
-            } else {
1606
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
1607
-            }
1608
-        }
1609
-    }
1610
-
1611
-    ////////////////////////////////
1612
-    /* Diagnose Listing Preview Page Ends */
1613
-    ////////////////////////////////
1614
-
1615
-    //////////////////////////////////
1616
-    /* Diagnose Listing Success Page Starts */
1617
-    //////////////////////////////////
1618
-    $option_value = get_option('geodir_success_page');
1619
-    $page = get_post($option_value);
1620
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1621
-
1622
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1623
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1624
-    else {
1625
-        $is_error_during_diagnose = true;
1626
-        $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1627
-        if ($fix) {
1628
-            if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
1629
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
1630
-            } else {
1631
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
1632
-            }
1633
-        }
1634
-    }
1635
-
1636
-    ////////////////////////////////
1637
-    /* Diagnose Listing Sucess Page Ends */
1638
-    ////////////////////////////////
1639
-
1640
-    //////////////////////////////////
1641
-    /* Diagnose Info Page Starts */
1642
-    //////////////////////////////////
1643
-    $option_value = get_option('geodir_info_page');
1644
-    $page = get_post($option_value);
1645
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1646
-
1647
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1648
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1649
-    else {
1650
-        $is_error_during_diagnose = true;
1651
-        $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1652
-        if ($fix) {
1653
-            if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
1654
-                $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
1655
-            } else {
1656
-                $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
1657
-            }
1658
-        }
1659
-    }
1660
-
1661
-    ////////////////////////////////
1662
-    /* Diagnose Info Page Ends */
1663
-    ////////////////////////////////
1664
-
1665
-    //////////////////////////////////
1666
-    /* Diagnose Login Page Starts */
1667
-    //////////////////////////////////
1668
-    $option_value = get_option('geodir_login_page');
1669
-    $page = get_post($option_value);
1670
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1671
-
1672
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1673
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1674
-    else {
1675
-        $is_error_during_diagnose = true;
1676
-        $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1677
-        if ($fix) {
1678
-            if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
1679
-                $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
1680
-            } else {
1681
-                $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
1682
-            }
1683
-        }
1684
-    }
1685
-
1686
-    ////////////////////////////////
1687
-    /* Diagnose Info Page Ends */
1688
-    ////////////////////////////////
1689
-
1690
-    //////////////////////////////////
1691
-    /* Diagnose Location Page Starts */
1692
-    //////////////////////////////////
1693
-    $option_value = get_option('geodir_location_page');
1694
-    $page = get_post($option_value);
1695
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1696
-
1697
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1698
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1699
-    else {
1700
-        $is_error_during_diagnose = true;
1701
-        $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1702
-        if ($fix) {
1703
-            if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
1704
-                $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
1705
-            } else {
1706
-                $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
1707
-            }
1708
-        }
1709
-    }
1710
-
1711
-    ////////////////////////////////
1712
-    /* Diagnose Location Page Ends */
1713
-    ////////////////////////////////
1714
-
1715
-    $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1716
-    /**
1717
-     * This action is called at the end of the GD Tools page check function.
1718
-     *
1719
-     * @since 1.5.2
1720
-     */
1721
-    $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1722
-
1723
-    $output_str = $page_chk_arr['output_str'];
1724
-    $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
1725
-
1726
-    if ($is_error_during_diagnose) {
1727
-        if ($fix) {
1728
-            flush_rewrite_rules();
1729
-        }
1730
-        $info_div_class = "geodir_problem_info";
1731
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1732
-    } else {
1733
-        $info_div_class = "geodir_noproblem_info";
1734
-        $fix_button_txt = '';
1735
-    }
1736
-    echo "<ul class='$info_div_class'>";
1737
-    echo $output_str;
1738
-    echo $fix_button_txt;
1739
-    echo "</ul>";
1534
+	global $wpdb;
1535
+	$is_error_during_diagnose = false;
1536
+	$output_str = '';
1537
+	$fix = isset($_POST['fix']) ? true : false;
1538
+
1539
+	//////////////////////////////////
1540
+	/* Diagnose GD Home Page Starts */
1541
+	//////////////////////////////////
1542
+	$option_value = get_option('geodir_home_page');
1543
+	$page = get_post($option_value);
1544
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1545
+
1546
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1547
+		$output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1548
+	else {
1549
+		$is_error_during_diagnose = true;
1550
+		$output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1551
+		if ($fix) {
1552
+			if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
1553
+				$output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
1554
+			} else {
1555
+				$output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
1556
+			}
1557
+		}
1558
+	}
1559
+
1560
+	////////////////////////////////
1561
+	/* Diagnose GD Home Page Ends */
1562
+	////////////////////////////////
1563
+
1564
+	//////////////////////////////////
1565
+	/* Diagnose Add Listing Page Starts */
1566
+	//////////////////////////////////
1567
+	$option_value = get_option('geodir_add_listing_page');
1568
+	$page = get_post($option_value);
1569
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1570
+
1571
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1572
+		$output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1573
+	else {
1574
+		$is_error_during_diagnose = true;
1575
+		$output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1576
+		if ($fix) {
1577
+			if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
1578
+				$output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
1579
+			} else {
1580
+				$output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
1581
+			}
1582
+		}
1583
+	}
1584
+
1585
+	////////////////////////////////
1586
+	/* Diagnose Add Listing Page Ends */
1587
+	////////////////////////////////
1588
+
1589
+
1590
+	//////////////////////////////////
1591
+	/* Diagnose Listing Preview Page Starts */
1592
+	//////////////////////////////////
1593
+	$option_value = get_option('geodir_preview_page');
1594
+	$page = get_post($option_value);
1595
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1596
+
1597
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1598
+		$output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1599
+	else {
1600
+		$is_error_during_diagnose = true;
1601
+		$output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1602
+		if ($fix) {
1603
+			if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
1604
+				$output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
1605
+			} else {
1606
+				$output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
1607
+			}
1608
+		}
1609
+	}
1610
+
1611
+	////////////////////////////////
1612
+	/* Diagnose Listing Preview Page Ends */
1613
+	////////////////////////////////
1614
+
1615
+	//////////////////////////////////
1616
+	/* Diagnose Listing Success Page Starts */
1617
+	//////////////////////////////////
1618
+	$option_value = get_option('geodir_success_page');
1619
+	$page = get_post($option_value);
1620
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1621
+
1622
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1623
+		$output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1624
+	else {
1625
+		$is_error_during_diagnose = true;
1626
+		$output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1627
+		if ($fix) {
1628
+			if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
1629
+				$output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
1630
+			} else {
1631
+				$output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
1632
+			}
1633
+		}
1634
+	}
1635
+
1636
+	////////////////////////////////
1637
+	/* Diagnose Listing Sucess Page Ends */
1638
+	////////////////////////////////
1639
+
1640
+	//////////////////////////////////
1641
+	/* Diagnose Info Page Starts */
1642
+	//////////////////////////////////
1643
+	$option_value = get_option('geodir_info_page');
1644
+	$page = get_post($option_value);
1645
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1646
+
1647
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1648
+		$output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1649
+	else {
1650
+		$is_error_during_diagnose = true;
1651
+		$output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1652
+		if ($fix) {
1653
+			if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
1654
+				$output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
1655
+			} else {
1656
+				$output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
1657
+			}
1658
+		}
1659
+	}
1660
+
1661
+	////////////////////////////////
1662
+	/* Diagnose Info Page Ends */
1663
+	////////////////////////////////
1664
+
1665
+	//////////////////////////////////
1666
+	/* Diagnose Login Page Starts */
1667
+	//////////////////////////////////
1668
+	$option_value = get_option('geodir_login_page');
1669
+	$page = get_post($option_value);
1670
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1671
+
1672
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1673
+		$output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1674
+	else {
1675
+		$is_error_during_diagnose = true;
1676
+		$output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1677
+		if ($fix) {
1678
+			if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
1679
+				$output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
1680
+			} else {
1681
+				$output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
1682
+			}
1683
+		}
1684
+	}
1685
+
1686
+	////////////////////////////////
1687
+	/* Diagnose Info Page Ends */
1688
+	////////////////////////////////
1689
+
1690
+	//////////////////////////////////
1691
+	/* Diagnose Location Page Starts */
1692
+	//////////////////////////////////
1693
+	$option_value = get_option('geodir_location_page');
1694
+	$page = get_post($option_value);
1695
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1696
+
1697
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1698
+		$output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1699
+	else {
1700
+		$is_error_during_diagnose = true;
1701
+		$output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1702
+		if ($fix) {
1703
+			if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
1704
+				$output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
1705
+			} else {
1706
+				$output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
1707
+			}
1708
+		}
1709
+	}
1710
+
1711
+	////////////////////////////////
1712
+	/* Diagnose Location Page Ends */
1713
+	////////////////////////////////
1714
+
1715
+	$page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1716
+	/**
1717
+	 * This action is called at the end of the GD Tools page check function.
1718
+	 *
1719
+	 * @since 1.5.2
1720
+	 */
1721
+	$page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1722
+
1723
+	$output_str = $page_chk_arr['output_str'];
1724
+	$is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
1725
+
1726
+	if ($is_error_during_diagnose) {
1727
+		if ($fix) {
1728
+			flush_rewrite_rules();
1729
+		}
1730
+		$info_div_class = "geodir_problem_info";
1731
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1732
+	} else {
1733
+		$info_div_class = "geodir_noproblem_info";
1734
+		$fix_button_txt = '';
1735
+	}
1736
+	echo "<ul class='$info_div_class'>";
1737
+	echo $output_str;
1738
+	echo $fix_button_txt;
1739
+	echo "</ul>";
1740 1740
 
1741 1741
 }
1742 1742
 
@@ -1748,26 +1748,26 @@  discard block
 block discarded – undo
1748 1748
  * @global object $wpdb WordPress Database object.
1749 1749
  */
1750 1750
 function geodir_diagnose_load_db_language() {
1751
-    global $wpdb;
1751
+	global $wpdb;
1752 1752
 	
1753 1753
 	$is_error_during_diagnose = geodirectory_load_db_language();
1754 1754
 
1755
-    $output_str = '';
1756
-    $fix_button_txt = '';
1755
+	$output_str = '';
1756
+	$fix_button_txt = '';
1757 1757
 
1758
-    if ($is_error_during_diagnose) {
1759
-        $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>";
1758
+	if ($is_error_during_diagnose) {
1759
+		$output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>";
1760 1760
 		$info_div_class = "geodir_problem_info";
1761
-    } else {
1762
-        $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1761
+	} else {
1762
+		$output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1763 1763
 		$info_div_class = "geodir_noproblem_info";
1764
-        $fix_button_txt = '';
1765
-    }
1764
+		$fix_button_txt = '';
1765
+	}
1766 1766
     
1767 1767
 	echo "<ul class='$info_div_class'>";
1768
-    echo $output_str;
1769
-    echo $fix_button_txt;
1770
-    echo "</ul>";
1768
+	echo $output_str;
1769
+	echo $fix_button_txt;
1770
+	echo "</ul>";
1771 1771
 
1772 1772
 }
1773 1773
 
@@ -1798,23 +1798,23 @@  discard block
 block discarded – undo
1798 1798
  */
1799 1799
 function geodir_posts_clauses_request($clauses)
1800 1800
 {
1801
-    global $wpdb, $wp_query, $plugin_prefix;
1801
+	global $wpdb, $wp_query, $plugin_prefix;
1802 1802
 
1803
-    if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
1804
-        $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail';
1803
+	if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
1804
+		$table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail';
1805 1805
 
1806
-        $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)';
1807
-        $clauses['join'] = $join;
1806
+		$join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)';
1807
+		$clauses['join'] = $join;
1808 1808
 
1809
-        $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : '';
1810
-        $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire';
1811
-        $clauses['fields'] = $fields;
1809
+		$fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : '';
1810
+		$fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire';
1811
+		$clauses['fields'] = $fields;
1812 1812
 
1813
-        $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC';
1814
-        $orderby = 'gd_expire ' . $order;
1815
-        $clauses['orderby'] = $orderby;
1816
-    }
1817
-    return $clauses;
1813
+		$order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC';
1814
+		$orderby = 'gd_expire ' . $order;
1815
+		$clauses['orderby'] = $orderby;
1816
+	}
1817
+	return $clauses;
1818 1818
 }
1819 1819
 
1820 1820
 
@@ -1835,7 +1835,7 @@  discard block
 block discarded – undo
1835 1835
  */
1836 1836
 function gd_theme_switch_compat_check()
1837 1837
 {
1838
-    gd_set_theme_compat();
1838
+	gd_set_theme_compat();
1839 1839
 }
1840 1840
 
1841 1841
 /**
@@ -1848,27 +1848,27 @@  discard block
 block discarded – undo
1848 1848
  */
1849 1849
 function geodir_str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\")
1850 1850
 {
1851
-    if (function_exists('str_getcsv')) {
1852
-        $fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape);
1853
-    } else {
1854
-        global $current_user;
1855
-        $upload_dir = wp_upload_dir();
1856
-
1857
-        $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv';
1858
-        $handle = fopen($file, 'w');
1859
-
1860
-        fwrite($handle, $input);
1861
-        fclose($handle);
1862
-
1863
-        $handle = fopen($file, 'rt');
1864
-        if (PHP_VERSION >= '5.3.0') {
1865
-            $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape);
1866
-        } else {
1867
-            $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure);
1868
-        }
1869
-        fclose($handle);
1870
-    }
1871
-    return $fgetcsv;
1851
+	if (function_exists('str_getcsv')) {
1852
+		$fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape);
1853
+	} else {
1854
+		global $current_user;
1855
+		$upload_dir = wp_upload_dir();
1856
+
1857
+		$file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv';
1858
+		$handle = fopen($file, 'w');
1859
+
1860
+		fwrite($handle, $input);
1861
+		fclose($handle);
1862
+
1863
+		$handle = fopen($file, 'rt');
1864
+		if (PHP_VERSION >= '5.3.0') {
1865
+			$fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape);
1866
+		} else {
1867
+			$fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure);
1868
+		}
1869
+		fclose($handle);
1870
+	}
1871
+	return $fgetcsv;
1872 1872
 }
1873 1873
 
1874 1874
 add_action('wp_ajax_gdImportCsv', 'geodir_ajax_import_csv');
@@ -1883,375 +1883,375 @@  discard block
 block discarded – undo
1883 1883
  */
1884 1884
 function geodir_ajax_import_csv()
1885 1885
 {
1886
-    error_reporting(0); // hide error to get clean json response
1886
+	error_reporting(0); // hide error to get clean json response
1887 1887
 
1888
-    global $wpdb, $plugin_prefix, $current_user;
1889
-    $uploads = wp_upload_dir();
1890
-    ini_set('auto_detect_line_endings', true);
1888
+	global $wpdb, $plugin_prefix, $current_user;
1889
+	$uploads = wp_upload_dir();
1890
+	ini_set('auto_detect_line_endings', true);
1891 1891
 	
1892 1892
 	$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
1893 1893
 
1894
-    $task = isset($_POST['task']) ? $_POST['task'] : '';
1895
-    $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL;
1896
-    $filename = $uploadedFile;
1897
-
1898
-    $uploads = wp_upload_dir();
1899
-    $uploads_dir = $uploads['path'];
1900
-    $image_name_arr = explode('/', $filename);
1901
-    $filename = end($image_name_arr);
1902
-    $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1903
-    $return = array();
1904
-    $return['file'] = $uploadedFile;
1905
-    $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
1906
-
1907
-    if (is_file($target_path) && file_exists($target_path) && $uploadedFile) {
1908
-        $wp_filetype = wp_check_filetype_and_ext($target_path, $filename);
1909
-
1910
-        if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
1911
-            $return['error'] = NULL;
1912
-
1913
-            $return['rows'] = 0;
1914
-
1915
-
1916
-
1917
-                if (($handle = fopen($target_path, "r")) !== FALSE) {
1918
-                    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
1919
-                        if(is_array($data) && !empty($data)) {
1920
-                            $file[] = '"' . implode('","', $data) . '"';
1921
-                        }
1922
-                    }
1923
-                    fclose($handle);
1924
-                    $file = $file;
1925
-                }
1926
-
1927
-
1928
-
1929
-                $return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
1930
-
1931
-
1932
-            if (!$return['rows'] > 0) {
1933
-                $return['error'] = __('No data found in csv file.', 'geodirectory');
1934
-            }
1935
-        }
1936
-    }
1937
-    if ($task == 'prepare' || !empty($return['error'])) {
1938
-        echo json_encode($return);
1939
-        exit;
1940
-    }
1941
-
1942
-    $totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL;
1943
-    $importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1;
1944
-    $count = $importlimit;
1945
-    $requested_limit = $importlimit;
1946
-    $tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0;
1947
-
1948
-    if ($count < $totRecords) {
1949
-        $count = $tmpCnt + $count;
1950
-        if ($count > $totRecords) {
1951
-            $count = $totRecords;
1952
-        }
1953
-    } else {
1954
-        $count = $totRecords;
1955
-    }
1956
-
1957
-    $total_records = 0;
1958
-    $rowcount = 0;
1959
-    $address_invalid = 0;
1960
-    $blank_address = 0;
1961
-    $upload_files = 0;
1962
-    $invalid_post_type = 0;
1963
-    $invalid_title = 0;
1964
-    $customKeyarray = array();
1965
-    $gd_post_info = array();
1966
-    $post_location = array();
1967
-    $countpost = 0;
1968
-
1969
-    if (!empty($file)) {
1970
-        $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL;
1971
-        $customKeyarray = $columns;
1972
-
1973
-        if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
1974
-            $return['error'] = CSV_INVAILD_FILE;
1975
-            echo json_encode($return);
1976
-            exit;
1977
-        }
1978
-
1979
-        for ($i = 1; $i <= $importlimit; $i++) {
1980
-            $current_index = $tmpCnt + $i;
1981
-            if (isset($file[$current_index])) {
1982
-                $total_records++;
1983
-
1984
-                $buffer = geodir_str_getcsv($file[$current_index]);
1985
-                $post_title = addslashes($buffer[0]);
1986
-                $current_post_author = $buffer[1];
1987
-                $post_desc = addslashes($buffer[2]);
1988
-                $post_cat = array();
1989
-                $catids_arr = array();
1990
-                $post_cat = trim($buffer[3]); // comma seperated category name
1991
-
1992
-                if ($post_cat) {
1993
-                    $post_cat_arr = explode(',', $post_cat);
1994
-
1995
-                    for ($c = 0; $c < count($post_cat_arr); $c++) {
1996
-                        $catid = wp_kses_normalize_entities(trim($post_cat_arr[$c]));
1997
-
1998
-                        if (!empty($buffer[5])) {
1999
-                            if (in_array($buffer[5], geodir_get_posttypes())) {
2000
-
2001
-                                $p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5]));
2002
-
2003
-                                if (get_term_by('name', $catid, $p_taxonomy[0])) {
2004
-                                    $cat = get_term_by('name', $catid, $p_taxonomy[0]);
2005
-                                    $catids_arr[] = $cat->slug;
2006
-                                } else if (get_term_by('slug', $catid, $p_taxonomy[0])) {
2007
-                                    $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
2008
-                                    $catids_arr[] = $cat->slug;
2009
-                                } else {
2010
-                                    $ret = wp_insert_term($catid, $p_taxonomy[0]);
2011
-                                    if ($ret && !is_wp_error($ret)) {
2012
-                                        if (get_term_by('name', $catid, $p_taxonomy[0])) {
2013
-                                            $cat = get_term_by('name', $catid, $p_taxonomy[0]);
2014
-                                            $catids_arr[] = $cat->slug;
2015
-                                        } elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
2016
-                                            $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
2017
-                                            $catids_arr[] = $cat->slug;
2018
-                                        }
2019
-                                    }
2020
-                                }
2021
-                            }
2022
-                        }
2023
-                    }
2024
-                }
2025
-
2026
-                if (!$catids_arr) {
2027
-                    $catids_arr[] = 1;
2028
-                }
2029
-
2030
-                $post_tags = trim($buffer[4]); // comma seperated tags
2031
-
2032
-                $tag_arr = '';
2033
-                if ($post_tags) {
2034
-                    $tag_arr = explode(',', $post_tags);
2035
-                }
2036
-
2037
-                $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
2038
-
2039
-                $error = '';
2040
-                if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
2041
-                    $invalid_post_type++;
2042
-                    continue;
2043
-                }
2044
-
2045
-                if ($post_title != '') {
2046
-                    $menu_order = 0;
2047
-                    $image_folder_name = 'uplaod/';
2048
-
2049
-                    $image_names = array();
2050
-
2051
-                    for ($c = 5; $c < count($customKeyarray); $c++) {
2052
-                        $gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]);
2053
-
2054
-                        if ($customKeyarray[$c] == 'IMAGE') {
2055
-                            $buffer[$c] = trim($buffer[$c]);
2056
-
2057
-                            if (!empty($buffer[$c])) {
2058
-                                $image_names[] = $buffer[$c];
2059
-                            }
2060
-                        }
2061
-
2062
-                        if ($customKeyarray[$c] == 'alive_days') {
2063
-                            if ($buffer[$c] != '0' && $buffer[$c] != '') {
2064
-                                $submitdata = date('Y-m-d');
2065
-
2066
-                                $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
2067
-                            } else {
2068
-                                $gd_post_info['expire_date'] = 'Never';
2069
-                            }
2070
-                        }
2071
-
2072
-                        if ($customKeyarray[$c] == 'post_city') {
2073
-                            $post_city = addslashes($buffer[$c]);
2074
-                        }
2075
-
2076
-                        if ($customKeyarray[$c] == 'post_region') {
2077
-                            $post_region = addslashes($buffer[$c]);
2078
-                        }
2079
-
2080
-                        if ($customKeyarray[$c] == 'post_country') {
2081
-                            $post_country = addslashes($buffer[$c]);
2082
-                        }
2083
-
2084
-                        if ($customKeyarray[$c] == 'post_latitude') {
2085
-                            $post_latitude = addslashes($buffer[$c]);
2086
-                        }
2087
-
2088
-                        if ($customKeyarray[$c] == 'post_longitude') {
2089
-                            $post_longitude = addslashes($buffer[$c]);
2090
-                        }
1894
+	$task = isset($_POST['task']) ? $_POST['task'] : '';
1895
+	$uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL;
1896
+	$filename = $uploadedFile;
1897
+
1898
+	$uploads = wp_upload_dir();
1899
+	$uploads_dir = $uploads['path'];
1900
+	$image_name_arr = explode('/', $filename);
1901
+	$filename = end($image_name_arr);
1902
+	$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1903
+	$return = array();
1904
+	$return['file'] = $uploadedFile;
1905
+	$return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
1906
+
1907
+	if (is_file($target_path) && file_exists($target_path) && $uploadedFile) {
1908
+		$wp_filetype = wp_check_filetype_and_ext($target_path, $filename);
1909
+
1910
+		if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
1911
+			$return['error'] = NULL;
1912
+
1913
+			$return['rows'] = 0;
1914
+
1915
+
1916
+
1917
+				if (($handle = fopen($target_path, "r")) !== FALSE) {
1918
+					while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
1919
+						if(is_array($data) && !empty($data)) {
1920
+							$file[] = '"' . implode('","', $data) . '"';
1921
+						}
1922
+					}
1923
+					fclose($handle);
1924
+					$file = $file;
1925
+				}
1926
+
1927
+
1928
+
1929
+				$return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
1930
+
1931
+
1932
+			if (!$return['rows'] > 0) {
1933
+				$return['error'] = __('No data found in csv file.', 'geodirectory');
1934
+			}
1935
+		}
1936
+	}
1937
+	if ($task == 'prepare' || !empty($return['error'])) {
1938
+		echo json_encode($return);
1939
+		exit;
1940
+	}
1941
+
1942
+	$totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL;
1943
+	$importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1;
1944
+	$count = $importlimit;
1945
+	$requested_limit = $importlimit;
1946
+	$tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0;
1947
+
1948
+	if ($count < $totRecords) {
1949
+		$count = $tmpCnt + $count;
1950
+		if ($count > $totRecords) {
1951
+			$count = $totRecords;
1952
+		}
1953
+	} else {
1954
+		$count = $totRecords;
1955
+	}
1956
+
1957
+	$total_records = 0;
1958
+	$rowcount = 0;
1959
+	$address_invalid = 0;
1960
+	$blank_address = 0;
1961
+	$upload_files = 0;
1962
+	$invalid_post_type = 0;
1963
+	$invalid_title = 0;
1964
+	$customKeyarray = array();
1965
+	$gd_post_info = array();
1966
+	$post_location = array();
1967
+	$countpost = 0;
1968
+
1969
+	if (!empty($file)) {
1970
+		$columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL;
1971
+		$customKeyarray = $columns;
1972
+
1973
+		if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
1974
+			$return['error'] = CSV_INVAILD_FILE;
1975
+			echo json_encode($return);
1976
+			exit;
1977
+		}
1978
+
1979
+		for ($i = 1; $i <= $importlimit; $i++) {
1980
+			$current_index = $tmpCnt + $i;
1981
+			if (isset($file[$current_index])) {
1982
+				$total_records++;
1983
+
1984
+				$buffer = geodir_str_getcsv($file[$current_index]);
1985
+				$post_title = addslashes($buffer[0]);
1986
+				$current_post_author = $buffer[1];
1987
+				$post_desc = addslashes($buffer[2]);
1988
+				$post_cat = array();
1989
+				$catids_arr = array();
1990
+				$post_cat = trim($buffer[3]); // comma seperated category name
1991
+
1992
+				if ($post_cat) {
1993
+					$post_cat_arr = explode(',', $post_cat);
1994
+
1995
+					for ($c = 0; $c < count($post_cat_arr); $c++) {
1996
+						$catid = wp_kses_normalize_entities(trim($post_cat_arr[$c]));
1997
+
1998
+						if (!empty($buffer[5])) {
1999
+							if (in_array($buffer[5], geodir_get_posttypes())) {
2000
+
2001
+								$p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5]));
2002
+
2003
+								if (get_term_by('name', $catid, $p_taxonomy[0])) {
2004
+									$cat = get_term_by('name', $catid, $p_taxonomy[0]);
2005
+									$catids_arr[] = $cat->slug;
2006
+								} else if (get_term_by('slug', $catid, $p_taxonomy[0])) {
2007
+									$cat = get_term_by('slug', $catid, $p_taxonomy[0]);
2008
+									$catids_arr[] = $cat->slug;
2009
+								} else {
2010
+									$ret = wp_insert_term($catid, $p_taxonomy[0]);
2011
+									if ($ret && !is_wp_error($ret)) {
2012
+										if (get_term_by('name', $catid, $p_taxonomy[0])) {
2013
+											$cat = get_term_by('name', $catid, $p_taxonomy[0]);
2014
+											$catids_arr[] = $cat->slug;
2015
+										} elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
2016
+											$cat = get_term_by('slug', $catid, $p_taxonomy[0]);
2017
+											$catids_arr[] = $cat->slug;
2018
+										}
2019
+									}
2020
+								}
2021
+							}
2022
+						}
2023
+					}
2024
+				}
2025
+
2026
+				if (!$catids_arr) {
2027
+					$catids_arr[] = 1;
2028
+				}
2029
+
2030
+				$post_tags = trim($buffer[4]); // comma seperated tags
2031
+
2032
+				$tag_arr = '';
2033
+				if ($post_tags) {
2034
+					$tag_arr = explode(',', $post_tags);
2035
+				}
2036
+
2037
+				$table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
2038
+
2039
+				$error = '';
2040
+				if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
2041
+					$invalid_post_type++;
2042
+					continue;
2043
+				}
2044
+
2045
+				if ($post_title != '') {
2046
+					$menu_order = 0;
2047
+					$image_folder_name = 'uplaod/';
2048
+
2049
+					$image_names = array();
2050
+
2051
+					for ($c = 5; $c < count($customKeyarray); $c++) {
2052
+						$gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]);
2053
+
2054
+						if ($customKeyarray[$c] == 'IMAGE') {
2055
+							$buffer[$c] = trim($buffer[$c]);
2056
+
2057
+							if (!empty($buffer[$c])) {
2058
+								$image_names[] = $buffer[$c];
2059
+							}
2060
+						}
2061
+
2062
+						if ($customKeyarray[$c] == 'alive_days') {
2063
+							if ($buffer[$c] != '0' && $buffer[$c] != '') {
2064
+								$submitdata = date('Y-m-d');
2065
+
2066
+								$gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
2067
+							} else {
2068
+								$gd_post_info['expire_date'] = 'Never';
2069
+							}
2070
+						}
2071
+
2072
+						if ($customKeyarray[$c] == 'post_city') {
2073
+							$post_city = addslashes($buffer[$c]);
2074
+						}
2075
+
2076
+						if ($customKeyarray[$c] == 'post_region') {
2077
+							$post_region = addslashes($buffer[$c]);
2078
+						}
2079
+
2080
+						if ($customKeyarray[$c] == 'post_country') {
2081
+							$post_country = addslashes($buffer[$c]);
2082
+						}
2083
+
2084
+						if ($customKeyarray[$c] == 'post_latitude') {
2085
+							$post_latitude = addslashes($buffer[$c]);
2086
+						}
2087
+
2088
+						if ($customKeyarray[$c] == 'post_longitude') {
2089
+							$post_longitude = addslashes($buffer[$c]);
2090
+						}
2091 2091
 						
2092 2092
 						// Post status
2093 2093
 						if ($customKeyarray[$c] == 'post_status') {
2094
-                            $post_status = sanitize_key( $buffer[$c] );
2095
-                        }
2096
-                    }
2097
-
2098
-                    /* ================ before array create ============== */
2099
-                    $location_result = geodir_get_default_location();
2100
-                    if ((!isset($gd_post_info['post_city']) || $gd_post_info['post_city'] == '') || (!isset($gd_post_info['post_region']) || $gd_post_info['post_region'] == '') || (!isset($gd_post_info['post_country']) || $gd_post_info['post_country'] == '') || (!isset($gd_post_info['post_address']) || $gd_post_info['post_address'] == '') || (!isset($gd_post_info['post_latitude']) || $gd_post_info['post_latitude'] == '') || (!isset($gd_post_info['post_longitude']) || $gd_post_info['post_longitude'] == '')) {
2101
-                        $blank_address++;
2102
-                        continue;
2103
-                    } else if ($location_result->location_id == 0) {
2104
-                        if ((geodir_strtolower($gd_post_info['post_city']) != geodir_strtolower($location_result->city)) || (geodir_strtolower($gd_post_info['post_region']) != geodir_strtolower($location_result->region)) || (geodir_strtolower($gd_post_info['post_country']) != geodir_strtolower($location_result->country))) {
2105
-                            $address_invalid++;
2106
-                            continue;
2107
-                        }
2108
-                    }
2094
+							$post_status = sanitize_key( $buffer[$c] );
2095
+						}
2096
+					}
2097
+
2098
+					/* ================ before array create ============== */
2099
+					$location_result = geodir_get_default_location();
2100
+					if ((!isset($gd_post_info['post_city']) || $gd_post_info['post_city'] == '') || (!isset($gd_post_info['post_region']) || $gd_post_info['post_region'] == '') || (!isset($gd_post_info['post_country']) || $gd_post_info['post_country'] == '') || (!isset($gd_post_info['post_address']) || $gd_post_info['post_address'] == '') || (!isset($gd_post_info['post_latitude']) || $gd_post_info['post_latitude'] == '') || (!isset($gd_post_info['post_longitude']) || $gd_post_info['post_longitude'] == '')) {
2101
+						$blank_address++;
2102
+						continue;
2103
+					} else if ($location_result->location_id == 0) {
2104
+						if ((geodir_strtolower($gd_post_info['post_city']) != geodir_strtolower($location_result->city)) || (geodir_strtolower($gd_post_info['post_region']) != geodir_strtolower($location_result->region)) || (geodir_strtolower($gd_post_info['post_country']) != geodir_strtolower($location_result->country))) {
2105
+							$address_invalid++;
2106
+							continue;
2107
+						}
2108
+					}
2109 2109
 					
2110 2110
 					// Default post status
2111 2111
 					$default_status = 'publish';
2112 2112
 					$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
2113 2113
 					$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
2114 2114
 
2115
-                    $my_post['post_title'] = $post_title;
2116
-                    $my_post['post_content'] = $post_desc;
2117
-                    $my_post['post_type'] = addslashes($buffer[5]);
2118
-                    $my_post['post_author'] = $current_post_author;
2119
-                    $my_post['post_status'] = $post_status;
2120
-                    $my_post['post_category'] = $catids_arr;
2121
-                    $my_post['post_tags'] = $tag_arr;
2122
-
2123
-                    $gd_post_info['post_tags'] = $tag_arr;
2124
-                    $gd_post_info['post_title'] = $post_title;
2125
-                    $gd_post_info['post_status'] = $post_status;
2126
-                    $gd_post_info['submit_time'] = time();
2127
-                    $gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR'];
2128
-
2129
-                    $last_postid = wp_insert_post($my_post);
2130
-                    $countpost++;
2131
-
2132
-                    // Check if we need to save post location as new location
2133
-                    if ($location_result->location_id > 0) {
2134
-                        if (isset($post_city) && isset($post_region)) {
2135
-                            $request_info['post_location'] = array(
2136
-                                'city' => $post_city,
2137
-                                'region' => $post_region,
2138
-                                'country' => $post_country,
2139
-                                'geo_lat' => $post_latitude,
2140
-                                'geo_lng' => $post_longitude
2141
-                            );
2142
-
2143
-                            $post_location_info = $request_info['post_location'];
2144
-                            if ($location_id = geodir_add_new_location($post_location_info))
2145
-                                $post_location_id = $location_id;
2146
-                        } else {
2147
-                            $post_location_id = 0;
2148
-                        }
2149
-                    } else {
2150
-                        $post_location_id = 0;
2151
-                    }
2152
-
2153
-                    /* ------- get default package info ----- */
2154
-                    $payment_info = array();
2155
-                    $package_info = array();
2156
-
2157
-                    $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2158
-                    $package_id = '';
2159
-                    if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2160
-                        $package_id = $gd_post_info['package_id'];
2161
-                    }
2162
-
2163
-                    if (!empty($package_info)) {
2164
-                        $payment_info['package_id'] = $package_info['pid'];
2165
-
2166
-                        if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
2167
-                            $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
2168
-                        } else {
2169
-                            $payment_info['expire_date'] = 'Never';
2170
-                        }
2171
-
2172
-                        $gd_post_info = array_merge($gd_post_info, $payment_info);
2173
-                    }
2174
-
2175
-                    $gd_post_info['post_location_id'] = $post_location_id;
2176
-
2177
-                    $post_type = get_post_type($last_postid);
2178
-
2179
-                    $table = $plugin_prefix . $post_type . '_detail';
2180
-
2181
-                    geodir_save_post_info($last_postid, $gd_post_info);
2182
-
2183
-                    if (!empty($image_names)) {
2184
-                        $upload_files++;
2185
-                        $menu_order = 1;
2186
-
2187
-                        foreach ($image_names as $image_name) {
2188
-                            $img_name_arr = explode('.', $image_name);
2189
-
2190
-                            $uploads = wp_upload_dir();
2191
-                            $sub_dir = $uploads['subdir'];
2192
-
2193
-                            $arr_file_type = wp_check_filetype($image_name);
2194
-                            $uploaded_file_type = $arr_file_type['type'];
2195
-
2196
-                            $attachment = array();
2197
-                            $attachment['post_id'] = $last_postid;
2198
-                            $attachment['title'] = $img_name_arr[0];
2199
-                            $attachment['content'] = '';
2200
-                            $attachment['file'] = $sub_dir . '/' . $image_name;
2201
-                            $attachment['mime_type'] = $uploaded_file_type;
2202
-                            $attachment['menu_order'] = $menu_order;
2203
-                            $attachment['is_featured'] = 0;
2204
-
2205
-                            $attachment_set = '';
2206
-
2207
-                            foreach ($attachment as $key => $val) {
2208
-                                if ($val != '')
2209
-                                    $attachment_set .= $key . " = '" . $val . "', ";
2210
-                            }
2211
-                            $attachment_set = trim($attachment_set, ", ");
2212
-
2213
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
2214
-
2215
-                            if ($menu_order == 1) {
2216
-                                $post_type = get_post_type($last_postid);
2217
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
2218
-                            }
2219
-                            $menu_order++;
2220
-                        }
2221
-                    }
2222
-
2223
-                    $gd_post_info['package_id'] = $package_id;
2224
-
2225
-                    /** This action is documented in geodirectory-functions/post-functions.php */
2226
-                    do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
2227
-
2228
-                    if (!empty($buffer[5])) {
2229
-                        if (in_array($buffer[5], geodir_get_posttypes())) {
2230
-                            $taxonomies = geodir_get_posttype_info(addslashes($buffer[5]));
2231
-                            wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]);
2232
-                            wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]);
2233
-
2234
-                            $post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : '';
2235
-                            $post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : '';
2236
-                            geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str);
2237
-                        }
2238
-                    }
2239
-                } else {
2240
-                    $invalid_title++;
2241
-                }
2242
-            }
2243
-        }
2244
-    }
2245
-    $return['rowcount'] = $countpost;
2246
-    $return['invalidcount'] = $address_invalid;
2247
-    $return['blank_address'] = $blank_address;
2248
-    $return['upload_files'] = $upload_files;
2249
-    $return['invalid_post_type'] = $invalid_post_type;
2250
-    $return['invalid_title'] = $invalid_title;
2251
-    $return['total_records'] = $total_records;
2252
-
2253
-    echo json_encode($return);
2254
-    exit;
2115
+					$my_post['post_title'] = $post_title;
2116
+					$my_post['post_content'] = $post_desc;
2117
+					$my_post['post_type'] = addslashes($buffer[5]);
2118
+					$my_post['post_author'] = $current_post_author;
2119
+					$my_post['post_status'] = $post_status;
2120
+					$my_post['post_category'] = $catids_arr;
2121
+					$my_post['post_tags'] = $tag_arr;
2122
+
2123
+					$gd_post_info['post_tags'] = $tag_arr;
2124
+					$gd_post_info['post_title'] = $post_title;
2125
+					$gd_post_info['post_status'] = $post_status;
2126
+					$gd_post_info['submit_time'] = time();
2127
+					$gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR'];
2128
+
2129
+					$last_postid = wp_insert_post($my_post);
2130
+					$countpost++;
2131
+
2132
+					// Check if we need to save post location as new location
2133
+					if ($location_result->location_id > 0) {
2134
+						if (isset($post_city) && isset($post_region)) {
2135
+							$request_info['post_location'] = array(
2136
+								'city' => $post_city,
2137
+								'region' => $post_region,
2138
+								'country' => $post_country,
2139
+								'geo_lat' => $post_latitude,
2140
+								'geo_lng' => $post_longitude
2141
+							);
2142
+
2143
+							$post_location_info = $request_info['post_location'];
2144
+							if ($location_id = geodir_add_new_location($post_location_info))
2145
+								$post_location_id = $location_id;
2146
+						} else {
2147
+							$post_location_id = 0;
2148
+						}
2149
+					} else {
2150
+						$post_location_id = 0;
2151
+					}
2152
+
2153
+					/* ------- get default package info ----- */
2154
+					$payment_info = array();
2155
+					$package_info = array();
2156
+
2157
+					$package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2158
+					$package_id = '';
2159
+					if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2160
+						$package_id = $gd_post_info['package_id'];
2161
+					}
2162
+
2163
+					if (!empty($package_info)) {
2164
+						$payment_info['package_id'] = $package_info['pid'];
2165
+
2166
+						if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
2167
+							$payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
2168
+						} else {
2169
+							$payment_info['expire_date'] = 'Never';
2170
+						}
2171
+
2172
+						$gd_post_info = array_merge($gd_post_info, $payment_info);
2173
+					}
2174
+
2175
+					$gd_post_info['post_location_id'] = $post_location_id;
2176
+
2177
+					$post_type = get_post_type($last_postid);
2178
+
2179
+					$table = $plugin_prefix . $post_type . '_detail';
2180
+
2181
+					geodir_save_post_info($last_postid, $gd_post_info);
2182
+
2183
+					if (!empty($image_names)) {
2184
+						$upload_files++;
2185
+						$menu_order = 1;
2186
+
2187
+						foreach ($image_names as $image_name) {
2188
+							$img_name_arr = explode('.', $image_name);
2189
+
2190
+							$uploads = wp_upload_dir();
2191
+							$sub_dir = $uploads['subdir'];
2192
+
2193
+							$arr_file_type = wp_check_filetype($image_name);
2194
+							$uploaded_file_type = $arr_file_type['type'];
2195
+
2196
+							$attachment = array();
2197
+							$attachment['post_id'] = $last_postid;
2198
+							$attachment['title'] = $img_name_arr[0];
2199
+							$attachment['content'] = '';
2200
+							$attachment['file'] = $sub_dir . '/' . $image_name;
2201
+							$attachment['mime_type'] = $uploaded_file_type;
2202
+							$attachment['menu_order'] = $menu_order;
2203
+							$attachment['is_featured'] = 0;
2204
+
2205
+							$attachment_set = '';
2206
+
2207
+							foreach ($attachment as $key => $val) {
2208
+								if ($val != '')
2209
+									$attachment_set .= $key . " = '" . $val . "', ";
2210
+							}
2211
+							$attachment_set = trim($attachment_set, ", ");
2212
+
2213
+							$wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
2214
+
2215
+							if ($menu_order == 1) {
2216
+								$post_type = get_post_type($last_postid);
2217
+								$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
2218
+							}
2219
+							$menu_order++;
2220
+						}
2221
+					}
2222
+
2223
+					$gd_post_info['package_id'] = $package_id;
2224
+
2225
+					/** This action is documented in geodirectory-functions/post-functions.php */
2226
+					do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
2227
+
2228
+					if (!empty($buffer[5])) {
2229
+						if (in_array($buffer[5], geodir_get_posttypes())) {
2230
+							$taxonomies = geodir_get_posttype_info(addslashes($buffer[5]));
2231
+							wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]);
2232
+							wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]);
2233
+
2234
+							$post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : '';
2235
+							$post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : '';
2236
+							geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str);
2237
+						}
2238
+					}
2239
+				} else {
2240
+					$invalid_title++;
2241
+				}
2242
+			}
2243
+		}
2244
+	}
2245
+	$return['rowcount'] = $countpost;
2246
+	$return['invalidcount'] = $address_invalid;
2247
+	$return['blank_address'] = $blank_address;
2248
+	$return['upload_files'] = $upload_files;
2249
+	$return['invalid_post_type'] = $invalid_post_type;
2250
+	$return['invalid_title'] = $invalid_title;
2251
+	$return['total_records'] = $total_records;
2252
+
2253
+	echo json_encode($return);
2254
+	exit;
2255 2255
 }
2256 2256
 
2257 2257
 // Add the tab in left sidebar menu fro import & export page.
@@ -2271,9 +2271,9 @@  discard block
 block discarded – undo
2271 2271
  * @param $post object $post The post object of the post being saved.
2272 2272
  */
2273 2273
 function geodir_update_location_prefix($post_id,$post){
2274
-    if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2275
-        update_option('geodir_location_prefix',$post->post_name);
2276
-    }
2274
+	if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2275
+		update_option('geodir_location_prefix',$post->post_name);
2276
+	}
2277 2277
 
2278 2278
 }
2279 2279
 
@@ -2284,50 +2284,50 @@  discard block
 block discarded – undo
2284 2284
 function geodir_ga_callback(){
2285 2285
 
2286 2286
 if(isset($_REQUEST['code']) && $_REQUEST['code']) {
2287
-    $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2288
-    $code = "code=".$_REQUEST['code'];
2289
-    $grant_type = "&grant_type=authorization_code";
2290
-    $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2291
-    $client_id = "&client_id=".get_option('geodir_ga_client_id');
2292
-    $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2287
+	$oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2288
+	$code = "code=".$_REQUEST['code'];
2289
+	$grant_type = "&grant_type=authorization_code";
2290
+	$redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2291
+	$client_id = "&client_id=".get_option('geodir_ga_client_id');
2292
+	$client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2293 2293
 
2294
-    $auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2294
+	$auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2295 2295
 
2296
-    $response = wp_remote_post($auth_url, array('timeout' => 15));
2296
+	$response = wp_remote_post($auth_url, array('timeout' => 15));
2297 2297
 
2298
-    //print_r($response);
2298
+	//print_r($response);
2299 2299
 
2300
-    $error_msg =  __('Something went wrong','geodirectory');
2301
-    if(!empty($response['response']['code']) && $response['response']['code']==200){
2300
+	$error_msg =  __('Something went wrong','geodirectory');
2301
+	if(!empty($response['response']['code']) && $response['response']['code']==200){
2302 2302
 
2303
-        $parts = json_decode($response['body']);
2304
-        //print_r($parts);
2305
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2306
-        else{
2303
+		$parts = json_decode($response['body']);
2304
+		//print_r($parts);
2305
+		if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2306
+		else{
2307 2307
 
2308
-            update_option('gd_ga_access_token', $parts->access_token);
2309
-            update_option('gd_ga_refresh_token', $parts->refresh_token);
2310
-            ?><script>window.close();</script><?php
2311
-        }
2308
+			update_option('gd_ga_access_token', $parts->access_token);
2309
+			update_option('gd_ga_refresh_token', $parts->refresh_token);
2310
+			?><script>window.close();</script><?php
2311
+		}
2312 2312
 
2313 2313
 
2314
-    }
2315
-    elseif(!empty($response['response']['code'])) {
2316
-        $parts = json_decode($response['body']);
2314
+	}
2315
+	elseif(!empty($response['response']['code'])) {
2316
+		$parts = json_decode($response['body']);
2317 2317
 
2318
-        if(isset($parts->error)){
2319
-            echo $parts->error.": ".$parts->error_description;exit;
2320
-        }else{
2321
-            echo $error_msg." - #2";exit;
2322
-        }
2318
+		if(isset($parts->error)){
2319
+			echo $parts->error.": ".$parts->error_description;exit;
2320
+		}else{
2321
+			echo $error_msg." - #2";exit;
2322
+		}
2323 2323
 
2324
-    }else{
2324
+	}else{
2325 2325
 
2326
-        echo $error_msg." - #3";exit;
2326
+		echo $error_msg." - #3";exit;
2327 2327
 
2328
-    }
2328
+	}
2329 2329
 }
2330
-    exit;
2330
+	exit;
2331 2331
 }
2332 2332
 
2333 2333
 add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
@@ -2345,45 +2345,45 @@  discard block
 block discarded – undo
2345 2345
  * @return array Array of settings.
2346 2346
  */
2347 2347
 function geodir_uninstall_settings($general_settings) {
2348
-    $settings   = array();
2349
-    $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
2350
-    $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
2348
+	$settings   = array();
2349
+	$settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
2350
+	$settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
2351 2351
     
2352
-    $plugins    = get_plugins();
2353
-    $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
2352
+	$plugins    = get_plugins();
2353
+	$un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
2354 2354
     
2355
-    if (!empty($plugins) && !empty($un_plugins)) {
2356
-        foreach ($plugins as $plugin => $data) {
2357
-            $plugin_name = plugin_basename(dirname($plugin));
2355
+	if (!empty($plugins) && !empty($un_plugins)) {
2356
+		foreach ($plugins as $plugin => $data) {
2357
+			$plugin_name = plugin_basename(dirname($plugin));
2358 2358
             
2359
-            if (in_array($plugin_name, $un_plugins)) {
2360
-                $settings[] = array(
2361
-                    'type' => 'checkbox',
2362
-                    'id' => 'geodir_un_' . $plugin_name,
2363
-                    'name' => $data['Name'],
2364
-                    'desc' => __('Remove all data when deleted?', 'geodirectory'),
2365
-                    'std' => '0'
2366
-                );
2367
-            }
2368
-        }
2369
-    }
2359
+			if (in_array($plugin_name, $un_plugins)) {
2360
+				$settings[] = array(
2361
+					'type' => 'checkbox',
2362
+					'id' => 'geodir_un_' . $plugin_name,
2363
+					'name' => $data['Name'],
2364
+					'desc' => __('Remove all data when deleted?', 'geodirectory'),
2365
+					'std' => '0'
2366
+				);
2367
+			}
2368
+		}
2369
+	}
2370 2370
         
2371
-    $settings[] = array('type' => 'sectionend', 'id' => 'uninstall_settings_main');
2371
+	$settings[] = array('type' => 'sectionend', 'id' => 'uninstall_settings_main');
2372 2372
     
2373
-    /**
2374
-     * Filter the uninstall settings array.
2375
-     *
2376
-     * @since 1.6.9
2377
-     *
2378
-     * @param array $settings The settings array.
2379
-     */
2380
-    $settings = apply_filters('geodir_uninstall_settings', $settings);
2373
+	/**
2374
+	 * Filter the uninstall settings array.
2375
+	 *
2376
+	 * @since 1.6.9
2377
+	 *
2378
+	 * @param array $settings The settings array.
2379
+	 */
2380
+	$settings = apply_filters('geodir_uninstall_settings', $settings);
2381 2381
     
2382
-    if (!empty($settings) && count($settings) > 3) {
2383
-        return array_merge($general_settings, $settings);
2384
-    }
2382
+	if (!empty($settings) && count($settings) > 3) {
2383
+		return array_merge($general_settings, $settings);
2384
+	}
2385 2385
     
2386
-    return $general_settings;
2386
+	return $general_settings;
2387 2387
 }
2388 2388
 add_filter('geodir_general_settings', 'geodir_uninstall_settings', 100, 1);
2389 2389
 
@@ -2393,7 +2393,7 @@  discard block
 block discarded – undo
2393 2393
  * @since 1.6.9
2394 2394
  */
2395 2395
 function geodir_uninstall_settings_desc() {
2396
-    echo '<p class="gd-un-settings-desc">' . __('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory') . '</p>';
2396
+	echo '<p class="gd-un-settings-desc">' . __('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory') . '</p>';
2397 2397
 }
2398 2398
 add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc');
2399 2399
 
@@ -2409,18 +2409,18 @@  discard block
 block discarded – undo
2409 2409
  * @return array The settings array.
2410 2410
  */
2411 2411
 function geodir_resave_settings($settings = array()) {
2412
-    if (!empty($settings) && is_array($settings)) {
2413
-        $c = 0;
2412
+	if (!empty($settings) && is_array($settings)) {
2413
+		$c = 0;
2414 2414
         
2415
-        foreach ($settings as $setting) {
2416
-            if (!empty($setting['id']) && false !== ($value = get_option($setting['id']))) {
2417
-                $settings[$c]['std'] = $value;
2418
-            }
2419
-            $c++;
2420
-        }
2421
-    }
2422
-
2423
-    return $settings;
2415
+		foreach ($settings as $setting) {
2416
+			if (!empty($setting['id']) && false !== ($value = get_option($setting['id']))) {
2417
+				$settings[$c]['std'] = $value;
2418
+			}
2419
+			$c++;
2420
+		}
2421
+	}
2422
+
2423
+	return $settings;
2424 2424
 }
2425 2425
 
2426 2426
 /**
@@ -2432,8 +2432,8 @@  discard block
 block discarded – undo
2432 2432
  * @return array The modified settings.
2433 2433
  */
2434 2434
 function geodir_core_uninstall_settings($settings) {
2435
-    $settings[] = plugin_basename(dirname(dirname(__FILE__)));
2435
+	$settings[] = plugin_basename(dirname(dirname(__FILE__)));
2436 2436
     
2437
-    return $settings;
2437
+	return $settings;
2438 2438
 }
2439 2439
 add_filter('geodir_plugins_uninstall_settings', 'geodir_core_uninstall_settings', 10, 1);
2440 2440
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  */
63 63
 function geodir_get_admin_option_form($current_tab)
64 64
 {
65
-    geodir_admin_option_form($current_tab);// defined in admin template tags.php
65
+    geodir_admin_option_form($current_tab); // defined in admin template tags.php
66 66
 }
67 67
 
68 68
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 add_action('geodir_update_options_compatibility_settings', 'geodir_update_options_compatibility_settings');
71 71
 add_action('geodir_update_options_default_location_settings', 'geodir_location_form_submit');
72 72
 add_action('geodir_before_admin_panel', 'geodir_before_admin_panel'); // this function is in admin_functions.php
73
-add_action('geodir_before_update_options', 'geodir_before_update_options',10,2);
73
+add_action('geodir_before_update_options', 'geodir_before_update_options', 10, 2);
74 74
 
75 75
 //add_action('geodir_before_admin_panel', 'geodir_autoinstall_admin_header');
76 76
 
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 add_action('admin_panel_init', 'geodir_admin_list_columns', 2);
121 121
 
122 122
 /* --- insert dummy post action ---*/
123
-add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1,3);
124
-add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1,3);
123
+add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1, 3);
124
+add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1, 3);
125 125
 
126 126
 
127 127
 /**
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 
230 230
         // Filter-Payment-Manager
231 231
 
232
-        add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
232
+        add_meta_box('geodir_post_images', $post_typename.' '.__('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
233 233
 
234
-        add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
234
+        add_meta_box('geodir_post_info', $post_typename.' '.__('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
235 235
 
236 236
         // no need of this box as all fields moved to main information box
237 237
         //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 }
242 242
 
243
-add_action('save_post', 'geodir_post_information_save',10,2);
243
+add_action('save_post', 'geodir_post_information_save', 10, 2);
244 244
 
245 245
 
246 246
 
@@ -267,10 +267,10 @@  discard block
 block discarded – undo
267 267
 
268 268
             $gd_taxonomy = geodir_get_taxonomies($geodir_post_type);
269 269
 
270
-            if(!empty($gd_taxonomy)) {
270
+            if (!empty($gd_taxonomy)) {
271 271
                 foreach ($gd_taxonomy as $tax) {
272 272
 
273
-                    remove_meta_box($tax . 'div', $geodir_post_type, 'normal');
273
+                    remove_meta_box($tax.'div', $geodir_post_type, 'normal');
274 274
 
275 275
                 }
276 276
             }
@@ -356,14 +356,14 @@  discard block
 block discarded – undo
356 356
 add_action('geodir_manage_available_fields_predefined', 'geodir_manage_available_fields_predefined');
357 357
 add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom');
358 358
 
359
-function geodir_manage_available_fields_predefined($sub_tab){
360
-    if($sub_tab=='custom_fields'){
359
+function geodir_manage_available_fields_predefined($sub_tab) {
360
+    if ($sub_tab == 'custom_fields') {
361 361
         geodir_custom_available_fields('predefined');
362 362
     }
363 363
 }
364 364
 
365
-function geodir_manage_available_fields_custom($sub_tab){
366
-    if($sub_tab=='custom_fields'){
365
+function geodir_manage_available_fields_custom($sub_tab) {
366
+    if ($sub_tab == 'custom_fields') {
367 367
         geodir_custom_available_fields('custom');
368 368
     }
369 369
 }
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
     global $wpdb;
434 434
     $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
435 435
     ?>
436
-    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
436
+    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/>
437 437
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
438 438
     <ul>
439 439
     <?php
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 
445 445
             $check_html_variable = $wpdb->get_var(
446 446
                 $wpdb->prepare(
447
-                    "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
447
+                    "SELECT htmlvar_name FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
448 448
                     array($val['htmlvar_name'], $listing_type, $val['field_type'])
449 449
                 )
450 450
             );
@@ -452,23 +452,23 @@  discard block
 block discarded – undo
452 452
             $display = $check_html_variable ? ' style="display:none;"' : '';
453 453
            ?>
454 454
 
455
-            <li   class="gd-cf-tooltip-wrap" <?php echo $display;?>>
455
+            <li   class="gd-cf-tooltip-wrap" <?php echo $display; ?>>
456 456
                 <?php
457
-                if(isset($val['description']) && $val['description']){
457
+                if (isset($val['description']) && $val['description']) {
458 458
                     echo '<div class="gdcf-tooltip">'.$val['description'].'</div>';
459 459
                 }?>
460 460
 
461
-                <a id="gd-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" data-field-type-key="<?php echo $val['htmlvar_name'];?>"  data-field-type="<?php echo $val['field_type'];?>"
462
-                   title="<?php echo $val['site_title'];?>"
463
-                   class="gd-draggable-form-items  gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);">
461
+                <a id="gd-<?php echo $val['field_type']; ?>-_-<?php echo $val['htmlvar_name']; ?>" data-field-type-key="<?php echo $val['htmlvar_name']; ?>"  data-field-type="<?php echo $val['field_type']; ?>"
462
+                   title="<?php echo $val['site_title']; ?>"
463
+                   class="gd-draggable-form-items  gd-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>" href="javascript:void(0);">
464 464
                     <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
465 465
                         echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
466
-                    }elseif(isset($val['field_icon']) && $val['field_icon'] ){
466
+                    }elseif (isset($val['field_icon']) && $val['field_icon']) {
467 467
                         echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
468
-                    }else{
468
+                    } else {
469 469
                         echo '<i class="fa fa-cog" aria-hidden="true"></i>';
470 470
                     }?>
471
-                    <?php echo $val['site_title'];?>
471
+                    <?php echo $val['site_title']; ?>
472 472
                 </a>
473 473
             </li>
474 474
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
     <?php 
497 497
         global $wpdb;
498 498
         
499
-        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
499
+        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
500 500
 
501 501
         if (!empty($fields)) {
502 502
             foreach ($fields as $field) {
@@ -521,14 +521,14 @@  discard block
 block discarded – undo
521 521
  * @since 1.6.9
522 522
  * @package GeoDirectory
523 523
  */
524
-function geodir_custom_fields_custom($post_type=''){
524
+function geodir_custom_fields_custom($post_type = '') {
525 525
 
526 526
     $custom_fields = array();
527 527
 
528 528
     /**
529 529
      * @see `geodir_custom_fields`
530 530
      */
531
-    return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
531
+    return apply_filters('geodir_custom_fields_custom', $custom_fields, $post_type);
532 532
 }
533 533
 
534 534
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
  * @since 1.6.6
540 540
  * @package GeoDirectory
541 541
  */
542
-function geodir_custom_fields($post_type=''){
542
+function geodir_custom_fields($post_type = '') {
543 543
     
544 544
     $custom_fields = array(
545 545
         'text' => array(
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
      * }
675 675
      * @param string $post_type The post type requested.
676 676
      */
677
-    return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
677
+    return apply_filters('geodir_custom_fields', $custom_fields, $post_type);
678 678
 }
679 679
 
680 680
 /**
@@ -685,25 +685,25 @@  discard block
 block discarded – undo
685 685
  * @param string $type The custom field type, predefined, custom or blank for default
686 686
  * @package GeoDirectory
687 687
  */
688
-function geodir_custom_available_fields($type='')
688
+function geodir_custom_available_fields($type = '')
689 689
 {
690 690
     $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
691 691
     ?>
692
-    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
692
+    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/>
693 693
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" />
694 694
 
695 695
         <?php
696
-        if($type=='predefined'){
696
+        if ($type == 'predefined') {
697 697
             $cfs = geodir_custom_fields_predefined($listing_type);
698
-        }elseif($type=='custom'){
698
+        }elseif ($type == 'custom') {
699 699
             $cfs = geodir_custom_fields_custom($listing_type);
700
-        }else{
700
+        } else {
701 701
             $cfs = geodir_custom_fields($listing_type);
702 702
             ?>
703 703
             <ul class="full gd-cf-tooltip-wrap">
704 704
                 <li>
705 705
                     <div class="gdcf-tooltip">
706
-                        <?php _e('This adds a section separator with a title.', 'geodirectory');?>
706
+                        <?php _e('This adds a section separator with a title.', 'geodirectory'); ?>
707 707
                     </div>
708 708
                     <a id="gt-fieldset"
709 709
                        class="gd-draggable-form-items gt-fieldset"
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 
715 715
                         <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
716 716
                         <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
717
-                        <?php _e('Fieldset (section separator)', 'geodirectory');?>
717
+                        <?php _e('Fieldset (section separator)', 'geodirectory'); ?>
718 718
                     </a>
719 719
                 </li>
720 720
             </ul>
@@ -722,15 +722,15 @@  discard block
 block discarded – undo
722 722
             <?php
723 723
         }
724 724
 
725
-    if(!empty($cfs)) {
725
+    if (!empty($cfs)) {
726 726
 
727
-        foreach ( $cfs as $id => $cf ) {
727
+        foreach ($cfs as $id => $cf) {
728 728
             ?>
729 729
             <ul>
730 730
             <li class="gd-cf-tooltip-wrap">
731 731
                 <?php
732
-                if ( isset( $cf['description'] ) && $cf['description'] ) {
733
-                    echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>';
732
+                if (isset($cf['description']) && $cf['description']) {
733
+                    echo '<div class="gdcf-tooltip">'.$cf['description'].'</div>';
734 734
                 } ?>
735 735
 
736 736
                 <a id="gd-<?php echo $id; ?>"
@@ -740,10 +740,10 @@  discard block
 block discarded – undo
740 740
                    class="gd-draggable-form-items <?php echo $cf['class']; ?>"
741 741
                    href="javascript:void(0);">
742 742
 
743
-                    <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) {
744
-                        echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>';
745
-                    } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
746
-                        echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
743
+                    <?php if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
744
+                        echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
745
+                    } elseif (isset($cf['icon']) && $cf['icon']) {
746
+                        echo '<b style="background-image: url("'.$cf['icon'].'")"></b>';
747 747
                     } else {
748 748
                         echo '<i class="fa fa-cog" aria-hidden="true"></i>';
749 749
                     } ?>
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
             </li>
753 753
             <?php
754 754
         }
755
-    }else{
755
+    } else {
756 756
         _e('There are no custom fields here yet.', 'geodirectory');
757 757
     }
758 758
         ?>
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
     <ul class="core">
781 781
     <?php 
782 782
         global $wpdb;
783
-        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
783
+        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
784 784
 
785 785
         if (!empty($fields)) {
786 786
             foreach ($fields as $field) {
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
                 $field_type_key = $field->field_type_key;
791 791
                 $field_ins_upd = 'display';
792 792
 
793
-                geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key);
793
+                geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd, $field_type_key);
794 794
             }
795 795
         }
796 796
         ?></ul>
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
 
869 869
     switch ($sub_tab) {
870 870
         case 'custom_fields':
871
-            $note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));;
871
+            $note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type)); ;
872 872
             break;
873 873
 
874 874
         case 'sorting_options':
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 
923 923
     switch ($sub_tab) {
924 924
         case 'custom_fields':
925
-            $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));;
925
+            $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type)); ;
926 926
             break;
927 927
 
928 928
         case 'sorting_options':
@@ -949,8 +949,8 @@  discard block
 block discarded – undo
949 949
 
950 950
     if (!get_option('geodir_remove_unnecessary_fields')) {
951 951
 
952
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
953
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
952
+        if ($wpdb->get_var("SHOW COLUMNS FROM ".$plugin_prefix."gd_place_detail WHERE field = 'categories'"))
953
+            $wpdb->query("ALTER TABLE `".$plugin_prefix."gd_place_detail` DROP `categories`");
954 954
 
955 955
         update_option('geodir_remove_unnecessary_fields', '1');
956 956
 
@@ -978,14 +978,14 @@  discard block
 block discarded – undo
978 978
             case 'diagnosis' :
979 979
                 if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
980 980
                     $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
981
-                call_user_func('geodir_diagnose_' . $diagnose_this);
981
+                call_user_func('geodir_diagnose_'.$diagnose_this);
982 982
                 exit();
983 983
                 break;
984 984
 
985 985
             case 'diagnosis-fix' :
986 986
                 if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
987 987
                     $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
988
-                call_user_func('geodir_diagnose_' . $diagnose_this);
988
+                call_user_func('geodir_diagnose_'.$diagnose_this);
989 989
                 exit();
990 990
                 break;
991 991
         }
@@ -1010,50 +1010,50 @@  discard block
 block discarded – undo
1010 1010
 {
1011 1011
     global $wpdb;
1012 1012
     //$filter_arr['output_str'] .='###'.$table.'###';
1013
-    if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
1014
-        $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
1013
+    if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0) {
1014
+        $filter_arr['output_str'] .= "<li>".__('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory')."</li>";
1015 1015
         $filter_arr['is_error_during_diagnose'] = true;
1016 1016
 
1017
-    } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1018
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
1017
+    } elseif ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
1018
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name)."</li>";
1019 1019
         $filter_arr['is_error_during_diagnose'] = true;
1020
-        $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
1020
+        $filter_arr['output_str'] .= "<li>".__('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory')."</li>";
1021 1021
         $filter_arr['is_error_during_diagnose'] = true;
1022 1022
 
1023 1023
         if ($fix) {
1024
-            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
1025
-            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
1024
+            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$table."_ms_bak"); // get backup table count
1025
+            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table"); // get new table count
1026 1026
 
1027 1027
             if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
1028 1028
                 //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
1029 1029
 
1030
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
1030
+                $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename bak table to new table
1031 1031
 
1032
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1033
-                    $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
1032
+                if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
1033
+                    $filter_arr['output_str'] .= "<li>".__('-->FIXED: Renamed and backed up the tables', 'geodirectory')."</li>";
1034 1034
                 } else {
1035
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1035
+                    $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
1036 1036
                 }
1037 1037
 
1038 1038
             } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
1039 1039
 
1040
-                $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
1041
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
1040
+                $wpdb->query("RENAME TABLE ".$wpdb->prefix."$table TO ".$table."_ms_bak2"); // rename new table to bak2
1041
+                $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$wpdb->prefix."$table"); // rename bak table to new table
1042 1042
 
1043
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1044
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
1043
+                if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1044
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table)."</li>";
1045 1045
                 } else {
1046
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1046
+                    $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
1047 1047
                 }
1048 1048
 
1049 1049
             } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
1050 1050
 
1051
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
1051
+                $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename ms_bak table to ms_bak2
1052 1052
 
1053
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1054
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
1053
+                if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
1054
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table)."</li>";
1055 1055
                 } else {
1056
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1056
+                    $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
1057 1057
                 }
1058 1058
 
1059 1059
             }
@@ -1061,54 +1061,54 @@  discard block
 block discarded – undo
1061 1061
         }
1062 1062
 
1063 1063
 
1064
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1065
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
1064
+    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
1065
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name)."</li>";
1066 1066
         $filter_arr['is_error_during_diagnose'] = true;
1067 1067
 
1068 1068
         if ($fix) {
1069 1069
             if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
1070 1070
                 if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
1071
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
1071
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table)."</li>";
1072 1072
                 } else {
1073
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
1073
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table)."</li>";
1074 1074
                 }
1075 1075
 
1076
-            } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
1077
-                if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
1078
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1076
+            } elseif ($wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table") == 0) {// if main table is empty but original is not, delete main and rename original
1077
+                if ($wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."$table")) {
1078
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix.$table)."</li>";
1079 1079
                 } else {
1080
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1080
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix.$table)."</li>";
1081 1081
                 }
1082
-                if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1083
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1082
+                if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1083
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
1084 1084
                 } else {
1085
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1085
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
1086 1086
                 }
1087 1087
             } else {// else rename the original table to _ms_bak
1088
-                if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1089
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
1088
+                if ($wpdb->query("RENAME TABLE $table TO ".$table."_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1089
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table."_ms_bak")."</li>";
1090 1090
                 } else {
1091
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
1091
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table."_ms_bak")."</li>";
1092 1092
                 }
1093 1093
             }
1094 1094
         }
1095 1095
 
1096
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1097
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
1096
+    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
1097
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name)."</li>";
1098 1098
         $filter_arr['is_error_during_diagnose'] = true;
1099 1099
 
1100 1100
         if ($fix) {
1101 1101
             // if original table exists but new does not, rename
1102
-            if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1103
-                $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1102
+            if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1103
+                $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
1104 1104
             } else {
1105
-                $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1105
+                $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
1106 1106
             }
1107 1107
 
1108 1108
         }
1109 1109
 
1110
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1111
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
1110
+    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
1111
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name)."</li>";
1112 1112
         $filter_arr['is_error_during_diagnose'] = true;
1113 1113
 
1114 1114
         if ($fix) {
@@ -1122,11 +1122,11 @@  discard block
 block discarded – undo
1122 1122
             delete_option('geodir_custom_posts_db_version');
1123 1123
             delete_option('geodir_reviewratings_db_version');
1124 1124
             delete_option('geodiradvancesearch_db_version');
1125
-            $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
1125
+            $filter_arr['output_str'] .= "<li>".__('-->TRY: Please refresh page to run table install functions', 'geodirectory')."</li>";
1126 1126
         }
1127 1127
 
1128 1128
     } else {
1129
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
1129
+        $filter_arr['output_str'] .= "<li>".sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name)."</li>";
1130 1130
     }
1131 1131
     return $filter_arr;
1132 1132
 }
@@ -1155,23 +1155,23 @@  discard block
 block discarded – undo
1155 1155
     if (!empty($all_postypes)) {
1156 1156
         foreach ($all_postypes as $key) {
1157 1157
             // update each GD CPT
1158
-            $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
1158
+            $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d");
1159 1159
 
1160 1160
             if (!empty($posts)) {
1161 1161
 
1162 1162
                 foreach ($posts as $p) {
1163 1163
                     $p->post_type = $key;
1164
-                    $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
1164
+                    $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
1165 1165
                     if (empty($raw_tags)) {
1166 1166
                         $post_tags = '';
1167 1167
                     } else {
1168 1168
                         $post_tags = implode(",", $raw_tags);
1169 1169
                     }
1170
-                    $tablename = $plugin_prefix . $p->post_type . '_detail';
1171
-                    $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1170
+                    $tablename = $plugin_prefix.$p->post_type.'_detail';
1171
+                    $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1172 1172
 
1173 1173
                 }
1174
-                $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1174
+                $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
1175 1175
             }
1176 1176
 
1177 1177
         }
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 
1181 1181
     if ($is_error_during_diagnose) {
1182 1182
         $info_div_class = "geodir_problem_info";
1183
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1183
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1184 1184
     } else {
1185 1185
         $info_div_class = "geodir_noproblem_info";
1186 1186
         $fix_button_txt = '';
@@ -1217,29 +1217,29 @@  discard block
 block discarded – undo
1217 1217
     if (!empty($all_postypes)) {
1218 1218
         foreach ($all_postypes as $key) {
1219 1219
             // update each GD CTP
1220
-            $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
1220
+            $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d WHERE d.".$key."category='' ");
1221 1221
 
1222 1222
             if (!empty($posts)) {
1223 1223
 
1224 1224
                 foreach ($posts as $p) {
1225 1225
                     $p->post_type = $key;
1226
-                    $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
1226
+                    $raw_cats = wp_get_object_terms($p->post_id, $p->post_type.'category', array('fields' => 'ids'));
1227 1227
 
1228 1228
                     if (empty($raw_cats)) {
1229 1229
                         $post_categories = get_post_meta($p->post_id, 'post_categories', true);
1230 1230
 
1231
-                        if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
1232
-                            $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
1233
-                            foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
1231
+                        if (!empty($post_categories) && !empty($post_categories[$p->post_type.'category'])) {
1232
+                            $post_categories[$p->post_type.'category'] = str_replace("d:", "", $post_categories[$p->post_type.'category']);
1233
+                            foreach (explode(",", $post_categories[$p->post_type.'category']) as $cat_part) {
1234 1234
                                 if (is_numeric($cat_part)) {
1235
-                                    $raw_cats[] = (int)$cat_part;
1235
+                                    $raw_cats[] = (int) $cat_part;
1236 1236
                                 }
1237 1237
                             }
1238 1238
 
1239 1239
                         }
1240 1240
 
1241 1241
                         if (!empty($raw_cats)) {
1242
-                            $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category');
1242
+                            $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type.'category');
1243 1243
 
1244 1244
                         }
1245 1245
 
@@ -1249,14 +1249,14 @@  discard block
 block discarded – undo
1249 1249
                     if (empty($raw_cats)) {
1250 1250
                         $post_cats = '';
1251 1251
                     } else {
1252
-                        $post_cats = ',' . implode(",", $raw_cats) . ',';
1252
+                        $post_cats = ','.implode(",", $raw_cats).',';
1253 1253
                     }
1254
-                    $tablename = $plugin_prefix . $p->post_type . '_detail';
1255
-                    $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1254
+                    $tablename = $plugin_prefix.$p->post_type.'_detail';
1255
+                    $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET ".$p->post_type."category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1256 1256
                 }
1257 1257
 
1258 1258
             }
1259
-            $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1259
+            $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
1260 1260
 
1261 1261
         }
1262 1262
 
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 
1265 1265
     if ($is_error_during_diagnose) {
1266 1266
         $info_div_class = "geodir_problem_info";
1267
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1267
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1268 1268
     } else {
1269 1269
         $info_div_class = "geodir_noproblem_info";
1270 1270
         $fix_button_txt = '';
@@ -1317,15 +1317,15 @@  discard block
 block discarded – undo
1317 1317
     if (!empty($ver_arr)) {
1318 1318
         foreach ($ver_arr as $key => $val) {
1319 1319
             if (delete_option($val)) {
1320
-                $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
1320
+                $output_str .= "<li>".$key.__(' Version: Deleted', 'geodirectory')."</li>";
1321 1321
             } else {
1322
-                $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
1322
+                $output_str .= "<li>".$key.__(' Version: Not Found', 'geodirectory')."</li>";
1323 1323
             }
1324 1324
 
1325 1325
         }
1326 1326
 
1327 1327
         if ($output_str) {
1328
-            $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
1328
+            $output_str .= "<li><strong>".__(' Upgrade/install scripts will run on next page reload.', 'geodirectory')."</strong></li>";
1329 1329
         }
1330 1330
 
1331 1331
     }
@@ -1362,43 +1362,43 @@  discard block
 block discarded – undo
1362 1362
     $output_str = '';
1363 1363
 
1364 1364
     // check review locations
1365
-    if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
1366
-        $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
1365
+    if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
1366
+        $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>";
1367 1367
         $is_error_during_diagnose = true;
1368 1368
 
1369 1369
         if ($fix) {
1370 1370
             if (geodir_fix_review_location()) {
1371
-                $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
1371
+                $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>";
1372 1372
             } else {
1373
-                $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
1373
+                $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>";
1374 1374
             }
1375 1375
         }
1376 1376
 
1377 1377
     } else {
1378
-        $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
1378
+        $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>";
1379 1379
     }
1380 1380
 
1381 1381
     // check review content
1382
-    if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
1383
-        $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
1382
+    if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) {
1383
+        $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>";
1384 1384
         $is_error_during_diagnose = true;
1385 1385
 
1386 1386
         if ($fix) {
1387 1387
             if (geodir_fix_review_content()) {
1388
-                $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
1388
+                $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>";
1389 1389
             } else {
1390
-                $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
1390
+                $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>";
1391 1391
             }
1392 1392
         }
1393 1393
 
1394 1394
     } else {
1395
-        $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
1395
+        $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>";
1396 1396
     }
1397 1397
 
1398 1398
 
1399 1399
     if ($is_error_during_diagnose) {
1400 1400
         $info_div_class = "geodir_problem_info";
1401
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1401
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1402 1402
     } else {
1403 1403
         $info_div_class = "geodir_noproblem_info";
1404 1404
         $fix_button_txt = '';
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
 
1463 1463
     if ($is_error_during_diagnose) {
1464 1464
         $info_div_class = "geodir_problem_info";
1465
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1465
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1466 1466
     } else {
1467 1467
         $info_div_class = "geodir_noproblem_info";
1468 1468
         $fix_button_txt = '';
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
     else {
1497 1497
         $page_found = $wpdb->get_var(
1498 1498
             $wpdb->prepare(
1499
-                "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
1499
+                "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;",
1500 1500
                 array($slug)
1501 1501
             )
1502 1502
         );
@@ -1542,18 +1542,18 @@  discard block
 block discarded – undo
1542 1542
     //////////////////////////////////
1543 1543
     $option_value = get_option('geodir_home_page');
1544 1544
     $page = get_post($option_value);
1545
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1545
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1546 1546
 
1547
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1548
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1547
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1548
+        $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>";
1549 1549
     else {
1550 1550
         $is_error_during_diagnose = true;
1551
-        $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1551
+        $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>";
1552 1552
         if ($fix) {
1553 1553
             if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
1554
-                $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
1554
+                $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>";
1555 1555
             } else {
1556
-                $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
1556
+                $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>";
1557 1557
             }
1558 1558
         }
1559 1559
     }
@@ -1567,18 +1567,18 @@  discard block
 block discarded – undo
1567 1567
     //////////////////////////////////
1568 1568
     $option_value = get_option('geodir_add_listing_page');
1569 1569
     $page = get_post($option_value);
1570
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1570
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1571 1571
 
1572
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1573
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1572
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1573
+        $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>";
1574 1574
     else {
1575 1575
         $is_error_during_diagnose = true;
1576
-        $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1576
+        $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>";
1577 1577
         if ($fix) {
1578 1578
             if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
1579
-                $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
1579
+                $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>";
1580 1580
             } else {
1581
-                $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
1581
+                $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>";
1582 1582
             }
1583 1583
         }
1584 1584
     }
@@ -1593,18 +1593,18 @@  discard block
 block discarded – undo
1593 1593
     //////////////////////////////////
1594 1594
     $option_value = get_option('geodir_preview_page');
1595 1595
     $page = get_post($option_value);
1596
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1596
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1597 1597
 
1598
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1599
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1598
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1599
+        $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>";
1600 1600
     else {
1601 1601
         $is_error_during_diagnose = true;
1602
-        $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1602
+        $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>";
1603 1603
         if ($fix) {
1604 1604
             if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
1605
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
1605
+                $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>";
1606 1606
             } else {
1607
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
1607
+                $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>";
1608 1608
             }
1609 1609
         }
1610 1610
     }
@@ -1618,18 +1618,18 @@  discard block
 block discarded – undo
1618 1618
     //////////////////////////////////
1619 1619
     $option_value = get_option('geodir_success_page');
1620 1620
     $page = get_post($option_value);
1621
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1621
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1622 1622
 
1623
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1624
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1623
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1624
+        $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>";
1625 1625
     else {
1626 1626
         $is_error_during_diagnose = true;
1627
-        $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1627
+        $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>";
1628 1628
         if ($fix) {
1629 1629
             if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
1630
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
1630
+                $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>";
1631 1631
             } else {
1632
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
1632
+                $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>";
1633 1633
             }
1634 1634
         }
1635 1635
     }
@@ -1643,18 +1643,18 @@  discard block
 block discarded – undo
1643 1643
     //////////////////////////////////
1644 1644
     $option_value = get_option('geodir_info_page');
1645 1645
     $page = get_post($option_value);
1646
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1646
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1647 1647
 
1648
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1649
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1648
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1649
+        $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>";
1650 1650
     else {
1651 1651
         $is_error_during_diagnose = true;
1652
-        $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1652
+        $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>";
1653 1653
         if ($fix) {
1654 1654
             if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
1655
-                $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
1655
+                $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>";
1656 1656
             } else {
1657
-                $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
1657
+                $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>";
1658 1658
             }
1659 1659
         }
1660 1660
     }
@@ -1668,18 +1668,18 @@  discard block
 block discarded – undo
1668 1668
     //////////////////////////////////
1669 1669
     $option_value = get_option('geodir_login_page');
1670 1670
     $page = get_post($option_value);
1671
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1671
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1672 1672
 
1673
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1674
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1673
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1674
+        $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>";
1675 1675
     else {
1676 1676
         $is_error_during_diagnose = true;
1677
-        $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1677
+        $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>";
1678 1678
         if ($fix) {
1679 1679
             if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
1680
-                $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
1680
+                $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>";
1681 1681
             } else {
1682
-                $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
1682
+                $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>";
1683 1683
             }
1684 1684
         }
1685 1685
     }
@@ -1693,18 +1693,18 @@  discard block
 block discarded – undo
1693 1693
     //////////////////////////////////
1694 1694
     $option_value = get_option('geodir_location_page');
1695 1695
     $page = get_post($option_value);
1696
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1696
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1697 1697
 
1698
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1699
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1698
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1699
+        $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>";
1700 1700
     else {
1701 1701
         $is_error_during_diagnose = true;
1702
-        $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1702
+        $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>";
1703 1703
         if ($fix) {
1704 1704
             if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
1705
-                $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
1705
+                $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>";
1706 1706
             } else {
1707
-                $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
1707
+                $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>";
1708 1708
             }
1709 1709
         }
1710 1710
     }
@@ -1713,13 +1713,13 @@  discard block
 block discarded – undo
1713 1713
     /* Diagnose Location Page Ends */
1714 1714
     ////////////////////////////////
1715 1715
 
1716
-    $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1716
+    $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose);
1717 1717
     /**
1718 1718
      * This action is called at the end of the GD Tools page check function.
1719 1719
      *
1720 1720
      * @since 1.5.2
1721 1721
      */
1722
-    $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1722
+    $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr);
1723 1723
 
1724 1724
     $output_str = $page_chk_arr['output_str'];
1725 1725
     $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
@@ -1729,7 +1729,7 @@  discard block
 block discarded – undo
1729 1729
             flush_rewrite_rules();
1730 1730
         }
1731 1731
         $info_div_class = "geodir_problem_info";
1732
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1732
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1733 1733
     } else {
1734 1734
         $info_div_class = "geodir_noproblem_info";
1735 1735
         $fix_button_txt = '';
@@ -1757,10 +1757,10 @@  discard block
 block discarded – undo
1757 1757
     $fix_button_txt = '';
1758 1758
 
1759 1759
     if ($is_error_during_diagnose) {
1760
-        $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>";
1760
+        $output_str .= "<li>".__('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory').' '.geodir_plugin_path().'/db-language.php'."</li>";
1761 1761
 		$info_div_class = "geodir_problem_info";
1762 1762
     } else {
1763
-        $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1763
+        $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>";
1764 1764
 		$info_div_class = "geodir_noproblem_info";
1765 1765
         $fix_button_txt = '';
1766 1766
     }
@@ -1802,17 +1802,17 @@  discard block
 block discarded – undo
1802 1802
     global $wpdb, $wp_query, $plugin_prefix;
1803 1803
 
1804 1804
     if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
1805
-        $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail';
1805
+        $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail';
1806 1806
 
1807
-        $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)';
1807
+        $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)';
1808 1808
         $clauses['join'] = $join;
1809 1809
 
1810
-        $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : '';
1810
+        $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : '';
1811 1811
         $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire';
1812 1812
         $clauses['fields'] = $fields;
1813 1813
 
1814 1814
         $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC';
1815
-        $orderby = 'gd_expire ' . $order;
1815
+        $orderby = 'gd_expire '.$order;
1816 1816
         $clauses['orderby'] = $orderby;
1817 1817
     }
1818 1818
     return $clauses;
@@ -1855,7 +1855,7 @@  discard block
 block discarded – undo
1855 1855
         global $current_user;
1856 1856
         $upload_dir = wp_upload_dir();
1857 1857
 
1858
-        $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv';
1858
+        $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv';
1859 1859
         $handle = fopen($file, 'w');
1860 1860
 
1861 1861
         fwrite($handle, $input);
@@ -1900,7 +1900,7 @@  discard block
 block discarded – undo
1900 1900
     $uploads_dir = $uploads['path'];
1901 1901
     $image_name_arr = explode('/', $filename);
1902 1902
     $filename = end($image_name_arr);
1903
-    $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1903
+    $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
1904 1904
     $return = array();
1905 1905
     $return['file'] = $uploadedFile;
1906 1906
     $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
@@ -1917,8 +1917,8 @@  discard block
 block discarded – undo
1917 1917
 
1918 1918
                 if (($handle = fopen($target_path, "r")) !== FALSE) {
1919 1919
                     while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
1920
-                        if(is_array($data) && !empty($data)) {
1921
-                            $file[] = '"' . implode('","', $data) . '"';
1920
+                        if (is_array($data) && !empty($data)) {
1921
+                            $file[] = '"'.implode('","', $data).'"';
1922 1922
                         }
1923 1923
                     }
1924 1924
                     fclose($handle);
@@ -2035,10 +2035,10 @@  discard block
 block discarded – undo
2035 2035
                     $tag_arr = explode(',', $post_tags);
2036 2036
                 }
2037 2037
 
2038
-                $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
2038
+                $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database
2039 2039
 
2040 2040
                 $error = '';
2041
-                if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
2041
+                if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) {
2042 2042
                     $invalid_post_type++;
2043 2043
                     continue;
2044 2044
                 }
@@ -2064,7 +2064,7 @@  discard block
 block discarded – undo
2064 2064
                             if ($buffer[$c] != '0' && $buffer[$c] != '') {
2065 2065
                                 $submitdata = date('Y-m-d');
2066 2066
 
2067
-                                $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
2067
+                                $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days"));
2068 2068
                             } else {
2069 2069
                                 $gd_post_info['expire_date'] = 'Never';
2070 2070
                             }
@@ -2092,7 +2092,7 @@  discard block
 block discarded – undo
2092 2092
 						
2093 2093
 						// Post status
2094 2094
 						if ($customKeyarray[$c] == 'post_status') {
2095
-                            $post_status = sanitize_key( $buffer[$c] );
2095
+                            $post_status = sanitize_key($buffer[$c]);
2096 2096
                         }
2097 2097
                     }
2098 2098
 
@@ -2110,8 +2110,8 @@  discard block
 block discarded – undo
2110 2110
 					
2111 2111
 					// Default post status
2112 2112
 					$default_status = 'publish';
2113
-					$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
2114
-					$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
2113
+					$post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
2114
+					$post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
2115 2115
 
2116 2116
                     $my_post['post_title'] = $post_title;
2117 2117
                     $my_post['post_content'] = $post_desc;
@@ -2155,7 +2155,7 @@  discard block
 block discarded – undo
2155 2155
                     $payment_info = array();
2156 2156
                     $package_info = array();
2157 2157
 
2158
-                    $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2158
+                    $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]);
2159 2159
                     $package_id = '';
2160 2160
                     if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2161 2161
                         $package_id = $gd_post_info['package_id'];
@@ -2165,7 +2165,7 @@  discard block
 block discarded – undo
2165 2165
                         $payment_info['package_id'] = $package_info['pid'];
2166 2166
 
2167 2167
                         if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
2168
-                            $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
2168
+                            $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days"));
2169 2169
                         } else {
2170 2170
                             $payment_info['expire_date'] = 'Never';
2171 2171
                         }
@@ -2177,7 +2177,7 @@  discard block
 block discarded – undo
2177 2177
 
2178 2178
                     $post_type = get_post_type($last_postid);
2179 2179
 
2180
-                    $table = $plugin_prefix . $post_type . '_detail';
2180
+                    $table = $plugin_prefix.$post_type.'_detail';
2181 2181
 
2182 2182
                     geodir_save_post_info($last_postid, $gd_post_info);
2183 2183
 
@@ -2198,7 +2198,7 @@  discard block
 block discarded – undo
2198 2198
                             $attachment['post_id'] = $last_postid;
2199 2199
                             $attachment['title'] = $img_name_arr[0];
2200 2200
                             $attachment['content'] = '';
2201
-                            $attachment['file'] = $sub_dir . '/' . $image_name;
2201
+                            $attachment['file'] = $sub_dir.'/'.$image_name;
2202 2202
                             $attachment['mime_type'] = $uploaded_file_type;
2203 2203
                             $attachment['menu_order'] = $menu_order;
2204 2204
                             $attachment['is_featured'] = 0;
@@ -2207,15 +2207,15 @@  discard block
 block discarded – undo
2207 2207
 
2208 2208
                             foreach ($attachment as $key => $val) {
2209 2209
                                 if ($val != '')
2210
-                                    $attachment_set .= $key . " = '" . $val . "', ";
2210
+                                    $attachment_set .= $key." = '".$val."', ";
2211 2211
                             }
2212 2212
                             $attachment_set = trim($attachment_set, ", ");
2213 2213
 
2214
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
2214
+                            $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
2215 2215
 
2216 2216
                             if ($menu_order == 1) {
2217 2217
                                 $post_type = get_post_type($last_postid);
2218
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
2218
+                                $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid)));
2219 2219
                             }
2220 2220
                             $menu_order++;
2221 2221
                         }
@@ -2256,11 +2256,11 @@  discard block
 block discarded – undo
2256 2256
 }
2257 2257
 
2258 2258
 // Add the tab in left sidebar menu fro import & export page.
2259
-add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 );
2259
+add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94);
2260 2260
 
2261 2261
 // Handle ajax request for import/export.
2262
-add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' );
2263
-add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' );
2262
+add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export');
2263
+add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export');
2264 2264
 
2265 2265
 
2266 2266
 /**
@@ -2271,40 +2271,40 @@  discard block
 block discarded – undo
2271 2271
  * @param $post_id int $post_id The post ID of the post being saved.
2272 2272
  * @param $post object $post The post object of the post being saved.
2273 2273
  */
2274
-function geodir_update_location_prefix($post_id,$post){
2275
-    if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2276
-        update_option('geodir_location_prefix',$post->post_name);
2274
+function geodir_update_location_prefix($post_id, $post) {
2275
+    if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) {
2276
+        update_option('geodir_location_prefix', $post->post_name);
2277 2277
     }
2278 2278
 
2279 2279
 }
2280 2280
 
2281
-add_action('save_post', 'geodir_update_location_prefix',10,2);
2281
+add_action('save_post', 'geodir_update_location_prefix', 10, 2);
2282 2282
 
2283
-add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' );
2283
+add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback');
2284 2284
 
2285
-function geodir_ga_callback(){
2285
+function geodir_ga_callback() {
2286 2286
 
2287
-if(isset($_REQUEST['code']) && $_REQUEST['code']) {
2287
+if (isset($_REQUEST['code']) && $_REQUEST['code']) {
2288 2288
     $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2289 2289
     $code = "code=".$_REQUEST['code'];
2290 2290
     $grant_type = "&grant_type=authorization_code";
2291
-    $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2291
+    $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
2292 2292
     $client_id = "&client_id=".get_option('geodir_ga_client_id');
2293 2293
     $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2294 2294
 
2295
-    $auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2295
+    $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret;
2296 2296
 
2297 2297
     $response = wp_remote_post($auth_url, array('timeout' => 15));
2298 2298
 
2299 2299
     //print_r($response);
2300 2300
 
2301
-    $error_msg =  __('Something went wrong','geodirectory');
2302
-    if(!empty($response['response']['code']) && $response['response']['code']==200){
2301
+    $error_msg = __('Something went wrong', 'geodirectory');
2302
+    if (!empty($response['response']['code']) && $response['response']['code'] == 200) {
2303 2303
 
2304 2304
         $parts = json_decode($response['body']);
2305 2305
         //print_r($parts);
2306
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2307
-        else{
2306
+        if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; }
2307
+        else {
2308 2308
 
2309 2309
             update_option('gd_ga_access_token', $parts->access_token);
2310 2310
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2313,25 +2313,25 @@  discard block
 block discarded – undo
2313 2313
 
2314 2314
 
2315 2315
     }
2316
-    elseif(!empty($response['response']['code'])) {
2316
+    elseif (!empty($response['response']['code'])) {
2317 2317
         $parts = json_decode($response['body']);
2318 2318
 
2319
-        if(isset($parts->error)){
2320
-            echo $parts->error.": ".$parts->error_description;exit;
2321
-        }else{
2322
-            echo $error_msg." - #2";exit;
2319
+        if (isset($parts->error)) {
2320
+            echo $parts->error.": ".$parts->error_description; exit;
2321
+        } else {
2322
+            echo $error_msg." - #2"; exit;
2323 2323
         }
2324 2324
 
2325
-    }else{
2325
+    } else {
2326 2326
 
2327
-        echo $error_msg." - #3";exit;
2327
+        echo $error_msg." - #3"; exit;
2328 2328
 
2329 2329
     }
2330 2330
 }
2331 2331
     exit;
2332 2332
 }
2333 2333
 
2334
-add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2334
+add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
2335 2335
 
2336 2336
 if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
2337 2337
 	add_action('geodir_before_admin_panel', 'geodir_wpml_permalink_setting_notice');
@@ -2348,7 +2348,7 @@  discard block
 block discarded – undo
2348 2348
 function geodir_uninstall_settings($general_settings) {
2349 2349
     $settings   = array();
2350 2350
     $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
2351
-    $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
2351
+    $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory'));
2352 2352
     
2353 2353
     $plugins    = get_plugins();
2354 2354
     $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
@@ -2360,7 +2360,7 @@  discard block
 block discarded – undo
2360 2360
             if (in_array($plugin_name, $un_plugins)) {
2361 2361
                 $settings[] = array(
2362 2362
                     'type' => 'checkbox',
2363
-                    'id' => 'geodir_un_' . $plugin_name,
2363
+                    'id' => 'geodir_un_'.$plugin_name,
2364 2364
                     'name' => $data['Name'],
2365 2365
                     'desc' => __('Remove all data when deleted?', 'geodirectory'),
2366 2366
                     'std' => '0'
@@ -2394,7 +2394,7 @@  discard block
 block discarded – undo
2394 2394
  * @since 1.6.9
2395 2395
  */
2396 2396
 function geodir_uninstall_settings_desc() {
2397
-    echo '<p class="gd-un-settings-desc">' . __('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory') . '</p>';
2397
+    echo '<p class="gd-un-settings-desc">'.__('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory').'</p>';
2398 2398
 }
2399 2399
 add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc');
2400 2400
 
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.
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.
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : '';
40 40
 
41 41
 
42
-if(isset($field_info->extra_fields)){$extra_fields = $field_info->extra_fields;}
42
+if (isset($field_info->extra_fields)) {$extra_fields = $field_info->extra_fields; }
43 43
 $field_info = stripslashes_deep($field_info); // strip slashes from labels
44
-if(isset($field_info->extra_fields)){$field_info->extra_fields = $extra_fields;}
44
+if (isset($field_info->extra_fields)) {$field_info->extra_fields = $extra_fields; }
45 45
 
46 46
 
47
-$nonce = wp_create_nonce('custom_fields_' . $result_str);
47
+$nonce = wp_create_nonce('custom_fields_'.$result_str);
48 48
 
49 49
 $field_admin_title = '';
50 50
 if (isset($field_info->admin_title))
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 
70 70
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
71 71
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
72
-}elseif(isset($cf['icon']) && $cf['icon']){
72
+}elseif (isset($cf['icon']) && $cf['icon']) {
73 73
     $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
74
-}else{
74
+} else {
75 75
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
76 76
 }
77 77
 
78
-if(isset($cf['name']) && $cf['name']){
78
+if (isset($cf['name']) && $cf['name']) {
79 79
     $field_type_name = $cf['name'];
80
-}else{
80
+} else {
81 81
     $field_type_name = $field_type;
82 82
 }
83 83
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
89 89
         <?php
90 90
 
91
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
91
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
92 92
         ?>
93 93
 
94 94
         <?php if ($default): ?>
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
104 104
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
105 105
             <b style="cursor:pointer;"
106
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
106
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
107 107
         <?php
108 108
         } else {echo $field_icon;
109 109
             ?>
110 110
             <b style="cursor:pointer;"
111
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
111
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b>
112 112
         <?php
113 113
         }
114 114
         ?>
@@ -131,43 +131,43 @@  discard block
 block discarded – undo
131 131
         } ?>"/>
132 132
         <input type="hidden" name="is_active" id="is_active" value="1"/>
133 133
 
134
-        <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?>
135
-        <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" />
136
-        <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" />
137
-        <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" />
134
+        <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?>
135
+        <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" />
136
+        <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" />
137
+        <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" />
138 138
 
139 139
         <ul class="widefat post fixed" border="0" style="width:100%;">
140 140
 
141 141
             <?php
142 142
 
143 143
             // data_type
144
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
144
+            if (has_filter("geodir_cfa_data_type_{$field_type}")) {
145 145
 
146
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
146
+                echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info);
147 147
 
148
-            }else{
148
+            } else {
149 149
                 $value = '';
150 150
                 if (isset($field_info->data_type)) {
151 151
                     $value = esc_attr($field_info->data_type);
152
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
152
+                }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
153 153
                     $value = $cf['defaults']['data_type'];
154 154
                 }
155 155
                 ?>
156
-                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
156
+                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/>
157 157
             <?php
158 158
             }
159 159
 
160 160
 
161 161
             // admin_title
162
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
162
+            if (has_filter("geodir_cfa_admin_title_{$field_type}")) {
163 163
 
164
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
164
+                echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info);
165 165
 
166
-            }else{
166
+            } else {
167 167
                 $value = '';
168 168
                 if (isset($field_info->admin_title)) {
169 169
                     $value = esc_attr($field_info->admin_title);
170
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
170
+                }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) {
171 171
                     $value = $cf['defaults']['admin_title'];
172 172
                 }
173 173
                 ?>
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
                     </label>
181 181
                     <div class="gd-cf-input-wrap">
182 182
                         <input type="text" name="admin_title" id="admin_title"
183
-                               value="<?php echo $value;?>"/>
183
+                               value="<?php echo $value; ?>"/>
184 184
                     </div>
185 185
                 </li>
186 186
                 <?php
@@ -188,15 +188,15 @@  discard block
 block discarded – undo
188 188
 
189 189
 
190 190
             // site_title
191
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
191
+            if (has_filter("geodir_cfa_site_title_{$field_type}")) {
192 192
 
193
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
193
+                echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info);
194 194
 
195
-            }else{
195
+            } else {
196 196
                 $value = '';
197 197
                 if (isset($field_info->site_title)) {
198 198
                     $value = esc_attr($field_info->site_title);
199
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
199
+                }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) {
200 200
                     $value = $cf['defaults']['site_title'];
201 201
                 }
202 202
                 ?>
@@ -216,15 +216,15 @@  discard block
 block discarded – undo
216 216
 
217 217
 
218 218
             // admin_desc
219
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
219
+            if (has_filter("geodir_cfa_admin_desc_{$field_type}")) {
220 220
 
221
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
221
+                echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info);
222 222
 
223
-            }else{
223
+            } else {
224 224
                 $value = '';
225 225
                 if (isset($field_info->admin_desc)) {
226 226
                     $value = esc_attr($field_info->admin_desc);
227
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
227
+                }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) {
228 228
                     $value = $cf['defaults']['admin_desc'];
229 229
                 }
230 230
                 ?>
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                         </div>
236 236
                     </label>
237 237
                     <div class="gd-cf-input-wrap">
238
-                        <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/>
238
+                        <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/>
239 239
                     </div>
240 240
                 </li>
241 241
                 <?php
@@ -244,26 +244,26 @@  discard block
 block discarded – undo
244 244
 
245 245
 
246 246
             // htmlvar_name
247
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
247
+            if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) {
248 248
 
249
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
249
+                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info);
250 250
 
251
-            }else{
251
+            } else {
252 252
                 $value = '';
253 253
                 if (isset($field_info->htmlvar_name)) {
254 254
                     $value = esc_attr($field_info->htmlvar_name);
255
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
255
+                }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) {
256 256
                     $value = $cf['defaults']['htmlvar_name'];
257 257
                 }
258 258
                 ?>
259 259
                 <li>
260
-                    <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');?>
260
+                    <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'); ?>
261 261
                         <div class="gdcf-tooltip">
262 262
                             <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?>
263 263
                         </div>
264 264
                     </label>
265 265
                     <div class="gd-cf-input-wrap">
266
-                        <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');?>"
266
+                        <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'); ?>"
267 267
                                value="<?php if ($value) {
268 268
                                    echo preg_replace('/geodir_/', '', $value, 1);
269 269
                                }?>" <?php if ($default) {
@@ -276,15 +276,15 @@  discard block
 block discarded – undo
276 276
 
277 277
 
278 278
             // is_active
279
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
279
+            if (has_filter("geodir_cfa_is_active_{$field_type}")) {
280 280
 
281
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
281
+                echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info);
282 282
 
283
-            }else{
283
+            } else {
284 284
                 $value = '';
285 285
                 if (isset($field_info->is_active)) {
286 286
                     $value = esc_attr($field_info->is_active);
287
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
287
+                }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) {
288 288
                     $value = $cf['defaults']['is_active'];
289 289
                 }
290 290
                 ?>
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
                     </label>
297 297
                     <div class="gd-cf-input-wrap gd-switch">
298 298
 
299
-                        <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
299
+                        <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled"  value="1"
300 300
                             <?php if ($value == '1') {
301 301
                                 echo 'checked';
302 302
                             } ?>/>
303
-                        <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
303
+                        <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
304 304
 
305
-                        <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
305
+                        <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0"
306 306
                             <?php if ($value == '0' || !$value) {
307 307
                                 echo 'checked';
308 308
                             } ?>/>
309
-                        <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
309
+                        <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
310 310
 
311 311
                     </div>
312 312
                 </li>
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
 
316 316
 
317 317
             // for_admin_use
318
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
318
+            if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) {
319 319
 
320
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
320
+                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info);
321 321
 
322
-            }else{
322
+            } else {
323 323
                 $value = '';
324 324
                 if (isset($field_info->for_admin_use)) {
325 325
                     $value = esc_attr($field_info->for_admin_use);
326
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
326
+                }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) {
327 327
                     $value = $cf['defaults']['for_admin_use'];
328 328
                 }
329 329
                 ?>
@@ -335,17 +335,17 @@  discard block
 block discarded – undo
335 335
                     </label>
336 336
                     <div class="gd-cf-input-wrap gd-switch">
337 337
 
338
-                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
338
+                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled"  value="1"
339 339
                             <?php if ($value == '1') {
340 340
                                 echo 'checked';
341 341
                             } ?>/>
342
-                        <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
342
+                        <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
343 343
 
344
-                        <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
344
+                        <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0"
345 345
                             <?php if ($value == '0' || !$value) {
346 346
                                 echo 'checked';
347 347
                             } ?>/>
348
-                        <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
348
+                        <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
349 349
 
350 350
                     </div>
351 351
                 </li>
@@ -354,20 +354,20 @@  discard block
 block discarded – undo
354 354
 
355 355
 
356 356
             // default_value
357
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
357
+            if (has_filter("geodir_cfa_default_value_{$field_type}")) {
358 358
 
359
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
359
+                echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info);
360 360
 
361
-            }else{
361
+            } else {
362 362
                 $value = '';
363 363
                 if (isset($field_info->default_value)) {
364 364
                     $value = esc_attr($field_info->default_value);
365
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
365
+                }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) {
366 366
                     $value = $cf['defaults']['default_value'];
367 367
                 }
368 368
                 ?>
369 369
                 <li>
370
-                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
370
+                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?>
371 371
                         <div class="gdcf-tooltip">
372 372
                             <?php
373 373
                             if ($field_type == 'checkbox') {
@@ -384,12 +384,12 @@  discard block
 block discarded – undo
384 384
                         <?php if ($field_type == 'checkbox') { ?>
385 385
                             <select name="default_value" id="default_value">
386 386
                                 <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
387
-                                <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
387
+                                <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
388 388
                             </select>
389 389
                         <?php } else if ($field_type == 'email') { ?>
390
-                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
390
+                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
391 391
                         <?php } else { ?>
392
-                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
392
+                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
393 393
                         <?php } ?>
394 394
                     </div>
395 395
                 </li>
@@ -398,15 +398,15 @@  discard block
 block discarded – undo
398 398
 
399 399
 
400 400
             // show_in
401
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
401
+            if (has_filter("geodir_cfa_show_in_{$field_type}")) {
402 402
 
403
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
403
+                echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info);
404 404
 
405
-            }else{
405
+            } else {
406 406
                 $value = '';
407 407
                 if (isset($field_info->show_in)) {
408 408
                     $value = esc_attr($field_info->show_in);
409
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
409
+                }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) {
410 410
                     $value = esc_attr($cf['defaults']['show_in']);
411 411
                 }
412 412
                 ?>
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
                          * @param object $field_info The field being displayed info.
440 440
                          * @param string $field_info The type of field.
441 441
                          */
442
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
442
+                        $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type);
443 443
 
444 444
 
445 445
                         // remove some locations for some field types
@@ -447,11 +447,11 @@  discard block
 block discarded – undo
447 447
                         // don't show new tab option for some types
448 448
 
449 449
                         if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
450
-                        }else{
450
+                        } else {
451 451
                             unset($show_in_locations['[owntab]']);
452 452
                         }
453 453
 
454
-                        if(!$display_on_listing){
454
+                        if (!$display_on_listing) {
455 455
                             unset($show_in_locations['[listings]']);
456 456
                         }
457 457
 
@@ -465,17 +465,17 @@  discard block
 block discarded – undo
465 465
                                 option-ajaxchosen="false">
466 466
                             <?php
467 467
 
468
-                            $show_in_values = explode(',',$value);
468
+                            $show_in_values = explode(',', $value);
469 469
 
470
-                            foreach( $show_in_locations as $key => $val){
470
+                            foreach ($show_in_locations as $key => $val) {
471 471
                                 $selected = '';
472 472
 
473
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
473
+                                if (is_array($show_in_values) && in_array($key, $show_in_values)) {
474 474
                                     $selected = 'selected';
475 475
                                 }
476 476
 
477 477
                                 ?>
478
-                                <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
478
+                                <option  value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option>
479 479
                                 <?php
480 480
                             }
481 481
                             ?>
@@ -487,9 +487,9 @@  discard block
 block discarded – undo
487 487
 
488 488
 
489 489
             // advanced_editor
490
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
490
+            if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) {
491 491
 
492
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
492
+                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info);
493 493
 
494 494
             }
495 495
 
@@ -500,10 +500,10 @@  discard block
 block discarded – undo
500 500
 
501 501
 
502 502
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
503
-            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/>
503
+            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/>
504 504
 
505 505
             <?php // we dont need to show the sort order ?>
506
-            <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);} ?>"/>
506
+            <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); } ?>"/>
507 507
 
508 508
 
509 509
 
@@ -556,15 +556,15 @@  discard block
 block discarded – undo
556 556
             <?php
557 557
 
558 558
             // is_required
559
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
559
+            if (has_filter("geodir_cfa_is_required_{$field_type}")) {
560 560
 
561
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
561
+                echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info);
562 562
 
563
-            }else{
563
+            } else {
564 564
                 $value = '';
565 565
                 if (isset($field_info->is_required)) {
566 566
                     $value = esc_attr($field_info->is_required);
567
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
567
+                }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) {
568 568
                     $value = $cf['defaults']['is_required'];
569 569
                 }
570 570
                 ?>
@@ -577,17 +577,17 @@  discard block
 block discarded – undo
577 577
 
578 578
                     <div class="gd-cf-input-wrap gd-switch">
579 579
 
580
-                        <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
580
+                        <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled"  value="1"
581 581
                             <?php if ($value == '1') {
582 582
                                 echo 'checked';
583 583
                             } ?>/>
584
-                        <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>
584
+                        <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>
585 585
 
586
-                        <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
586
+                        <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0"
587 587
                             <?php if ($value == '0' || !$value) {
588 588
                                 echo 'checked';
589 589
                             } ?>/>
590
-                        <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>
590
+                        <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>
591 591
 
592 592
                     </div>
593 593
 
@@ -597,19 +597,19 @@  discard block
 block discarded – undo
597 597
             }
598 598
 
599 599
             // required_msg
600
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
600
+            if (has_filter("geodir_cfa_required_msg_{$field_type}")) {
601 601
 
602
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
602
+                echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info);
603 603
 
604
-            }else{
604
+            } else {
605 605
                 $value = '';
606 606
                 if (isset($field_info->required_msg)) {
607 607
                     $value = esc_attr($field_info->required_msg);
608
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
608
+                }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) {
609 609
                     $value = $cf['defaults']['required_msg'];
610 610
                 }
611 611
                 ?>
612
-                <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;'";}?>>
612
+                <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;'"; }?>>
613 613
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
614 614
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
615 615
                         <div class="gdcf-tooltip">
@@ -626,31 +626,31 @@  discard block
 block discarded – undo
626 626
 
627 627
 
628 628
             // required_msg
629
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
629
+            if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) {
630 630
 
631
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
631
+                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info);
632 632
 
633 633
             }
634 634
 
635 635
 
636 636
             // extra_fields
637
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
637
+            if (has_filter("geodir_cfa_extra_fields_{$field_type}")) {
638 638
 
639
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
639
+                echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info);
640 640
 
641 641
             }
642 642
 
643 643
 
644 644
             // field_icon
645
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
645
+            if (has_filter("geodir_cfa_field_icon_{$field_type}")) {
646 646
 
647
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
647
+                echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info);
648 648
 
649
-            }else{
649
+            } else {
650 650
                 $value = '';
651 651
                 if (isset($field_info->field_icon)) {
652 652
                     $value = esc_attr($field_info->field_icon);
653
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
653
+                }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) {
654 654
                     $value = $cf['defaults']['field_icon'];
655 655
                 }
656 656
                 ?>
@@ -661,12 +661,12 @@  discard block
 block discarded – undo
661 661
                     <label for="field_icon" class="gd-cf-tooltip-wrap">
662 662
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?>
663 663
                         <div class="gdcf-tooltip">
664
-                            <?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');?>
664
+                            <?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'); ?>
665 665
                         </div>
666 666
                     </label>
667 667
                     <div class="gd-cf-input-wrap">
668 668
                         <input type="text" name="field_icon" id="field_icon"
669
-                               value="<?php echo $value;?>"/>
669
+                               value="<?php echo $value; ?>"/>
670 670
                     </div>
671 671
 
672 672
                 </li>
@@ -675,15 +675,15 @@  discard block
 block discarded – undo
675 675
 
676 676
 
677 677
             // css_class
678
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
678
+            if (has_filter("geodir_cfa_css_class_{$field_type}")) {
679 679
 
680
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
680
+                echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info);
681 681
 
682
-            }else{
682
+            } else {
683 683
                 $value = '';
684 684
                 if (isset($field_info->css_class)) {
685 685
                     $value = esc_attr($field_info->css_class);
686
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
686
+                }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) {
687 687
                     $value = $cf['defaults']['css_class'];
688 688
                 }
689 689
                 ?>
@@ -692,8 +692,8 @@  discard block
 block discarded – undo
692 692
                     <label for="css_class" class="gd-cf-tooltip-wrap">
693 693
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?>
694 694
                         <div class="gdcf-tooltip">
695
-                            <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
696
-                            <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?>
695
+                            <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
696
+                            <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?>
697 697
                         </div>
698 698
                     </label>
699 699
                     <div class="gd-cf-input-wrap">
@@ -708,23 +708,23 @@  discard block
 block discarded – undo
708 708
 
709 709
 
710 710
             // cat_sort
711
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
711
+            if (has_filter("geodir_cfa_cat_sort_{$field_type}")) {
712 712
 
713
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
713
+                echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info);
714 714
 
715
-            }else{
715
+            } else {
716 716
                 $value = '';
717
-                $hide_cat_sort  ='';
717
+                $hide_cat_sort = '';
718 718
                 if (isset($field_info->cat_sort)) {
719 719
                     $value = esc_attr($field_info->cat_sort);
720
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
720
+                }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) {
721 721
                     $value = $cf['defaults']['cat_sort'];
722
-                    $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
722
+                    $hide_cat_sort = ($value === false) ? "style='display:none;'" : '';
723 723
                 }
724 724
 
725
-                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
725
+                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : '';
726 726
                 ?>
727
-                <li <?php echo $hide_cat_sort ;?>>
727
+                <li <?php echo $hide_cat_sort; ?>>
728 728
                     <h3><?php
729 729
                         /**
730 730
                          * Filter the section title.
@@ -743,23 +743,23 @@  discard block
 block discarded – undo
743 743
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
744 744
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
745 745
                         <div class="gdcf-tooltip">
746
-                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?>
746
+                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?>
747 747
                         </div>
748 748
                     </label>
749 749
 
750 750
                     <div class="gd-cf-input-wrap gd-switch">
751 751
 
752
-                        <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
752
+                        <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled"  value="1"
753 753
                             <?php if ($value == '1') {
754 754
                                 echo 'checked';
755 755
                             } ?>/>
756
-                        <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
756
+                        <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
757 757
 
758
-                        <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
758
+                        <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0"
759 759
                             <?php if (!$value) {
760 760
                                 echo 'checked';
761 761
                             } ?>/>
762
-                        <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
762
+                        <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
763 763
 
764 764
                     </div>
765 765
                 </li>
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
                      * @param object $field_info The current fields info.
787 787
                      * @param array $cf The custom field settings
788 788
                      */
789
-                    do_action('geodir_advance_custom_fields', $field_info,$cf);?>
789
+                    do_action('geodir_advance_custom_fields', $field_info, $cf); ?>
790 790
 
791 791
 
792 792
                 <?php endswitch; ?>
@@ -798,10 +798,10 @@  discard block
 block discarded – undo
798 798
                     <h3></h3>
799 799
                 </label>
800 800
                 <div class="gd-cf-input-wrap">
801
-                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
801
+                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
802 802
                            onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
803 803
                     <?php if (!$default): ?>
804
-                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
804
+                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
805 805
                                                             onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
806 806
                                                             class="button"/></a>
807 807
                     <?php endif; ?>
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_predefined.php 3 patches
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.
Indentation   +403 added lines, -403 removed lines patch added patch discarded remove patch
@@ -17,370 +17,370 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function geodir_custom_fields_predefined($post_type=''){
19 19
 
20
-    $custom_fields = array();
21
-
22
-
23
-    // price
24
-    $custom_fields['price'] = array( // The key value should be unique and not contain any spaces.
25
-        'field_type'  =>  'text',
26
-        'class'       =>  'gd-price',
27
-        'icon'        =>  'fa fa-usd',
28
-        'name'        =>  __('Price', 'geodirectory'),
29
-        'description' =>  __('Adds a input for a price field. This will let you filter and sort by price.', 'geodirectory'),
30
-        'defaults'    => array(
31
-            'data_type'           =>  'FLOAT',
32
-            'decimal_point'       =>  '2',
33
-            'admin_title'         =>  'Price',
34
-            'site_title'          =>  'Price',
35
-            'admin_desc'          =>  'Enter the price in $ (no currency symbol)',
36
-            'htmlvar_name'        =>  'price',
37
-            'is_active'           =>  true,
38
-            'for_admin_use'       =>  false,
39
-            'default_value'       =>  '',
40
-            'show_in' 	      =>  '[detail],[listing]',
41
-            'is_required'         =>  false,
42
-            'validation_pattern'  =>  '\d+(\.\d{2})?',
43
-            'validation_msg'      =>  'Please enter number and decimal only ie: 100.50',
44
-            'required_msg'        =>  '',
45
-            'field_icon'          =>  'fa fa-usd',
46
-            'css_class'           =>  '',
47
-            'cat_sort'            =>  true,
48
-            'cat_filter'	      =>  true,
49
-            'extra_fields'        =>  array(
50
-                'is_price'                  =>  1,
51
-                'thousand_separator'        =>  'comma',
52
-                'decimal_separator'         =>  'period',
53
-                'decimal_display'           =>  'if',
54
-                'currency_symbol'           =>  '$',
55
-                'currency_symbol_placement' =>  'left'
56
-            )
57
-        )
58
-    );
59
-
60
-    // property status
61
-    $custom_fields['property_status'] = array( // The key value should be unique and not contain any spaces.
62
-        'field_type'  =>  'select',
63
-        'class'       =>  'gd-property-status',
64
-        'icon'        =>  'fa fa-home',
65
-        'name'        =>  __('Property Status', 'geodirectory'),
66
-        'description' =>  __('Adds a select input to be able to set the status of a property ie: For Sale, For Rent', 'geodirectory'),
67
-        'defaults'    => array(
68
-            'data_type'           =>  'VARCHAR',
69
-            'admin_title'         =>  'Property Status',
70
-            'site_title'          =>  'Property Status',
71
-            'admin_desc'          =>  'Enter the status of the property.',
72
-            'htmlvar_name'        =>  'property_status',
73
-            'is_active'           =>  true,
74
-            'for_admin_use'       =>  false,
75
-            'default_value'       =>  '',
76
-            'show_in' 	          =>  '[detail],[listing]',
77
-            'is_required'         =>  true,
78
-            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
79
-            'validation_pattern'  =>  '',
80
-            'validation_msg'      =>  '',
81
-            'required_msg'        =>  '',
82
-            'field_icon'          =>  'fa fa-home',
83
-            'css_class'           =>  '',
84
-            'cat_sort'            =>  true,
85
-            'cat_filter'	      =>  true
86
-        )
87
-    );
88
-
89
-    // property furnishing
90
-    $custom_fields['property_furnishing'] = array( // The key value should be unique and not contain any spaces.
91
-        'field_type'  =>  'select',
92
-        'class'       =>  'gd-property-furnishing',
93
-        'icon'        =>  'fa fa-home',
94
-        'name'        =>  __('Property Furnishing', 'geodirectory'),
95
-        'description' =>  __('Adds a select input to be able to set the furnishing status of a property ie: Unfurnished, Furnished', 'geodirectory'),
96
-        'defaults'    => array(
97
-            'data_type'           =>  'VARCHAR',
98
-            'admin_title'         =>  'Furnishing',
99
-            'site_title'          =>  'Furnishing',
100
-            'admin_desc'          =>  'Enter the furnishing status of the property.',
101
-            'htmlvar_name'        =>  'property_furnishing',
102
-            'is_active'           =>  true,
103
-            'for_admin_use'       =>  false,
104
-            'default_value'       =>  '',
105
-            'show_in' 	          =>  '[detail],[listing]',
106
-            'is_required'         =>  true,
107
-            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
108
-            'validation_pattern'  =>  '',
109
-            'validation_msg'      =>  '',
110
-            'required_msg'        =>  '',
111
-            'field_icon'          =>  'fa fa-th-large',
112
-            'css_class'           =>  '',
113
-            'cat_sort'            =>  true,
114
-            'cat_filter'	      =>  true
115
-        )
116
-    );
117
-
118
-    // property type
119
-    $custom_fields['property_type'] = array( // The key value should be unique and not contain any spaces.
120
-        'field_type'  =>  'select',
121
-        'class'       =>  'gd-property-type',
122
-        'icon'        =>  'fa fa-home',
123
-        'name'        =>  __('Property Type', 'geodirectory'),
124
-        'description' =>  __('Adds a select input for the property type ie: Detached house, Apartment', 'geodirectory'),
125
-        'defaults'    => array(
126
-            'data_type'           =>  'VARCHAR',
127
-            'admin_title'         =>  'Property Type',
128
-            'site_title'          =>  'Property Type',
129
-            'admin_desc'          =>  'Select the property type.',
130
-            'htmlvar_name'        =>  'property_type',
131
-            'is_active'           =>  true,
132
-            'for_admin_use'       =>  false,
133
-            'default_value'       =>  '',
134
-            'show_in' 	          =>  '[detail],[listing]',
135
-            'is_required'         =>  true,
136
-            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
137
-            'validation_pattern'  =>  '',
138
-            'validation_msg'      =>  '',
139
-            'required_msg'        =>  '',
140
-            'field_icon'          =>  'fa fa-home',
141
-            'css_class'           =>  '',
142
-            'cat_sort'            =>  true,
143
-            'cat_filter'	      =>  true
144
-        )
145
-    );
146
-
147
-    // property bedrooms
148
-    $custom_fields['property_bedrooms'] = array( // The key value should be unique and not contain any spaces.
149
-        'field_type'  =>  'select',
150
-        'class'       =>  'gd-property-bedrooms',
151
-        'icon'        =>  'fa fa-home',
152
-        'name'        =>  __('Property Bedrooms', 'geodirectory'),
153
-        'description' =>  __('Adds a select input for the number of bedrooms.', 'geodirectory'),
154
-        'defaults'    => array(
155
-            'data_type'           =>  'VARCHAR',
156
-            'admin_title'         =>  'Property Bedrooms',
157
-            'site_title'          =>  'Bedrooms',
158
-            'admin_desc'          =>  'Select the number of bedrooms',
159
-            'htmlvar_name'        =>  'property_bedrooms',
160
-            'is_active'           =>  true,
161
-            'for_admin_use'       =>  false,
162
-            'default_value'       =>  '',
163
-            'show_in' 	          =>  '[detail],[listing]',
164
-            'is_required'         =>  true,
165
-            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
166
-            'validation_pattern'  =>  '',
167
-            'validation_msg'      =>  '',
168
-            'required_msg'        =>  '',
169
-            'field_icon'          =>  'fa fa-bed',
170
-            'css_class'           =>  '',
171
-            'cat_sort'            =>  true,
172
-            'cat_filter'	      =>  true
173
-        )
174
-    );
175
-
176
-    // property bathrooms
177
-    $custom_fields['property_bathrooms'] = array( // The key value should be unique and not contain any spaces.
178
-        'field_type'  =>  'select',
179
-        'class'       =>  'gd-property-bathrooms',
180
-        'icon'        =>  'fa fa-home',
181
-        'name'        =>  __('Property Bathrooms', 'geodirectory'),
182
-        'description' =>  __('Adds a select input for the number of bathrooms.', 'geodirectory'),
183
-        'defaults'    => array(
184
-            'data_type'           =>  'VARCHAR',
185
-            'admin_title'         =>  'Property Bathrooms',
186
-            'site_title'          =>  'Bathrooms',
187
-            'admin_desc'          =>  'Select the number of bathrooms',
188
-            'htmlvar_name'        =>  'property_bathrooms',
189
-            'is_active'           =>  true,
190
-            'for_admin_use'       =>  false,
191
-            'default_value'       =>  '',
192
-            'show_in' 	          =>  '[detail],[listing]',
193
-            'is_required'         =>  true,
194
-            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
195
-            'validation_pattern'  =>  '',
196
-            'validation_msg'      =>  '',
197
-            'required_msg'        =>  '',
198
-            'field_icon'          =>  'fa fa-bold',
199
-            'css_class'           =>  '',
200
-            'cat_sort'            =>  true,
201
-            'cat_filter'	      =>  true
202
-        )
203
-    );
204
-
205
-    // property area
206
-    $custom_fields['property_area'] = array( // The key value should be unique and not contain any spaces.
207
-        'field_type'  =>  'text',
208
-        'class'       =>  'gd-area',
209
-        'icon'        =>  'fa fa-home',
210
-        'name'        =>  __('Property Area', 'geodirectory'),
211
-        'description' =>  __('Adds a input for the property area.', 'geodirectory'),
212
-        'defaults'    => array(
213
-            'data_type'           =>  'FLOAT',
214
-            'admin_title'         =>  'Property Area',
215
-            'site_title'          =>  'Area (Sq Ft)',
216
-            'admin_desc'          =>  'Enter the Sq Ft value for the property',
217
-            'htmlvar_name'        =>  'property_area',
218
-            'is_active'           =>  true,
219
-            'for_admin_use'       =>  false,
220
-            'default_value'       =>  '',
221
-            'show_in' 	      =>  '[detail],[listing]',
222
-            'is_required'         =>  false,
223
-            'validation_pattern'  =>  '\d+(\.\d{2})?',
224
-            'validation_msg'      =>  'Please enter the property area in numbers only: 1500',
225
-            'required_msg'        =>  '',
226
-            'field_icon'          =>  'fa fa-area-chart',
227
-            'css_class'           =>  '',
228
-            'cat_sort'            =>  true,
229
-            'cat_filter'	      =>  true
230
-        )
231
-    );
232
-
233
-    // property features
234
-    $custom_fields['property_features'] = array( // The key value should be unique and not contain any spaces.
235
-        'field_type'  =>  'multiselect',
236
-        'class'       =>  'gd-property-features',
237
-        'icon'        =>  'fa fa-home',
238
-        'name'        =>  __('Property Features', 'geodirectory'),
239
-        'description' =>  __('Adds a select input for the property features.', 'geodirectory'),
240
-        'defaults'    => array(
241
-            'data_type'           =>  'VARCHAR',
242
-            'admin_title'         =>  'Property Features',
243
-            'site_title'          =>  'Features',
244
-            'admin_desc'          =>  'Select the property features.',
245
-            'htmlvar_name'        =>  'property_features',
246
-            'is_active'           =>  true,
247
-            'for_admin_use'       =>  false,
248
-            'default_value'       =>  '',
249
-            'show_in' 	          =>  '[detail],[listing]',
250
-            'is_required'         =>  true,
251
-            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
252
-            'validation_pattern'  =>  '',
253
-            'validation_msg'      =>  '',
254
-            'required_msg'        =>  '',
255
-            'field_icon'          =>  'fa fa-plus-square',
256
-            'css_class'           =>  '',
257
-            'cat_sort'            =>  true,
258
-            'cat_filter'	      =>  true
259
-        )
260
-    );
261
-
262
-    // Twitter feed
263
-    $custom_fields['twitter_feed'] = array( // The key value should be unique and not contain any spaces.
264
-        'field_type'  =>  'text',
265
-        'class'       =>  'gd-twitter',
266
-        'icon'        =>  'fa fa-twitter',
267
-        'name'        =>  __('Twitter feed', 'geodirectory'),
268
-        'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
269
-        'defaults'    => array(
270
-            'data_type'           =>  'VARCHAR',
271
-            'admin_title'         =>  'Twitter',
272
-            'site_title'          =>  'Twitter',
273
-            'admin_desc'          =>  'Enter your Twitter username',
274
-            'htmlvar_name'        =>  'twitterusername',
275
-            'is_active'           =>  true,
276
-            'for_admin_use'       =>  false,
277
-            'default_value'       =>  '',
278
-            'show_in' 	      =>  '[detail],[owntab]',
279
-            'is_required'         =>  false,
280
-            'validation_pattern'  =>  '^[A-Za-z0-9_]{1,32}$',
281
-            'validation_msg'      =>  'Please enter a valid twitter username.',
282
-            'required_msg'        =>  '',
283
-            'field_icon'          =>  'fa fa-twitter',
284
-            'css_class'           =>  '',
285
-            'cat_sort'            =>  false,
286
-            'cat_filter'	      =>  false
287
-        )
288
-    );
289
-
290
-    // Get directions link
291
-    $custom_fields['get_directions'] = array( // The key value should be unique and not contain any spaces.
292
-        'field_type'  =>  'text',
293
-        'class'       =>  'gd-get-directions',
294
-        'icon'        =>  'fa fa-location-arrow',
295
-        'name'        =>  __('Get Directions Link', 'geodirectory'),
296
-        'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
297
-        'defaults'    => array(
298
-            'data_type'           =>  'VARCHAR',
299
-            'admin_title'         =>  'Get Directions',
300
-            'site_title'          =>  'Get Directions',
301
-            'admin_desc'          =>  '',
302
-            'htmlvar_name'        =>  'get_directions',
303
-            'is_active'           =>  true,
304
-            'for_admin_use'       =>  true,
305
-            'default_value'       =>  'Get Directions',
306
-            'show_in' 	      =>  '[detail],[listing]',
307
-            'is_required'         =>  false,
308
-            'validation_pattern'  =>  '',
309
-            'validation_msg'      =>  '',
310
-            'required_msg'        =>  '',
311
-            'field_icon'          =>  'fa fa-location-arrow',
312
-            'css_class'           =>  '',
313
-            'cat_sort'            =>  false,
314
-            'cat_filter'	      =>  false
315
-        )
316
-    );
317
-
318
-
319
-    // JOB TYPE CF
320
-
321
-    // job type
322
-    $custom_fields['job_type'] = array( // The key value should be unique and not contain any spaces.
323
-        'field_type'  =>  'select',
324
-        'class'       =>  'gd-job-type',
325
-        'icon'        =>  'fa fa-briefcase',
326
-        'name'        =>  __('Job Type', 'geodirectory'),
327
-        'description' =>  __('Adds a select input to be able to set the type of a job ie: Full Time, Part Time', 'geodirectory'),
328
-        'defaults'    => array(
329
-            'data_type'           =>  'VARCHAR',
330
-            'admin_title'         =>  __('Job Type', 'geodirectory'),
331
-            'site_title'          =>  __('Job Type','geodirectory'),
332
-            'admin_desc'          =>  __('Select the type of job.','geodirectory'),
333
-            'htmlvar_name'        =>  'job_type',
334
-            'is_active'           =>  true,
335
-            'for_admin_use'       =>  false,
336
-            'default_value'       =>  '',
337
-            'show_in' 	          =>  '[detail],[listing]',
338
-            'is_required'         =>  true,
339
-            'option_values'       =>  __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'),
340
-            'validation_pattern'  =>  '',
341
-            'validation_msg'      =>  '',
342
-            'required_msg'        =>  '',
343
-            'field_icon'          =>  'fa fa-briefcase',
344
-            'css_class'           =>  '',
345
-            'cat_sort'            =>  true,
346
-            'cat_filter'	      =>  true
347
-        )
348
-    );
349
-
350
-    // job sector
351
-    $custom_fields['job_sector'] = array( // The key value should be unique and not contain any spaces.
352
-        'field_type'  =>  'select',
353
-        'class'       =>  'gd-job-type',
354
-        'icon'        =>  'fa fa-briefcase',
355
-        'name'        =>  __('Job Sector', 'geodirectory'),
356
-        'description' =>  __('Adds a select input to be able to set the type of a job Sector ie: Private Sector,Public Sector', 'geodirectory'),
357
-        'defaults'    => array(
358
-            'data_type'           =>  'VARCHAR',
359
-            'admin_title'         =>  __('Job Sector','geodirectory'),
360
-            'site_title'          =>  __('Job Sector','geodirectory'),
361
-            'admin_desc'          =>  __('Select the job sector.','geodirectory'),
362
-            'htmlvar_name'        =>  'job_sector',
363
-            'is_active'           =>  true,
364
-            'for_admin_use'       =>  false,
365
-            'default_value'       =>  '',
366
-            'show_in' 	          =>  '[detail]',
367
-            'is_required'         =>  true,
368
-            'option_values'       =>  __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'),
369
-            'validation_pattern'  =>  '',
370
-            'validation_msg'      =>  '',
371
-            'required_msg'        =>  '',
372
-            'field_icon'          =>  'fa fa-briefcase',
373
-            'css_class'           =>  '',
374
-            'cat_sort'            =>  true,
375
-            'cat_filter'	      =>  true
376
-        )
377
-    );
378
-
379
-
380
-    /**
381
-     * @see `geodir_custom_fields`
382
-     */
383
-    return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
20
+	$custom_fields = array();
21
+
22
+
23
+	// price
24
+	$custom_fields['price'] = array( // The key value should be unique and not contain any spaces.
25
+		'field_type'  =>  'text',
26
+		'class'       =>  'gd-price',
27
+		'icon'        =>  'fa fa-usd',
28
+		'name'        =>  __('Price', 'geodirectory'),
29
+		'description' =>  __('Adds a input for a price field. This will let you filter and sort by price.', 'geodirectory'),
30
+		'defaults'    => array(
31
+			'data_type'           =>  'FLOAT',
32
+			'decimal_point'       =>  '2',
33
+			'admin_title'         =>  'Price',
34
+			'site_title'          =>  'Price',
35
+			'admin_desc'          =>  'Enter the price in $ (no currency symbol)',
36
+			'htmlvar_name'        =>  'price',
37
+			'is_active'           =>  true,
38
+			'for_admin_use'       =>  false,
39
+			'default_value'       =>  '',
40
+			'show_in' 	      =>  '[detail],[listing]',
41
+			'is_required'         =>  false,
42
+			'validation_pattern'  =>  '\d+(\.\d{2})?',
43
+			'validation_msg'      =>  'Please enter number and decimal only ie: 100.50',
44
+			'required_msg'        =>  '',
45
+			'field_icon'          =>  'fa fa-usd',
46
+			'css_class'           =>  '',
47
+			'cat_sort'            =>  true,
48
+			'cat_filter'	      =>  true,
49
+			'extra_fields'        =>  array(
50
+				'is_price'                  =>  1,
51
+				'thousand_separator'        =>  'comma',
52
+				'decimal_separator'         =>  'period',
53
+				'decimal_display'           =>  'if',
54
+				'currency_symbol'           =>  '$',
55
+				'currency_symbol_placement' =>  'left'
56
+			)
57
+		)
58
+	);
59
+
60
+	// property status
61
+	$custom_fields['property_status'] = array( // The key value should be unique and not contain any spaces.
62
+		'field_type'  =>  'select',
63
+		'class'       =>  'gd-property-status',
64
+		'icon'        =>  'fa fa-home',
65
+		'name'        =>  __('Property Status', 'geodirectory'),
66
+		'description' =>  __('Adds a select input to be able to set the status of a property ie: For Sale, For Rent', 'geodirectory'),
67
+		'defaults'    => array(
68
+			'data_type'           =>  'VARCHAR',
69
+			'admin_title'         =>  'Property Status',
70
+			'site_title'          =>  'Property Status',
71
+			'admin_desc'          =>  'Enter the status of the property.',
72
+			'htmlvar_name'        =>  'property_status',
73
+			'is_active'           =>  true,
74
+			'for_admin_use'       =>  false,
75
+			'default_value'       =>  '',
76
+			'show_in' 	          =>  '[detail],[listing]',
77
+			'is_required'         =>  true,
78
+			'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
79
+			'validation_pattern'  =>  '',
80
+			'validation_msg'      =>  '',
81
+			'required_msg'        =>  '',
82
+			'field_icon'          =>  'fa fa-home',
83
+			'css_class'           =>  '',
84
+			'cat_sort'            =>  true,
85
+			'cat_filter'	      =>  true
86
+		)
87
+	);
88
+
89
+	// property furnishing
90
+	$custom_fields['property_furnishing'] = array( // The key value should be unique and not contain any spaces.
91
+		'field_type'  =>  'select',
92
+		'class'       =>  'gd-property-furnishing',
93
+		'icon'        =>  'fa fa-home',
94
+		'name'        =>  __('Property Furnishing', 'geodirectory'),
95
+		'description' =>  __('Adds a select input to be able to set the furnishing status of a property ie: Unfurnished, Furnished', 'geodirectory'),
96
+		'defaults'    => array(
97
+			'data_type'           =>  'VARCHAR',
98
+			'admin_title'         =>  'Furnishing',
99
+			'site_title'          =>  'Furnishing',
100
+			'admin_desc'          =>  'Enter the furnishing status of the property.',
101
+			'htmlvar_name'        =>  'property_furnishing',
102
+			'is_active'           =>  true,
103
+			'for_admin_use'       =>  false,
104
+			'default_value'       =>  '',
105
+			'show_in' 	          =>  '[detail],[listing]',
106
+			'is_required'         =>  true,
107
+			'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
108
+			'validation_pattern'  =>  '',
109
+			'validation_msg'      =>  '',
110
+			'required_msg'        =>  '',
111
+			'field_icon'          =>  'fa fa-th-large',
112
+			'css_class'           =>  '',
113
+			'cat_sort'            =>  true,
114
+			'cat_filter'	      =>  true
115
+		)
116
+	);
117
+
118
+	// property type
119
+	$custom_fields['property_type'] = array( // The key value should be unique and not contain any spaces.
120
+		'field_type'  =>  'select',
121
+		'class'       =>  'gd-property-type',
122
+		'icon'        =>  'fa fa-home',
123
+		'name'        =>  __('Property Type', 'geodirectory'),
124
+		'description' =>  __('Adds a select input for the property type ie: Detached house, Apartment', 'geodirectory'),
125
+		'defaults'    => array(
126
+			'data_type'           =>  'VARCHAR',
127
+			'admin_title'         =>  'Property Type',
128
+			'site_title'          =>  'Property Type',
129
+			'admin_desc'          =>  'Select the property type.',
130
+			'htmlvar_name'        =>  'property_type',
131
+			'is_active'           =>  true,
132
+			'for_admin_use'       =>  false,
133
+			'default_value'       =>  '',
134
+			'show_in' 	          =>  '[detail],[listing]',
135
+			'is_required'         =>  true,
136
+			'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
137
+			'validation_pattern'  =>  '',
138
+			'validation_msg'      =>  '',
139
+			'required_msg'        =>  '',
140
+			'field_icon'          =>  'fa fa-home',
141
+			'css_class'           =>  '',
142
+			'cat_sort'            =>  true,
143
+			'cat_filter'	      =>  true
144
+		)
145
+	);
146
+
147
+	// property bedrooms
148
+	$custom_fields['property_bedrooms'] = array( // The key value should be unique and not contain any spaces.
149
+		'field_type'  =>  'select',
150
+		'class'       =>  'gd-property-bedrooms',
151
+		'icon'        =>  'fa fa-home',
152
+		'name'        =>  __('Property Bedrooms', 'geodirectory'),
153
+		'description' =>  __('Adds a select input for the number of bedrooms.', 'geodirectory'),
154
+		'defaults'    => array(
155
+			'data_type'           =>  'VARCHAR',
156
+			'admin_title'         =>  'Property Bedrooms',
157
+			'site_title'          =>  'Bedrooms',
158
+			'admin_desc'          =>  'Select the number of bedrooms',
159
+			'htmlvar_name'        =>  'property_bedrooms',
160
+			'is_active'           =>  true,
161
+			'for_admin_use'       =>  false,
162
+			'default_value'       =>  '',
163
+			'show_in' 	          =>  '[detail],[listing]',
164
+			'is_required'         =>  true,
165
+			'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
166
+			'validation_pattern'  =>  '',
167
+			'validation_msg'      =>  '',
168
+			'required_msg'        =>  '',
169
+			'field_icon'          =>  'fa fa-bed',
170
+			'css_class'           =>  '',
171
+			'cat_sort'            =>  true,
172
+			'cat_filter'	      =>  true
173
+		)
174
+	);
175
+
176
+	// property bathrooms
177
+	$custom_fields['property_bathrooms'] = array( // The key value should be unique and not contain any spaces.
178
+		'field_type'  =>  'select',
179
+		'class'       =>  'gd-property-bathrooms',
180
+		'icon'        =>  'fa fa-home',
181
+		'name'        =>  __('Property Bathrooms', 'geodirectory'),
182
+		'description' =>  __('Adds a select input for the number of bathrooms.', 'geodirectory'),
183
+		'defaults'    => array(
184
+			'data_type'           =>  'VARCHAR',
185
+			'admin_title'         =>  'Property Bathrooms',
186
+			'site_title'          =>  'Bathrooms',
187
+			'admin_desc'          =>  'Select the number of bathrooms',
188
+			'htmlvar_name'        =>  'property_bathrooms',
189
+			'is_active'           =>  true,
190
+			'for_admin_use'       =>  false,
191
+			'default_value'       =>  '',
192
+			'show_in' 	          =>  '[detail],[listing]',
193
+			'is_required'         =>  true,
194
+			'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
195
+			'validation_pattern'  =>  '',
196
+			'validation_msg'      =>  '',
197
+			'required_msg'        =>  '',
198
+			'field_icon'          =>  'fa fa-bold',
199
+			'css_class'           =>  '',
200
+			'cat_sort'            =>  true,
201
+			'cat_filter'	      =>  true
202
+		)
203
+	);
204
+
205
+	// property area
206
+	$custom_fields['property_area'] = array( // The key value should be unique and not contain any spaces.
207
+		'field_type'  =>  'text',
208
+		'class'       =>  'gd-area',
209
+		'icon'        =>  'fa fa-home',
210
+		'name'        =>  __('Property Area', 'geodirectory'),
211
+		'description' =>  __('Adds a input for the property area.', 'geodirectory'),
212
+		'defaults'    => array(
213
+			'data_type'           =>  'FLOAT',
214
+			'admin_title'         =>  'Property Area',
215
+			'site_title'          =>  'Area (Sq Ft)',
216
+			'admin_desc'          =>  'Enter the Sq Ft value for the property',
217
+			'htmlvar_name'        =>  'property_area',
218
+			'is_active'           =>  true,
219
+			'for_admin_use'       =>  false,
220
+			'default_value'       =>  '',
221
+			'show_in' 	      =>  '[detail],[listing]',
222
+			'is_required'         =>  false,
223
+			'validation_pattern'  =>  '\d+(\.\d{2})?',
224
+			'validation_msg'      =>  'Please enter the property area in numbers only: 1500',
225
+			'required_msg'        =>  '',
226
+			'field_icon'          =>  'fa fa-area-chart',
227
+			'css_class'           =>  '',
228
+			'cat_sort'            =>  true,
229
+			'cat_filter'	      =>  true
230
+		)
231
+	);
232
+
233
+	// property features
234
+	$custom_fields['property_features'] = array( // The key value should be unique and not contain any spaces.
235
+		'field_type'  =>  'multiselect',
236
+		'class'       =>  'gd-property-features',
237
+		'icon'        =>  'fa fa-home',
238
+		'name'        =>  __('Property Features', 'geodirectory'),
239
+		'description' =>  __('Adds a select input for the property features.', 'geodirectory'),
240
+		'defaults'    => array(
241
+			'data_type'           =>  'VARCHAR',
242
+			'admin_title'         =>  'Property Features',
243
+			'site_title'          =>  'Features',
244
+			'admin_desc'          =>  'Select the property features.',
245
+			'htmlvar_name'        =>  'property_features',
246
+			'is_active'           =>  true,
247
+			'for_admin_use'       =>  false,
248
+			'default_value'       =>  '',
249
+			'show_in' 	          =>  '[detail],[listing]',
250
+			'is_required'         =>  true,
251
+			'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
252
+			'validation_pattern'  =>  '',
253
+			'validation_msg'      =>  '',
254
+			'required_msg'        =>  '',
255
+			'field_icon'          =>  'fa fa-plus-square',
256
+			'css_class'           =>  '',
257
+			'cat_sort'            =>  true,
258
+			'cat_filter'	      =>  true
259
+		)
260
+	);
261
+
262
+	// Twitter feed
263
+	$custom_fields['twitter_feed'] = array( // The key value should be unique and not contain any spaces.
264
+		'field_type'  =>  'text',
265
+		'class'       =>  'gd-twitter',
266
+		'icon'        =>  'fa fa-twitter',
267
+		'name'        =>  __('Twitter feed', 'geodirectory'),
268
+		'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
269
+		'defaults'    => array(
270
+			'data_type'           =>  'VARCHAR',
271
+			'admin_title'         =>  'Twitter',
272
+			'site_title'          =>  'Twitter',
273
+			'admin_desc'          =>  'Enter your Twitter username',
274
+			'htmlvar_name'        =>  'twitterusername',
275
+			'is_active'           =>  true,
276
+			'for_admin_use'       =>  false,
277
+			'default_value'       =>  '',
278
+			'show_in' 	      =>  '[detail],[owntab]',
279
+			'is_required'         =>  false,
280
+			'validation_pattern'  =>  '^[A-Za-z0-9_]{1,32}$',
281
+			'validation_msg'      =>  'Please enter a valid twitter username.',
282
+			'required_msg'        =>  '',
283
+			'field_icon'          =>  'fa fa-twitter',
284
+			'css_class'           =>  '',
285
+			'cat_sort'            =>  false,
286
+			'cat_filter'	      =>  false
287
+		)
288
+	);
289
+
290
+	// Get directions link
291
+	$custom_fields['get_directions'] = array( // The key value should be unique and not contain any spaces.
292
+		'field_type'  =>  'text',
293
+		'class'       =>  'gd-get-directions',
294
+		'icon'        =>  'fa fa-location-arrow',
295
+		'name'        =>  __('Get Directions Link', 'geodirectory'),
296
+		'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
297
+		'defaults'    => array(
298
+			'data_type'           =>  'VARCHAR',
299
+			'admin_title'         =>  'Get Directions',
300
+			'site_title'          =>  'Get Directions',
301
+			'admin_desc'          =>  '',
302
+			'htmlvar_name'        =>  'get_directions',
303
+			'is_active'           =>  true,
304
+			'for_admin_use'       =>  true,
305
+			'default_value'       =>  'Get Directions',
306
+			'show_in' 	      =>  '[detail],[listing]',
307
+			'is_required'         =>  false,
308
+			'validation_pattern'  =>  '',
309
+			'validation_msg'      =>  '',
310
+			'required_msg'        =>  '',
311
+			'field_icon'          =>  'fa fa-location-arrow',
312
+			'css_class'           =>  '',
313
+			'cat_sort'            =>  false,
314
+			'cat_filter'	      =>  false
315
+		)
316
+	);
317
+
318
+
319
+	// JOB TYPE CF
320
+
321
+	// job type
322
+	$custom_fields['job_type'] = array( // The key value should be unique and not contain any spaces.
323
+		'field_type'  =>  'select',
324
+		'class'       =>  'gd-job-type',
325
+		'icon'        =>  'fa fa-briefcase',
326
+		'name'        =>  __('Job Type', 'geodirectory'),
327
+		'description' =>  __('Adds a select input to be able to set the type of a job ie: Full Time, Part Time', 'geodirectory'),
328
+		'defaults'    => array(
329
+			'data_type'           =>  'VARCHAR',
330
+			'admin_title'         =>  __('Job Type', 'geodirectory'),
331
+			'site_title'          =>  __('Job Type','geodirectory'),
332
+			'admin_desc'          =>  __('Select the type of job.','geodirectory'),
333
+			'htmlvar_name'        =>  'job_type',
334
+			'is_active'           =>  true,
335
+			'for_admin_use'       =>  false,
336
+			'default_value'       =>  '',
337
+			'show_in' 	          =>  '[detail],[listing]',
338
+			'is_required'         =>  true,
339
+			'option_values'       =>  __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'),
340
+			'validation_pattern'  =>  '',
341
+			'validation_msg'      =>  '',
342
+			'required_msg'        =>  '',
343
+			'field_icon'          =>  'fa fa-briefcase',
344
+			'css_class'           =>  '',
345
+			'cat_sort'            =>  true,
346
+			'cat_filter'	      =>  true
347
+		)
348
+	);
349
+
350
+	// job sector
351
+	$custom_fields['job_sector'] = array( // The key value should be unique and not contain any spaces.
352
+		'field_type'  =>  'select',
353
+		'class'       =>  'gd-job-type',
354
+		'icon'        =>  'fa fa-briefcase',
355
+		'name'        =>  __('Job Sector', 'geodirectory'),
356
+		'description' =>  __('Adds a select input to be able to set the type of a job Sector ie: Private Sector,Public Sector', 'geodirectory'),
357
+		'defaults'    => array(
358
+			'data_type'           =>  'VARCHAR',
359
+			'admin_title'         =>  __('Job Sector','geodirectory'),
360
+			'site_title'          =>  __('Job Sector','geodirectory'),
361
+			'admin_desc'          =>  __('Select the job sector.','geodirectory'),
362
+			'htmlvar_name'        =>  'job_sector',
363
+			'is_active'           =>  true,
364
+			'for_admin_use'       =>  false,
365
+			'default_value'       =>  '',
366
+			'show_in' 	          =>  '[detail]',
367
+			'is_required'         =>  true,
368
+			'option_values'       =>  __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'),
369
+			'validation_pattern'  =>  '',
370
+			'validation_msg'      =>  '',
371
+			'required_msg'        =>  '',
372
+			'field_icon'          =>  'fa fa-briefcase',
373
+			'css_class'           =>  '',
374
+			'cat_sort'            =>  true,
375
+			'cat_filter'	      =>  true
376
+		)
377
+	);
378
+
379
+
380
+	/**
381
+	 * @see `geodir_custom_fields`
382
+	 */
383
+	return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
384 384
 }
385 385
 
386 386
 
@@ -395,32 +395,32 @@  discard block
 block discarded – undo
395 395
  * @return string The html to output.
396 396
  */
397 397
 function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){
398
-    global $post;
398
+	global $post;
399 399
 
400 400
 
401
-    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
401
+	if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
402 402
 
403
-        $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
403
+		$class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
404 404
 
405
-        $field_icon = geodir_field_icon_proccess($cf);
406
-        if (strpos($field_icon, 'http') !== false) {
407
-            $field_icon_af = '';
408
-        } elseif ($field_icon == '') {
409
-            $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
410
-        } else {
411
-            $field_icon_af = $field_icon;
412
-            $field_icon = '';
413
-        }
405
+		$field_icon = geodir_field_icon_proccess($cf);
406
+		if (strpos($field_icon, 'http') !== false) {
407
+			$field_icon_af = '';
408
+		} elseif ($field_icon == '') {
409
+			$field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
410
+		} else {
411
+			$field_icon_af = $field_icon;
412
+			$field_icon = '';
413
+		}
414 414
 
415 415
 
416
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
416
+		$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
417 417
 
418
-        $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>';
419
-        $html .= '</div>';
418
+		$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>';
419
+		$html .= '</div>';
420 420
 
421
-    endif;
421
+	endif;
422 422
 
423
-    return $html;
423
+	return $html;
424 424
 }
425 425
 add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3);
426 426
 
@@ -435,36 +435,36 @@  discard block
 block discarded – undo
435 435
  * @return string The html to output.
436 436
  */
437 437
 function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) {
438
-    global $post;
438
+	global $post;
439 439
 
440 440
 
441
-    if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
441
+	if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
442 442
 
443
-        $field_icon = geodir_field_icon_proccess( $cf );
444
-        if ( strpos( $field_icon, 'http' ) !== false ) {
445
-            $field_icon_af = '';
446
-        } elseif ( $field_icon == '' ) {
447
-            $field_icon_af = '<i class="fa fa-location-arrow"></i>';
448
-        } else {
449
-            $field_icon_af = $field_icon;
450
-            $field_icon    = '';
451
-        }
443
+		$field_icon = geodir_field_icon_proccess( $cf );
444
+		if ( strpos( $field_icon, 'http' ) !== false ) {
445
+			$field_icon_af = '';
446
+		} elseif ( $field_icon == '' ) {
447
+			$field_icon_af = '<i class="fa fa-location-arrow"></i>';
448
+		} else {
449
+			$field_icon_af = $field_icon;
450
+			$field_icon    = '';
451
+		}
452 452
 
453
-        $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
453
+		$link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
454 454
 
455
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
455
+		$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
456 456
 
457
-        if(isset( $cf['field_icon'] ) && $cf['field_icon']){
458
-            $html .= $field_icon_af;
459
-        }
457
+		if(isset( $cf['field_icon'] ) && $cf['field_icon']){
458
+			$html .= $field_icon_af;
459
+		}
460 460
 
461
-        $html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>';
462
-        $html .= '</div>';
461
+		$html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>';
462
+		$html .= '</div>';
463 463
 
464
-    }else{
465
-        $html ='';
466
-    }
464
+	}else{
465
+		$html ='';
466
+	}
467 467
 
468
-    return $html;
468
+	return $html;
469 469
 }
470 470
 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   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @package GeoDirectory
16 16
  * @see `geodir_custom_field_save` for array details.
17 17
  */
18
-function geodir_custom_fields_predefined($post_type=''){
18
+function geodir_custom_fields_predefined($post_type = '') {
19 19
 
20 20
     $custom_fields = array();
21 21
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             'default_value'       =>  '',
76 76
             'show_in' 	          =>  '[detail],[listing]',
77 77
             'is_required'         =>  true,
78
-            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
78
+            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let', 'geodirectory'),
79 79
             'validation_pattern'  =>  '',
80 80
             'validation_msg'      =>  '',
81 81
             'required_msg'        =>  '',
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             'default_value'       =>  '',
105 105
             'show_in' 	          =>  '[detail],[listing]',
106 106
             'is_required'         =>  true,
107
-            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
107
+            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional', 'geodirectory'),
108 108
             'validation_pattern'  =>  '',
109 109
             'validation_msg'      =>  '',
110 110
             'required_msg'        =>  '',
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             'default_value'       =>  '',
134 134
             'show_in' 	          =>  '[detail],[listing]',
135 135
             'is_required'         =>  true,
136
-            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
136
+            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage', 'geodirectory'),
137 137
             'validation_pattern'  =>  '',
138 138
             'validation_msg'      =>  '',
139 139
             'required_msg'        =>  '',
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             'default_value'       =>  '',
163 163
             'show_in' 	          =>  '[detail],[listing]',
164 164
             'is_required'         =>  true,
165
-            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
165
+            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'),
166 166
             'validation_pattern'  =>  '',
167 167
             'validation_msg'      =>  '',
168 168
             'required_msg'        =>  '',
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
             'default_value'       =>  '',
192 192
             'show_in' 	          =>  '[detail],[listing]',
193 193
             'is_required'         =>  true,
194
-            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
194
+            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'),
195 195
             'validation_pattern'  =>  '',
196 196
             'validation_msg'      =>  '',
197 197
             'required_msg'        =>  '',
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
             'default_value'       =>  '',
249 249
             'show_in' 	          =>  '[detail],[listing]',
250 250
             'is_required'         =>  true,
251
-            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
251
+            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace', 'geodirectory'),
252 252
             'validation_pattern'  =>  '',
253 253
             'validation_msg'      =>  '',
254 254
             'required_msg'        =>  '',
@@ -328,15 +328,15 @@  discard block
 block discarded – undo
328 328
         'defaults'    => array(
329 329
             'data_type'           =>  'VARCHAR',
330 330
             'admin_title'         =>  __('Job Type', 'geodirectory'),
331
-            'site_title'          =>  __('Job Type','geodirectory'),
332
-            'admin_desc'          =>  __('Select the type of job.','geodirectory'),
331
+            'site_title'          =>  __('Job Type', 'geodirectory'),
332
+            'admin_desc'          =>  __('Select the type of job.', 'geodirectory'),
333 333
             'htmlvar_name'        =>  'job_type',
334 334
             'is_active'           =>  true,
335 335
             'for_admin_use'       =>  false,
336 336
             'default_value'       =>  '',
337 337
             'show_in' 	          =>  '[detail],[listing]',
338 338
             'is_required'         =>  true,
339
-            'option_values'       =>  __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'),
339
+            'option_values'       =>  __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other', 'geodirectory'),
340 340
             'validation_pattern'  =>  '',
341 341
             'validation_msg'      =>  '',
342 342
             'required_msg'        =>  '',
@@ -356,16 +356,16 @@  discard block
 block discarded – undo
356 356
         'description' =>  __('Adds a select input to be able to set the type of a job Sector ie: Private Sector,Public Sector', 'geodirectory'),
357 357
         'defaults'    => array(
358 358
             'data_type'           =>  'VARCHAR',
359
-            'admin_title'         =>  __('Job Sector','geodirectory'),
360
-            'site_title'          =>  __('Job Sector','geodirectory'),
361
-            'admin_desc'          =>  __('Select the job sector.','geodirectory'),
359
+            'admin_title'         =>  __('Job Sector', 'geodirectory'),
360
+            'site_title'          =>  __('Job Sector', 'geodirectory'),
361
+            'admin_desc'          =>  __('Select the job sector.', 'geodirectory'),
362 362
             'htmlvar_name'        =>  'job_sector',
363 363
             'is_active'           =>  true,
364 364
             'for_admin_use'       =>  false,
365 365
             'default_value'       =>  '',
366 366
             'show_in' 	          =>  '[detail]',
367 367
             'is_required'         =>  true,
368
-            'option_values'       =>  __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'),
368
+            'option_values'       =>  __('Select Sector/,Private Sector,Public Sector,Agencies', 'geodirectory'),
369 369
             'validation_pattern'  =>  '',
370 370
             'validation_msg'      =>  '',
371 371
             'required_msg'        =>  '',
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
     /**
381 381
      * @see `geodir_custom_fields`
382 382
      */
383
-    return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
383
+    return apply_filters('geodir_custom_fields_predefined', $custom_fields, $post_type);
384 384
 }
385 385
 
386 386
 
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
  * @since 1.6.9
395 395
  * @return string The html to output.
396 396
  */
397
-function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){
397
+function geodir_predefined_custom_field_output_twitter_feed($html, $location, $cf) {
398 398
     global $post;
399 399
 
400 400
 
401
-    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
401
+    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
402 402
 
403 403
         $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
404 404
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
         }
414 414
 
415 415
 
416
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
416
+        $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;">';
417 417
 
418 418
         $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>';
419 419
         $html .= '</div>';
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 
423 423
     return $html;
424 424
 }
425
-add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3);
425
+add_filter('geodir_custom_field_output_text_key_twitter_feed', 'geodir_predefined_custom_field_output_twitter_feed', 10, 3);
426 426
 
427 427
 /**
428 428
  * Filter the get_directions custom field output to show a link.
@@ -434,37 +434,37 @@  discard block
 block discarded – undo
434 434
  * @since 1.6.9
435 435
  * @return string The html to output.
436 436
  */
437
-function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) {
437
+function geodir_predefined_custom_field_output_get_directions($html, $location, $cf) {
438 438
     global $post;
439 439
 
440 440
 
441
-    if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
441
+    if (isset($post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset($post->post_latitude) && $post->post_latitude) {
442 442
 
443
-        $field_icon = geodir_field_icon_proccess( $cf );
444
-        if ( strpos( $field_icon, 'http' ) !== false ) {
443
+        $field_icon = geodir_field_icon_proccess($cf);
444
+        if (strpos($field_icon, 'http') !== false) {
445 445
             $field_icon_af = '';
446
-        } elseif ( $field_icon == '' ) {
446
+        } elseif ($field_icon == '') {
447 447
             $field_icon_af = '<i class="fa fa-location-arrow"></i>';
448 448
         } else {
449 449
             $field_icon_af = $field_icon;
450 450
             $field_icon    = '';
451 451
         }
452 452
 
453
-        $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
453
+        $link_text = isset($post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __('Get Directions', 'geodirectory');
454 454
 
455
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
455
+        $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;">';
456 456
 
457
-        if(isset( $cf['field_icon'] ) && $cf['field_icon']){
457
+        if (isset($cf['field_icon']) && $cf['field_icon']) {
458 458
             $html .= $field_icon_af;
459 459
         }
460 460
 
461
-        $html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>';
461
+        $html .= '<a href="https://www.google.com/maps/dir//\''.$post->post_latitude.','.$post->post_longitude.'\'/" target="_blank" >'.$link_text.'</a>';
462 462
         $html .= '</div>';
463 463
 
464
-    }else{
465
-        $html ='';
464
+    } else {
465
+        $html = '';
466 466
     }
467 467
 
468 468
     return $html;
469 469
 }
470
-add_filter('geodir_custom_field_output_text_key_get_directions','geodir_predefined_custom_field_output_get_directions',10,3);
470
+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.
uninstall.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,21 +10,21 @@
 block discarded – undo
10 10
 
11 11
 // Exit if accessed directly.
12 12
 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
-    exit;
13
+	exit;
14 14
 }
15 15
 
16 16
 global $wpdb;
17 17
 
18 18
 if (get_option('geodir_un_geodirectory')) {
19
-    $wpdb->hide_errors();
19
+	$wpdb->hide_errors();
20 20
     
21
-    /*
21
+	/*
22 22
     if (!defined('GEODIRECTORY_VERSION')) {
23 23
         // Load plugin file.
24 24
         include_once('geodirectory.php');
25 25
     }
26 26
     */
27 27
 
28
-    // Delete default data.
29
-    delete_option('geodir_default_data_installed');
28
+	// Delete default data.
29
+	delete_option('geodir_default_data_installed');
30 30
 }
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
12
+if (!defined('WP_UNINSTALL_PLUGIN')) {
13 13
     exit;
14 14
 }
15 15
 
Please login to merge, or discard this patch.
geodirectory_widgets.php 3 patches
Indentation   +898 added lines, -898 removed lines patch added patch discarded remove patch
@@ -15,296 +15,296 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function geodir_register_sidebar()
17 17
 {
18
-    global $geodir_sidebars;
19
-
20
-    if (function_exists('register_sidebar')) {
21
-        /*===========================*/
22
-        /* Home page sidebars start*/
23
-        /*===========================*/
24
-
25
-        /**
26
-         * Filter the `$before_widget` widget opening HTML tag.
27
-         *
28
-         * @since 1.0.0
29
-         * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'.
30
-         * @see 'geodir_after_widget'
31
-         */
32
-        $before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">');
33
-        /**
34
-         * Filter the `$after_widget` widget closing HTML tag.
35
-         *
36
-         * @since 1.0.0
37
-         * @param string $var The HTML string to filter. Default = '</section>'.
38
-         * @see 'geodir_before_widget'
39
-         */
40
-        $after_widget = apply_filters('geodir_after_widget', '</section>');
41
-        /**
42
-         * Filter the `$before_title` widget title opening HTML tag.
43
-         *
44
-         * @since 1.0.0
45
-         * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'.
46
-         * @see 'geodir_after_title'
47
-         */
48
-        $before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">');
49
-        /**
50
-         * Filter the `$after_title` widget title closing HTML tag.
51
-         *
52
-         * @since 1.0.0
53
-         * @param string $var The HTML string to filter. Default = '</h3>'.
54
-         * @see 'geodir_before_title'
55
-         */
56
-        $after_title = apply_filters('geodir_after_title', '</h3>');
57
-
58
-        if (get_option('geodir_show_home_top_section')) {
59
-            register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
60
-
61
-            $geodir_sidebars[] = 'geodir_home_top';
62
-        }
63
-
64
-        if (get_option('geodir_show_home_contant_section')) {
65
-            register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
18
+	global $geodir_sidebars;
66 19
 
67
-            $geodir_sidebars[] = 'geodir_home_content';
68
-        }
20
+	if (function_exists('register_sidebar')) {
21
+		/*===========================*/
22
+		/* Home page sidebars start*/
23
+		/*===========================*/
69 24
 
70
-        if (get_option('geodir_show_home_right_section')) {
71
-            register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
25
+		/**
26
+		 * Filter the `$before_widget` widget opening HTML tag.
27
+		 *
28
+		 * @since 1.0.0
29
+		 * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'.
30
+		 * @see 'geodir_after_widget'
31
+		 */
32
+		$before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">');
33
+		/**
34
+		 * Filter the `$after_widget` widget closing HTML tag.
35
+		 *
36
+		 * @since 1.0.0
37
+		 * @param string $var The HTML string to filter. Default = '</section>'.
38
+		 * @see 'geodir_before_widget'
39
+		 */
40
+		$after_widget = apply_filters('geodir_after_widget', '</section>');
41
+		/**
42
+		 * Filter the `$before_title` widget title opening HTML tag.
43
+		 *
44
+		 * @since 1.0.0
45
+		 * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'.
46
+		 * @see 'geodir_after_title'
47
+		 */
48
+		$before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">');
49
+		/**
50
+		 * Filter the `$after_title` widget title closing HTML tag.
51
+		 *
52
+		 * @since 1.0.0
53
+		 * @param string $var The HTML string to filter. Default = '</h3>'.
54
+		 * @see 'geodir_before_title'
55
+		 */
56
+		$after_title = apply_filters('geodir_after_title', '</h3>');
57
+
58
+		if (get_option('geodir_show_home_top_section')) {
59
+			register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
72 60
 
73
-            $geodir_sidebars[] = 'geodir_home_right';
74
-        }
61
+			$geodir_sidebars[] = 'geodir_home_top';
62
+		}
75 63
 
76
-        if (get_option('geodir_show_home_left_section')) {
77
-            register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
64
+		if (get_option('geodir_show_home_contant_section')) {
65
+			register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
78 66
 
79
-            $geodir_sidebars[] = 'geodir_home_left';
80
-        }
67
+			$geodir_sidebars[] = 'geodir_home_content';
68
+		}
81 69
 
82
-        if (get_option('geodir_show_home_bottom_section')) {
83
-            register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
70
+		if (get_option('geodir_show_home_right_section')) {
71
+			register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
84 72
 
85
-            $geodir_sidebars[] = 'geodir_home_bottom';
86
-        }
73
+			$geodir_sidebars[] = 'geodir_home_right';
74
+		}
87 75
 
88
-        /*===========================*/
89
-        /* Home page sidebars end*/
90
-        /*===========================*/
76
+		if (get_option('geodir_show_home_left_section')) {
77
+			register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
91 78
 
92
-        /*===========================*/
93
-        /* Listing page sidebars start*/
94
-        /*===========================*/
79
+			$geodir_sidebars[] = 'geodir_home_left';
80
+		}
95 81
 
96
-        if (get_option('geodir_show_listing_top_section')) {
97
-            register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
82
+		if (get_option('geodir_show_home_bottom_section')) {
83
+			register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
98 84
 
99
-            $geodir_sidebars[] = 'geodir_listing_top';
100
-        }
85
+			$geodir_sidebars[] = 'geodir_home_bottom';
86
+		}
101 87
 
102
-        if (get_option('geodir_show_listing_left_section')) {
103
-            register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
88
+		/*===========================*/
89
+		/* Home page sidebars end*/
90
+		/*===========================*/
104 91
 
105
-            $geodir_sidebars[] = 'geodir_listing_left_sidebar';
106
-        }
92
+		/*===========================*/
93
+		/* Listing page sidebars start*/
94
+		/*===========================*/
107 95
 
108
-        if (get_option('geodir_show_listing_right_section')) {
109
-            register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
96
+		if (get_option('geodir_show_listing_top_section')) {
97
+			register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
110 98
 
111
-            $geodir_sidebars[] = 'geodir_listing_right_sidebar';
112
-        }
99
+			$geodir_sidebars[] = 'geodir_listing_top';
100
+		}
113 101
 
114
-        if (get_option('geodir_show_listing_bottom_section')) {
115
-            register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
102
+		if (get_option('geodir_show_listing_left_section')) {
103
+			register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
116 104
 
117
-            $geodir_sidebars[] = 'geodir_listing_bottom';
118
-        }
105
+			$geodir_sidebars[] = 'geodir_listing_left_sidebar';
106
+		}
119 107
 
120
-        /*===========================*/
121
-        /* Listing page sidebars start*/
122
-        /*===========================*/
108
+		if (get_option('geodir_show_listing_right_section')) {
109
+			register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
123 110
 
124
-        /*===========================*/
125
-        /* Search page sidebars start*/
126
-        /*===========================*/
111
+			$geodir_sidebars[] = 'geodir_listing_right_sidebar';
112
+		}
127 113
 
128
-        if (get_option('geodir_show_search_top_section')) {
129
-            register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
114
+		if (get_option('geodir_show_listing_bottom_section')) {
115
+			register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
130 116
 
131
-            $geodir_sidebars[] = 'geodir_search_top';
132
-        }
117
+			$geodir_sidebars[] = 'geodir_listing_bottom';
118
+		}
133 119
 
134
-        if (get_option('geodir_show_search_left_section')) {
135
-            register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
120
+		/*===========================*/
121
+		/* Listing page sidebars start*/
122
+		/*===========================*/
136 123
 
137
-            $geodir_sidebars[] = 'geodir_search_left_sidebar';
138
-        }
124
+		/*===========================*/
125
+		/* Search page sidebars start*/
126
+		/*===========================*/
139 127
 
140
-        if (get_option('geodir_show_search_right_section')) {
141
-            register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
128
+		if (get_option('geodir_show_search_top_section')) {
129
+			register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
142 130
 
143
-            $geodir_sidebars[] = 'geodir_search_right_sidebar';
144
-        }
131
+			$geodir_sidebars[] = 'geodir_search_top';
132
+		}
145 133
 
146
-        if (get_option('geodir_show_search_bottom_section')) {
147
-            register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
134
+		if (get_option('geodir_show_search_left_section')) {
135
+			register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
148 136
 
149
-            $geodir_sidebars[] = 'geodir_search_bottom';
150
-        }
137
+			$geodir_sidebars[] = 'geodir_search_left_sidebar';
138
+		}
151 139
 
152
-        /*===========================*/
153
-        /* Search page sidebars end*/
154
-        /*===========================*/
140
+		if (get_option('geodir_show_search_right_section')) {
141
+			register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
155 142
 
156
-        /*==================================*/
157
-        /* Detail/Single page sidebars start*/
158
-        /*==================================*/
159
-        if (get_option('geodir_show_detail_top_section')) {
160
-            register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
143
+			$geodir_sidebars[] = 'geodir_search_right_sidebar';
144
+		}
161 145
 
162
-            $geodir_sidebars[] = 'geodir_detail_top';
163
-        }
146
+		if (get_option('geodir_show_search_bottom_section')) {
147
+			register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
164 148
 
165
-        register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
149
+			$geodir_sidebars[] = 'geodir_search_bottom';
150
+		}
166 151
 
167
-        $geodir_sidebars[] = 'geodir_detail_sidebar';
152
+		/*===========================*/
153
+		/* Search page sidebars end*/
154
+		/*===========================*/
168 155
 
169
-        if (get_option('geodir_show_detail_bottom_section')) {
170
-            register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
156
+		/*==================================*/
157
+		/* Detail/Single page sidebars start*/
158
+		/*==================================*/
159
+		if (get_option('geodir_show_detail_top_section')) {
160
+			register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
171 161
 
172
-            $geodir_sidebars[] = 'geodir_detail_bottom';
173
-        }
162
+			$geodir_sidebars[] = 'geodir_detail_top';
163
+		}
174 164
 
175
-        /*==================================*/
176
-        /* Detail/Single page sidebars end*/
177
-        /*==================================*/
165
+		register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
178 166
 
179
-        /*==================================*/
180
-        /* Author page sidebars start       */
181
-        /*==================================*/
167
+		$geodir_sidebars[] = 'geodir_detail_sidebar';
182 168
 
183
-        if (get_option('geodir_show_author_top_section')) {
184
-            register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
169
+		if (get_option('geodir_show_detail_bottom_section')) {
170
+			register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
185 171
 
186
-            $geodir_sidebars[] = 'geodir_author_top';
187
-        }
172
+			$geodir_sidebars[] = 'geodir_detail_bottom';
173
+		}
188 174
 
189
-        if (get_option('geodir_show_author_left_section')) {
190
-            register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
175
+		/*==================================*/
176
+		/* Detail/Single page sidebars end*/
177
+		/*==================================*/
191 178
 
192
-            $geodir_sidebars[] = 'geodir_author_left_sidebar';
193
-        }
179
+		/*==================================*/
180
+		/* Author page sidebars start       */
181
+		/*==================================*/
194 182
 
195
-        if (get_option('geodir_show_author_right_section')) {
196
-            register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
183
+		if (get_option('geodir_show_author_top_section')) {
184
+			register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
197 185
 
198
-            $geodir_sidebars[] = 'geodir_author_right_sidebar';
199
-        }
186
+			$geodir_sidebars[] = 'geodir_author_top';
187
+		}
200 188
 
201
-        if (get_option('geodir_show_author_bottom_section')) {
202
-            register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
189
+		if (get_option('geodir_show_author_left_section')) {
190
+			register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
203 191
 
204
-            $geodir_sidebars[] = 'geodir_author_bottom';
205
-        }
192
+			$geodir_sidebars[] = 'geodir_author_left_sidebar';
193
+		}
206 194
 
207
-        /*==================================*/
208
-        /* Author page sidebars end         */
209
-        /*==================================*/
195
+		if (get_option('geodir_show_author_right_section')) {
196
+			register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
210 197
 
211
-        /*==================================*/
212
-        /* Add listing page sidebars start       */
213
-        /*==================================*/
198
+			$geodir_sidebars[] = 'geodir_author_right_sidebar';
199
+		}
214 200
 
215
-        register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
201
+		if (get_option('geodir_show_author_bottom_section')) {
202
+			register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
216 203
 
217
-        $geodir_sidebars[] = 'geodir_add_listing_sidebar';
204
+			$geodir_sidebars[] = 'geodir_author_bottom';
205
+		}
218 206
 
219
-        /*==================================*/
220
-        /* Add listing page sidebars end         */
221
-        /*==================================*/
207
+		/*==================================*/
208
+		/* Author page sidebars end         */
209
+		/*==================================*/
222 210
 
223
-    }
211
+		/*==================================*/
212
+		/* Add listing page sidebars start       */
213
+		/*==================================*/
214
+
215
+		register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
216
+
217
+		$geodir_sidebars[] = 'geodir_add_listing_sidebar';
218
+
219
+		/*==================================*/
220
+		/* Add listing page sidebars end         */
221
+		/*==================================*/
222
+
223
+	}
224 224
 }
225 225
 
226 226
 
227 227
 if (!function_exists('register_geodir_widgets')) {
228
-    /**
229
-     * Registers all Widgets.
230
-     *
231
-     * @since 1.0.0
232
-     * @package GeoDirectory
233
-     */
234
-    function register_geodir_widgets()
235
-    {
236
-        /**
237
-         * Login Widget.
238
-         *
239
-         * @since 1.0.0
240
-         */
241
-        class geodir_loginwidget extends WP_Widget
242
-        {
243
-            /**
244
-             * Register the login widget with WordPress.
245
-             *
246
-             * @since 1.0.0
247
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
248
-             */
249
-            public function __construct() {
250
-                $widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory'));
251
-                parent::__construct(
252
-                    'geodir_loginbox', // Base ID
253
-                    __('GD > Loginbox', 'geodirectory'), // Name
254
-                    $widget_ops// Args
255
-                );
256
-            }
257
-
258
-            /**
259
-             * Front-end display content for login widget.
260
-             *
261
-             * @since 1.0.0
262
-             * @since 1.5.1 Declare function public.
263
-             *
264
-             * @param array $args     Widget arguments.
265
-             * @param array $instance Saved values from database.
266
-             */
267
-            public function widget($args, $instance)
268
-            {
269
-                geodir_loginwidget_output($args, $instance);
270
-            }
271
-
272
-            /**
273
-             * Sanitize login widget form values as they are saved.
274
-             *
275
-             * @since 1.0.0
276
-             * @since 1.5.1 Declare function public.
277
-             *
278
-             * @param array $new_instance Values just sent to be saved.
279
-             * @param array $old_instance Previously saved values from database.
280
-             *
281
-             * @return array Updated safe values to be saved.
282
-             */
283
-            public function update($new_instance, $old_instance)
284
-            {
285
-                //save the widget
286
-                $instance = $old_instance;
287
-                $instance['title'] = strip_tags($new_instance['title']);
288
-
289
-                return $instance;
290
-            }
291
-
292
-            /**
293
-             * Back-end login widget settings form.
294
-             *
295
-             * @since 1.0.0
296
-             * @since 1.5.1 Declare function public.
297
-             *
298
-             * @param array $instance Previously saved values from database.
299
-             * @return string|void
300
-             */
301
-            public function form($instance)
302
-            {
303
-                //widgetform in backend
304
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
305
-                $title = strip_tags($instance['title']);
306
-
307
-                ?>
228
+	/**
229
+	 * Registers all Widgets.
230
+	 *
231
+	 * @since 1.0.0
232
+	 * @package GeoDirectory
233
+	 */
234
+	function register_geodir_widgets()
235
+	{
236
+		/**
237
+		 * Login Widget.
238
+		 *
239
+		 * @since 1.0.0
240
+		 */
241
+		class geodir_loginwidget extends WP_Widget
242
+		{
243
+			/**
244
+			 * Register the login widget with WordPress.
245
+			 *
246
+			 * @since 1.0.0
247
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
248
+			 */
249
+			public function __construct() {
250
+				$widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory'));
251
+				parent::__construct(
252
+					'geodir_loginbox', // Base ID
253
+					__('GD > Loginbox', 'geodirectory'), // Name
254
+					$widget_ops// Args
255
+				);
256
+			}
257
+
258
+			/**
259
+			 * Front-end display content for login widget.
260
+			 *
261
+			 * @since 1.0.0
262
+			 * @since 1.5.1 Declare function public.
263
+			 *
264
+			 * @param array $args     Widget arguments.
265
+			 * @param array $instance Saved values from database.
266
+			 */
267
+			public function widget($args, $instance)
268
+			{
269
+				geodir_loginwidget_output($args, $instance);
270
+			}
271
+
272
+			/**
273
+			 * Sanitize login widget form values as they are saved.
274
+			 *
275
+			 * @since 1.0.0
276
+			 * @since 1.5.1 Declare function public.
277
+			 *
278
+			 * @param array $new_instance Values just sent to be saved.
279
+			 * @param array $old_instance Previously saved values from database.
280
+			 *
281
+			 * @return array Updated safe values to be saved.
282
+			 */
283
+			public function update($new_instance, $old_instance)
284
+			{
285
+				//save the widget
286
+				$instance = $old_instance;
287
+				$instance['title'] = strip_tags($new_instance['title']);
288
+
289
+				return $instance;
290
+			}
291
+
292
+			/**
293
+			 * Back-end login widget settings form.
294
+			 *
295
+			 * @since 1.0.0
296
+			 * @since 1.5.1 Declare function public.
297
+			 *
298
+			 * @param array $instance Previously saved values from database.
299
+			 * @return string|void
300
+			 */
301
+			public function form($instance)
302
+			{
303
+				//widgetform in backend
304
+				$instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
305
+				$title = strip_tags($instance['title']);
306
+
307
+				?>
308 308
                 <p><label
309 309
                         for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'geodirectory'); ?>
310 310
                         : <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
@@ -313,64 +313,64 @@  discard block
 block discarded – undo
313 313
 
314 314
 
315 315
             <?php
316
-            }
317
-        }
318
-
319
-        register_widget('geodir_loginwidget');
320
-
321
-
322
-        /**
323
-         * GeoDirectory Social Like Widget.
324
-         *
325
-         * @since 1.0.0
326
-         */
327
-        class geodir_social_like_widget extends WP_Widget
328
-        {
329
-
330
-            /**
331
-             * Register the social like widget with WordPress.
332
-             *
333
-             * @since 1.0.0
334
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
335
-             */
336
-            public function __construct() {
337
-                $widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory'));
338
-                parent::__construct(
339
-                    'social_like_widget', // Base ID
340
-                    __('GD > Social Like', 'geodirectory'), // Name
341
-                    $widget_ops// Args
342
-                );
343
-            }
344
-
345
-            /**
346
-             * Front-end display content for social like widget.
347
-             *
348
-             * @since 1.0.0
349
-             * @since 1.5.1 Declare function public.
350
-             *
351
-             * @param array $args     Widget arguments.
352
-             * @param array $instance Saved values from database.
353
-             */
354
-            public function widget($args, $instance)
355
-            {
356
-                // prints the widget
357
-                extract($args, EXTR_SKIP);
358
-
359
-                /**
360
-                 * Filter the widget title text.
361
-                 *
362
-                 * @since 1.0.0
363
-                 * @global object $current_user Current user object.
364
-                 * @param string $title The widget title text.
365
-                 */
366
-                $title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
367
-
368
-                global $current_user, $post;
369
-                echo $before_widget;
370
-                ?>
316
+			}
317
+		}
318
+
319
+		register_widget('geodir_loginwidget');
320
+
321
+
322
+		/**
323
+		 * GeoDirectory Social Like Widget.
324
+		 *
325
+		 * @since 1.0.0
326
+		 */
327
+		class geodir_social_like_widget extends WP_Widget
328
+		{
329
+
330
+			/**
331
+			 * Register the social like widget with WordPress.
332
+			 *
333
+			 * @since 1.0.0
334
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
335
+			 */
336
+			public function __construct() {
337
+				$widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory'));
338
+				parent::__construct(
339
+					'social_like_widget', // Base ID
340
+					__('GD > Social Like', 'geodirectory'), // Name
341
+					$widget_ops// Args
342
+				);
343
+			}
344
+
345
+			/**
346
+			 * Front-end display content for social like widget.
347
+			 *
348
+			 * @since 1.0.0
349
+			 * @since 1.5.1 Declare function public.
350
+			 *
351
+			 * @param array $args     Widget arguments.
352
+			 * @param array $instance Saved values from database.
353
+			 */
354
+			public function widget($args, $instance)
355
+			{
356
+				// prints the widget
357
+				extract($args, EXTR_SKIP);
358
+
359
+				/**
360
+				 * Filter the widget title text.
361
+				 *
362
+				 * @since 1.0.0
363
+				 * @global object $current_user Current user object.
364
+				 * @param string $title The widget title text.
365
+				 */
366
+				$title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
367
+
368
+				global $current_user, $post;
369
+				echo $before_widget;
370
+				?>
371 371
 
372 372
                 <?php //if ( get_option('gd_tweet_button') ) {
373
-                ?>
373
+				?>
374 374
 
375 375
                 <a href="http://twitter.com/share"
376 376
                    class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a>
@@ -378,23 +378,23 @@  discard block
 block discarded – undo
378 378
                 <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
379 379
 
380 380
                 <?php //}
381
-                ?>
381
+				?>
382 382
 
383 383
                 <?php // if ( get_option('gd_facebook_button') ) {
384
-                ?>
384
+				?>
385 385
 
386 386
                 <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
387
-                    echo 'allowtransparency="true"';
388
-                }?> class="facebook"
387
+					echo 'allowtransparency="true"';
388
+				}?> class="facebook"
389 389
                     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(geodir_curPageURL()); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
390 390
                     style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
391 391
 
392 392
 
393 393
                 <?php //}
394
-                ?>
394
+				?>
395 395
 
396 396
                 <?php //if ( get_option('gd_google_button') ) {
397
-                ?>
397
+				?>
398 398
                 <script>
399 399
                     window.___gcfg = {
400 400
                         parsetags: 'explicit'
@@ -408,118 +408,118 @@  discard block
 block discarded – undo
408 408
                         "count": "true"
409 409
                     });</script>
410 410
                 <?php //}
411
-                echo $after_widget;
412
-
413
-            }
414
-
415
-            /**
416
-             * Sanitize social like widget form values as they are saved.
417
-             *
418
-             * @since 1.0.0
419
-             * @since 1.5.1 Declare function public.
420
-             *
421
-             * @param array $new_instance Values just sent to be saved.
422
-             * @param array $old_instance Previously saved values from database.
423
-             *
424
-             * @return array Updated safe values to be saved.
425
-             */
426
-            public function update($new_instance, $old_instance)
427
-            {
428
-                //save the widget
429
-                $instance = $old_instance;
430
-                $instance['title'] = strip_tags($new_instance['title']);
431
-                return $instance;
432
-            }
433
-
434
-            /**
435
-             * Back-end social like widget settings form.
436
-             *
437
-             * @since 1.0.0
438
-             * @since 1.5.1 Declare function public.
439
-             *
440
-             * @param array $instance Previously saved values from database.
441
-             * @return string|void
442
-             */
443
-            public function form($instance)
444
-            {
445
-                //widgetform in backend
446
-                $instance = wp_parse_args((array)$instance, array('title' => ''));
447
-                $title = strip_tags($instance['title']);
448
-                ?>
411
+				echo $after_widget;
412
+
413
+			}
414
+
415
+			/**
416
+			 * Sanitize social like widget form values as they are saved.
417
+			 *
418
+			 * @since 1.0.0
419
+			 * @since 1.5.1 Declare function public.
420
+			 *
421
+			 * @param array $new_instance Values just sent to be saved.
422
+			 * @param array $old_instance Previously saved values from database.
423
+			 *
424
+			 * @return array Updated safe values to be saved.
425
+			 */
426
+			public function update($new_instance, $old_instance)
427
+			{
428
+				//save the widget
429
+				$instance = $old_instance;
430
+				$instance['title'] = strip_tags($new_instance['title']);
431
+				return $instance;
432
+			}
433
+
434
+			/**
435
+			 * Back-end social like widget settings form.
436
+			 *
437
+			 * @since 1.0.0
438
+			 * @since 1.5.1 Declare function public.
439
+			 *
440
+			 * @param array $instance Previously saved values from database.
441
+			 * @return string|void
442
+			 */
443
+			public function form($instance)
444
+			{
445
+				//widgetform in backend
446
+				$instance = wp_parse_args((array)$instance, array('title' => ''));
447
+				$title = strip_tags($instance['title']);
448
+				?>
449 449
                 <p>No settings for this widget</p>
450 450
 
451 451
 
452 452
             <?php
453
-            }
454
-        }
455
-
456
-        register_widget('geodir_social_like_widget');
457
-
458
-
459
-        /**
460
-         * GeoDirectory Feedburner Subscribe widget.
461
-         *
462
-         * @since 1.0.0
463
-         */
464
-        class geodirsubscribeWidget extends WP_Widget
465
-        {
466
-
467
-            /**
468
-             * Register the feedburner subscribe widget with WordPress.
469
-             *
470
-             * @since 1.0.0
471
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
472
-             */
473
-            public function __construct() {
474
-                $widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory'));
475
-                parent::__construct(
476
-                    'widget_subscribeWidget', // Base ID
477
-                    __('GD > Subscribe', 'geodirectory'), // Name
478
-                    $widget_ops// Args
479
-                );
480
-            }
481
-
482
-            /**
483
-             * Front-end display content for feedburner subscribe widget.
484
-             *
485
-             * @since 1.0.0
486
-             * @since 1.5.1 Declare function public.
487
-             *
488
-             * @param array $args     Widget arguments.
489
-             * @param array $instance Saved values from database.
490
-             */
491
-            public function widget($args, $instance)
492
-            {
493
-                // prints the widget
494
-                extract($args, EXTR_SKIP);
495
-
496
-                /**
497
-                 * Filter the widget instance id.
498
-                 *
499
-                 * @since 1.0.0
500
-                 * @param string $id The widget instance id.
501
-                 */
502
-                $id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']);
503
-
504
-                /** This filter is documented in geodirectory_widgets.php */
505
-                $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
506
-
507
-                /**
508
-                 * Filter the widget text.
509
-                 *
510
-                 * @since 1.0.0
511
-                 * @param string $text The widget text.
512
-                 */
513
-                $text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']);
514
-
515
-                echo $before_widget;
516
-                ?>
453
+			}
454
+		}
455
+
456
+		register_widget('geodir_social_like_widget');
457
+
458
+
459
+		/**
460
+		 * GeoDirectory Feedburner Subscribe widget.
461
+		 *
462
+		 * @since 1.0.0
463
+		 */
464
+		class geodirsubscribeWidget extends WP_Widget
465
+		{
466
+
467
+			/**
468
+			 * Register the feedburner subscribe widget with WordPress.
469
+			 *
470
+			 * @since 1.0.0
471
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
472
+			 */
473
+			public function __construct() {
474
+				$widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory'));
475
+				parent::__construct(
476
+					'widget_subscribeWidget', // Base ID
477
+					__('GD > Subscribe', 'geodirectory'), // Name
478
+					$widget_ops// Args
479
+				);
480
+			}
481
+
482
+			/**
483
+			 * Front-end display content for feedburner subscribe widget.
484
+			 *
485
+			 * @since 1.0.0
486
+			 * @since 1.5.1 Declare function public.
487
+			 *
488
+			 * @param array $args     Widget arguments.
489
+			 * @param array $instance Saved values from database.
490
+			 */
491
+			public function widget($args, $instance)
492
+			{
493
+				// prints the widget
494
+				extract($args, EXTR_SKIP);
495
+
496
+				/**
497
+				 * Filter the widget instance id.
498
+				 *
499
+				 * @since 1.0.0
500
+				 * @param string $id The widget instance id.
501
+				 */
502
+				$id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']);
503
+
504
+				/** This filter is documented in geodirectory_widgets.php */
505
+				$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
506
+
507
+				/**
508
+				 * Filter the widget text.
509
+				 *
510
+				 * @since 1.0.0
511
+				 * @param string $text The widget text.
512
+				 */
513
+				$text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']);
514
+
515
+				echo $before_widget;
516
+				?>
517 517
 
518 518
                 <?php echo $before_title . $title; ?>  <a href="<?php if ($id) {
519
-                echo 'http://feeds2.feedburner.com/' . $id;
520
-            } else {
521
-                bloginfo('rss_url');
522
-            } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?>
519
+				echo 'http://feeds2.feedburner.com/' . $id;
520
+			} else {
521
+				bloginfo('rss_url');
522
+			} ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?>
523 523
 
524 524
                 <?php if ($text <> "") { ?>
525 525
 
@@ -544,57 +544,57 @@  discard block
 block discarded – undo
544 544
                 </form>
545 545
 
546 546
                 <?php
547
-                echo $after_widget;
547
+				echo $after_widget;
548 548
 
549
-            }
549
+			}
550 550
 
551
-            /**
552
-             * Sanitize feedburner subscribe widget form values as they are saved.
553
-             *
554
-             * @since 1.0.0
555
-             * @since 1.5.1 Declare function public.
556
-             *
557
-             * @param array $new_instance Values just sent to be saved.
558
-             * @param array $old_instance Previously saved values from database.
559
-             *
560
-             * @return array Updated safe values to be saved.
561
-             */
562
-            public function update($new_instance, $old_instance)
563
-            {
551
+			/**
552
+			 * Sanitize feedburner subscribe widget form values as they are saved.
553
+			 *
554
+			 * @since 1.0.0
555
+			 * @since 1.5.1 Declare function public.
556
+			 *
557
+			 * @param array $new_instance Values just sent to be saved.
558
+			 * @param array $old_instance Previously saved values from database.
559
+			 *
560
+			 * @return array Updated safe values to be saved.
561
+			 */
562
+			public function update($new_instance, $old_instance)
563
+			{
564 564
 
565
-                //save the widget
566
-                $instance = $old_instance;
567
-                $instance['id'] = strip_tags($new_instance['id']);
568
-                $instance['title'] = ($new_instance['title']);
569
-                $instance['text'] = ($new_instance['text']);
565
+				//save the widget
566
+				$instance = $old_instance;
567
+				$instance['id'] = strip_tags($new_instance['id']);
568
+				$instance['title'] = ($new_instance['title']);
569
+				$instance['text'] = ($new_instance['text']);
570 570
 
571 571
 
572
-                return $instance;
573
-            }
572
+				return $instance;
573
+			}
574 574
 
575
-            /**
576
-             * Back-end feedburner subscribe widget settings form.
577
-             *
578
-             * @since 1.0.0
579
-             * @since 1.5.1 Declare function public.
580
-             *
581
-             * @param array $instance Previously saved values from database.
582
-             * @return string|void
583
-             */
584
-            public function form($instance)
585
-            {
586
-                //widgetform in backend
587
-                $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
575
+			/**
576
+			 * Back-end feedburner subscribe widget settings form.
577
+			 *
578
+			 * @since 1.0.0
579
+			 * @since 1.5.1 Declare function public.
580
+			 *
581
+			 * @param array $instance Previously saved values from database.
582
+			 * @return string|void
583
+			 */
584
+			public function form($instance)
585
+			{
586
+				//widgetform in backend
587
+				$instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
588 588
 
589
-                $id = strip_tags($instance['id']);
589
+				$id = strip_tags($instance['id']);
590 590
 
591
-                $title = strip_tags($instance['title']);
591
+				$title = strip_tags($instance['title']);
592 592
 
593
-                $text = strip_tags($instance['text']);
593
+				$text = strip_tags($instance['text']);
594 594
 
595 595
 
596 596
 
597
-                ?>
597
+				?>
598 598
                 <p><label
599 599
                         for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>:
600 600
                         <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
@@ -613,101 +613,101 @@  discard block
 block discarded – undo
613 613
                                   name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label>
614 614
                 </p>
615 615
             <?php
616
-            }
617
-        }
618
-
619
-        register_widget('geodirsubscribeWidget');
620
-
621
-        /**
622
-         * GeoDirectory advertise widget.
623
-         *
624
-         * @since 1.0.0
625
-         */
626
-        class geodiradvtwidget extends WP_Widget
627
-        {
628
-
629
-            /**
630
-             * Register the advertise widget with WordPress.
631
-             *
632
-             * @since 1.0.0
633
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
634
-             */
635
-            public function __construct() {
636
-                $widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory'));
637
-                parent::__construct(
638
-                    'advtwidget', // Base ID
639
-                    __('GD > Advertise', 'geodirectory'), // Name
640
-                    $widget_ops// Args
641
-                );
642
-            }
643
-
644
-
645
-            /**
646
-             * Front-end display content for advertise widget.
647
-             *
648
-             * @since 1.0.0
649
-             * @since 1.5.1 Declare function public.
650
-             *
651
-             * @param array $args     Widget arguments.
652
-             * @param array $instance Saved values from database.
653
-             */
654
-            public function widget($args, $instance)
655
-            {
656
-
657
-                // prints the widget
658
-
659
-                extract($args, EXTR_SKIP);
660
-
661
-                /**
662
-                 * Filter the description text.
663
-                 *
664
-                 * @since 1.0.0
665
-                 * @param string $desc1 The widget description text.
666
-                 */
667
-                $desc1 = empty($instance['desc1']) ? '&nbsp;' : apply_filters('widget_desc1', $instance['desc1']);
668
-                echo $before_widget;
669
-                ?>
616
+			}
617
+		}
618
+
619
+		register_widget('geodirsubscribeWidget');
620
+
621
+		/**
622
+		 * GeoDirectory advertise widget.
623
+		 *
624
+		 * @since 1.0.0
625
+		 */
626
+		class geodiradvtwidget extends WP_Widget
627
+		{
628
+
629
+			/**
630
+			 * Register the advertise widget with WordPress.
631
+			 *
632
+			 * @since 1.0.0
633
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
634
+			 */
635
+			public function __construct() {
636
+				$widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory'));
637
+				parent::__construct(
638
+					'advtwidget', // Base ID
639
+					__('GD > Advertise', 'geodirectory'), // Name
640
+					$widget_ops// Args
641
+				);
642
+			}
643
+
644
+
645
+			/**
646
+			 * Front-end display content for advertise widget.
647
+			 *
648
+			 * @since 1.0.0
649
+			 * @since 1.5.1 Declare function public.
650
+			 *
651
+			 * @param array $args     Widget arguments.
652
+			 * @param array $instance Saved values from database.
653
+			 */
654
+			public function widget($args, $instance)
655
+			{
656
+
657
+				// prints the widget
658
+
659
+				extract($args, EXTR_SKIP);
660
+
661
+				/**
662
+				 * Filter the description text.
663
+				 *
664
+				 * @since 1.0.0
665
+				 * @param string $desc1 The widget description text.
666
+				 */
667
+				$desc1 = empty($instance['desc1']) ? '&nbsp;' : apply_filters('widget_desc1', $instance['desc1']);
668
+				echo $before_widget;
669
+				?>
670 670
                 <?php if ($desc1 <> "") { ?>
671 671
                 <?php echo $desc1; ?>
672 672
             <?php }
673
-                echo $after_widget;
674
-            }
675
-
676
-            /**
677
-             * Sanitize advertise widget form values as they are saved.
678
-             *
679
-             * @since 1.0.0
680
-             * @since 1.5.1 Declare function public.
681
-             *
682
-             * @param array $new_instance Values just sent to be saved.
683
-             * @param array $old_instance Previously saved values from database.
684
-             *
685
-             * @return array Updated safe values to be saved.
686
-             */
687
-            public function update($new_instance, $old_instance)
688
-            {
689
-                //save the widget
690
-                $instance = $old_instance;
691
-                $instance['desc1'] = ($new_instance['desc1']);
692
-                return $instance;
693
-            }
694
-
695
-            /**
696
-             * Back-end advertise widget settings form.
697
-             *
698
-             * @since 1.0.0
699
-             * @since 1.5.1 Declare function public.
700
-             *
701
-             * @param array $instance Previously saved values from database.
702
-             * @return string|void
703
-             */
704
-            public function form($instance)
705
-            {
706
-                //widgetform in backend
707
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
708
-
709
-                $desc1 = ($instance['desc1']);
710
-                ?>
673
+				echo $after_widget;
674
+			}
675
+
676
+			/**
677
+			 * Sanitize advertise widget form values as they are saved.
678
+			 *
679
+			 * @since 1.0.0
680
+			 * @since 1.5.1 Declare function public.
681
+			 *
682
+			 * @param array $new_instance Values just sent to be saved.
683
+			 * @param array $old_instance Previously saved values from database.
684
+			 *
685
+			 * @return array Updated safe values to be saved.
686
+			 */
687
+			public function update($new_instance, $old_instance)
688
+			{
689
+				//save the widget
690
+				$instance = $old_instance;
691
+				$instance['desc1'] = ($new_instance['desc1']);
692
+				return $instance;
693
+			}
694
+
695
+			/**
696
+			 * Back-end advertise widget settings form.
697
+			 *
698
+			 * @since 1.0.0
699
+			 * @since 1.5.1 Declare function public.
700
+			 *
701
+			 * @param array $instance Previously saved values from database.
702
+			 * @return string|void
703
+			 */
704
+			public function form($instance)
705
+			{
706
+				//widgetform in backend
707
+				$instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
708
+
709
+				$desc1 = ($instance['desc1']);
710
+				?>
711 711
                 <p><label
712 712
                         for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?>
713 713
                         <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>"
@@ -715,65 +715,65 @@  discard block
 block discarded – undo
715 715
                 </p>
716 716
 
717 717
             <?php
718
-            }
719
-        }
720
-
721
-        register_widget('geodiradvtwidget');
722
-
723
-        /**
724
-         * GeoDirectory Flickr widget.
725
-         *
726
-         * @since 1.0.0
727
-         */
728
-        class GeodirFlickrWidget extends WP_Widget
729
-        {
730
-
731
-            /**
732
-             * Register the flickr widget with WordPress.
733
-             *
734
-             * @since 1.0.0
735
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
736
-             */
737
-            public function __construct() {
738
-                $widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory'));
739
-                parent::__construct(
740
-                    'widget_flickrwidget', // Base ID
741
-                    __('GD > Flickr Photos', 'geodirectory'), // Name
742
-                    $widget_ops// Args
743
-                );
744
-            }
745
-
746
-            /**
747
-             * Front-end display content for flickr widget.
748
-             *
749
-             * @since 1.0.0
750
-             * @since 1.5.1 Declare function public.
751
-             *
752
-             * @param array $args     Widget arguments.
753
-             * @param array $instance Saved values from database.
754
-             */
755
-            public function widget($args, $instance)
756
-            {
757
-
758
-                // prints the widget
759
-                extract($args, EXTR_SKIP);
760
-
761
-                echo $before_widget;
762
-
763
-                /** This filter is documented in geodirectory_widgets.php */
764
-                $id = empty($instance['id']) ? '&nbsp;' : apply_filters('widget_id', $instance['id']);
765
-
766
-                /**
767
-                 * Filter the widget number.
768
-                 *
769
-                 * This is used in the flicker widget to show how many images to show.
770
-                 *
771
-                 * @since 1.0.0
772
-                 * @param string $number The image count.
773
-                 */
774
-                $number = empty($instance['number']) ? '&nbsp;' : apply_filters('widget_number', $instance['number']);
775
-                echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title;
776
-                ?>
718
+			}
719
+		}
720
+
721
+		register_widget('geodiradvtwidget');
722
+
723
+		/**
724
+		 * GeoDirectory Flickr widget.
725
+		 *
726
+		 * @since 1.0.0
727
+		 */
728
+		class GeodirFlickrWidget extends WP_Widget
729
+		{
730
+
731
+			/**
732
+			 * Register the flickr widget with WordPress.
733
+			 *
734
+			 * @since 1.0.0
735
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
736
+			 */
737
+			public function __construct() {
738
+				$widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory'));
739
+				parent::__construct(
740
+					'widget_flickrwidget', // Base ID
741
+					__('GD > Flickr Photos', 'geodirectory'), // Name
742
+					$widget_ops// Args
743
+				);
744
+			}
745
+
746
+			/**
747
+			 * Front-end display content for flickr widget.
748
+			 *
749
+			 * @since 1.0.0
750
+			 * @since 1.5.1 Declare function public.
751
+			 *
752
+			 * @param array $args     Widget arguments.
753
+			 * @param array $instance Saved values from database.
754
+			 */
755
+			public function widget($args, $instance)
756
+			{
757
+
758
+				// prints the widget
759
+				extract($args, EXTR_SKIP);
760
+
761
+				echo $before_widget;
762
+
763
+				/** This filter is documented in geodirectory_widgets.php */
764
+				$id = empty($instance['id']) ? '&nbsp;' : apply_filters('widget_id', $instance['id']);
765
+
766
+				/**
767
+				 * Filter the widget number.
768
+				 *
769
+				 * This is used in the flicker widget to show how many images to show.
770
+				 *
771
+				 * @since 1.0.0
772
+				 * @param string $number The image count.
773
+				 */
774
+				$number = empty($instance['number']) ? '&nbsp;' : apply_filters('widget_number', $instance['number']);
775
+				echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title;
776
+				?>
777 777
 
778 778
                 <div class="geodir-flickr clearfix">
779 779
 
@@ -784,45 +784,45 @@  discard block
 block discarded – undo
784 784
 
785 785
 
786 786
                 <?php echo $after_widget;
787
-            }
788
-
789
-            /**
790
-             * Sanitize flickr widget form values as they are saved.
791
-             *
792
-             * @since 1.0.0
793
-             * @since 1.5.1 Declare function public.
794
-             *
795
-             * @param array $new_instance Values just sent to be saved.
796
-             * @param array $old_instance Previously saved values from database.
797
-             *
798
-             * @return array Updated safe values to be saved.
799
-             */
800
-            public function update($new_instance, $old_instance)
801
-            {
802
-                //save the widget
803
-                $instance = $old_instance;
804
-                $instance['id'] = strip_tags($new_instance['id']);
805
-                $instance['number'] = strip_tags($new_instance['number']);
806
-                return $instance;
807
-            }
808
-
809
-            /**
810
-             * Back-end flickr widget settings form.
811
-             *
812
-             * @since 1.0.0
813
-             * @since 1.5.1 Declare function public.
814
-             *
815
-             * @param array $instance Previously saved values from database.
816
-             * @return string|void
817
-             */
818
-            public function form($instance)
819
-            {
820
-
821
-                //widgetform in backend
822
-                $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
823
-                $id = strip_tags($instance['id']);
824
-                $number = strip_tags($instance['number']);
825
-                ?>
787
+			}
788
+
789
+			/**
790
+			 * Sanitize flickr widget form values as they are saved.
791
+			 *
792
+			 * @since 1.0.0
793
+			 * @since 1.5.1 Declare function public.
794
+			 *
795
+			 * @param array $new_instance Values just sent to be saved.
796
+			 * @param array $old_instance Previously saved values from database.
797
+			 *
798
+			 * @return array Updated safe values to be saved.
799
+			 */
800
+			public function update($new_instance, $old_instance)
801
+			{
802
+				//save the widget
803
+				$instance = $old_instance;
804
+				$instance['id'] = strip_tags($new_instance['id']);
805
+				$instance['number'] = strip_tags($new_instance['number']);
806
+				return $instance;
807
+			}
808
+
809
+			/**
810
+			 * Back-end flickr widget settings form.
811
+			 *
812
+			 * @since 1.0.0
813
+			 * @since 1.5.1 Declare function public.
814
+			 *
815
+			 * @param array $instance Previously saved values from database.
816
+			 * @return string|void
817
+			 */
818
+			public function form($instance)
819
+			{
820
+
821
+				//widgetform in backend
822
+				$instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
823
+				$id = strip_tags($instance['id']);
824
+				$number = strip_tags($instance['number']);
825
+				?>
826 826
 
827 827
                 <p>
828 828
                     <label
@@ -843,99 +843,99 @@  discard block
 block discarded – undo
843 843
                     </label>
844 844
                 </p>
845 845
             <?php
846
-            }
847
-        }
848
-
849
-        register_widget('GeodirFlickrWidget');
850
-
851
-        /**
852
-         * GeoDirectory Twitter widget.
853
-         *
854
-         * @since 1.0.0
855
-         */
856
-        class geodir_twitter extends WP_Widget
857
-        {
858
-            /**
859
-             * Register the Twitter widget with WordPress.
860
-             *
861
-             * @since 1.0.0
862
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
863
-             */
864
-            public function __construct() {
865
-                $widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory'));
866
-                parent::__construct(
867
-                    'widget_Twidget', // Base ID
868
-                    __('GD > Twitter', 'geodirectory'), // Name
869
-                    $widget_ops// Args
870
-                );
871
-            }
872
-
873
-
874
-            /**
875
-             * Front-end display content for Twitter widget.
876
-             *
877
-             * @since 1.0.0
878
-             * @since 1.5.1 Declare function public.
879
-             *
880
-             * @param array $args     Widget arguments.
881
-             * @param array $instance Saved values from database.
882
-             */
883
-            public function widget($args, $instance)
884
-            {
885
-
886
-                // prints the widget
887
-
888
-                extract($args, EXTR_SKIP);
889
-
890
-                /**
891
-                 * Filter the twitter widget description text.
892
-                 *
893
-                 * @since 1.0.0
894
-                 * @param string $desc1 The widget description text.
895
-                 */
896
-                $desc1 = empty($instance['gd_tw_desc1']) ? '&nbsp;' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']);
897
-                echo $before_widget;
898
-                if ($desc1 <> "") {
899
-                    echo $desc1;
900
-                }
901
-                echo $after_widget;
902
-            }
903
-
904
-            /**
905
-             * Sanitize twitter widget form values as they are saved.
906
-             *
907
-             * @since 1.0.0
908
-             * @since 1.5.1 Declare function public.
909
-             *
910
-             * @param array $new_instance Values just sent to be saved.
911
-             * @param array $old_instance Previously saved values from database.
912
-             *
913
-             * @return array Updated safe values to be saved.
914
-             */
915
-            public function update($new_instance, $old_instance)
916
-            {
917
-                //save the widget
918
-                $instance = $old_instance;
919
-                $instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']);
920
-                return $instance;
921
-            }
922
-
923
-            /**
924
-             * Back-end twitter widget settings form.
925
-             *
926
-             * @since 1.0.0
927
-             * @since 1.5.1 Declare function public.
928
-             *
929
-             * @param array $instance Previously saved values from database.
930
-             * @return string|void
931
-             */
932
-            public function form($instance)
933
-            {
934
-                //widgetform in backend
935
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
936
-
937
-                $desc1 = ($instance['gd_tw_desc1']);
938
-                ?>
846
+			}
847
+		}
848
+
849
+		register_widget('GeodirFlickrWidget');
850
+
851
+		/**
852
+		 * GeoDirectory Twitter widget.
853
+		 *
854
+		 * @since 1.0.0
855
+		 */
856
+		class geodir_twitter extends WP_Widget
857
+		{
858
+			/**
859
+			 * Register the Twitter widget with WordPress.
860
+			 *
861
+			 * @since 1.0.0
862
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
863
+			 */
864
+			public function __construct() {
865
+				$widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory'));
866
+				parent::__construct(
867
+					'widget_Twidget', // Base ID
868
+					__('GD > Twitter', 'geodirectory'), // Name
869
+					$widget_ops// Args
870
+				);
871
+			}
872
+
873
+
874
+			/**
875
+			 * Front-end display content for Twitter widget.
876
+			 *
877
+			 * @since 1.0.0
878
+			 * @since 1.5.1 Declare function public.
879
+			 *
880
+			 * @param array $args     Widget arguments.
881
+			 * @param array $instance Saved values from database.
882
+			 */
883
+			public function widget($args, $instance)
884
+			{
885
+
886
+				// prints the widget
887
+
888
+				extract($args, EXTR_SKIP);
889
+
890
+				/**
891
+				 * Filter the twitter widget description text.
892
+				 *
893
+				 * @since 1.0.0
894
+				 * @param string $desc1 The widget description text.
895
+				 */
896
+				$desc1 = empty($instance['gd_tw_desc1']) ? '&nbsp;' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']);
897
+				echo $before_widget;
898
+				if ($desc1 <> "") {
899
+					echo $desc1;
900
+				}
901
+				echo $after_widget;
902
+			}
903
+
904
+			/**
905
+			 * Sanitize twitter widget form values as they are saved.
906
+			 *
907
+			 * @since 1.0.0
908
+			 * @since 1.5.1 Declare function public.
909
+			 *
910
+			 * @param array $new_instance Values just sent to be saved.
911
+			 * @param array $old_instance Previously saved values from database.
912
+			 *
913
+			 * @return array Updated safe values to be saved.
914
+			 */
915
+			public function update($new_instance, $old_instance)
916
+			{
917
+				//save the widget
918
+				$instance = $old_instance;
919
+				$instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']);
920
+				return $instance;
921
+			}
922
+
923
+			/**
924
+			 * Back-end twitter widget settings form.
925
+			 *
926
+			 * @since 1.0.0
927
+			 * @since 1.5.1 Declare function public.
928
+			 *
929
+			 * @param array $instance Previously saved values from database.
930
+			 * @return string|void
931
+			 */
932
+			public function form($instance)
933
+			{
934
+				//widgetform in backend
935
+				$instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
936
+
937
+				$desc1 = ($instance['gd_tw_desc1']);
938
+				?>
939 939
                 <p><label
940 940
                         for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?>
941 941
                         <textarea class="widefat" rows="6" cols="20"
@@ -944,179 +944,179 @@  discard block
 block discarded – undo
944 944
                 </p>
945 945
 
946 946
             <?php
947
-            }
948
-        }
949
-
950
-        register_widget('geodir_twitter');
951
-
952
-        /**
953
-         * GeoDirectory Advanced Search widget.
954
-         *
955
-         * @since 1.0.0
956
-         */
957
-        class geodir_advance_search_widget extends WP_Widget
958
-        {
959
-            /**
960
-             * Register the advanced search widget with WordPress.
961
-             *
962
-             * @since 1.0.0
963
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
964
-             */
965
-            public function __construct() {
966
-                $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>'');
967
-                parent::__construct(
968
-                    'geodir_advance_search', // Base ID
969
-                    __('GD > Search', 'geodirectory'), // Name
970
-                    $widget_ops// Args
971
-                );
972
-            }
973
-
974
-
975
-            /**
976
-             * Front-end display content for advanced search widget.
977
-             *
978
-             * @since 1.0.0
979
-             * @since 1.5.1 Declare function public.
980
-             *
981
-             * @param array $args     Widget arguments.
982
-             * @param array $instance Saved values from database.
983
-             */
984
-            public function widget($args, $instance)
985
-            {
986
-                /**
987
-                 * Filter the search widget arguments.
988
-                 *
989
-                 * @since 1.5.7
990
-                 * @param array $args The widget arguments.
991
-                 * @param array $instance The widget instance.
992
-                 */
993
-                $args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
994
-
995
-                // prints the widget
996
-                extract($args, EXTR_SKIP);
997
-
998
-                if(isset($post_type) && $post_type){
999
-                    geodir_get_search_post_type($post_type);// set the post type
1000
-                }else{
1001
-                    geodir_get_search_post_type();// set the post type
1002
-                }
1003
-
1004
-                echo $before_widget;
1005
-
1006
-                /** This filter is documented in geodirectory_widgets.php */
1007
-                $title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
1008
-
1009
-                geodir_get_template_part('listing', 'filter-form');
1010
-
1011
-                echo $after_widget;
1012
-
1013
-                // after outputing the search reset the CPT
1014
-                global $geodir_search_post_type;
1015
-                $geodir_search_post_type = '';
1016
-            }
1017
-
1018
-            /**
1019
-             * Sanitize advanced search widget form values as they are saved.
1020
-             *
1021
-             * @since 1.0.0
1022
-             * @since 1.5.1 Declare function public.
1023
-             *
1024
-             * @param array $new_instance Values just sent to be saved.
1025
-             * @param array $old_instance Previously saved values from database.
1026
-             *
1027
-             * @return array Updated safe values to be saved.
1028
-             */
1029
-            public function update($new_instance, $old_instance)
1030
-            {
1031
-                //save the widget
1032
-                //Nothing to save
1033
-                return isset($instance) ? $instance : array();
1034
-            }
1035
-
1036
-            /**
1037
-             * Back-end advanced search widget settings form.
1038
-             *
1039
-             * @since 1.0.0
1040
-             * @since 1.5.1 Declare function public.
1041
-             *
1042
-             * @param array $instance Previously saved values from database.
1043
-             * @return string|void
1044
-             */
1045
-            public function form($instance)
1046
-            {
1047
-                //widgetform in backend
1048
-                echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory');
1049
-            }
1050
-        }
1051
-
1052
-        register_widget('geodir_advance_search_widget');
1053
-
1054
-
1055
-        /**
1056
-         * Contains all functions for popular widget.
1057
-         *
1058
-         * @since 1.0.0
1059
-         * @package GeoDirectory
1060
-         */
1061
-        include_once('geodirectory-widgets/geodirectory_popular_widget.php');
1062
-        /**
1063
-         * Contains all functions for listing slider widget.
1064
-         *
1065
-         * @since 1.0.0
1066
-         * @package GeoDirectory
1067
-         */
1068
-        include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php');
1069
-        /**
1070
-         * Contains all functions for home map widget.
1071
-         *
1072
-         * @since 1.0.0
1073
-         * @package GeoDirectory
1074
-         */
1075
-        include_once('geodirectory-widgets/home_map_widget.php');
1076
-        /**
1077
-         * Contains all functions for listing map widget.
1078
-         *
1079
-         * @since 1.0.0
1080
-         * @package GeoDirectory
1081
-         */
1082
-        include_once('geodirectory-widgets/listing_map_widget.php');
1083
-        /**
1084
-         * Contains all functions for reviews widget.
1085
-         *
1086
-         * @since 1.0.0
1087
-         * @package GeoDirectory
1088
-         */
1089
-        include_once('geodirectory-widgets/geodirectory_reviews_widget.php');
1090
-        /**
1091
-         * Contains all functions for related listing widget.
1092
-         *
1093
-         * @since 1.0.0
1094
-         * @package GeoDirectory
1095
-         */
1096
-        include_once('geodirectory-widgets/geodirectory_related_listing_widget.php');
1097
-        /**
1098
-         * Contains all functions for bestof widget.
1099
-         *
1100
-         * @since 1.0.0
1101
-         * @package GeoDirectory
1102
-         */
1103
-        include_once('geodirectory-widgets/geodirectory_bestof_widget.php');
947
+			}
948
+		}
949
+
950
+		register_widget('geodir_twitter');
951
+
952
+		/**
953
+		 * GeoDirectory Advanced Search widget.
954
+		 *
955
+		 * @since 1.0.0
956
+		 */
957
+		class geodir_advance_search_widget extends WP_Widget
958
+		{
959
+			/**
960
+			 * Register the advanced search widget with WordPress.
961
+			 *
962
+			 * @since 1.0.0
963
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
964
+			 */
965
+			public function __construct() {
966
+				$widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>'');
967
+				parent::__construct(
968
+					'geodir_advance_search', // Base ID
969
+					__('GD > Search', 'geodirectory'), // Name
970
+					$widget_ops// Args
971
+				);
972
+			}
973
+
974
+
975
+			/**
976
+			 * Front-end display content for advanced search widget.
977
+			 *
978
+			 * @since 1.0.0
979
+			 * @since 1.5.1 Declare function public.
980
+			 *
981
+			 * @param array $args     Widget arguments.
982
+			 * @param array $instance Saved values from database.
983
+			 */
984
+			public function widget($args, $instance)
985
+			{
986
+				/**
987
+				 * Filter the search widget arguments.
988
+				 *
989
+				 * @since 1.5.7
990
+				 * @param array $args The widget arguments.
991
+				 * @param array $instance The widget instance.
992
+				 */
993
+				$args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
994
+
995
+				// prints the widget
996
+				extract($args, EXTR_SKIP);
997
+
998
+				if(isset($post_type) && $post_type){
999
+					geodir_get_search_post_type($post_type);// set the post type
1000
+				}else{
1001
+					geodir_get_search_post_type();// set the post type
1002
+				}
1003
+
1004
+				echo $before_widget;
1005
+
1006
+				/** This filter is documented in geodirectory_widgets.php */
1007
+				$title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
1008
+
1009
+				geodir_get_template_part('listing', 'filter-form');
1010
+
1011
+				echo $after_widget;
1012
+
1013
+				// after outputing the search reset the CPT
1014
+				global $geodir_search_post_type;
1015
+				$geodir_search_post_type = '';
1016
+			}
1017
+
1018
+			/**
1019
+			 * Sanitize advanced search widget form values as they are saved.
1020
+			 *
1021
+			 * @since 1.0.0
1022
+			 * @since 1.5.1 Declare function public.
1023
+			 *
1024
+			 * @param array $new_instance Values just sent to be saved.
1025
+			 * @param array $old_instance Previously saved values from database.
1026
+			 *
1027
+			 * @return array Updated safe values to be saved.
1028
+			 */
1029
+			public function update($new_instance, $old_instance)
1030
+			{
1031
+				//save the widget
1032
+				//Nothing to save
1033
+				return isset($instance) ? $instance : array();
1034
+			}
1035
+
1036
+			/**
1037
+			 * Back-end advanced search widget settings form.
1038
+			 *
1039
+			 * @since 1.0.0
1040
+			 * @since 1.5.1 Declare function public.
1041
+			 *
1042
+			 * @param array $instance Previously saved values from database.
1043
+			 * @return string|void
1044
+			 */
1045
+			public function form($instance)
1046
+			{
1047
+				//widgetform in backend
1048
+				echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory');
1049
+			}
1050
+		}
1051
+
1052
+		register_widget('geodir_advance_search_widget');
1053
+
1054
+
1055
+		/**
1056
+		 * Contains all functions for popular widget.
1057
+		 *
1058
+		 * @since 1.0.0
1059
+		 * @package GeoDirectory
1060
+		 */
1061
+		include_once('geodirectory-widgets/geodirectory_popular_widget.php');
1062
+		/**
1063
+		 * Contains all functions for listing slider widget.
1064
+		 *
1065
+		 * @since 1.0.0
1066
+		 * @package GeoDirectory
1067
+		 */
1068
+		include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php');
1069
+		/**
1070
+		 * Contains all functions for home map widget.
1071
+		 *
1072
+		 * @since 1.0.0
1073
+		 * @package GeoDirectory
1074
+		 */
1075
+		include_once('geodirectory-widgets/home_map_widget.php');
1076
+		/**
1077
+		 * Contains all functions for listing map widget.
1078
+		 *
1079
+		 * @since 1.0.0
1080
+		 * @package GeoDirectory
1081
+		 */
1082
+		include_once('geodirectory-widgets/listing_map_widget.php');
1083
+		/**
1084
+		 * Contains all functions for reviews widget.
1085
+		 *
1086
+		 * @since 1.0.0
1087
+		 * @package GeoDirectory
1088
+		 */
1089
+		include_once('geodirectory-widgets/geodirectory_reviews_widget.php');
1090
+		/**
1091
+		 * Contains all functions for related listing widget.
1092
+		 *
1093
+		 * @since 1.0.0
1094
+		 * @package GeoDirectory
1095
+		 */
1096
+		include_once('geodirectory-widgets/geodirectory_related_listing_widget.php');
1097
+		/**
1098
+		 * Contains all functions for bestof widget.
1099
+		 *
1100
+		 * @since 1.0.0
1101
+		 * @package GeoDirectory
1102
+		 */
1103
+		include_once('geodirectory-widgets/geodirectory_bestof_widget.php');
1104
+		/**
1105
+		 * Contains all functions for cpt categories widget.
1106
+		 *
1107
+		 * @since 1.5.4
1108
+		 * @package GeoDirectory
1109
+		 */
1110
+		include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php');
1104 1111
 		/**
1105
-         * Contains all functions for cpt categories widget.
1106
-         *
1107
-         * @since 1.5.4
1108
-         * @package GeoDirectory
1109
-         */
1110
-        include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php');
1111
-        /**
1112
-         * Contains all functions for features widget.
1113
-         *
1114
-         * @since 1.5.6
1115
-         * @package GeoDirectory
1116
-         * @todo make the image field recurring
1117
-         */
1118
-        include_once('geodirectory-widgets/geodirectory_features_widget.php');
1119
-    }
1112
+		 * Contains all functions for features widget.
1113
+		 *
1114
+		 * @since 1.5.6
1115
+		 * @package GeoDirectory
1116
+		 * @todo make the image field recurring
1117
+		 */
1118
+		include_once('geodirectory-widgets/geodirectory_features_widget.php');
1119
+	}
1120 1120
 
1121 1121
 }
1122 1122
 
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
             public function form($instance)
302 302
             {
303 303
                 //widgetform in backend
304
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
304
+                $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
305 305
                 $title = strip_tags($instance['title']);
306 306
 
307 307
                 ?>
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
                 ?>
374 374
 
375 375
                 <a href="http://twitter.com/share"
376
-                   class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a>
376
+                   class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
377 377
 
378 378
                 <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
379 379
 
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
             public function form($instance)
444 444
             {
445 445
                 //widgetform in backend
446
-                $instance = wp_parse_args((array)$instance, array('title' => ''));
446
+                $instance = wp_parse_args((array) $instance, array('title' => ''));
447 447
                 $title = strip_tags($instance['title']);
448 448
                 ?>
449 449
                 <p>No settings for this widget</p>
@@ -515,11 +515,11 @@  discard block
 block discarded – undo
515 515
                 echo $before_widget;
516 516
                 ?>
517 517
 
518
-                <?php echo $before_title . $title; ?>  <a href="<?php if ($id) {
519
-                echo 'http://feeds2.feedburner.com/' . $id;
518
+                <?php echo $before_title.$title; ?>  <a href="<?php if ($id) {
519
+                echo 'http://feeds2.feedburner.com/'.$id;
520 520
             } else {
521 521
                 bloginfo('rss_url');
522
-            } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?>
522
+            } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title; ?>
523 523
 
524 524
                 <?php if ($text <> "") { ?>
525 525
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
             public function form($instance)
585 585
             {
586 586
                 //widgetform in backend
587
-                $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
587
+                $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
588 588
 
589 589
                 $id = strip_tags($instance['id']);
590 590
 
@@ -596,19 +596,19 @@  discard block
 block discarded – undo
596 596
 
597 597
                 ?>
598 598
                 <p><label
599
-                        for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>:
599
+                        for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory'); ?>:
600 600
                         <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
601 601
                                name="<?php echo $this->get_field_name('title'); ?>" type="text"
602 602
                                value="<?php echo esc_attr($title); ?>"/></label></p>
603 603
 
604 604
                 <p><label
605
-                        for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory');?>
605
+                        for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory'); ?>
606 606
                         : <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>"
607 607
                                  name="<?php echo $this->get_field_name('id'); ?>" type="text"
608 608
                                  value="<?php echo esc_attr($id); ?>"/></label></p>
609 609
 
610 610
                 <p><label
611
-                        for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory');?>
611
+                        for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory'); ?>
612 612
                         <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('text'); ?>"
613 613
                                   name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label>
614 614
                 </p>
@@ -704,12 +704,12 @@  discard block
 block discarded – undo
704 704
             public function form($instance)
705 705
             {
706 706
                 //widgetform in backend
707
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
707
+                $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
708 708
 
709 709
                 $desc1 = ($instance['desc1']);
710 710
                 ?>
711 711
                 <p><label
712
-                        for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?>
712
+                        for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory'); ?>
713 713
                         <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>"
714 714
                                   name="<?php echo $this->get_field_name('desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label>
715 715
                 </p>
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
                  * @param string $number The image count.
773 773
                  */
774 774
                 $number = empty($instance['number']) ? '&nbsp;' : apply_filters('widget_number', $instance['number']);
775
-                echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title;
775
+                echo $before_title.__('Photo Gallery', 'geodirectory').$after_title;
776 776
                 ?>
777 777
 
778 778
                 <div class="geodir-flickr clearfix">
@@ -819,14 +819,14 @@  discard block
 block discarded – undo
819 819
             {
820 820
 
821 821
                 //widgetform in backend
822
-                $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
822
+                $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'number' => ''));
823 823
                 $id = strip_tags($instance['id']);
824 824
                 $number = strip_tags($instance['number']);
825 825
                 ?>
826 826
 
827 827
                 <p>
828 828
                     <label
829
-                        for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory');?>
829
+                        for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory'); ?>
830 830
                         (<a href="http://www.idgettr.com">idGettr</a>):
831 831
                         <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>"
832 832
                                name="<?php echo $this->get_field_name('id'); ?>" type="text"
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
 
837 837
                 <p>
838 838
                     <label
839
-                        for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory');?>
839
+                        for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory'); ?>
840 840
                         <input class="widefat" id="<?php echo $this->get_field_id('number'); ?>"
841 841
                                name="<?php echo $this->get_field_name('number'); ?>" type="text"
842 842
                                value="<?php echo esc_attr($number); ?>"/>
@@ -932,12 +932,12 @@  discard block
 block discarded – undo
932 932
             public function form($instance)
933 933
             {
934 934
                 //widgetform in backend
935
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
935
+                $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
936 936
 
937 937
                 $desc1 = ($instance['gd_tw_desc1']);
938 938
                 ?>
939 939
                 <p><label
940
-                        for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?>
940
+                        for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory'); ?>
941 941
                         <textarea class="widefat" rows="6" cols="20"
942 942
                                   id="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"
943 943
                                   name="<?php echo $this->get_field_name('gd_tw_desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label>
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
              * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
964 964
              */
965 965
             public function __construct() {
966
-                $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>'');
966
+                $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'), 'post_type'=>'');
967 967
                 parent::__construct(
968 968
                     'geodir_advance_search', // Base ID
969 969
                     __('GD > Search', 'geodirectory'), // Name
@@ -990,15 +990,15 @@  discard block
 block discarded – undo
990 990
                  * @param array $args The widget arguments.
991 991
                  * @param array $instance The widget instance.
992 992
                  */
993
-                $args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
993
+                $args = apply_filters('widget_geodir_advance_search_args', $args, $instance);
994 994
 
995 995
                 // prints the widget
996 996
                 extract($args, EXTR_SKIP);
997 997
 
998
-                if(isset($post_type) && $post_type){
999
-                    geodir_get_search_post_type($post_type);// set the post type
1000
-                }else{
1001
-                    geodir_get_search_post_type();// set the post type
998
+                if (isset($post_type) && $post_type) {
999
+                    geodir_get_search_post_type($post_type); // set the post type
1000
+                } else {
1001
+                    geodir_get_search_post_type(); // set the post type
1002 1002
                 }
1003 1003
 
1004 1004
                 echo $before_widget;
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -997,7 +997,7 @@
 block discarded – undo
997 997
 
998 998
                 if(isset($post_type) && $post_type){
999 999
                     geodir_get_search_post_type($post_type);// set the post type
1000
-                }else{
1000
+                } else{
1001 1001
                     geodir_get_search_post_type();// set the post type
1002 1002
                 }
1003 1003
 
Please login to merge, or discard this patch.