Test Failed
Push — master ( d1dc8e...305a97 )
by Stiofan
09:28
created
geodirectory-functions/custom_fields_input_functions.php 1 patch
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.
geodirectory-functions/custom_fields_functions.php 1 patch
Braces   +120 added lines, -79 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
 
@@ -1204,8 +1224,9 @@  discard block
 block discarded – undo
1204 1224
     if (is_admin()) {
1205 1225
         global $post,$gd_session;
1206 1226
 
1207
-        if (isset($_REQUEST['post']))
1208
-            $_REQUEST['pid'] = $_REQUEST['post'];
1227
+        if (isset($_REQUEST['post'])) {
1228
+                    $_REQUEST['pid'] = $_REQUEST['post'];
1229
+        }
1209 1230
     }
1210 1231
 
1211 1232
     if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
@@ -1258,8 +1279,9 @@  discard block
 block discarded – undo
1258 1279
         if (is_admin()) {
1259 1280
             global $post;
1260 1281
 
1261
-            if (isset($_REQUEST['post']))
1262
-                $_REQUEST['pid'] = $_REQUEST['post'];
1282
+            if (isset($_REQUEST['post'])) {
1283
+                            $_REQUEST['pid'] = $_REQUEST['post'];
1284
+            }
1263 1285
         }
1264 1286
 
1265 1287
         
@@ -1351,7 +1373,7 @@  discard block
 block discarded – undo
1351 1373
         $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1352 1374
     } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1353 1375
         $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1354
-    }else{
1376
+    } else{
1355 1377
         $field_icon = $cf['field_icon'];
1356 1378
     }
1357 1379
 
@@ -1424,8 +1446,9 @@  discard block
 block discarded – undo
1424 1446
                     $variables_array['post_id'] = $post->ID;
1425 1447
                     $variables_array['label'] = __($type['site_title'], 'geodirectory');
1426 1448
                     $variables_array['value'] = '';
1427
-                    if (isset($post->{$type['htmlvar_name']}))
1428
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1449
+                    if (isset($post->{$type['htmlvar_name']})) {
1450
+                                            $variables_array['value'] = $post->{$type['htmlvar_name']};
1451
+                    }
1429 1452
                 endif;
1430 1453
 
1431 1454
 
@@ -1448,7 +1471,9 @@  discard block
 block discarded – undo
1448 1471
                      * @param string $html Custom field unfiltered HTML.
1449 1472
                      * @param array $variables_array Custom field variables array.
1450 1473
                      */
1451
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1474
+                    if ($html) {
1475
+                    	echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1476
+                    }
1452 1477
 
1453 1478
                     /**
1454 1479
                      * Called after a custom fields is output on the frontend.
@@ -1482,10 +1507,11 @@  discard block
 block discarded – undo
1482 1507
      */
1483 1508
     function geodir_default_date_format()
1484 1509
     {
1485
-        if ($format = get_option('date_format'))
1486
-            return $format;
1487
-        else
1488
-            return 'dd-mm-yy';
1510
+        if ($format = get_option('date_format')) {
1511
+                    return $format;
1512
+        } else {
1513
+                    return 'dd-mm-yy';
1514
+        }
1489 1515
     }
1490 1516
 }
1491 1517
 
@@ -1592,11 +1618,13 @@  discard block
 block discarded – undo
1592 1618
                     // Set an array containing a list of acceptable formats
1593 1619
                     //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1594 1620
 
1595
-                    if (!function_exists('wp_handle_upload'))
1596
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1621
+                    if (!function_exists('wp_handle_upload')) {
1622
+                                            require_once(ABSPATH . 'wp-admin/includes/file.php');
1623
+                    }
1597 1624
 
1598
-                    if (!is_dir($geodir_uploadpath))
1599
-                        mkdir($geodir_uploadpath);
1625
+                    if (!is_dir($geodir_uploadpath)) {
1626
+                                            mkdir($geodir_uploadpath);
1627
+                    }
1600 1628
 
1601 1629
                     $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1602 1630
                     $explode_sub_dir = explode("/", $sub_dir);
