Test Failed
Push — master ( dec562...db4cca )
by Stiofan
04:56
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  echo $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  echo $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);
@@ -412,11 +441,17 @@  discard block
 block discarded – undo
412 441
         ?>
413 442
 
414 443
         <div id="<?php echo $cf['name'];?>_row"
415
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
444
+             class="<?php if ($cf['is_required']) {
445
+	echo 'required_field';
446
+}
447
+?> geodir_form_row clearfix gd-fieldset-details">
416 448
             <label>
417 449
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
418 450
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
419
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
451
+                <?php if ($cf['is_required']) {
452
+	echo '<span>*</span>';
453
+}
454
+?>
420 455
             </label>
421 456
             <?php if ($value != '1') {
422 457
                 $value = '0';
@@ -476,11 +511,17 @@  discard block
 block discarded – undo
476 511
         ?>
477 512
 
478 513
         <div id="<?php echo $cf['name'];?>_row"
479
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
514
+             class="<?php if ($cf['is_required']) {
515
+	echo 'required_field';
516
+}
517
+?> geodir_form_row clearfix gd-fieldset-details">
480 518
             <label>
481 519
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
482 520
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
483
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
521
+                <?php if ($cf['is_required']) {
522
+	echo '<span>*</span>';
523
+}
524
+?>
484 525
             </label><?php
485 526
 
486 527
 
@@ -548,11 +589,17 @@  discard block
 block discarded – undo
548 589
 
549 590
         ?>
550 591
         <div id="<?php echo $cf['name'];?>_row"
551
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
592
+             class="<?php if ($cf['is_required']) {
593
+	echo 'required_field';
594
+}
595
+?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
552 596
             <label>
553 597
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
554 598
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
555
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
599
+                <?php if ($cf['is_required']) {
600
+	echo '<span>*</span>';
601
+}
602
+?>
556 603
             </label>
557 604
             <?php
558 605
             $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
@@ -629,11 +676,17 @@  discard block
 block discarded – undo
629 676
         }
630 677
         ?>
631 678
         <div id="<?php echo $cf['name']; ?>_row"
632
-             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
679
+             class="<?php if ($cf['is_required']) {
680
+	echo 'required_field';
681
+}
682
+?> geodir_form_row clearfix gd-fieldset-details">
633 683
             <label>
634 684
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
635 685
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
636
-                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
686
+                <?php if ($cf['is_required']) {
687
+	echo '<span>*</span>';
688
+}
689
+?>
637 690
             </label>
638 691
             <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/>
639 692
             <?php if ($multi_display == 'select') { ?>
@@ -748,11 +801,17 @@  discard block
 block discarded – undo
748 801
         ?>
749 802
 
750 803
         <div id="<?php echo $cf['name']; ?>_row"
751
-             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
804
+             class="<?php if ($cf['is_required']) {
805
+	echo 'required_field';
806
+}
807
+?> geodir_form_row clearfix gd-fieldset-details">
752 808
             <label>
753 809
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
754 810
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
755
-                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
811
+                <?php if ($cf['is_required']) {
812
+	echo '<span>*</span>';
813
+}
814
+?>
756 815
             </label>
757 816
 
758 817
             <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
@@ -812,8 +871,9 @@  discard block
 block discarded – undo
812 871
         $extra_fields = unserialize($cf['extra_fields']);
813 872
         $name = $cf['name'];
814 873
 
815
-        if ($extra_fields['date_format'] == '')
816
-            $extra_fields['date_format'] = 'yy-mm-dd';
874
+        if ($extra_fields['date_format'] == '') {
875
+                    $extra_fields['date_format'] = 'yy-mm-dd';
876
+        }
817 877
 
818 878
         $date_format = $extra_fields['date_format'];
819 879
         $jquery_date_format  = $date_format;
@@ -827,7 +887,7 @@  discard block
 block discarded – undo
827 887
             $replace = array('d','j','l','m','n','F','Y');//PHP date format
828 888
 
829 889
             $date_format = str_replace($search, $replace, $date_format);
830
-        }else{
890
+        } else{
831 891
             $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
832 892
         }
833 893
 
@@ -862,12 +922,18 @@  discard block
 block discarded – undo
862 922
 
863 923
         </script>
864 924
         <div id="<?php echo $name;?>_row"
865
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
925
+             class="<?php if ($cf['is_required']) {
926
+	echo 'required_field';
927
+}
928
+?> geodir_form_row clearfix gd-fieldset-details">
866 929
             <label>
867 930
 
868 931
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
869 932
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
870
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
933
+                <?php if ($cf['is_required']) {
934
+	echo '<span>*</span>';
935
+}
936
+?>
871 937
             </label>