@@ -1609,16 +1637,19 @@  discard block
 block discarded – undo
1609 1637
                     }
1610 1638
 
1611 1639
                     $uploaded_file = '';
1612
-                    if (file_exists($img_path))
1613
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1640
+                    if (file_exists($img_path)) {
1641
+                                            $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1642
+                    }
1614 1643
 
1615 1644
                     if ($curr_img_dir != $geodir_uploaddir) {
1616
-                        if (file_exists($img_path))
1617
-                            unlink($img_path);
1645
+                        if (file_exists($img_path)) {
1646
+                                                    unlink($img_path);
1647
+                        }
1618 1648
                     }
1619 1649
 
1620
-                    if (!empty($uploaded_file))
1621
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1650
+                    if (!empty($uploaded_file)) {
1651
+                                            $file_urls = $geodir_uploadurl . '/' . $new_name;
1652
+                    }
1622 1653
 
1623 1654
                 } else {
1624 1655
                     $file_urls = $post_image[$m];
@@ -1639,8 +1670,9 @@  discard block
 block discarded – undo
1639 1670
 
1640 1671
         geodir_save_post_meta($post_id, $field_id, $file_urls);
1641 1672
 
1642
-        if (!empty($invalid_files))
1643
-            geodir_remove_attachments($invalid_files);
1673
+        if (!empty($invalid_files)) {
1674
+                    geodir_remove_attachments($invalid_files);
1675
+        }
1644 1676
 
1645 1677
     }
1646 1678
 }
@@ -1866,8 +1898,9 @@  discard block
 block discarded – undo
1866 1898
 
1867 1899
         $all_postypes = geodir_get_posttypes();
1868 1900
 
1869
-        if (!in_array($post_type, $all_postypes))
1870
-            return false;
1901
+        if (!in_array($post_type, $all_postypes)) {
1902
+                    return false;
1903
+        }
1871 1904
 
1872 1905
         $fields = array();
1873 1906
 
@@ -1955,8 +1988,10 @@  discard block
 block discarded – undo
1955 1988
         }
1956 1989
 
1957 1990
         return $field_ids;
1958
-    else:
1959
-        return false;
1991
+    else {
1992
+    	:
1993
+        return false;
1994
+    }
1960 1995
     endif;
1961 1996
 }
1962 1997
 
@@ -2129,8 +2164,9 @@  discard block
 block discarded – undo
2129 2164
 
2130 2165
             return $field_id;
2131 2166
 
2132
-        } else
2133
-            return 0;
2167
+        } else {
2168
+                    return 0;
2169
+        }
2134 2170
 
2135 2171
     }
2136 2172
 }
@@ -2172,8 +2208,9 @@  discard block
 block discarded – undo
2172 2208
         $htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';
2173 2209
 
2174 2210
         $site_title = '';
2175
-        if ($site_title == '')
2176
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2211
+        if ($site_title == '') {
2212
+                    $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2213
+        }
2177 2214
 
2178 2215
         if ($site_title == '') {
2179 2216
             $fields = geodir_get_custom_sort_options($post_type);
@@ -2187,8 +2224,9 @@  discard block
 block discarded – undo
2187 2224
             }
2188 2225
         }
2189 2226
 
2190
-        if ($htmlvar_name == '')
2191
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2227
+        if ($htmlvar_name == '') {
2228
+                    $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2229
+        }
2192 2230
 
2193 2231
         $nonce = wp_create_nonce('custom_fields_' . $result_str);
2194 2232
 
@@ -2594,11 +2632,13 @@  discard block
 block discarded – undo
2594 2632
 
2595 2633
             <?php
2596 2634
             $selected = '';
2597
-            if (isset($field_info->extra_fields))
2598
-                $advanced_editor = unserialize($field_info->extra_fields);
2635
+            if (isset($field_info->extra_fields)) {
2636
+                            $advanced_editor = unserialize($field_info->extra_fields);
2637
+            }
2599 2638
 