872 938
 
873 939
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -921,8 +987,9 @@  discard block
 block discarded – undo
921 987
 
922 988
         $name = $cf['name'];
923 989
 
924
-        if ($value != '')
925
-            $value = date('H:i', strtotime($value));
990
+        if ($value != '') {
991
+                    $value = date('H:i', strtotime($value));
992
+        }
926 993
         ?>
927 994
         <script type="text/javascript">
928 995
             jQuery(document).ready(function () {
@@ -935,12 +1002,18 @@  discard block
 block discarded – undo
935 1002
             });
936 1003
         </script>
937 1004
         <div id="<?php echo $name;?>_row"
938
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1005
+             class="<?php if ($cf['is_required']) {
1006
+	echo 'required_field';
1007
+}
1008
+?> geodir_form_row clearfix gd-fieldset-details">
939 1009
             <label>
940 1010
 
941 1011
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
942 1012
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
943
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
1013
+                <?php if ($cf['is_required']) {
1014
+	echo '<span>*</span>';
1015
+}
1016
+?>
944 1017
             </label>
945 1018
             <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
946 1019
                    id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
@@ -1032,17 +1105,27 @@  discard block
 block discarded – undo
1032 1105
         }
1033 1106
 
1034 1107
         $location = geodir_get_default_location();
1035
-        if (empty($city)) $city = isset($location->city) ? $location->city : '';
1036
-        if (empty($region)) $region = isset($location->region) ? $location->region : '';
1037
-        if (empty($country)) $country = isset($location->country) ? $location->country : '';
1108
+        if (empty($city)) {
1109
+        	$city = isset($location->city) ? $location->city : '';
1110
+        }
1111
+        if (empty($region)) {
1112
+        	$region = isset($location->region) ? $location->region : '';
1113
+        }
1114
+        if (empty($country)) {
1115
+        	$country = isset($location->country) ? $location->country : '';
1116
+        }
1038 1117
 
1039 1118
         $lat_lng_blank = false;
1040 1119
         if (empty($lat) && empty($lng)) {
1041 1120
             $lat_lng_blank = true;
1042 1121
         }
1043 1122
 
1044
-        if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1045
-        if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1123
+        if (empty($lat)) {
1124
+        	$lat = isset($location->city_latitude) ? $location->city_latitude : '';
1125
+        }
1126
+        if (empty($lng)) {
1127
+        	$lng = isset($location->city_longitude) ? $location->city_longitude : '';
1128
+        }
1046 1129
 
1047 1130
         /**
1048 1131
          * Filter the default latitude.
@@ -1067,8 +1150,14 @@  discard block
 block discarded – undo
1067 1150
         $locate_me_class = $locate_me ? ' gd-form-control' : '';
1068 1151
         ?>
1069 1152
         <div id="geodir_<?php echo $prefix . 'address';?>_row"
1070
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1071
-            <label><?php _e($address_title, 'geodirectory'); ?> <?php if ($is_required) echo '<span>*</span>';?></label>
1153
+             class="<?php if ($is_required) {
1154
+	echo 'required_field';
1155
+}
1156
+?> geodir_form_row clearfix gd-fieldset-details">
1157
+            <label><?php _e($address_title, 'geodirectory'); ?> <?php if ($is_required) {
1158
+	echo '<span>*</span>';
1159
+}
1160
+?></label>
1072 1161
             <?php if ($locate_me) { ?>
1073 1162
             <div class="gd-input-group gd-locate-me">
1074 1163
             <?php } ?>
@@ -1132,10 +1221,16 @@  discard block
 block discarded – undo
1132 1221
             /* show lat lng */
1133 1222
             $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1134 1223
             <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1135
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1224
+                 class="<?php if ($is_required) {
1225
+	echo 'required_field';
1226
+}
1227
+?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1136 1228
                 <label>
1137 1229
                     <?php echo PLACE_ADDRESS_LAT; ?>
1138
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1230
+                    <?php if ($is_required) {
1231
+	echo '<span>*</span>';
1232
+}
1233
+?>
1139 1234
                 </label>
1140 1235
                 <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1141 1236
                        id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
@@ -1147,10 +1242,16 @@  discard block
 block discarded – undo
1147 1242
             </div>
1148 1243
 
1149 1244
             <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1150
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1245
+                 class="<?php if ($is_required) {
1246
+	echo 'required_field';
1247
+}
1248
+?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1151 1249
                 <label>
1152 1250
                     <?php echo PLACE_ADDRESS_LNG; ?>
1153
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1251
+                    <?php if ($is_required) {
1252
+	echo '<span>*</span>';
1253
+}
1254
+?>
1154 1255
                 </label>