2600
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2601
-                $selected = 'checked="checked"';
2639
+            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) {
2640
+                            $selected = 'checked="checked"';
2641
+            }
2602 2642
             ?>
2603 2643
 
2604 2644
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
@@ -2660,8 +2700,9 @@  discard block
 block discarded – undo
2660 2700
 
2661 2701
     if (!isset($field_info->post_type)) {
2662 2702
         $post_type = sanitize_text_field($_REQUEST['listing_type']);
2663
-    } else
2664
-        $post_type = $field_info->post_type;
2703
+    } else {
2704
+            $post_type = $field_info->post_type;
2705
+    }
2665 2706
     ?>
2666 2707
     <li style="display: none;">
2667 2708
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
Please login to merge, or discard this patch.
geodirectory-functions/custom_field_html.php 1 patch
Braces   +41 added lines, -36 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
 $cf_arr = geodir_custom_fields($post_type);
26 27
 $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : '';
@@ -30,8 +31,9 @@  discard block
 block discarded – undo
30 31
 $nonce = wp_create_nonce('custom_fields_' . $result_str);
31 32
 
32 33
 $field_admin_title = '';
33
-if (isset($field_info->admin_title))
34
-    $field_admin_title = $field_info->admin_title;
34
+if (isset($field_info->admin_title)) {
35
+    $field_admin_title = $field_info->admin_title;
36
+}
35 37
 
36 38
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
37 39
 
@@ -52,9 +54,9 @@  discard block
 block discarded – undo
52 54
 
53 55
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
54 56
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
55
-}elseif(isset($cf['icon']) && $cf['icon']){
57
+} elseif(isset($cf['icon']) && $cf['icon']){
56 58
     $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
57
-}else{
59
+} else{
58 60
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
59 61
 }
60 62
 
@@ -70,8 +72,11 @@  discard block
 block discarded – undo
70 72
 
71 73
         <?php if ($default): ?>
72 74
             <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>
73
-        <?php else: ?>
74
-            <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
75
+        <?php else {
76
+	: ?>
77
+            <div title="<?php _e('Click to remove field', 'geodirectory');
78
+}
79
+?>"
75 80
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
76 81
                  class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
77 82
         <?php endif;
@@ -122,11 +127,11 @@  discard block
 block discarded – undo
122 127
 
123 128
                 echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
124 129
 
125
-            }else{
130
+            } else{
126 131
                 $value = '';
127 132
                 if (isset($field_info->data_type)) {
128 133
                     $value = esc_attr($field_info->data_type);
129
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
134
+                } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
130 135
                     $value = $cf['defaults']['data_type'];
131 136
                 }
132 137
                 ?>
@@ -140,11 +145,11 @@  discard block
 block discarded – undo
140 145
 
141 146
                 echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
142 147
 
143
-            }else{
148
+            } else{
144 149
                 $value = '';
145 150
                 if (isset($field_info->admin_title)) {
146 151
                     $value = esc_attr($field_info->admin_title);
147
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
152
+                } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
148 153
                     $value = $cf['defaults']['admin_title'];
149 154
                 }
150 155
                 ?>
@@ -169,11 +174,11 @@  discard block
 block discarded – undo
169 174
 
170 175
                 echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
171 176
 
172
-            }else{
177
+            } else{
173 178
                 $value = '';
174 179
                 if (isset($field_info->site_title)) {
175 180
                     $value = esc_attr($field_info->site_title);
176
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
181
+                } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
177 182
                     $value = $cf['defaults']['site_title'];
178 183
                 }
179 184
                 ?>
@@ -197,11 +202,11 @@  discard block
 block discarded – undo
197 202
 
198 203
                 echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
199 204
 
200
-            }else{
205
+            } else{
201 206
                 $value = '';
202 207
                 if (isset($field_info->admin_desc)) {
203 208
                     $value = esc_attr($field_info->admin_desc);
204
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
209
+                } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
205 210
                     $value = $cf['defaults']['admin_desc'];
206 211
                 }
207 212
                 ?>
@@ -226,11 +231,11 @@  discard block
 block discarded – undo
226 231
 
227 232
                 echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
228 233
 
229
-            }else{
234
+            } else{
230 235
                 $value = '';
231 236
                 if (isset($field_info->htmlvar_name)) {
232 237
                     $value = esc_attr($field_info->htmlvar_name);
233
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
238
+                } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
234 239
                     $value = $cf['defaults']['htmlvar_name'];
235 240
                 }
236 241
                 ?>
@@ -258,11 +263,11 @@  discard block
 block discarded – undo
258 263
 
259 264
                 echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
260 265
 
261
-            }else{
266
+            } else{
262 267
                 $value = '';
263 268
                 if (isset($field_info->is_active)) {
264 269
                     $value = esc_attr($field_info->is_active);
265
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
270
+                } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
266 271
                     $value = $cf['defaults']['is_active'];
267 272
                 }
268 273
                 ?>
@@ -297,11 +302,11 @@  discard block
 block discarded – undo
297 302
 
298 303
                 echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
299 304
 
300
-            }else{
305
+            } else{
301 306
                 $value = '';
302 307
                 if (isset($field_info->for_admin_use)) {
303 308
                     $value = esc_attr($field_info->for_admin_use);
304
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
309
+                } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
305 310
                     $value = $cf['defaults']['for_admin_use'];
306 311
                 }
307 312
                 ?>
@@ -336,11 +341,11 @@  discard block
 block discarded – undo
336 341
 
337 342
                 echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
338 343
 
339
-            }else{
344
+            } else{
340 345
                 $value = '';
341 346
                 if (isset($field_info->default_value)) {
342 347
                     $value = esc_attr($field_info->default_value);
343
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
348
+                } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
344 349
                     $value = $cf['defaults']['default_value'];
345 350
                 }
346 351
                 ?>
@@ -380,7 +385,7 @@  discard block
 block discarded – undo
380 385
 
381 386
                 echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
382 387
 
383
-            }else{
388
+            } else{
384 389
                 $value = '';
385 390
                 ?>
386 391
                 <li>
@@ -420,7 +425,7 @@  discard block
 block discarded – undo
420 425
                         // don't show new tab option for some types
421 426
 
422 427
                         if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
423
-                        }else{
428
+                        } else{
424 429
                             unset($show_in_locations['[owntab]']);
425 430
                         }
426 431
 
@@ -533,11 +538,11 @@  discard block
 block discarded – undo
533 538
 
534 539
                 echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
535 540
 
536
-            }else{
541
+            } else{
537 542
                 $value = '';
538 543
                 if (isset($field_info->is_required)) {
539 544
                     $value = esc_attr($field_info->is_required);
540
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
545
+                } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
541 546
                     $value = $cf['defaults']['is_required'];
542 547
                 }
543 548
                 ?>
@@ -574,11 +579,11 @@  discard block
 block discarded – undo
574 579
 
575 580
                 echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
576 581
 
577
-            }else{
582
+            } else{
578 583
                 $value = '';
579 584
                 if (isset($field_info->required_msg)) {
580 585
                     $value = esc_attr($field_info->required_msg);
581
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
586
+                } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
582 587
                     $value = $cf['defaults']['required_msg'];
583 588
                 }
584 589
                 ?>
@@ -619,11 +624,11 @@  discard block
 block discarded – undo
619 624
 
620 625
                 echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
621 626
 
622
-            }else{
627
+            } else{
623 628
                 $value = '';
624 629
                 if (isset($field_info->field_icon)) {
625 630
                     $value = esc_attr($field_info->field_icon);
626
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
631
+                } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
627 632
                     $value = $cf['defaults']['field_icon'];
628 633
                 }
629 634
                 ?>
@@ -652,11 +657,11 @@  discard block
 block discarded – undo
652 657
 
653 658
                 echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
654 659
 
655
-            }else{
660
+            } else{
656 661
                 $value = '';
657 662
                 if (isset($field_info->css_class)) {
658 663
                     $value = esc_attr($field_info->css_class);
659
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
664
+                } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
660 665
                     $value = $cf['defaults']['css_class'];
661 666
                 }