1155 1256
                 <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1156 1257
                        id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
@@ -1254,11 +1355,17 @@  discard block
 block discarded – undo
1254 1355
             $value = '';
1255 1356
         } ?>
1256 1357
         <div id="<?php echo $name;?>_row"
1257
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1358
+             class="<?php if ($is_required) {
1359
+	echo 'required_field';
1360
+}
1361
+?> geodir_form_row clearfix gd-fieldset-details">
1258 1362
             <label>
1259 1363
                 <?php $site_title = __($site_title, 'geodirectory');
1260 1364
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1261
-                <?php if ($is_required) echo '<span>*</span>';?>
1365
+                <?php if ($is_required) {
1366
+	echo '<span>*</span>';
1367
+}
1368
+?>
1262 1369
             </label>
1263 1370
 
1264 1371
             <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
@@ -1290,8 +1397,9 @@  discard block
 block discarded – undo
1290 1397
                 if (isset($_REQUEST['backandedit']) && !empty($post_cat[$name]) && is_array($post_cat[$name])) {
1291 1398
                     $post_cat = implode(",", $post_cat[$name]);
1292 1399
                 } else {
1293
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1294
-                        $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1400
+                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1401
+                                            $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1402
+                    }
1295 1403
                 }
1296 1404
 
1297 1405
 
@@ -1329,21 +1437,24 @@  discard block
 block discarded – undo
1329 1437
 
1330 1438
                         $cat_display == '';
1331 1439
                         $multiple = '';
1332
-                        if ($cat_display == 'multiselect')
1333
-                            $multiple = 'multiple="multiple"';
1440
+                        if ($cat_display == 'multiselect') {
1441
+                                                    $multiple = 'multiple="multiple"';
1442
+                        }
1334 1443
 
1335 1444
                         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') . '">';
1336 1445
 
1337 1446
 
1338
-                        if ($cat_display == 'select')
1339
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1447
+                        if ($cat_display == 'select') {
1448
+                                                    echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1449
+                        }
1340 1450
 
1341 1451
                     }
1342 1452
 
1343 1453
                     echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1344 1454
 
1345
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
1346
-                        echo '</select>';
1455
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
1456
+                                            echo '</select>';
1457
+                    }
1347 1458
 
1348 1459
                 } else {
1349 1460
 
@@ -1415,18 +1526,23 @@  discard block
 block discarded – undo
1415 1526
 
1416 1527
             $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1417 1528
 
1418
-        } else
1419
-            $file_value = '';
1529
+        } else {
1530
+                    $file_value = '';
1531
+        }
1420 1532
 
1421
-        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1422
-            $file_multiple = true; // allow multiple files upload
1423
-        else
1424
-            $file_multiple = false;
1533
+        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) {
1534
+                    $file_multiple = true;
1535
+        }
1536
+        // allow multiple files upload
1537
+        else {
1538
+                    $file_multiple = false;
1539
+        }
1425 1540
 
1426
-        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1427
-            $file_image_limit = $extra_fields['image_limit'];
1428
-        else
1429
-            $file_image_limit = 1;
1541
+        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) {
1542
+                    $file_image_limit = $extra_fields['image_limit'];
1543
+        } else {
1544
+                    $file_image_limit = 1;
1545
+        }
1430 1546
 
1431 1547
         $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1432 1548
 
@@ -1434,8 +1550,9 @@  discard block
 block discarded – undo
1434 1550
 
1435 1551
         if (!empty($file_value)) {
1436 1552
             $curImages = explode(',', $file_value);
1437
-            if (!empty($curImages))
1438
-                $file_totImg = count($curImages);
1553
+            if (!empty($curImages)) {
1554
+                            $file_totImg = count($curImages);
1555
+            }
1439 1556
         }
1440 1557
 
1441 1558
         $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']) : '';
@@ -1450,12 +1567,18 @@  discard block
 block discarded – undo
1450 1567
         ?>
1451 1568
 
1452 1569
         <div id="<?php echo $name;?>_row"
1453
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1570
+             class="<?php if ($is_required) {
1571
+	echo 'required_field';
1572
+}
1573
+?> geodir_form_row clearfix gd-fieldset-details">
1454 1574
 
1455 1575
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1456 1576
                 <label
1457 1577
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1458
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1578
+                    echo $site_title; ?><?php if ($is_required) {
1579
+                    	echo '<span>*</span>';
1580
+                    }
1581
+                    ?></label>
1459 1582
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1460 1583
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1461 1584
                        value="<?php echo esc_attr($file_value); ?>"/>
Please login to merge, or discard this patch.