662 667
                 ?>
@@ -684,11 +689,11 @@  discard block
 block discarded – undo
684 689
 
685 690
                 echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
686 691
 
687
-            }else{
692
+            } else{
688 693
                 $value = '';
689 694
                 if (isset($field_info->cat_sort)) {
690 695
                     $value = esc_attr($field_info->cat_sort);
691
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
696
+                } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
692 697
                     $value = $cf['defaults']['cat_sort'];
693 698
                 }
694 699
                 ?>
Please login to merge, or discard this patch.
geodirectory-admin/admin_hooks_actions.php 1 patch
Braces   +60 added lines, -52 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
     }
@@ -675,9 +680,9 @@  discard block
 block discarded – undo
675 680
                 <a id="gd-<?php echo $id;?>" data-field-type-key="<?php echo $id;?>"  data-field-type="<?php echo $cf['field_type'];?>" class="gd-draggable-form-items <?php echo $cf['class'];?>" href="javascript:void(0);">
676 681
                     <?php if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
677 682
                         echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
678
-                    }elseif(isset($cf['icon']) && $cf['icon'] ){
683
+                    } elseif(isset($cf['icon']) && $cf['icon'] ){
679 684
                         echo '<b style="background-image: url("'.$cf['icon'].'")"></b>';
680
-                    }else{
685
+                    } else{
681 686
                         echo '<i class="fa fa-cog" aria-hidden="true"></i>';
682 687
                     }?>
683 688
                     <?php echo $cf['name'];?>
@@ -879,8 +884,9 @@  discard block
 block discarded – undo
879 884
 
880 885
     if (!get_option('geodir_remove_unnecessary_fields')) {
881 886
 
882
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
883
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
887
+        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) {
888
+                    $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
889
+        }
884 890
 
885 891
         update_option('geodir_remove_unnecessary_fields', '1');
886 892
 
@@ -906,15 +912,17 @@  discard block
 block discarded – undo
906 912
         $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action'];
907 913
         switch ($geodir_admin_ajax_action) {
908 914
             case 'diagnosis' :
909
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
910
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
915
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
916
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
917
+                }
911 918
                 call_user_func('geodir_diagnose_' . $diagnose_this);
912 919
                 exit();
913 920
                 break;
914 921
 
915 922
             case 'diagnosis-fix' :
916
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
917
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
923
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
924
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
925
+                }
918 926
                 call_user_func('geodir_diagnose_' . $diagnose_this);
919 927
                 exit();
920 928
                 break;
@@ -1472,11 +1480,11 @@  discard block
 block discarded – undo
1472 1480
     //////////////////////////////////
1473 1481
     $option_value = get_option('geodir_home_page');
1474 1482
     $page = get_post($option_value);
1475
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1483
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1476 1484
 
1477
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1478
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1479
-    else {
1485
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1486
+            $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1487
+    } else {
1480 1488
         $is_error_during_diagnose = true;
1481 1489
         $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1482 1490
         if ($fix) {
@@ -1497,11 +1505,11 @@  discard block
 block discarded – undo
1497 1505
     //////////////////////////////////
1498 1506
     $option_value = get_option('geodir_add_listing_page');
1499 1507
     $page = get_post($option_value);
1500
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1508
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1501 1509
 
1502
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1503
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1504
-    else {
1510
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1511
+            $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1512
+    } else {
1505 1513
         $is_error_during_diagnose = true;
1506 1514
         $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1507 1515
         if ($fix) {
@@ -1523,11 +1531,11 @@  discard block
 block discarded – undo
1523 1531
     //////////////////////////////////
1524 1532
     $option_value = get_option('geodir_preview_page');
1525 1533
     $page = get_post($option_value);
1526
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1534
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1527 1535
 
1528
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1529
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1530
-    else {
1536
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1537
+            $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1538
+    } else {
1531 1539
         $is_error_during_diagnose = true;
1532 1540
         $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1533 1541
         if ($fix) {
@@ -1548,11 +1556,11 @@  discard block
 block discarded – undo
1548 1556
     //////////////////////////////////
1549 1557
     $option_value = get_option('geodir_success_page');
1550 1558
     $page = get_post($option_value);
1551
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1559
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1552 1560
 
1553
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1554
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1555
-    else {
1561
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1562
+            $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1563
+    } else {
1556 1564
         $is_error_during_diagnose = true;
1557 1565
         $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1558 1566
         if ($fix) {
@@ -1573,11 +1581,11 @@  discard block
 block discarded – undo
1573 1581
     //////////////////////////////////
1574 1582
     $option_value = get_option('geodir_info_page');
1575 1583
     $page = get_post($option_value);
1576
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1584
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1577 1585
 
1578
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1579
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1580
-    else {
1586
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1587
+            $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1588
+    } else {
1581 1589
         $is_error_during_diagnose = true;
1582 1590
         $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1583 1591
         if ($fix) {
@@ -1598,11 +1606,11 @@  discard block
 block discarded – undo
1598 1606
     //////////////////////////////////
1599 1607
     $option_value = get_option('geodir_login_page');
1600 1608
     $page = get_post($option_value);
1601
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1609
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1602 1610
 
1603
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1604
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1605
-    else {
1611
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1612
+            $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1613
+    } else {
1606 1614
         $is_error_during_diagnose = true;
1607 1615
         $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1608 1616
         if ($fix) {
@@ -1623,11 +1631,11 @@  discard block
 block discarded – undo
1623 1631
     //////////////////////////////////
1624 1632
     $option_value = get_option('geodir_location_page');
1625 1633
     $page = get_post($option_value);
1626
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1634
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1627 1635
 
1628
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1629
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1630
-    else {
1636
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1637
+            $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1638
+    } else {
1631 1639
         $is_error_during_diagnose = true;
1632 1640
         $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1633 1641
         if ($fix) {
@@ -2072,8 +2080,9 @@  discard block
 block discarded – undo
2072 2080
                             );
2073 2081
 
2074 2082
                             $post_location_info = $request_info['post_location'];
2075
-                            if ($location_id = geodir_add_new_location($post_location_info))
2076
-                                $post_location_id = $location_id;
2083
+                            if ($location_id = geodir_add_new_location($post_location_info)) {
2084
+                                                            $post_location_id = $location_id;
2085
+                            }
2077 2086
                         } else {
2078 2087
                             $post_location_id = 0;
2079 2088
                         }
@@ -2136,8 +2145,9 @@  discard block
 block discarded – undo
2136 2145
                             $attachment_set = '';
2137 2146
 
2138 2147
                             foreach ($attachment as $key => $val) {
2139
-                                if ($val != '')
2140
-                                    $attachment_set .= $key . " = '" . $val . "', ";
2148
+                                if ($val != '') {
2149
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
2150
+                                }
2141 2151
                             }
2142 2152
                             $attachment_set = trim($attachment_set, ", ");
2143 2153
 
@@ -2233,8 +2243,7 @@  discard block
 block discarded – undo
2233 2243
 
2234 2244
         $parts = json_decode($response['body']);
2235 2245
         //print_r($parts);
2236
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2237
-        else{
2246
+        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} else{
2238 2247
 
2239 2248
             update_option('gd_ga_access_token', $parts->access_token);
2240 2249
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2242,17 +2251,16 @@  discard block
 block discarded – undo
2242 2251
         }
2243 2252
 
2244 2253
 
2245
-    }
2246
-    elseif(!empty($response['response']['code'])) {
2254
+    } elseif(!empty($response['response']['code'])) {
2247 2255
         $parts = json_decode($response['body']);
2248 2256
 
2249 2257
         if(isset($parts->error)){
2250 2258
             echo $parts->error.": ".$parts->error_description;exit;
2251
-        }else{
2259
+        } else{
2252 2260
             echo $error_msg." - #2";exit;
2253 2261
         }
2254 2262
 
2255
-    }else{
2263
+    } else{
2256 2264
 
2257 2265
         echo $error_msg." - #3";exit;
2258 2266
 
Please login to merge, or discard this patch.