Test Failed
Push — master ( f48a23...7b3a74 )
by Stiofan
66:46
created
geodirectory-functions/custom_fields_input_functions.php 2 patches
Indentation   +704 added lines, -704 removed lines patch added patch discarded remove patch
@@ -19,35 +19,35 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_cfi_fieldset($html,$cf){
21 21
 
22
-    $html_var = $cf['htmlvar_name'];
23
-
24
-    // Check if there is a custom field specific filter.
25
-    if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
26
-        /**
27
-         * Filter the fieldset html by individual custom field.
28
-         *
29
-         * @param string $html The html to filter.
30
-         * @param array $cf The custom field array.
31
-         * @since 1.6.6
32
-         */
33
-        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
34
-    }
35
-
36
-    // If no html then we run the standard output.
37
-    if(empty($html)) {
38
-
39
-        ob_start(); // Start  buffering;
40
-        ?>
22
+	$html_var = $cf['htmlvar_name'];
23
+
24
+	// Check if there is a custom field specific filter.
25
+	if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
26
+		/**
27
+		 * Filter the fieldset html by individual custom field.
28
+		 *
29
+		 * @param string $html The html to filter.
30
+		 * @param array $cf The custom field array.
31
+		 * @since 1.6.6
32
+		 */
33
+		$html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
34
+	}
35
+
36
+	// If no html then we run the standard output.
37
+	if(empty($html)) {
38
+
39
+		ob_start(); // Start  buffering;
40
+		?>
41 41
         <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row"
42 42
             gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo $cf['site_title']; ?>
43 43
             <?php if ( $cf['desc'] != '' ) {
44
-                echo '<small>( ' . $cf['desc'] . ' )</small>';
45
-            } ?></h5>
44
+				echo '<small>( ' . $cf['desc'] . ' )</small>';
45
+			} ?></h5>
46 46
         <?php
47
-        $html = ob_get_clean();
48
-    }
47
+		$html = ob_get_clean();
48
+	}
49 49
 
50
-    return $html;
50
+	return $html;
51 51
 }
52 52
 add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2);
53 53
 
@@ -64,47 +64,47 @@  discard block
 block discarded – undo
64 64
  */
65 65
 function geodir_cfi_text($html,$cf){
66 66
 
67
-    $html_var = $cf['htmlvar_name'];
68
-
69
-    // Check if there is a custom field specific filter.
70
-    if(has_filter("geodir_custom_field_input_text_{$html_var}")){
71
-        /**
72
-         * Filter the text html by individual custom field.
73
-         *
74
-         * @param string $html The html to filter.
75
-         * @param array $cf The custom field array.
76
-         * @since 1.6.6
77
-         */
78
-        $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
79
-    }
80
-
81
-    // If no html then we run the standard output.
82
-    if(empty($html)) {
83
-
84
-        ob_start(); // Start  buffering;
85
-
86
-        $value = geodir_get_cf_value($cf);
87
-        $type = $cf['type'];
88
-        //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91
-
92
-        //validation
93
-        if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94
-            $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
96
-
97
-        // validation message
98
-        if(isset($cf['validation_msg']) && $cf['validation_msg']){
99
-            $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
101
-        ?>
67
+	$html_var = $cf['htmlvar_name'];
68
+
69
+	// Check if there is a custom field specific filter.
70
+	if(has_filter("geodir_custom_field_input_text_{$html_var}")){
71
+		/**
72
+		 * Filter the text html by individual custom field.
73
+		 *
74
+		 * @param string $html The html to filter.
75
+		 * @param array $cf The custom field array.
76
+		 * @since 1.6.6
77
+		 */
78
+		$html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
79
+	}
80
+
81
+	// If no html then we run the standard output.
82
+	if(empty($html)) {
83
+
84
+		ob_start(); // Start  buffering;
85
+
86
+		$value = geodir_get_cf_value($cf);
87
+		$type = $cf['type'];
88
+		//number and float validation $validation_pattern
89
+		if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
+		elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91
+
92
+		//validation
93
+		if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94
+			$validation = 'pattern="'.$cf['validation_pattern'].'"';
95
+		}else{$validation='';}
96
+
97
+		// validation message
98
+		if(isset($cf['validation_msg']) && $cf['validation_msg']){
99
+			$validation_msg = 'title="'.$cf['validation_msg'].'"';
100
+		}else{$validation_msg='';}
101
+		?>
102 102
 
103 103
         <div id="<?php echo $cf['name'];?>_row"
104 104
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
105 105
             <label>
106 106
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
107
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108 108
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
109 109
             </label>
110 110
             <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
         </div>
117 117
 
118 118
         <?php
119
-        $html = ob_get_clean();
120
-    }
119
+		$html = ob_get_clean();
120
+	}
121 121
 
122
-    return $html;
122
+	return $html;
123 123
 }
124 124
 add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2);
125 125
 
@@ -135,35 +135,35 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function geodir_cfi_email($html,$cf){
137 137
 
138
-    $html_var = $cf['htmlvar_name'];
138
+	$html_var = $cf['htmlvar_name'];
139 139
 
140
-    // Check if there is a custom field specific filter.
141
-    if(has_filter("geodir_custom_field_input_email_{$html_var}")){
142
-        /**
143
-         * Filter the email html by individual custom field.
144
-         *
145
-         * @param string $html The html to filter.
146
-         * @param array $cf The custom field array.
147
-         * @since 1.6.6
148
-         */
149
-        $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
150
-    }
140
+	// Check if there is a custom field specific filter.
141
+	if(has_filter("geodir_custom_field_input_email_{$html_var}")){
142
+		/**
143
+		 * Filter the email html by individual custom field.
144
+		 *
145
+		 * @param string $html The html to filter.
146
+		 * @param array $cf The custom field array.
147
+		 * @since 1.6.6
148
+		 */
149
+		$html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
150
+	}
151 151
 
152
-    // If no html then we run the standard output.
153
-    if(empty($html)) {
152
+	// If no html then we run the standard output.
153
+	if(empty($html)) {
154 154
 
155
-        ob_start(); // Start  buffering;
156
-        $value = geodir_get_cf_value($cf);
155
+		ob_start(); // Start  buffering;
156
+		$value = geodir_get_cf_value($cf);
157 157
 
158
-        if ($value == $cf['default']) {
159
-            $value = '';
160
-        }?>
158
+		if ($value == $cf['default']) {
159
+			$value = '';
160
+		}?>
161 161
 
162 162
         <div id="<?php echo $cf['name'];?>_row"
163 163
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
164 164
             <label>
165 165
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
166
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167 167
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
168 168
             </label>
169 169
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
         </div>
176 176
 
177 177
         <?php
178
-        $html = ob_get_clean();
179
-    }
178
+		$html = ob_get_clean();
179
+	}
180 180
 
181
-    return $html;
181
+	return $html;
182 182
 }
183 183
 add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2);
184 184
 
@@ -195,35 +195,35 @@  discard block
 block discarded – undo
195 195
  */
196 196
 function geodir_cfi_phone($html,$cf){
197 197
 
198
-    $html_var = $cf['htmlvar_name'];
198
+	$html_var = $cf['htmlvar_name'];
199 199
 
200
-    // Check if there is a custom field specific filter.
201
-    if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
202
-        /**
203
-         * Filter the phone html by individual custom field.
204
-         *
205
-         * @param string $html The html to filter.
206
-         * @param array $cf The custom field array.
207
-         * @since 1.6.6
208
-         */
209
-        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
210
-    }
200
+	// Check if there is a custom field specific filter.
201
+	if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
202
+		/**
203
+		 * Filter the phone html by individual custom field.
204
+		 *
205
+		 * @param string $html The html to filter.
206
+		 * @param array $cf The custom field array.
207
+		 * @since 1.6.6
208
+		 */
209
+		$html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
210
+	}
211 211
 
212
-    // If no html then we run the standard output.
213
-    if(empty($html)) {
212
+	// If no html then we run the standard output.
213
+	if(empty($html)) {
214 214
 
215
-        ob_start(); // Start  buffering;
216
-        $value = geodir_get_cf_value($cf);
215
+		ob_start(); // Start  buffering;
216
+		$value = geodir_get_cf_value($cf);
217 217
 
218
-        if ($value == $cf['default']) {
219
-            $value = '';
220
-        }?>
218
+		if ($value == $cf['default']) {
219
+			$value = '';
220
+		}?>
221 221
 
222 222
         <div id="<?php echo $cf['name'];?>_row"
223 223
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
224 224
             <label>
225 225
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
226
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227 227
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
228 228
             </label>
229 229
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
         </div>
236 236
 
237 237
         <?php
238
-        $html = ob_get_clean();
239
-    }
238
+		$html = ob_get_clean();
239
+	}
240 240
 
241
-    return $html;
241
+	return $html;
242 242
 }
243 243
 add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2);
244 244
 
@@ -255,35 +255,35 @@  discard block
 block discarded – undo
255 255
  */
256 256
 function geodir_cfi_url($html,$cf){
257 257
 
258
-    $html_var = $cf['htmlvar_name'];
258
+	$html_var = $cf['htmlvar_name'];
259 259
 
260
-    // Check if there is a custom field specific filter.
261
-    if(has_filter("geodir_custom_field_input_url_{$html_var}")){
262
-        /**
263
-         * Filter the url html by individual custom field.
264
-         *
265
-         * @param string $html The html to filter.
266
-         * @param array $cf The custom field array.
267
-         * @since 1.6.6
268
-         */
269
-        $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
270
-    }
260
+	// Check if there is a custom field specific filter.
261
+	if(has_filter("geodir_custom_field_input_url_{$html_var}")){
262
+		/**
263
+		 * Filter the url html by individual custom field.
264
+		 *
265
+		 * @param string $html The html to filter.
266
+		 * @param array $cf The custom field array.
267
+		 * @since 1.6.6
268
+		 */
269
+		$html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
270
+	}
271 271
 
272
-    // If no html then we run the standard output.
273
-    if(empty($html)) {
272
+	// If no html then we run the standard output.
273
+	if(empty($html)) {
274 274
 
275
-        ob_start(); // Start  buffering;
276
-        $value = geodir_get_cf_value($cf);
275
+		ob_start(); // Start  buffering;
276
+		$value = geodir_get_cf_value($cf);
277 277
 
278
-        if ($value == $cf['default']) {
279
-            $value = '';
280
-        }?>
278
+		if ($value == $cf['default']) {
279
+			$value = '';
280
+		}?>
281 281
 
282 282
         <div id="<?php echo $cf['name'];?>_row"
283 283
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
284 284
             <label>
285 285
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
286
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287 287
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
288 288
             </label>
289 289
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
         </div>
299 299
 
300 300
         <?php
301
-        $html = ob_get_clean();
302
-    }
301
+		$html = ob_get_clean();
302
+	}
303 303
 
304
-    return $html;
304
+	return $html;
305 305
 }
306 306
 add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2);
307 307
 
@@ -317,48 +317,48 @@  discard block
 block discarded – undo
317 317
  */
318 318
 function geodir_cfi_radio($html,$cf){
319 319
 
320
-    $html_var = $cf['htmlvar_name'];
320
+	$html_var = $cf['htmlvar_name'];
321 321
 
322
-    // Check if there is a custom field specific filter.
323
-    if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
324
-        /**
325
-         * Filter the radio html by individual custom field.
326
-         *
327
-         * @param string $html The html to filter.
328
-         * @param array $cf The custom field array.
329
-         * @since 1.6.6
330
-         */
331
-        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
332
-    }
322
+	// Check if there is a custom field specific filter.
323
+	if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
324
+		/**
325
+		 * Filter the radio html by individual custom field.
326
+		 *
327
+		 * @param string $html The html to filter.
328
+		 * @param array $cf The custom field array.
329
+		 * @since 1.6.6
330
+		 */
331
+		$html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
332
+	}
333 333
 
334
-    // If no html then we run the standard output.
335
-    if(empty($html)) {
334
+	// If no html then we run the standard output.
335
+	if(empty($html)) {
336 336
 
337
-        ob_start(); // Start  buffering;
338
-        $value = geodir_get_cf_value($cf);
337
+		ob_start(); // Start  buffering;
338
+		$value = geodir_get_cf_value($cf);
339 339
 
340
-        ?>
340
+		?>
341 341
         <div id="<?php echo $cf['name'];?>_row"
342 342
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
343 343
             <label>
344 344
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
345
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346 346
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
347 347
             </label>
348 348
             <?php if ($cf['option_values']) {
349
-                $option_values = geodir_string_values_to_options($cf['option_values'], true);
349
+				$option_values = geodir_string_values_to_options($cf['option_values'], true);
350 350
 
351
-                if (!empty($option_values)) {
352
-                    foreach ($option_values as $option_value) {
353
-                        if (empty($option_value['optgroup'])) {
354
-                            ?>
351
+				if (!empty($option_values)) {
352
+					foreach ($option_values as $option_value) {
353
+						if (empty($option_value['optgroup'])) {
354
+							?>
355 355
                             <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span>
356 356
                             <?php
357
-                        }
358
-                    }
359
-                }
360
-            }
361
-            ?>
357
+						}
358
+					}
359
+				}
360
+			}
361
+			?>
362 362
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
363 363
             <?php if ($cf['is_required']) { ?>
364 364
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
         </div>
367 367
 
368 368
         <?php
369
-        $html = ob_get_clean();
370
-    }
369
+		$html = ob_get_clean();
370
+	}
371 371
 
372
-    return $html;
372
+	return $html;
373 373
 }
374 374
 add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2);
375 375
 
@@ -385,44 +385,44 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function geodir_cfi_checkbox($html,$cf){
387 387
 
388
-    $html_var = $cf['htmlvar_name'];
388
+	$html_var = $cf['htmlvar_name'];
389 389
 
390
-    // Check if there is a custom field specific filter.
391
-    if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
392
-        /**
393
-         * Filter the checkbox html by individual custom field.
394
-         *
395
-         * @param string $html The html to filter.
396
-         * @param array $cf The custom field array.
397
-         * @since 1.6.6
398
-         */
399
-        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
400
-    }
390
+	// Check if there is a custom field specific filter.
391
+	if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
392
+		/**
393
+		 * Filter the checkbox html by individual custom field.
394
+		 *
395
+		 * @param string $html The html to filter.
396
+		 * @param array $cf The custom field array.
397
+		 * @since 1.6.6
398
+		 */
399
+		$html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
400
+	}
401 401
 
402
-    // If no html then we run the standard output.
403
-    if(empty($html)) {
402
+	// If no html then we run the standard output.
403
+	if(empty($html)) {
404 404
 
405
-        ob_start(); // Start  buffering;
406
-        $value = geodir_get_cf_value($cf);
405
+		ob_start(); // Start  buffering;
406
+		$value = geodir_get_cf_value($cf);
407 407
 
408
-        if ($value == $cf['default']) {
409
-            $value = '';
410
-        }?>
408
+		if ($value == $cf['default']) {
409
+			$value = '';
410
+		}?>
411 411
 
412 412
         <div id="<?php echo $cf['name'];?>_row"
413 413
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
414 414
             <label>
415 415
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
416
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
416
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
417 417
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
418 418
             </label>
419 419
             <?php if ($value != '1') {
420
-                $value = '0';
421
-            }?>
420
+				$value = '0';
421
+			}?>
422 422
             <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/>
423 423
             <input  <?php if ($value == '1') {
424
-                echo 'checked="checked"';
425
-            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
424
+				echo 'checked="checked"';
425
+			}?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
426 426
                  onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/>
427 427
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
428 428
             <?php if ($cf['is_required']) { ?>
@@ -431,10 +431,10 @@  discard block
 block discarded – undo
431 431
         </div>
432 432
 
433 433
         <?php
434
-        $html = ob_get_clean();
435
-    }
434
+		$html = ob_get_clean();
435
+	}
436 436
 
437
-    return $html;
437
+	return $html;
438 438
 }
439 439
 add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2);
440 440
 
@@ -450,52 +450,52 @@  discard block
 block discarded – undo
450 450
  */
451 451
 function geodir_cfi_textarea($html,$cf){
452 452
 
453
-    $html_var = $cf['htmlvar_name'];
453
+	$html_var = $cf['htmlvar_name'];
454 454
 
455
-    // Check if there is a custom field specific filter.
456
-    if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
457
-        /**
458
-         * Filter the textarea html by individual custom field.
459
-         *
460
-         * @param string $html The html to filter.
461
-         * @param array $cf The custom field array.
462
-         * @since 1.6.6
463
-         */
464
-        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
465
-    }
455
+	// Check if there is a custom field specific filter.
456
+	if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
457
+		/**
458
+		 * Filter the textarea html by individual custom field.
459
+		 *
460
+		 * @param string $html The html to filter.
461
+		 * @param array $cf The custom field array.
462
+		 * @since 1.6.6
463
+		 */
464
+		$html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
465
+	}
466 466
 
467
-    // If no html then we run the standard output.
468
-    if(empty($html)) {
467
+	// If no html then we run the standard output.
468
+	if(empty($html)) {
469 469
 
470
-        ob_start(); // Start  buffering;
471
-        $value = geodir_get_cf_value($cf);
470
+		ob_start(); // Start  buffering;
471
+		$value = geodir_get_cf_value($cf);
472 472
 
473
-        $extra_fields = unserialize($cf['extra_fields']);
474
-        ?>
473
+		$extra_fields = unserialize($cf['extra_fields']);
474
+		?>
475 475
 
476 476
         <div id="<?php echo $cf['name'];?>_row"
477 477
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
478 478
             <label>
479 479
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
480
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
480
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
481 481
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
482 482
             </label><?php
483 483
 
484 484
 
485
-            if (is_array($extra_fields) && in_array('1', $extra_fields)) {
485
+			if (is_array($extra_fields) && in_array('1', $extra_fields)) {
486 486
 
487
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
487
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
488 488
 
489 489
             <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor">
490 490
                 <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?>
491 491
                 </div><?php
492 492
 
493
-            } else {
493
+			} else {
494 494
 
495
-                ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
495
+				?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
496 496
                             id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php
497 497
 
498
-            }?>
498
+			}?>
499 499
 
500 500
 
501 501
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
@@ -505,10 +505,10 @@  discard block
 block discarded – undo
505 505
         </div>
506 506
 
507 507
         <?php
508
-        $html = ob_get_clean();
509
-    }
508
+		$html = ob_get_clean();
509
+	}
510 510
 
511
-    return $html;
511
+	return $html;
512 512
 }
513 513
 add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2);
514 514
 
@@ -524,53 +524,53 @@  discard block
 block discarded – undo
524 524
  */
525 525
 function geodir_cfi_select($html,$cf){
526 526
 
527
-    $html_var = $cf['htmlvar_name'];
527
+	$html_var = $cf['htmlvar_name'];
528 528
 
529
-    // Check if there is a custom field specific filter.
530
-    if(has_filter("geodir_custom_field_input_select_{$html_var}")){
531
-        /**
532
-         * Filter the select html by individual custom field.
533
-         *
534
-         * @param string $html The html to filter.
535
-         * @param array $cf The custom field array.
536
-         * @since 1.6.6
537
-         */
538
-        $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
539
-    }
529
+	// Check if there is a custom field specific filter.
530
+	if(has_filter("geodir_custom_field_input_select_{$html_var}")){
531
+		/**
532
+		 * Filter the select html by individual custom field.
533
+		 *
534
+		 * @param string $html The html to filter.
535
+		 * @param array $cf The custom field array.
536
+		 * @since 1.6.6
537
+		 */
538
+		$html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
539
+	}
540 540
 
541
-    // If no html then we run the standard output.
542
-    if(empty($html)) {
541
+	// If no html then we run the standard output.
542
+	if(empty($html)) {
543 543
 
544
-        ob_start(); // Start  buffering;
545
-        $value = geodir_get_cf_value($cf);
544
+		ob_start(); // Start  buffering;
545
+		$value = geodir_get_cf_value($cf);
546 546
 
547
-        ?>
547
+		?>
548 548
         <div id="<?php echo $cf['name'];?>_row"
549 549
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
550 550
             <label>
551 551
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
552
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
552
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
553 553
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
554 554
             </label>
555 555
             <?php
556
-            $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
557
-            $select_options = '';
558
-            if (!empty($option_values_arr)) {
559
-                foreach ($option_values_arr as $option_row) {
560
-                    if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
561
-                        $option_label = isset($option_row['label']) ? $option_row['label'] : '';
562
-
563
-                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
564
-                    } else {
565
-                        $option_label = isset($option_row['label']) ? $option_row['label'] : '';
566
-                        $option_value = isset($option_row['value']) ? $option_row['value'] : '';
567
-                        $selected = $option_value == $value ? 'selected="selected"' : '';
568
-
569
-                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
570
-                    }
571
-                }
572
-            }
573
-            ?>
556
+			$option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
557
+			$select_options = '';
558
+			if (!empty($option_values_arr)) {
559
+				foreach ($option_values_arr as $option_row) {
560
+					if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
561
+						$option_label = isset($option_row['label']) ? $option_row['label'] : '';
562
+
563
+						$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
564
+					} else {
565
+						$option_label = isset($option_row['label']) ? $option_row['label'] : '';
566
+						$option_value = isset($option_row['value']) ? $option_row['value'] : '';
567
+						$selected = $option_value == $value ? 'selected="selected"' : '';
568
+
569
+						$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
570
+					}
571
+				}
572
+			}
573
+			?>
574 574
             <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
575 575
                     class="geodir_textfield textfield_x chosen_select"
576 576
                     data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
@@ -582,10 +582,10 @@  discard block
 block discarded – undo
582 582
         </div>
583 583
 
584 584
         <?php
585
-        $html = ob_get_clean();
586
-    }
585
+		$html = ob_get_clean();
586
+	}
587 587
 
588
-    return $html;
588
+	return $html;
589 589
 }
590 590
 add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2);
591 591
 
@@ -601,36 +601,36 @@  discard block
 block discarded – undo
601 601
  */
602 602
 function geodir_cfi_multiselect($html,$cf){
603 603
 
604
-    $html_var = $cf['htmlvar_name'];
605
-
606
-    // Check if there is a custom field specific filter.
607
-    if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
608
-        /**
609
-         * Filter the multiselect html by individual custom field.
610
-         *
611
-         * @param string $html The html to filter.
612
-         * @param array $cf The custom field array.
613
-         * @since 1.6.6
614
-         */
615
-        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
616
-    }
617
-
618
-    // If no html then we run the standard output.
619
-    if(empty($html)) {
620
-
621
-        ob_start(); // Start  buffering;
622
-        $value = geodir_get_cf_value($cf);
623
-
624
-        $multi_display = 'select';
625
-        if (!empty($val['extra_fields'])) {
626
-            $multi_display = unserialize($val['extra_fields']);
627
-        }
628
-        ?>
604
+	$html_var = $cf['htmlvar_name'];
605
+
606
+	// Check if there is a custom field specific filter.
607
+	if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
608
+		/**
609
+		 * Filter the multiselect html by individual custom field.
610
+		 *
611
+		 * @param string $html The html to filter.
612
+		 * @param array $cf The custom field array.
613
+		 * @since 1.6.6
614
+		 */
615
+		$html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
616
+	}
617
+
618
+	// If no html then we run the standard output.
619
+	if(empty($html)) {
620
+
621
+		ob_start(); // Start  buffering;
622
+		$value = geodir_get_cf_value($cf);
623
+
624
+		$multi_display = 'select';
625
+		if (!empty($val['extra_fields'])) {
626
+			$multi_display = unserialize($val['extra_fields']);
627
+		}
628
+		?>
629 629
         <div id="<?php echo $cf['name']; ?>_row"
630 630
              class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
631 631
             <label>
632 632
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
633
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
633
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
634 634
                 <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
635 635
             </label>
636 636
             <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/>
@@ -641,55 +641,55 @@  discard block
 block discarded – undo
641 641
                         data-placeholder="<?php _e('Select', 'geodirectory'); ?>"
642 642
                         option-ajaxchosen="false">
643 643
                     <?php
644
-                    } else {
645
-                        echo '<ul class="gd_multi_choice">';
646
-                    }
647
-
648
-                    $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
649
-                    $select_options = '';
650
-                    if (!empty($option_values_arr)) {
651
-                        foreach ($option_values_arr as $option_row) {
652
-                            if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
653
-                                $option_label = isset($option_row['label']) ? $option_row['label'] : '';
654
-
655
-                                if ($multi_display == 'select') {
656
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
657
-                                } else {
658
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
659
-                                }
660
-                            } else {
661
-                                $option_label = isset($option_row['label']) ? $option_row['label'] : '';
662
-                                $option_value = isset($option_row['value']) ? $option_row['value'] : '';
663
-                                $selected = $option_value == $value ? 'selected="selected"' : '';
664
-                                $selected = '';
665
-                                $checked = '';
666
-
667
-                                if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
668
-                                    if (!is_array($value)) {
669
-                                        $value_array = explode(',', $value);
670
-                                    } else {
671
-                                        $value_array = $value;
672
-                                    }
673
-
674
-                                    if (is_array($value_array)) {
675
-                                        if (in_array($option_value, $value_array)) {
676
-                                            $selected = 'selected="selected"';
677
-                                            $checked = 'checked="checked"';
678
-                                        }
679
-                                    }
680
-                                }
681
-
682
-                                if ($multi_display == 'select') {
683
-                                    $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
684
-                                } else {
685
-                                    $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
686
-                                }
687
-                            }
688
-                        }
689
-                    }
690
-                    echo $select_options;
691
-
692
-                    if ($multi_display == 'select') { ?></select></div>
644
+					} else {
645
+						echo '<ul class="gd_multi_choice">';
646
+					}
647
+
648
+					$option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
649
+					$select_options = '';
650
+					if (!empty($option_values_arr)) {
651
+						foreach ($option_values_arr as $option_row) {
652
+							if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
653
+								$option_label = isset($option_row['label']) ? $option_row['label'] : '';
654
+
655
+								if ($multi_display == 'select') {
656
+									$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
657
+								} else {
658
+									$select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
659
+								}
660
+							} else {
661
+								$option_label = isset($option_row['label']) ? $option_row['label'] : '';
662
+								$option_value = isset($option_row['value']) ? $option_row['value'] : '';
663
+								$selected = $option_value == $value ? 'selected="selected"' : '';
664
+								$selected = '';
665
+								$checked = '';
666
+
667
+								if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
668
+									if (!is_array($value)) {
669
+										$value_array = explode(',', $value);
670
+									} else {
671
+										$value_array = $value;
672
+									}
673
+
674
+									if (is_array($value_array)) {
675
+										if (in_array($option_value, $value_array)) {
676
+											$selected = 'selected="selected"';
677
+											$checked = 'checked="checked"';
678
+										}
679
+									}
680
+								}
681
+
682
+								if ($multi_display == 'select') {
683
+									$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
684
+								} else {
685
+									$select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
686
+								}
687
+							}
688
+						}
689
+					}
690
+					echo $select_options;
691
+
692
+					if ($multi_display == 'select') { ?></select></div>
693 693
         <?php } else { ?></ul><?php } ?>
694 694
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
695 695
             <?php if ($cf['is_required']) { ?>
@@ -697,10 +697,10 @@  discard block
 block discarded – undo
697 697
             <?php } ?>
698 698
         </div>
699 699
         <?php
700
-        $html = ob_get_clean();
701
-    }
700
+		$html = ob_get_clean();
701
+	}
702 702
 
703
-    return $html;
703
+	return $html;
704 704
 }
705 705
 add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2);
706 706
 
@@ -716,32 +716,32 @@  discard block
 block discarded – undo
716 716
  */
717 717
 function geodir_cfi_html($html,$cf){
718 718
 
719
-    $html_var = $cf['htmlvar_name'];
719
+	$html_var = $cf['htmlvar_name'];
720 720
 
721
-    // Check if there is a custom field specific filter.
722
-    if(has_filter("geodir_custom_field_input_html_{$html_var}")){
723
-        /**
724
-         * Filter the html html by individual custom field.
725
-         *
726
-         * @param string $html The html to filter.
727
-         * @param array $cf The custom field array.
728
-         * @since 1.6.6
729
-         */
730
-        $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
731
-    }
721
+	// Check if there is a custom field specific filter.
722
+	if(has_filter("geodir_custom_field_input_html_{$html_var}")){
723
+		/**
724
+		 * Filter the html html by individual custom field.
725
+		 *
726
+		 * @param string $html The html to filter.
727
+		 * @param array $cf The custom field array.
728
+		 * @since 1.6.6
729
+		 */
730
+		$html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
731
+	}
732 732
 
733
-    // If no html then we run the standard output.
734
-    if(empty($html)) {
733
+	// If no html then we run the standard output.
734
+	if(empty($html)) {
735 735
 
736
-        ob_start(); // Start  buffering;
737
-        $value = geodir_get_cf_value($cf);
738
-        ?>
736
+		ob_start(); // Start  buffering;
737
+		$value = geodir_get_cf_value($cf);
738
+		?>
739 739
 
740 740
         <div id="<?php echo $cf['name']; ?>_row"
741 741
              class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
742 742
             <label>
743 743
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
744
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
744
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
745 745
                 <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
746 746
             </label>
747 747
 
@@ -759,10 +759,10 @@  discard block
 block discarded – undo
759 759
         </div>
760 760
 
761 761
         <?php
762
-        $html = ob_get_clean();
763
-    }
762
+		$html = ob_get_clean();
763
+	}
764 764
 
765
-    return $html;
765
+	return $html;
766 766
 }
767 767
 add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2);
768 768
 
@@ -779,68 +779,68 @@  discard block
 block discarded – undo
779 779
  */
780 780
 function geodir_cfi_datepicker($html,$cf){
781 781
 
782
-    $html_var = $cf['htmlvar_name'];
782
+	$html_var = $cf['htmlvar_name'];
783 783
 
784
-    // Check if there is a custom field specific filter.
785
-    if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
786
-        /**
787
-         * Filter the datepicker html by individual custom field.
788
-         *
789
-         * @param string $html The html to filter.
790
-         * @param array $cf The custom field array.
791
-         * @since 1.6.6
792
-         */
793
-        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
794
-    }
784
+	// Check if there is a custom field specific filter.
785
+	if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
786
+		/**
787
+		 * Filter the datepicker html by individual custom field.
788
+		 *
789
+		 * @param string $html The html to filter.
790
+		 * @param array $cf The custom field array.
791
+		 * @since 1.6.6
792
+		 */
793
+		$html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
794
+	}
795 795
 
796
-    // If no html then we run the standard output.
797
-    if(empty($html)) {
796
+	// If no html then we run the standard output.
797
+	if(empty($html)) {
798 798
 
799
-        ob_start(); // Start  buffering;
800
-        $value = geodir_get_cf_value($cf);
799
+		ob_start(); // Start  buffering;
800
+		$value = geodir_get_cf_value($cf);
801 801
 
802
-        $extra_fields = unserialize($cf['extra_fields']);
803
-        $name = $cf['name'];
802
+		$extra_fields = unserialize($cf['extra_fields']);
803
+		$name = $cf['name'];
804 804
 
805
-        if ($extra_fields['date_format'] == '')
806
-            $extra_fields['date_format'] = 'yy-mm-dd';
805
+		if ($extra_fields['date_format'] == '')
806
+			$extra_fields['date_format'] = 'yy-mm-dd';
807 807
 
808
-        $date_format = $extra_fields['date_format'];
809
-        $jquery_date_format  = $date_format;
808
+		$date_format = $extra_fields['date_format'];
809
+		$jquery_date_format  = $date_format;
810 810
 
811 811
 
812
-        // check if we need to change the format or not
813
-        $date_format_len = strlen(str_replace(' ', '', $date_format));
814
-        if($date_format_len>5){// if greater then 5 then it's the old style format.
812
+		// check if we need to change the format or not
813
+		$date_format_len = strlen(str_replace(' ', '', $date_format));
814
+		if($date_format_len>5){// if greater then 5 then it's the old style format.
815 815
 
816
-            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
817
-            $replace = array('d','j','l','m','n','F','Y');//PHP date format
816
+			$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
817
+			$replace = array('d','j','l','m','n','F','Y');//PHP date format
818 818
 
819
-            $date_format = str_replace($search, $replace, $date_format);
820
-        }else{
821
-            $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
822
-        }
819
+			$date_format = str_replace($search, $replace, $date_format);
820
+		}else{
821
+			$jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
822
+		}
823 823
 
824
-        if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
825
-        if($value && !isset($_REQUEST['backandedit'])) {
826
-            //$time = strtotime($value);
827
-            //$value = date_i18n($date_format, $time);
828
-        }
829
-        $value = geodir_date($value, 'Y-m-d', $date_format);
824
+		if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
825
+		if($value && !isset($_REQUEST['backandedit'])) {
826
+			//$time = strtotime($value);
827
+			//$value = date_i18n($date_format, $time);
828
+		}
829
+		$value = geodir_date($value, 'Y-m-d', $date_format);
830 830
 
831
-        ?>
831
+		?>
832 832
         <script type="text/javascript">
833 833
 
834 834
             jQuery(function () {
835 835
 
836 836
                 jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php
837
-                    /**
838
-                     * Used to add extra option to datepicker per custom field.
839
-                     *
840
-                     * @since 1.5.7
841
-                     * @param string $name The custom field name.
842
-                     */
843
-                    echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
837
+					/**
838
+					 * Used to add extra option to datepicker per custom field.
839
+					 *
840
+					 * @since 1.5.7
841
+					 * @param string $name The custom field name.
842
+					 */
843
+					echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
844 844
 
845 845
                 jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
846 846
 
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
             <label>
857 857
 
858 858
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
859
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
859
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
860 860
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
861 861
             </label>
862 862
 
@@ -870,10 +870,10 @@  discard block
 block discarded – undo
870 870
         </div>
871 871
 
872 872
         <?php
873
-        $html = ob_get_clean();
874
-    }
873
+		$html = ob_get_clean();
874
+	}
875 875
 
876
-    return $html;
876
+	return $html;
877 877
 }
878 878
 add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2);
879 879
 
@@ -889,31 +889,31 @@  discard block
 block discarded – undo
889 889
  */
890 890
 function geodir_cfi_time($html,$cf){
891 891
 
892
-    $html_var = $cf['htmlvar_name'];
892
+	$html_var = $cf['htmlvar_name'];
893 893
 
894
-    // Check if there is a custom field specific filter.
895
-    if(has_filter("geodir_custom_field_input_time_{$html_var}")){
896
-        /**
897
-         * Filter the time html by individual custom field.
898
-         *
899
-         * @param string $html The html to filter.
900
-         * @param array $cf The custom field array.
901
-         * @since 1.6.6
902
-         */
903
-        $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
904
-    }
894
+	// Check if there is a custom field specific filter.
895
+	if(has_filter("geodir_custom_field_input_time_{$html_var}")){
896
+		/**
897
+		 * Filter the time html by individual custom field.
898
+		 *
899
+		 * @param string $html The html to filter.
900
+		 * @param array $cf The custom field array.
901
+		 * @since 1.6.6
902
+		 */
903
+		$html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
904
+	}
905 905
 
906
-    // If no html then we run the standard output.
907
-    if(empty($html)) {
906
+	// If no html then we run the standard output.
907
+	if(empty($html)) {
908 908
 
909
-        ob_start(); // Start  buffering;
910
-        $value = geodir_get_cf_value($cf);
909
+		ob_start(); // Start  buffering;
910
+		$value = geodir_get_cf_value($cf);
911 911
 
912
-        $name = $cf['name'];
912
+		$name = $cf['name'];
913 913
 
914
-        if ($value != '')
915
-            $value = date('H:i', strtotime($value));
916
-        ?>
914
+		if ($value != '')
915
+			$value = date('H:i', strtotime($value));
916
+		?>
917 917
         <script type="text/javascript">
918 918
             jQuery(document).ready(function () {
919 919
 
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
             <label>
930 930
 
931 931
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
932
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
932
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
933 933
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
934 934
             </label>
935 935
             <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
@@ -941,10 +941,10 @@  discard block
 block discarded – undo
941 941
             <?php } ?>
942 942
         </div>
943 943
         <?php
944
-        $html = ob_get_clean();
945
-    }
944
+		$html = ob_get_clean();
945
+	}
946 946
 
947
-    return $html;
947
+	return $html;
948 948
 }
949 949
 add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2);
950 950
 
@@ -960,100 +960,100 @@  discard block
 block discarded – undo
960 960
  */
961 961
 function geodir_cfi_address($html,$cf){
962 962
 
963
-    $html_var = $cf['htmlvar_name'];
964
-
965
-    // Check if there is a custom field specific filter.
966
-    if(has_filter("geodir_custom_field_input_address_{$html_var}")){
967
-        /**
968
-         * Filter the address html by individual custom field.
969
-         *
970
-         * @param string $html The html to filter.
971
-         * @param array $cf The custom field array.
972
-         * @since 1.6.6
973
-         */
974
-        $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
975
-    }
976
-
977
-    // If no html then we run the standard output.
978
-    if(empty($html)) {
979
-
980
-        global $gd_session;
981
-        ob_start(); // Start  buffering;
982
-        $value = geodir_get_cf_value($cf);
983
-        $name = $cf['name'];
984
-        $type = $cf['type'];
985
-        $admin_desc = $cf['desc'];
986
-        $is_required = $cf['is_required'];
987
-        $required_msg = $cf['required_msg'];
988
-        $site_title = $cf['site_title'];
989
-        $is_admin = $cf['is_admin'];
990
-        $extra_fields = unserialize($cf['extra_fields']);
991
-        $prefix = $name . '_';
992
-
993
-        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
994
-        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
995
-        ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
996
-        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
997
-
998
-        $address = '';
999
-        $zip = '';
1000
-        $mapview = '';
1001
-        $mapzoom = '';
1002
-        $lat = '';
1003
-        $lng = '';
1004
-
1005
-        if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1006
-            $post = $gd_ses_listing;
1007
-            $address = $post[$prefix . 'address'];
1008
-            $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1009
-            $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1010
-            $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1011
-            $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1012
-            $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1013
-        } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1014
-            $post_info = (array)$post_info;
1015
-
1016
-            $address = $post_info[$prefix . 'address'];
1017
-            $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1018
-            $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1019
-            $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1020
-            $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1021
-            $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1022
-        }
1023
-
1024
-        $location = geodir_get_default_location();
1025
-        if (empty($city)) $city = isset($location->city) ? $location->city : '';
1026
-        if (empty($region)) $region = isset($location->region) ? $location->region : '';
1027
-        if (empty($country)) $country = isset($location->country) ? $location->country : '';
1028
-
1029
-        $lat_lng_blank = false;
1030
-        if (empty($lat) && empty($lng)) {
1031
-            $lat_lng_blank = true;
1032
-        }
1033
-
1034
-        if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1035
-        if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1036
-
1037
-        /**
1038
-         * Filter the default latitude.
1039
-         *
1040
-         * @since 1.0.0
1041
-         *
1042
-         * @param float $lat Default latitude.
1043
-         * @param bool $is_admin For admin use only?.
1044
-         */
1045
-        $lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1046
-        /**
1047
-         * Filter the default longitude.
1048
-         *
1049
-         * @since 1.0.0
1050
-         *
1051
-         * @param float $lat Default longitude.
1052
-         * @param bool $is_admin For admin use only?.
1053
-         */
1054
-        $lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1055
-
1056
-        ?>
963
+	$html_var = $cf['htmlvar_name'];
964
+
965
+	// Check if there is a custom field specific filter.
966
+	if(has_filter("geodir_custom_field_input_address_{$html_var}")){
967
+		/**
968
+		 * Filter the address html by individual custom field.
969
+		 *
970
+		 * @param string $html The html to filter.
971
+		 * @param array $cf The custom field array.
972
+		 * @since 1.6.6
973
+		 */
974
+		$html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
975
+	}
976
+
977
+	// If no html then we run the standard output.
978
+	if(empty($html)) {
979
+
980
+		global $gd_session;
981
+		ob_start(); // Start  buffering;
982
+		$value = geodir_get_cf_value($cf);
983
+		$name = $cf['name'];
984
+		$type = $cf['type'];
985
+		$admin_desc = $cf['desc'];
986
+		$is_required = $cf['is_required'];
987
+		$required_msg = $cf['required_msg'];
988
+		$site_title = $cf['site_title'];
989
+		$is_admin = $cf['is_admin'];
990
+		$extra_fields = unserialize($cf['extra_fields']);
991
+		$prefix = $name . '_';
992
+
993
+		($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
994
+		($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
995
+		($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
996
+		($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
997
+
998
+		$address = '';
999
+		$zip = '';
1000
+		$mapview = '';
1001
+		$mapzoom = '';
1002
+		$lat = '';
1003
+		$lng = '';
1004
+
1005
+		if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1006
+			$post = $gd_ses_listing;
1007
+			$address = $post[$prefix . 'address'];
1008
+			$zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1009
+			$lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1010
+			$lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1011
+			$mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1012
+			$mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1013
+		} else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1014
+			$post_info = (array)$post_info;
1015
+
1016
+			$address = $post_info[$prefix . 'address'];
1017
+			$zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1018
+			$lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1019
+			$lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1020
+			$mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1021
+			$mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1022
+		}
1023
+
1024
+		$location = geodir_get_default_location();
1025
+		if (empty($city)) $city = isset($location->city) ? $location->city : '';
1026
+		if (empty($region)) $region = isset($location->region) ? $location->region : '';
1027
+		if (empty($country)) $country = isset($location->country) ? $location->country : '';
1028
+
1029
+		$lat_lng_blank = false;
1030
+		if (empty($lat) && empty($lng)) {
1031
+			$lat_lng_blank = true;
1032
+		}
1033
+
1034
+		if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1035
+		if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1036
+
1037
+		/**
1038
+		 * Filter the default latitude.
1039
+		 *
1040
+		 * @since 1.0.0
1041
+		 *
1042
+		 * @param float $lat Default latitude.
1043
+		 * @param bool $is_admin For admin use only?.
1044
+		 */
1045
+		$lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1046
+		/**
1047
+		 * Filter the default longitude.
1048
+		 *
1049
+		 * @since 1.0.0
1050
+		 *
1051
+		 * @param float $lat Default longitude.
1052
+		 * @param bool $is_admin For admin use only?.
1053
+		 */
1054
+		$lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1055
+
1056
+		?>
1057 1057
 
1058 1058
         <div id="geodir_<?php echo $prefix . 'address';?>_row"
1059 1059
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
@@ -1072,17 +1072,17 @@  discard block
 block discarded – undo
1072 1072
 
1073 1073
 
1074 1074
         <?php
1075
-        /**
1076
-         * Called after the address input on the add listings.
1077
-         *
1078
-         * This is used by the location manage to add further locations info etc.
1079
-         *
1080
-         * @since 1.0.0
1081
-         * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}.
1082
-         */
1083
-        do_action('geodir_address_extra_listing_fields', $cf);
1084
-
1085
-        if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1075
+		/**
1076
+		 * Called after the address input on the add listings.
1077
+		 *
1078
+		 * This is used by the location manage to add further locations info etc.
1079
+		 *
1080
+		 * @since 1.0.0
1081
+		 * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}.
1082
+		 */
1083
+		do_action('geodir_address_extra_listing_fields', $cf);
1084
+
1085
+		if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1086 1086
 
1087 1087
             <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1088 1088
                  class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details">
@@ -1103,22 +1103,22 @@  discard block
 block discarded – undo
1103 1103
 
1104 1104
             <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1105 1105
                 <?php
1106
-                /**
1107
-                 * Contains add listing page map functions.
1108
-                 *
1109
-                 * @since 1.0.0
1110
-                 */
1111
-                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1112
-                if ($lat_lng_blank) {
1113
-                    $lat = '';
1114
-                    $lng = '';
1115
-                }
1116
-                ?>
1106
+				/**
1107
+				 * Contains add listing page map functions.
1108
+				 *
1109
+				 * @since 1.0.0
1110
+				 */
1111
+				include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1112
+				if ($lat_lng_blank) {
1113
+					$lat = '';
1114
+					$lng = '';
1115
+				}
1116
+				?>
1117 1117
                 <span class="geodir_message_note"><?php echo GET_MAP_MSG; ?></span>
1118 1118
             </div>
1119 1119
             <?php
1120
-            /* show lat lng */
1121
-            $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1120
+			/* show lat lng */
1121
+			$style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1122 1122
             <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1123 1123
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1124 1124
                 <label>
@@ -1159,27 +1159,27 @@  discard block
 block discarded – undo
1159 1159
                                                             class="gd-checkbox"
1160 1160
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1161 1161
                                                             id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1162
-                            echo 'checked="checked"';
1163
-                        } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1162
+							echo 'checked="checked"';
1163
+						} ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1164 1164
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1165 1165
                                                              class="gd-checkbox"
1166 1166
                                                              name="<?php echo $prefix . 'mapview'; ?>"
1167 1167
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1168
-                            echo 'checked="checked"';
1169
-                        } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1168
+							echo 'checked="checked"';
1169
+						} ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1170 1170
 
1171 1171
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1172 1172
                                                             class="gd-checkbox"
1173 1173
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1174 1174
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1175
-                            echo 'checked="checked"';
1176
-                        } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1175
+							echo 'checked="checked"';
1176
+						} ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1177 1177
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1178 1178
                                                             class="gd-checkbox"
1179 1179
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1180 1180
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1181
-                            echo 'checked="checked"';
1182
-                        } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1181
+							echo 'checked="checked"';
1182
+						} ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1183 1183
 
1184 1184
 
1185 1185
             </div>
@@ -1187,14 +1187,14 @@  discard block
 block discarded – undo
1187 1187
 
1188 1188
         <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1189 1189
             <input type="hidden" value="<?php if (isset($mapzoom)) {
1190
-                echo esc_attr($mapzoom);
1191
-            } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1190
+				echo esc_attr($mapzoom);
1191
+			} ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1192 1192
         <?php }
1193 1193
 
1194
-        $html = ob_get_clean();
1195
-    }
1194
+		$html = ob_get_clean();
1195
+	}
1196 1196
 
1197
-    return $html;
1197
+	return $html;
1198 1198
 }
1199 1199
 add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2);
1200 1200
 
@@ -1211,137 +1211,137 @@  discard block
 block discarded – undo
1211 1211
  */
1212 1212
 function geodir_cfi_taxonomy($html,$cf){
1213 1213
 
1214
-    $html_var = $cf['htmlvar_name'];
1215
-
1216
-    // Check if there is a custom field specific filter.
1217
-    if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1218
-        /**
1219
-         * Filter the taxonomy html by individual custom field.
1220
-         *
1221
-         * @param string $html The html to filter.
1222
-         * @param array $cf The custom field array.
1223
-         * @since 1.6.6
1224
-         */
1225
-        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1226
-    }
1227
-
1228
-    // If no html then we run the standard output.
1229
-    if(empty($html)) {
1230
-
1231
-        ob_start(); // Start  buffering;
1232
-        $value = geodir_get_cf_value($cf);
1233
-
1234
-        $name = $cf['name'];
1235
-        $site_title = $cf['site_title'];
1236
-        $admin_desc = $cf['desc'];
1237
-        $is_required = $cf['is_required'];
1238
-        $is_admin = $cf['is_admin'];
1239
-        $required_msg = $cf['required_msg'];
1240
-
1241
-        if ($value == $cf['default']) {
1242
-            $value = '';
1243
-        } ?>
1214
+	$html_var = $cf['htmlvar_name'];
1215
+
1216
+	// Check if there is a custom field specific filter.
1217
+	if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1218
+		/**
1219
+		 * Filter the taxonomy html by individual custom field.
1220
+		 *
1221
+		 * @param string $html The html to filter.
1222
+		 * @param array $cf The custom field array.
1223
+		 * @since 1.6.6
1224
+		 */
1225
+		$html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1226
+	}
1227
+
1228
+	// If no html then we run the standard output.
1229
+	if(empty($html)) {
1230
+
1231
+		ob_start(); // Start  buffering;
1232
+		$value = geodir_get_cf_value($cf);
1233
+
1234
+		$name = $cf['name'];
1235
+		$site_title = $cf['site_title'];
1236
+		$admin_desc = $cf['desc'];
1237
+		$is_required = $cf['is_required'];
1238
+		$is_admin = $cf['is_admin'];
1239
+		$required_msg = $cf['required_msg'];
1240
+
1241
+		if ($value == $cf['default']) {
1242
+			$value = '';
1243
+		} ?>
1244 1244
         <div id="<?php echo $name;?>_row"
1245 1245
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1246 1246
             <label>
1247 1247
                 <?php $site_title = __($site_title, 'geodirectory');
1248
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1248
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1249 1249
                 <?php if ($is_required) echo '<span>*</span>';?>
1250 1250
             </label>
1251 1251
 
1252 1252
             <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1253 1253
                 <?php
1254
-                global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1254
+				global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1255 1255
 
1256
-                $exclude_cats = array();
1256
+				$exclude_cats = array();
1257 1257
 
1258
-                if ($is_admin == '1') {
1258
+				if ($is_admin == '1') {
1259 1259
 
1260
-                    $post_type = get_post_type();
1260
+					$post_type = get_post_type();
1261 1261
 
1262
-                    $package_info = array();
1262
+					$package_info = array();
1263 1263
 
1264
-                    $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1264
+					$package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1265 1265
 
1266
-                    if (!empty($package_info)) {
1266
+					if (!empty($package_info)) {
1267 1267
 
1268
-                        if (isset($package_info['cat']) && $package_info['cat'] != '') {
1268
+						if (isset($package_info['cat']) && $package_info['cat'] != '') {
1269 1269
 
1270
-                            $exclude_cats = explode(',', $package_info['cat']);
1270
+							$exclude_cats = explode(',', $package_info['cat']);
1271 1271
 
1272
-                        }
1273
-                    }
1274
-                }
1272
+						}
1273
+					}
1274
+				}
1275 1275
 
1276
-                $cat_display = unserialize($cf['extra_fields']);
1276
+				$cat_display = unserialize($cf['extra_fields']);
1277 1277
 
1278
-                if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
1278
+				if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
1279 1279
 
1280
-                    $post_cat = implode(",", $post_cat[$name]);
1280
+					$post_cat = implode(",", $post_cat[$name]);
1281 1281
 
1282
-                } else {
1283
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1284
-                        $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1285
-                }
1282
+				} else {
1283
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1284
+						$post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1285
+				}
1286 1286
 
1287 1287
 
1288
-                global $geodir_addon_list;
1289
-                if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1288
+				global $geodir_addon_list;
1289
+				if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1290 1290
 
1291
-                    $catadd_limit = $wpdb->get_var(
1292
-                        $wpdb->prepare(
1293
-                            "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1294
-                            array($package_id)
1295
-                        )
1296
-                    );
1291
+					$catadd_limit = $wpdb->get_var(
1292
+						$wpdb->prepare(
1293
+							"SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1294
+							array($package_id)
1295
+						)
1296
+					);
1297 1297
 
1298 1298
 
1299
-                } else {
1300
-                    $catadd_limit = 0;
1301
-                }
1299
+				} else {
1300
+					$catadd_limit = 0;
1301
+				}
1302 1302
 
1303 1303
 
1304
-                if ($cat_display != '' && $cat_display != 'ajax_chained') {
1304
+				if ($cat_display != '' && $cat_display != 'ajax_chained') {
1305 1305
 
1306
-                    $required_limit_msg = '';
1307
-                    if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1306
+					$required_limit_msg = '';
1307
+					if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1308 1308
 
1309
-                        $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1309
+						$required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1310 1310
 
1311
-                    } else {
1312
-                        $required_limit_msg = $required_msg;
1313
-                    }
1311
+					} else {
1312
+						$required_limit_msg = $required_msg;
1313
+					}
1314 1314
 
1315
-                    echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1315
+					echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1316 1316
 
1317 1317
 
1318
-                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
1318
+					if ($cat_display == 'select' || $cat_display == 'multiselect') {
1319 1319
 
1320
-                        $cat_display == '';
1321
-                        $multiple = '';
1322
-                        if ($cat_display == 'multiselect')
1323
-                            $multiple = 'multiple="multiple"';
1320
+						$cat_display == '';
1321
+						$multiple = '';
1322
+						if ($cat_display == 'multiselect')
1323
+							$multiple = 'multiple="multiple"';
1324 1324
 
1325
-                        echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1325
+						echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1326 1326
 
1327 1327
 
1328
-                        if ($cat_display == 'select')
1329
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1328
+						if ($cat_display == 'select')
1329
+							echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1330 1330
 
1331
-                    }
1331
+					}
1332 1332
 
1333
-                    echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1333
+					echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1334 1334
 
1335
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
1336
-                        echo '</select>';
1335
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
1336
+						echo '</select>';
1337 1337
 
1338
-                } else {
1338
+				} else {
1339 1339
 
1340
-                    echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
1340
+					echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
1341 1341
 
1342
-                }
1342
+				}
1343 1343
 
1344
-                ?>
1344
+				?>
1345 1345
             </div>
1346 1346
 
1347 1347
             <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
@@ -1351,10 +1351,10 @@  discard block
 block discarded – undo
1351 1351
         </div>
1352 1352
 
1353 1353
         <?php
1354
-        $html = ob_get_clean();
1355
-    }
1354
+		$html = ob_get_clean();
1355
+	}
1356 1356
 
1357
-    return $html;
1357
+	return $html;
1358 1358
 }
1359 1359
 add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2);
1360 1360
 
@@ -1370,74 +1370,74 @@  discard block
 block discarded – undo
1370 1370
  */
1371 1371
 function geodir_cfi_file($html,$cf){
1372 1372
 
1373
-    $html_var = $cf['htmlvar_name'];
1373
+	$html_var = $cf['htmlvar_name'];
1374 1374
 
1375
-    // Check if there is a custom field specific filter.
1376
-    if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1377
-        /**
1378
-         * Filter the file html by individual custom field.
1379
-         *
1380
-         * @param string $html The html to filter.
1381
-         * @param array $cf The custom field array.
1382
-         * @since 1.6.6
1383
-         */
1384
-        $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1385
-    }
1375
+	// Check if there is a custom field specific filter.
1376
+	if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1377
+		/**
1378
+		 * Filter the file html by individual custom field.
1379
+		 *
1380
+		 * @param string $html The html to filter.
1381
+		 * @param array $cf The custom field array.
1382
+		 * @since 1.6.6
1383
+		 */
1384
+		$html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1385
+	}
1386 1386
 
1387
-    // If no html then we run the standard output.
1388
-    if(empty($html)) {
1387
+	// If no html then we run the standard output.
1388
+	if(empty($html)) {
1389 1389
 
1390
-        ob_start(); // Start  buffering;
1391
-        $value = geodir_get_cf_value($cf);
1390
+		ob_start(); // Start  buffering;
1391
+		$value = geodir_get_cf_value($cf);
1392 1392
 
1393
-        $name = $cf['name'];
1394
-        $site_title = $cf['site_title'];
1395
-        $admin_desc = $cf['desc'];
1396
-        $is_required = $cf['is_required'];
1397
-        $required_msg = $cf['required_msg'];
1398
-        $extra_fields = unserialize($cf['extra_fields']);
1393
+		$name = $cf['name'];
1394
+		$site_title = $cf['site_title'];
1395
+		$admin_desc = $cf['desc'];
1396
+		$is_required = $cf['is_required'];
1397
+		$required_msg = $cf['required_msg'];
1398
+		$extra_fields = unserialize($cf['extra_fields']);
1399 1399
 
1400 1400
 
1401
-        // adjust values here
1402
-        $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
1401
+		// adjust values here
1402
+		$file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
1403 1403
 
1404
-        if ($value != '') {
1404
+		if ($value != '') {
1405 1405
 
1406
-            $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1406
+			$file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1407 1407
 
1408
-        } else
1409
-            $file_value = '';
1408
+		} else
1409
+			$file_value = '';
1410 1410
 
1411
-        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1412
-            $file_multiple = true; // allow multiple files upload
1413
-        else
1414
-            $file_multiple = false;
1411
+		if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1412
+			$file_multiple = true; // allow multiple files upload
1413
+		else
1414
+			$file_multiple = false;
1415 1415
 
1416
-        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1417
-            $file_image_limit = $extra_fields['image_limit'];
1418
-        else
1419
-            $file_image_limit = 1;
1416
+		if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1417
+			$file_image_limit = $extra_fields['image_limit'];
1418
+		else
1419
+			$file_image_limit = 1;
1420 1420
 
1421
-        $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1421
+		$file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1422 1422
 
1423
-        $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1423
+		$file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1424 1424
 
1425
-        if (!empty($file_value)) {
1426
-            $curImages = explode(',', $file_value);
1427
-            if (!empty($curImages))
1428
-                $file_totImg = count($curImages);
1429
-        }
1425
+		if (!empty($file_value)) {
1426
+			$curImages = explode(',', $file_value);
1427
+			if (!empty($curImages))
1428
+				$file_totImg = count($curImages);
1429
+		}
1430 1430
 
1431
-        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1432
-        $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1431
+		$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1432
+		$display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1433 1433
 
1434
-        ?>
1434
+		?>
1435 1435
         <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
1436 1436
 				 <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?>
1437 1437
 				 <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?>
1438 1438
 				 <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?>
1439 1439
 			</h5>   <?php */
1440
-        ?>
1440
+		?>
1441 1441
 
1442 1442
         <div id="<?php echo $name;?>_row"
1443 1443
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1446 1446
                 <label
1447 1447
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1448
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1448
+					echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1449 1449
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1450 1450
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1451 1451
                        value="<?php echo esc_attr($file_value); ?>"/>
@@ -1457,17 +1457,17 @@  discard block
 block discarded – undo
1457 1457
                 <?php } ?>
1458 1458
                 <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
1459 1459
                        value="<?php if (isset($file_totImg)) {
1460
-                           echo esc_attr($file_totImg);
1461
-                       } else {
1462
-                           echo '0';
1463
-                       } ?>"/>
1460
+						   echo esc_attr($file_totImg);
1461
+					   } else {
1462
+						   echo '0';
1463
+					   } ?>"/>
1464 1464
 
1465 1465
                 <div style="float:left; width:55%;">
1466 1466
                     <div
1467 1467
                         class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
1468 1468
                         id="<?php echo $file_id; ?>plupload-upload-ui" style="float:left; width:30%;">
1469 1469
                         <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
1470
-                        ?>
1470
+						?>
1471 1471
                         <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
1472 1472
                                value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
1473 1473
                                class="geodir_button" style="margin-top:10px;"/>
@@ -1486,7 +1486,7 @@  discard block
 block discarded – undo
1486 1486
                         style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;">
1487 1487
                     </div>
1488 1488
                     <?php /*?><span id="upload-msg" ><?php _e('Please drag &amp; drop the images to rearrange the order');?></span><?php */
1489
-                    ?>
1489
+					?>
1490 1490
 
1491 1491
                     <span id="<?php echo $file_id; ?>upload-error" style="display:none"></span>
1492 1492
 
@@ -1500,9 +1500,9 @@  discard block
 block discarded – undo
1500 1500
 
1501 1501
 
1502 1502
         <?php
1503
-        $html = ob_get_clean();
1504
-    }
1503
+		$html = ob_get_clean();
1504
+	}
1505 1505
 
1506
-    return $html;
1506
+	return $html;
1507 1507
 }
1508 1508
 add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2);
1509 1509
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
  *
18 18
  * @return string The html to output for the custom field.
19 19
  */
20
-function geodir_cfi_fieldset($html,$cf){
20
+function geodir_cfi_fieldset($html, $cf) {
21 21
 
22 22
     $html_var = $cf['htmlvar_name'];
23 23
 
24 24
     // Check if there is a custom field specific filter.
25
-    if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
25
+    if (has_filter("geodir_custom_field_input_fieldset_{$html_var}")) {
26 26
         /**
27 27
          * Filter the fieldset html by individual custom field.
28 28
          *
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
          * @param array $cf The custom field array.
31 31
          * @since 1.6.6
32 32
          */
33
-        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
33
+        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}", $html, $cf);
34 34
     }
35 35
 
36 36
     // If no html then we run the standard output.
37
-    if(empty($html)) {
37
+    if (empty($html)) {
38 38
 
39 39
         ob_start(); // Start  buffering;
40 40
         ?>
41 41
         <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row"
42 42
             gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo $cf['site_title']; ?>
43
-            <?php if ( $cf['desc'] != '' ) {
44
-                echo '<small>( ' . $cf['desc'] . ' )</small>';
43
+            <?php if ($cf['desc'] != '') {
44
+                echo '<small>( '.$cf['desc'].' )</small>';
45 45
             } ?></h5>
46 46
         <?php
47 47
         $html = ob_get_clean();
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     return $html;
51 51
 }
52
-add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2);
52
+add_filter('geodir_custom_field_input_fieldset', 'geodir_cfi_fieldset', 10, 2);
53 53
 
54 54
 
55 55
 
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @return string The html to output for the custom field.
64 64
  */
65
-function geodir_cfi_text($html,$cf){
65
+function geodir_cfi_text($html, $cf) {
66 66
 
67 67
     $html_var = $cf['htmlvar_name'];
68 68
 
69 69
     // Check if there is a custom field specific filter.
70
-    if(has_filter("geodir_custom_field_input_text_{$html_var}")){
70
+    if (has_filter("geodir_custom_field_input_text_{$html_var}")) {
71 71
         /**
72 72
          * Filter the text html by individual custom field.
73 73
          *
@@ -75,41 +75,41 @@  discard block
 block discarded – undo
75 75
          * @param array $cf The custom field array.
76 76
          * @since 1.6.6
77 77
          */
78
-        $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
78
+        $html = apply_filters("geodir_custom_field_input_text_{$html_var}", $html, $cf);
79 79
     }
80 80
 
81 81
     // If no html then we run the standard output.
82
-    if(empty($html)) {
82
+    if (empty($html)) {
83 83
 
84 84
         ob_start(); // Start  buffering;
85 85
 
86 86
         $value = geodir_get_cf_value($cf);
87 87
         $type = $cf['type'];
88 88
         //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
89
+        if (isset($cf['data_type']) && $cf['data_type'] == 'INT') {$type = 'number'; }
90
+        elseif (isset($cf['data_type']) && $cf['data_type'] == 'FLOAT') {$type = 'float'; }
91 91
 
92 92
         //validation
93
-        if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
93
+        if (isset($cf['validation_pattern']) && $cf['validation_pattern']) {
94 94
             $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
95
+        } else {$validation = ''; }
96 96
 
97 97
         // validation message
98
-        if(isset($cf['validation_msg']) && $cf['validation_msg']){
98
+        if (isset($cf['validation_msg']) && $cf['validation_msg']) {
99 99
             $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
100
+        } else {$validation_msg = ''; }
101 101
         ?>
102 102
 
103
-        <div id="<?php echo $cf['name'];?>_row"
104
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
103
+        <div id="<?php echo $cf['name']; ?>_row"
104
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
105 105
             <label>
106 106
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107 107
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
108
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
109 109
             </label>
110
-            <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
111
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
112
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
110
+            <input field_type="<?php echo $type; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
111
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="<?php echo $type; ?>" class="geodir_textfield" <?php echo $validation; echo $validation_msg; ?> />
112
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
113 113
             <?php if ($cf['is_required']) { ?>
114 114
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
115 115
             <?php } ?>
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
     return $html;
123 123
 }
124
-add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2);
124
+add_filter('geodir_custom_field_input_text', 'geodir_cfi_text', 10, 2);
125 125
 
126 126
 
127 127
 /**
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return string The html to output for the custom field.
135 135
  */
136
-function geodir_cfi_email($html,$cf){
136
+function geodir_cfi_email($html, $cf) {
137 137
 
138 138
     $html_var = $cf['htmlvar_name'];
139 139
 
140 140
     // Check if there is a custom field specific filter.
141
-    if(has_filter("geodir_custom_field_input_email_{$html_var}")){
141
+    if (has_filter("geodir_custom_field_input_email_{$html_var}")) {
142 142
         /**
143 143
          * Filter the email html by individual custom field.
144 144
          *
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
          * @param array $cf The custom field array.
147 147
          * @since 1.6.6
148 148
          */
149
-        $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
149
+        $html = apply_filters("geodir_custom_field_input_email_{$html_var}", $html, $cf);
150 150
     }
151 151
 
152 152
     // If no html then we run the standard output.
153
-    if(empty($html)) {
153
+    if (empty($html)) {
154 154
 
155 155
         ob_start(); // Start  buffering;
156 156
         $value = geodir_get_cf_value($cf);
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
             $value = '';
160 160
         }?>
161 161
 
162
-        <div id="<?php echo $cf['name'];?>_row"
163
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
162
+        <div id="<?php echo $cf['name']; ?>_row"
163
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
164 164
             <label>
165 165
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166 166
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
167
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
168 168
             </label>
169
-            <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
170
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
171
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
169
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php  echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
170
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="email" class="geodir_textfield"/>
171
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
172 172
             <?php if ($cf['is_required']) { ?>
173 173
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
174 174
             <?php } ?>
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
     return $html;
182 182
 }
183
-add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2);
183
+add_filter('geodir_custom_field_input_email', 'geodir_cfi_email', 10, 2);
184 184
 
185 185
 
186 186
 
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @return string The html to output for the custom field.
195 195
  */
196
-function geodir_cfi_phone($html,$cf){
196
+function geodir_cfi_phone($html, $cf) {
197 197
 
198 198
     $html_var = $cf['htmlvar_name'];
199 199
 
200 200
     // Check if there is a custom field specific filter.
201
-    if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
201
+    if (has_filter("geodir_custom_field_input_phone_{$html_var}")) {
202 202
         /**
203 203
          * Filter the phone html by individual custom field.
204 204
          *
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
          * @param array $cf The custom field array.
207 207
          * @since 1.6.6
208 208
          */
209
-        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
209
+        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}", $html, $cf);
210 210
     }
211 211
 
212 212
     // If no html then we run the standard output.
213
-    if(empty($html)) {
213
+    if (empty($html)) {
214 214
 
215 215
         ob_start(); // Start  buffering;
216 216
         $value = geodir_get_cf_value($cf);
@@ -219,16 +219,16 @@  discard block
 block discarded – undo
219 219
             $value = '';
220 220
         }?>
221 221
 
222
-        <div id="<?php echo $cf['name'];?>_row"
223
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
222
+        <div id="<?php echo $cf['name']; ?>_row"
223
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
224 224
             <label>
225 225
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226 226
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
227
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
228 228
             </label>
229
-            <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
230
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
231
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
229
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php  echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
230
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="tel" class="geodir_textfield"/>
231
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
232 232
             <?php if ($cf['is_required']) { ?>
233 233
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
234 234
             <?php } ?>
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
     return $html;
242 242
 }
243
-add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2);
243
+add_filter('geodir_custom_field_input_phone', 'geodir_cfi_phone', 10, 2);
244 244
 
245 245
 
246 246
 
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return string The html to output for the custom field.
255 255
  */
256
-function geodir_cfi_url($html,$cf){
256
+function geodir_cfi_url($html, $cf) {
257 257
 
258 258
     $html_var = $cf['htmlvar_name'];
259 259
 
260 260
     // Check if there is a custom field specific filter.
261
-    if(has_filter("geodir_custom_field_input_url_{$html_var}")){
261
+    if (has_filter("geodir_custom_field_input_url_{$html_var}")) {
262 262
         /**
263 263
          * Filter the url html by individual custom field.
264 264
          *
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
          * @param array $cf The custom field array.
267 267
          * @since 1.6.6
268 268
          */
269
-        $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
269
+        $html = apply_filters("geodir_custom_field_input_url_{$html_var}", $html, $cf);
270 270
     }
271 271
 
272 272
     // If no html then we run the standard output.
273
-    if(empty($html)) {
273
+    if (empty($html)) {
274 274
 
275 275
         ob_start(); // Start  buffering;
276 276
         $value = geodir_get_cf_value($cf);
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
             $value = '';
280 280
         }?>
281 281
 
282
-        <div id="<?php echo $cf['name'];?>_row"
283
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
282
+        <div id="<?php echo $cf['name']; ?>_row"
283
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
284 284
             <label>
285 285
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286 286
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
287
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
288 288
             </label>
289
-            <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
290
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
289
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
290
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="url" class="geodir_textfield"
291 291
                    oninvalid="setCustomValidity('<?php _e('Please enter a valid URL including http://', 'geodirectory'); ?>')"
292 292
                    onchange="try{setCustomValidity('')}catch(e){}"
293 293
             />
294
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
294
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
295 295
             <?php if ($cf['is_required']) { ?>
296 296
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
297 297
             <?php } ?>
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
     return $html;
305 305
 }
306
-add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2);
306
+add_filter('geodir_custom_field_input_url', 'geodir_cfi_url', 10, 2);
307 307
 
308 308
 
309 309
 /**
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
  *
316 316
  * @return string The html to output for the custom field.
317 317
  */
318
-function geodir_cfi_radio($html,$cf){
318
+function geodir_cfi_radio($html, $cf) {
319 319
 
320 320
     $html_var = $cf['htmlvar_name'];
321 321
 
322 322
     // Check if there is a custom field specific filter.
323
-    if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
323
+    if (has_filter("geodir_custom_field_input_radio_{$html_var}")) {
324 324
         /**
325 325
          * Filter the radio html by individual custom field.
326 326
          *
@@ -328,22 +328,22 @@  discard block
 block discarded – undo
328 328
          * @param array $cf The custom field array.
329 329
          * @since 1.6.6
330 330
          */
331
-        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
331
+        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}", $html, $cf);
332 332
     }
333 333
 
334 334
     // If no html then we run the standard output.
335
-    if(empty($html)) {
335
+    if (empty($html)) {
336 336
 
337 337
         ob_start(); // Start  buffering;
338 338
         $value = geodir_get_cf_value($cf);
339 339
 
340 340
         ?>
341
-        <div id="<?php echo $cf['name'];?>_row"
342
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
341
+        <div id="<?php echo $cf['name']; ?>_row"
342
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
343 343
             <label>
344 344
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345 345
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
346
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
347 347
             </label>
348 348
             <?php if ($cf['option_values']) {
349 349
                 $option_values = geodir_string_values_to_options($cf['option_values'], true);
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
                     foreach ($option_values as $option_value) {
353 353
                         if (empty($option_value['optgroup'])) {
354 354
                             ?>
355
-                            <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span>
355
+                            <span class="gd-radios"><input name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" <?php checked($value, $option_value['value']); ?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="radio" /><?php echo $option_value['label']; ?></span>
356 356
                             <?php
357 357
                         }
358 358
                     }
359 359
                 }
360 360
             }
361 361
             ?>
362
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
362
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
363 363
             <?php if ($cf['is_required']) { ?>
364 364
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
365 365
             <?php } ?>
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 
372 372
     return $html;
373 373
 }
374
-add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2);
374
+add_filter('geodir_custom_field_input_radio', 'geodir_cfi_radio', 10, 2);
375 375
 
376 376
 
377 377
 /**
@@ -383,12 +383,12 @@  discard block
 block discarded – undo
383 383
  *
384 384
  * @return string The html to output for the custom field.
385 385
  */
386
-function geodir_cfi_checkbox($html,$cf){
386
+function geodir_cfi_checkbox($html, $cf) {
387 387
 
388 388
     $html_var = $cf['htmlvar_name'];
389 389
 
390 390
     // Check if there is a custom field specific filter.
391
-    if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
391
+    if (has_filter("geodir_custom_field_input_checkbox_{$html_var}")) {
392 392
         /**
393 393
          * Filter the checkbox html by individual custom field.
394 394
          *
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
          * @param array $cf The custom field array.
397 397
          * @since 1.6.6
398 398
          */
399
-        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
399
+        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}", $html, $cf);
400 400
     }
401 401
 
402 402
     // If no html then we run the standard output.
403
-    if(empty($html)) {
403
+    if (empty($html)) {
404 404
 
405 405
         ob_start(); // Start  buffering;
406 406
         $value = geodir_get_cf_value($cf);
@@ -409,22 +409,22 @@  discard block
 block discarded – undo
409 409
             $value = '';
410 410
         }?>
411 411
 
412
-        <div id="<?php echo $cf['name'];?>_row"
413
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
412
+        <div id="<?php echo $cf['name']; ?>_row"
413
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
414 414
             <label>
415 415
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
416 416
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
417
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
417
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
418 418
             </label>
419 419
             <?php if ($value != '1') {
420 420
                 $value = '0';
421 421
             }?>
422
-            <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/>
422
+            <input type="hidden" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" value="<?php echo esc_attr($value); ?>"/>
423 423
             <input  <?php if ($value == '1') {
424 424
                 echo 'checked="checked"';
425
-            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
426
-                 onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/>
427
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
425
+            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="checkbox"
426
+                 onchange="if(this.checked){jQuery('#<?php echo $cf['name']; ?>').val('1');} else{ jQuery('#<?php echo $cf['name']; ?>').val('0');}"/>
427
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
428 428
             <?php if ($cf['is_required']) { ?>
429 429
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
430 430
             <?php } ?>
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 
437 437
     return $html;
438 438
 }
439
-add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2);
439
+add_filter('geodir_custom_field_input_checkbox', 'geodir_cfi_checkbox', 10, 2);
440 440
 
441 441
 
442 442
 /**
@@ -448,12 +448,12 @@  discard block
 block discarded – undo
448 448
  *
449 449
  * @return string The html to output for the custom field.
450 450
  */
451
-function geodir_cfi_textarea($html,$cf){
451
+function geodir_cfi_textarea($html, $cf) {
452 452
 
453 453
     $html_var = $cf['htmlvar_name'];
454 454
 
455 455
     // Check if there is a custom field specific filter.
456
-    if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
456
+    if (has_filter("geodir_custom_field_input_textarea_{$html_var}")) {
457 457
         /**
458 458
          * Filter the textarea html by individual custom field.
459 459
          *
@@ -461,11 +461,11 @@  discard block
 block discarded – undo
461 461
          * @param array $cf The custom field array.
462 462
          * @since 1.6.6
463 463
          */
464
-        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
464
+        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}", $html, $cf);
465 465
     }
466 466
 
467 467
     // If no html then we run the standard output.
468
-    if(empty($html)) {
468
+    if (empty($html)) {
469 469
 
470 470
         ob_start(); // Start  buffering;
471 471
         $value = geodir_get_cf_value($cf);
@@ -473,32 +473,32 @@  discard block
 block discarded – undo
473 473
         $extra_fields = unserialize($cf['extra_fields']);
474 474
         ?>
475 475
 
476
-        <div id="<?php echo $cf['name'];?>_row"
477
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
476
+        <div id="<?php echo $cf['name']; ?>_row"
477
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
478 478
             <label>
479 479
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
480 480
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
481
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
481
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
482 482
             </label><?php
483 483
 
484 484
 
485 485
             if (is_array($extra_fields) && in_array('1', $extra_fields)) {
486 486
 
487
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
487
+                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
488 488
 
489
-            <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor">
489
+            <div class="editor" field_id="<?php echo $cf['name']; ?>" field_type="editor">
490 490
                 <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?>
491 491
                 </div><?php
492 492
 
493 493
             } else {
494 494
 
495
-                ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
496
-                            id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php
495
+                ?><textarea field_type="<?php echo $cf['type']; ?>" class="geodir_textarea" name="<?php echo $cf['name']; ?>"
496
+                            id="<?php echo $cf['name']; ?>"><?php echo stripslashes($value); ?></textarea><?php
497 497
 
498 498
             }?>
499 499
 
500 500
 
501
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
501
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
502 502
             <?php if ($cf['is_required']) { ?>
503 503
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
504 504
             <?php } ?>
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 
511 511
     return $html;
512 512
 }
513
-add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2);
513
+add_filter('geodir_custom_field_input_textarea', 'geodir_cfi_textarea', 10, 2);
514 514
 
515 515
 
516 516
 /**
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
  *
523 523
  * @return string The html to output for the custom field.
524 524
  */
525
-function geodir_cfi_select($html,$cf){
525
+function geodir_cfi_select($html, $cf) {
526 526
 
527 527
     $html_var = $cf['htmlvar_name'];
528 528
 
529 529
     // Check if there is a custom field specific filter.
530
-    if(has_filter("geodir_custom_field_input_select_{$html_var}")){
530
+    if (has_filter("geodir_custom_field_input_select_{$html_var}")) {
531 531
         /**
532 532
          * Filter the select html by individual custom field.
533 533
          *
@@ -535,22 +535,22 @@  discard block
 block discarded – undo
535 535
          * @param array $cf The custom field array.
536 536
          * @since 1.6.6
537 537
          */
538
-        $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
538
+        $html = apply_filters("geodir_custom_field_input_select_{$html_var}", $html, $cf);
539 539
     }
540 540
 
541 541
     // If no html then we run the standard output.
542
-    if(empty($html)) {
542
+    if (empty($html)) {
543 543
 
544 544
         ob_start(); // Start  buffering;
545 545
         $value = geodir_get_cf_value($cf);
546 546
 
547 547
         ?>
548
-        <div id="<?php echo $cf['name'];?>_row"
549
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
548
+        <div id="<?php echo $cf['name']; ?>_row"
549
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
550 550
             <label>
551 551
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
552 552
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
553
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
553
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
554 554
             </label>
555 555
             <?php
556 556
             $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
@@ -560,22 +560,22 @@  discard block
 block discarded – undo
560 560
                     if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
561 561
                         $option_label = isset($option_row['label']) ? $option_row['label'] : '';
562 562
 
563
-                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
563
+                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';
564 564
                     } else {
565 565
                         $option_label = isset($option_row['label']) ? $option_row['label'] : '';
566 566
                         $option_value = isset($option_row['value']) ? $option_row['value'] : '';
567 567
                         $selected = $option_value == $value ? 'selected="selected"' : '';
568 568
 
569
-                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
569
+                        $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';
570 570
                     }
571 571
                 }
572 572
             }
573 573
             ?>
574
-            <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
574
+            <select field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
575 575
                     class="geodir_textfield textfield_x chosen_select"
576
-                    data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
577
-                    option-ajaxchosen="false"><?php echo $select_options;?></select>
578
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
576
+                    data-placeholder="<?php echo __('Choose', 'geodirectory').' '.$site_title.'&hellip;'; ?>"
577
+                    option-ajaxchosen="false"><?php echo $select_options; ?></select>
578
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
579 579
             <?php if ($cf['is_required']) { ?>
580 580
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
581 581
             <?php } ?>
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 
588 588
     return $html;
589 589
 }
590
-add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2);
590
+add_filter('geodir_custom_field_input_select', 'geodir_cfi_select', 10, 2);
591 591
 
592 592
 
593 593
 /**
@@ -599,12 +599,12 @@  discard block
 block discarded – undo
599 599
  *
600 600
  * @return string The html to output for the custom field.
601 601
  */
602
-function geodir_cfi_multiselect($html,$cf){
602
+function geodir_cfi_multiselect($html, $cf) {
603 603
 
604 604
     $html_var = $cf['htmlvar_name'];
605 605
 
606 606
     // Check if there is a custom field specific filter.
607
-    if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
607
+    if (has_filter("geodir_custom_field_input_multiselect_{$html_var}")) {
608 608
         /**
609 609
          * Filter the multiselect html by individual custom field.
610 610
          *
@@ -612,11 +612,11 @@  discard block
 block discarded – undo
612 612
          * @param array $cf The custom field array.
613 613
          * @since 1.6.6
614 614
          */
615
-        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
615
+        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}", $html, $cf);
616 616
     }
617 617
 
618 618
     // If no html then we run the standard output.
619
-    if(empty($html)) {
619
+    if (empty($html)) {
620 620
 
621 621
         ob_start(); // Start  buffering;
622 622
         $value = geodir_get_cf_value($cf);
@@ -653,9 +653,9 @@  discard block
 block discarded – undo
653 653
                                 $option_label = isset($option_row['label']) ? $option_row['label'] : '';
654 654
 
655 655
                                 if ($multi_display == 'select') {
656
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
656
+                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';
657 657
                                 } else {
658
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
658
+                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>'.$option_label.'</li>' : '';
659 659
                                 }
660 660
                             } else {
661 661
                                 $option_label = isset($option_row['label']) ? $option_row['label'] : '';
@@ -680,9 +680,9 @@  discard block
 block discarded – undo
680 680
                                 }
681 681
 
682 682
                                 if ($multi_display == 'select') {
683
-                                    $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
683
+                                    $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';
684 684
                                 } else {
685
-                                    $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
685
+                                    $select_options .= '<li><input name="'.$cf['name'].'[]" '.$checked.' value="'.esc_attr($option_value).'" class="gd-'.$multi_display.'" field_type="'.$multi_display.'" type="'.$multi_display.'" />&nbsp;'.$option_label.' </li>';
686 686
                                 }
687 687
                             }
688 688
                         }
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 
703 703
     return $html;
704 704
 }
705
-add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2);
705
+add_filter('geodir_custom_field_input_multiselect', 'geodir_cfi_multiselect', 10, 2);
706 706
 
707 707
 
708 708
 /**
@@ -714,12 +714,12 @@  discard block
 block discarded – undo
714 714
  *
715 715
  * @return string The html to output for the custom field.
716 716
  */
717
-function geodir_cfi_html($html,$cf){
717
+function geodir_cfi_html($html, $cf) {
718 718
 
719 719
     $html_var = $cf['htmlvar_name'];
720 720
 
721 721
     // Check if there is a custom field specific filter.
722
-    if(has_filter("geodir_custom_field_input_html_{$html_var}")){
722
+    if (has_filter("geodir_custom_field_input_html_{$html_var}")) {
723 723
         /**
724 724
          * Filter the html html by individual custom field.
725 725
          *
@@ -727,11 +727,11 @@  discard block
 block discarded – undo
727 727
          * @param array $cf The custom field array.
728 728
          * @since 1.6.6
729 729
          */
730
-        $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
730
+        $html = apply_filters("geodir_custom_field_input_html_{$html_var}", $html, $cf);
731 731
     }
732 732
 
733 733
     // If no html then we run the standard output.
734
-    if(empty($html)) {
734
+    if (empty($html)) {
735 735
 
736 736
         ob_start(); // Start  buffering;
737 737
         $value = geodir_get_cf_value($cf);
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 
765 765
     return $html;
766 766
 }
767
-add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2);
767
+add_filter('geodir_custom_field_input_html', 'geodir_cfi_html', 10, 2);
768 768
 
769 769
 
770 770
 
@@ -777,12 +777,12 @@  discard block
 block discarded – undo
777 777
  *
778 778
  * @return string The html to output for the custom field.
779 779
  */
780
-function geodir_cfi_datepicker($html,$cf){
780
+function geodir_cfi_datepicker($html, $cf) {
781 781
 
782 782
     $html_var = $cf['htmlvar_name'];
783 783
 
784 784
     // Check if there is a custom field specific filter.
785
-    if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
785
+    if (has_filter("geodir_custom_field_input_datepicker_{$html_var}")) {
786 786
         /**
787 787
          * Filter the datepicker html by individual custom field.
788 788
          *
@@ -790,11 +790,11 @@  discard block
 block discarded – undo
790 790
          * @param array $cf The custom field array.
791 791
          * @since 1.6.6
792 792
          */
793
-        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
793
+        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}", $html, $cf);
794 794
     }
795 795
 
796 796
     // If no html then we run the standard output.
797
-    if(empty($html)) {
797
+    if (empty($html)) {
798 798
 
799 799
         ob_start(); // Start  buffering;
800 800
         $value = geodir_get_cf_value($cf);
@@ -806,23 +806,23 @@  discard block
 block discarded – undo
806 806
             $extra_fields['date_format'] = 'yy-mm-dd';
807 807
 
808 808
         $date_format = $extra_fields['date_format'];
809
-        $jquery_date_format  = $date_format;
809
+        $jquery_date_format = $date_format;
810 810
 
811 811
 
812 812
         // check if we need to change the format or not
813 813
         $date_format_len = strlen(str_replace(' ', '', $date_format));
814
-        if($date_format_len>5){// if greater then 5 then it's the old style format.
814
+        if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
815 815
 
816
-            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
817
-            $replace = array('d','j','l','m','n','F','Y');//PHP date format
816
+            $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
817
+            $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
818 818
 
819 819
             $date_format = str_replace($search, $replace, $date_format);
820
-        }else{
821
-            $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
820
+        } else {
821
+            $jquery_date_format = geodir_date_format_php_to_jqueryui($jquery_date_format);
822 822
         }
823 823
 
824
-        if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
825
-        if($value && !isset($_REQUEST['backandedit'])) {
824
+        if ($value == '0000-00-00') {$value = ''; }//if date not set, then mark it empty
825
+        if ($value && !isset($_REQUEST['backandedit'])) {
826 826
             //$time = strtotime($value);
827 827
             //$value = date_i18n($date_format, $time);
828 828
         }
@@ -833,37 +833,37 @@  discard block
 block discarded – undo
833 833
 
834 834
             jQuery(function () {
835 835
 
836
-                jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php
836
+                jQuery("#<?php echo $cf['name']; ?>").datepicker({changeMonth: true, changeYear: true <?php
837 837
                     /**
838 838
                      * Used to add extra option to datepicker per custom field.
839 839
                      *
840 840
                      * @since 1.5.7
841 841
                      * @param string $name The custom field name.
842 842
                      */
843
-                    echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
843
+                    echo apply_filters("gd_datepicker_extra_{$name}", ''); ?>});
844 844
 
845
-                jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
845
+                jQuery("#<?php echo $name; ?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format; ?>');
846 846
 
847
-                <?php if(!empty($value)){?>
848
-                jQuery("#<?php echo $name;?>").datepicker("setDate", '<?php echo $value;?>');
847
+                <?php if (!empty($value)) {?>
848
+                jQuery("#<?php echo $name; ?>").datepicker("setDate", '<?php echo $value; ?>');
849 849
                 <?php } ?>
850 850
 
851 851
             });
852 852
 
853 853
         </script>
854
-        <div id="<?php echo $name;?>_row"
855
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
854
+        <div id="<?php echo $name; ?>_row"
855
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
856 856
             <label>
857 857
 
858 858
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
859 859
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
860
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
860
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
861 861
             </label>
862 862
 
863
-            <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
864
-                   value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
863
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
864
+                   value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
865 865
 
866
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
866
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
867 867
             <?php if ($cf['is_required']) { ?>
868 868
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
869 869
             <?php } ?>
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 
876 876
     return $html;
877 877
 }
878
-add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2);
878
+add_filter('geodir_custom_field_input_datepicker', 'geodir_cfi_datepicker', 10, 2);
879 879
 
880 880
 
881 881
 /**
@@ -887,12 +887,12 @@  discard block
 block discarded – undo
887 887
  *
888 888
  * @return string The html to output for the custom field.
889 889
  */
890
-function geodir_cfi_time($html,$cf){
890
+function geodir_cfi_time($html, $cf) {
891 891
 
892 892
     $html_var = $cf['htmlvar_name'];
893 893
 
894 894
     // Check if there is a custom field specific filter.
895
-    if(has_filter("geodir_custom_field_input_time_{$html_var}")){
895
+    if (has_filter("geodir_custom_field_input_time_{$html_var}")) {
896 896
         /**
897 897
          * Filter the time html by individual custom field.
898 898
          *
@@ -900,11 +900,11 @@  discard block
 block discarded – undo
900 900
          * @param array $cf The custom field array.
901 901
          * @since 1.6.6
902 902
          */
903
-        $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
903
+        $html = apply_filters("geodir_custom_field_input_time_{$html_var}", $html, $cf);
904 904
     }
905 905
 
906 906
     // If no html then we run the standard output.
907
-    if(empty($html)) {
907
+    if (empty($html)) {
908 908
 
909 909
         ob_start(); // Start  buffering;
910 910
         $value = geodir_get_cf_value($cf);
@@ -917,25 +917,25 @@  discard block
 block discarded – undo
917 917
         <script type="text/javascript">
918 918
             jQuery(document).ready(function () {
919 919
 
920
-                jQuery('#<?php echo $name;?>').timepicker({
920
+                jQuery('#<?php echo $name; ?>').timepicker({
921 921
                     showPeriod: true,
922 922
                     showLeadingZero: true,
923 923
                     showPeriod: true,
924 924
                 });
925 925
             });
926 926
         </script>
927
-        <div id="<?php echo $name;?>_row"
928
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
927
+        <div id="<?php echo $name; ?>_row"
928
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
929 929
             <label>
930 930
 
931 931
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
932 932
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
933
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
933
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
934 934
             </label>
935
-            <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
936
-                   id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
935
+            <input readonly="readonly" field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>"
936
+                   id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
937 937
 
938
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
938
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
939 939
             <?php if ($cf['is_required']) { ?>
940 940
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
941 941
             <?php } ?>
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 
947 947
     return $html;
948 948
 }
949
-add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2);
949
+add_filter('geodir_custom_field_input_time', 'geodir_cfi_time', 10, 2);
950 950
 
951 951
 
952 952
 /**
@@ -958,12 +958,12 @@  discard block
 block discarded – undo
958 958
  *
959 959
  * @return string The html to output for the custom field.
960 960
  */
961
-function geodir_cfi_address($html,$cf){
961
+function geodir_cfi_address($html, $cf) {
962 962
 
963 963
     $html_var = $cf['htmlvar_name'];
964 964
 
965 965
     // Check if there is a custom field specific filter.
966
-    if(has_filter("geodir_custom_field_input_address_{$html_var}")){
966
+    if (has_filter("geodir_custom_field_input_address_{$html_var}")) {
967 967
         /**
968 968
          * Filter the address html by individual custom field.
969 969
          *
@@ -971,11 +971,11 @@  discard block
 block discarded – undo
971 971
          * @param array $cf The custom field array.
972 972
          * @since 1.6.6
973 973
          */
974
-        $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
974
+        $html = apply_filters("geodir_custom_field_input_address_{$html_var}", $html, $cf);
975 975
     }
976 976
 
977 977
     // If no html then we run the standard output.
978
-    if(empty($html)) {
978
+    if (empty($html)) {
979 979
 
980 980
         global $gd_session;
981 981
         ob_start(); // Start  buffering;
@@ -988,12 +988,12 @@  discard block
 block discarded – undo
988 988
         $site_title = $cf['site_title'];
989 989
         $is_admin = $cf['is_admin'];
990 990
         $extra_fields = unserialize($cf['extra_fields']);
991
-        $prefix = $name . '_';
991
+        $prefix = $name.'_';
992 992
 
993
-        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
994
-        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
993
+        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix.' address');
994
+        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix.' zip/post code ');
995 995
         ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
996
-        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
996
+        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix.' mapview');
997 997
 
998 998
         $address = '';
999 999
         $zip = '';
@@ -1004,21 +1004,21 @@  discard block
 block discarded – undo
1004 1004
 
1005 1005
         if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1006 1006
             $post = $gd_ses_listing;
1007
-            $address = $post[$prefix . 'address'];
1008
-            $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1009
-            $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1010
-            $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1011
-            $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1012
-            $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1007
+            $address = $post[$prefix.'address'];
1008
+            $zip = isset($post[$prefix.'zip']) ? $post[$prefix.'zip'] : '';
1009
+            $lat = isset($post[$prefix.'latitude']) ? $post[$prefix.'latitude'] : '';
1010
+            $lng = isset($post[$prefix.'longitude']) ? $post[$prefix.'longitude'] : '';
1011
+            $mapview = isset($post[$prefix.'mapview']) ? $post[$prefix.'mapview'] : '';
1012
+            $mapzoom = isset($post[$prefix.'mapzoom']) ? $post[$prefix.'mapzoom'] : '';
1013 1013
         } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1014
-            $post_info = (array)$post_info;
1015
-
1016
-            $address = $post_info[$prefix . 'address'];
1017
-            $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1018
-            $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1019
-            $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1020
-            $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1021
-            $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1014
+            $post_info = (array) $post_info;
1015
+
1016
+            $address = $post_info[$prefix.'address'];
1017
+            $zip = isset($post_info[$prefix.'zip']) ? $post_info[$prefix.'zip'] : '';
1018
+            $lat = isset($post_info[$prefix.'latitude']) ? $post_info[$prefix.'latitude'] : '';
1019
+            $lng = isset($post_info[$prefix.'longitude']) ? $post_info[$prefix.'longitude'] : '';
1020
+            $mapview = isset($post_info[$prefix.'mapview']) ? $post_info[$prefix.'mapview'] : '';
1021
+            $mapzoom = isset($post_info[$prefix.'mapzoom']) ? $post_info[$prefix.'mapzoom'] : '';
1022 1022
         }
1023 1023
 
1024 1024
         $location = geodir_get_default_location();
@@ -1055,16 +1055,16 @@  discard block
 block discarded – undo
1055 1055
 
1056 1056
         ?>
1057 1057
 
1058
-        <div id="geodir_<?php echo $prefix . 'address';?>_row"
1059
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1058
+        <div id="geodir_<?php echo $prefix.'address'; ?>_row"
1059
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1060 1060
             <label>
1061 1061
                 <?php _e($address_title, 'geodirectory'); ?>
1062
-                <?php if ($is_required) echo '<span>*</span>';?>
1062
+                <?php if ($is_required) echo '<span>*</span>'; ?>
1063 1063
             </label>
1064
-            <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"
1065
-                   id="<?php echo $prefix . 'address';?>" class="geodir_textfield"
1064
+            <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'address'; ?>"
1065
+                   id="<?php echo $prefix.'address'; ?>" class="geodir_textfield"
1066 1066
                    value="<?php echo esc_attr(stripslashes($address)); ?>"/>
1067
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1067
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1068 1068
             <?php if ($is_required) { ?>
1069 1069
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1070 1070
             <?php } ?>
@@ -1084,14 +1084,14 @@  discard block
 block discarded – undo
1084 1084
 
1085 1085
         if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1086 1086
 
1087
-            <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1087
+            <div id="geodir_<?php echo $prefix.'zip'; ?>_row"
1088 1088
                  class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details">
1089 1089
                 <label>
1090 1090
                     <?php _e($zip_title, 'geodirectory'); ?>
1091 1091
                     <?php /*if($is_required) echo '<span>*</span>';*/ ?>
1092 1092
                 </label>
1093
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'zip'; ?>"
1094
-                       id="<?php echo $prefix . 'zip'; ?>" class="geodir_textfield autofill"
1093
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'zip'; ?>"
1094
+                       id="<?php echo $prefix.'zip'; ?>" class="geodir_textfield autofill"
1095 1095
                        value="<?php echo esc_attr(stripslashes($zip)); ?>"/>
1096 1096
                 <?php /*if($is_required) {?>
1097 1097
 					<span class="geodir_message_error"><?php echo _e($required_msg,'geodirectory');?></span>
@@ -1101,14 +1101,14 @@  discard block
 block discarded – undo
1101 1101
 
1102 1102
         <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?>
1103 1103
 
1104
-            <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1104
+            <div id="geodir_<?php echo $prefix.'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1105 1105
                 <?php
1106 1106
                 /**
1107 1107
                  * Contains add listing page map functions.
1108 1108
                  *
1109 1109
                  * @since 1.0.0
1110 1110
                  */
1111
-                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1111
+                include(geodir_plugin_path()."/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1112 1112
                 if ($lat_lng_blank) {
1113 1113
                     $lat = '';
1114 1114
                     $lng = '';
@@ -1119,14 +1119,14 @@  discard block
 block discarded – undo
1119 1119
             <?php
1120 1120
             /* show lat lng */
1121 1121
             $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1122
-            <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1122
+            <div id="geodir_<?php echo $prefix.'latitude'; ?>_row"
1123 1123
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1124 1124
                 <label>
1125 1125
                     <?php echo PLACE_ADDRESS_LAT; ?>
1126 1126
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1127 1127
                 </label>
1128
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1129
-                       id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
1128
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'latitude'; ?>"
1129
+                       id="<?php echo $prefix.'latitude'; ?>" class="geodir_textfield"
1130 1130
                        value="<?php echo esc_attr(stripslashes($lat)); ?>" size="25"/>
1131 1131
                 <span class="geodir_message_note"><?php echo GET_LATITUDE_MSG; ?></span>
1132 1132
                 <?php if ($is_required) { ?>
@@ -1134,14 +1134,14 @@  discard block
 block discarded – undo
1134 1134
                 <?php } ?>
1135 1135
             </div>
1136 1136
 
1137
-            <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1137
+            <div id="geodir_<?php echo $prefix.'longitude'; ?>_row"
1138 1138
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1139 1139
                 <label>
1140 1140
                     <?php echo PLACE_ADDRESS_LNG; ?>
1141 1141
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1142 1142
                 </label>
1143
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1144
-                       id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
1143
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'longitude'; ?>"
1144
+                       id="<?php echo $prefix.'longitude'; ?>" class="geodir_textfield"
1145 1145
                        value="<?php echo esc_attr(stripslashes($lng)); ?>" size="25"/>
1146 1146
                 <span class="geodir_message_note"><?php echo GET_LOGNGITUDE_MSG; ?></span>
1147 1147
                 <?php if ($is_required) { ?>
@@ -1151,32 +1151,32 @@  discard block
 block discarded – undo
1151 1151
         <?php } ?>
1152 1152
 
1153 1153
         <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?>
1154
-            <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1154
+            <div id="geodir_<?php echo $prefix.'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1155 1155
                 <label><?php _e($mapview_title, 'geodirectory'); ?></label>
1156 1156
 
1157 1157
 
1158 1158
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1159 1159
                                                             class="gd-checkbox"
1160
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1161
-                                                            id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1160
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1161
+                                                            id="<?php echo $prefix.'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1162 1162
                             echo 'checked="checked"';
1163 1163
                         } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1164 1164
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1165 1165
                                                              class="gd-checkbox"
1166
-                                                             name="<?php echo $prefix . 'mapview'; ?>"
1166
+                                                             name="<?php echo $prefix.'mapview'; ?>"
1167 1167
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1168 1168
                             echo 'checked="checked"';
1169 1169
                         } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1170 1170
 
1171 1171
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1172 1172
                                                             class="gd-checkbox"
1173
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1173
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1174 1174
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1175 1175
                             echo 'checked="checked"';
1176 1176
                         } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1177 1177
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1178 1178
                                                             class="gd-checkbox"
1179
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1179
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1180 1180
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1181 1181
                             echo 'checked="checked"';
1182 1182
                         } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
         <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1189 1189
             <input type="hidden" value="<?php if (isset($mapzoom)) {
1190 1190
                 echo esc_attr($mapzoom);
1191
-            } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1191
+            } ?>" name="<?php echo $prefix.'mapzoom'; ?>" id="<?php echo $prefix.'mapzoom'; ?>"/>
1192 1192
         <?php }
1193 1193
 
1194 1194
         $html = ob_get_clean();
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 
1197 1197
     return $html;
1198 1198
 }
1199
-add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2);
1199
+add_filter('geodir_custom_field_input_address', 'geodir_cfi_address', 10, 2);
1200 1200
 
1201 1201
 
1202 1202
 
@@ -1209,12 +1209,12 @@  discard block
 block discarded – undo
1209 1209
  *
1210 1210
  * @return string The html to output for the custom field.
1211 1211
  */
1212
-function geodir_cfi_taxonomy($html,$cf){
1212
+function geodir_cfi_taxonomy($html, $cf) {
1213 1213
 
1214 1214
     $html_var = $cf['htmlvar_name'];
1215 1215
 
1216 1216
     // Check if there is a custom field specific filter.
1217
-    if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1217
+    if (has_filter("geodir_custom_field_input_taxonomy_{$html_var}")) {
1218 1218
         /**
1219 1219
          * Filter the taxonomy html by individual custom field.
1220 1220
          *
@@ -1222,11 +1222,11 @@  discard block
 block discarded – undo
1222 1222
          * @param array $cf The custom field array.
1223 1223
          * @since 1.6.6
1224 1224
          */
1225
-        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1225
+        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}", $html, $cf);
1226 1226
     }
1227 1227
 
1228 1228
     // If no html then we run the standard output.
1229
-    if(empty($html)) {
1229
+    if (empty($html)) {
1230 1230
 
1231 1231
         ob_start(); // Start  buffering;
1232 1232
         $value = geodir_get_cf_value($cf);
@@ -1241,15 +1241,15 @@  discard block
 block discarded – undo
1241 1241
         if ($value == $cf['default']) {
1242 1242
             $value = '';
1243 1243
         } ?>
1244
-        <div id="<?php echo $name;?>_row"
1245
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1244
+        <div id="<?php echo $name; ?>_row"
1245
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1246 1246
             <label>
1247 1247
                 <?php $site_title = __($site_title, 'geodirectory');
1248 1248
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1249
-                <?php if ($is_required) echo '<span>*</span>';?>
1249
+                <?php if ($is_required) echo '<span>*</span>'; ?>
1250 1250
             </label>
1251 1251
 
1252
-            <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1252
+            <div id="<?php echo $name; ?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1253 1253
                 <?php
1254 1254
                 global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1255 1255
 
@@ -1261,7 +1261,7 @@  discard block
 block discarded – undo
1261 1261
 
1262 1262
                     $package_info = array();
1263 1263
 
1264
-                    $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1264
+                    $package_info = (array) geodir_post_package_info($package_info, $post, $post_type);
1265 1265
 
1266 1266
                     if (!empty($package_info)) {
1267 1267
 
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
 
1291 1291
                     $catadd_limit = $wpdb->get_var(
1292 1292
                         $wpdb->prepare(
1293
-                            "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1293
+                            "SELECT cat_limit FROM ".GEODIR_PRICE_TABLE." WHERE pid = %d",
1294 1294
                             array($package_id)
1295 1295
                         )
1296 1296
                     );
@@ -1306,13 +1306,13 @@  discard block
 block discarded – undo
1306 1306
                     $required_limit_msg = '';
1307 1307
                     if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1308 1308
 
1309
-                        $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1309
+                        $required_limit_msg = __('Only select', 'geodirectory').' '.$catadd_limit.__(' categories for this package.', 'geodirectory');
1310 1310
 
1311 1311
                     } else {
1312 1312
                         $required_limit_msg = $required_msg;
1313 1313
                     }
1314 1314
 
1315
-                    echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1315
+                    echo '<input type="hidden" cat_limit="'.$catadd_limit.'" id="cat_limit" value="'.esc_attr($required_limit_msg).'" name="cat_limit['.$name.']"  />';
1316 1316
 
1317 1317
 
1318 1318
                     if ($cat_display == 'select' || $cat_display == 'multiselect') {
@@ -1322,11 +1322,11 @@  discard block
 block discarded – undo
1322 1322
                         if ($cat_display == 'multiselect')
1323 1323
                             $multiple = 'multiple="multiple"';
1324 1324
 
1325
-                        echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1325
+                        echo '<select id="'.$name.'" '.$multiple.' type="'.$name.'" name="post_category['.$name.'][]" alt="'.$name.'" field_type="'.$cat_display.'" class="geodir_textfield textfield_x chosen_select" data-placeholder="'.__('Select Category', 'geodirectory').'">';
1326 1326
 
1327 1327
 
1328 1328
                         if ($cat_display == 'select')
1329
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1329
+                            echo '<option value="">'.__('Select Category', 'geodirectory').'</option>';
1330 1330
 
1331 1331
                     }
1332 1332
 
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
                 ?>
1345 1345
             </div>
1346 1346
 
1347
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1347
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1348 1348
             <?php if ($is_required) { ?>
1349 1349
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1350 1350
             <?php } ?>
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
 
1357 1357
     return $html;
1358 1358
 }
1359
-add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2);
1359
+add_filter('geodir_custom_field_input_taxonomy', 'geodir_cfi_taxonomy', 10, 2);
1360 1360
 
1361 1361
 
1362 1362
 /**
@@ -1368,12 +1368,12 @@  discard block
 block discarded – undo
1368 1368
  *
1369 1369
  * @return string The html to output for the custom field.
1370 1370
  */
1371
-function geodir_cfi_file($html,$cf){
1371
+function geodir_cfi_file($html, $cf) {
1372 1372
 
1373 1373
     $html_var = $cf['htmlvar_name'];
1374 1374
 
1375 1375
     // Check if there is a custom field specific filter.
1376
-    if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1376
+    if (has_filter("geodir_custom_field_input_file_{$html_var}")) {
1377 1377
         /**
1378 1378
          * Filter the file html by individual custom field.
1379 1379
          *
@@ -1381,11 +1381,11 @@  discard block
 block discarded – undo
1381 1381
          * @param array $cf The custom field array.
1382 1382
          * @since 1.6.6
1383 1383
          */
1384
-        $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1384
+        $html = apply_filters("geodir_custom_field_input_file_{$html_var}", $html, $cf);
1385 1385
     }
1386 1386
 
1387 1387
     // If no html then we run the standard output.
1388
-    if(empty($html)) {
1388
+    if (empty($html)) {
1389 1389
 
1390 1390
         ob_start(); // Start  buffering;
1391 1391
         $value = geodir_get_cf_value($cf);
@@ -1428,8 +1428,8 @@  discard block
 block discarded – undo
1428 1428
                 $file_totImg = count($curImages);
1429 1429
         }
1430 1430
 
1431
-        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1432
-        $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1431
+        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? implode(",", $extra_fields['gd_file_types']) : '';
1432
+        $display_file_types = $allowed_file_types != '' ? '.'.implode(", .", $extra_fields['gd_file_types']) : '';
1433 1433
 
1434 1434
         ?>
1435 1435
         <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
@@ -1439,13 +1439,13 @@  discard block
 block discarded – undo
1439 1439
 			</h5>   <?php */
1440 1440
         ?>
1441 1441
 
1442
-        <div id="<?php echo $name;?>_row"
1443
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1442
+        <div id="<?php echo $name; ?>_row"
1443
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1444 1444
 
1445 1445
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1446 1446
                 <label
1447 1447
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1448
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1448
+                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>'; ?></label>
1449 1449
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1450 1450
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1451 1451
                        value="<?php echo esc_attr($file_value); ?>"/>
@@ -1453,7 +1453,7 @@  discard block
 block discarded – undo
1453 1453
                        id="<?php echo $file_id; ?>image_limit" value="<?php echo $file_image_limit; ?>"/>
1454 1454
                 <?php if ($allowed_file_types != '') { ?>
1455 1455
                     <input type="hidden" name="<?php echo $file_id; ?>_allowed_types"
1456
-                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types);?>"/>
1456
+                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types); ?>"/>
1457 1457
                 <?php } ?>
1458 1458
                 <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
1459 1459
                        value="<?php if (isset($file_totImg)) {
@@ -1469,10 +1469,10 @@  discard block
 block discarded – undo
1469 1469
                         <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
1470 1470
                         ?>
1471 1471
                         <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
1472
-                               value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
1472
+                               value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory')); ?>"
1473 1473
                                class="geodir_button" style="margin-top:10px;"/>
1474 1474
                             <span class="ajaxnonceplu"
1475
-                                  id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?>"></span>
1475
+                                  id="ajaxnonceplu<?php echo wp_create_nonce($file_id.'pluploadan'); ?>"></span>
1476 1476
                         <?php if ($file_width && $file_height): ?>
1477 1477
                             <span class="plupload-resize"></span>
1478 1478
                             <span class="plupload-width" id="plupload-width<?php echo $file_width; ?>"></span>
@@ -1492,7 +1492,7 @@  discard block
 block discarded – undo
1492 1492
 
1493 1493
                 </div>
1494 1494
             </div>
1495
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?> <?php echo ( $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : '' );?></span>
1495
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo ($display_file_types != '' ? __('Allowed file types:', 'geodirectory').' '.$display_file_types : ''); ?></span>
1496 1496
             <?php if ($is_required) { ?>
1497 1497
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1498 1498
             <?php } ?>
@@ -1505,4 +1505,4 @@  discard block
 block discarded – undo
1505 1505
 
1506 1506
     return $html;
1507 1507
 }
1508
-add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2);
1509 1508
\ No newline at end of file
1509
+add_filter('geodir_custom_field_input_file', 'geodir_cfi_file', 10, 2);
1510 1510
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/post_functions.php 2 patches
Indentation   +2213 added lines, -2213 removed lines patch added patch discarded remove patch
@@ -20,480 +20,480 @@  discard block
 block discarded – undo
20 20
 function geodir_set_postcat_structure($post_id, $taxonomy, $default_cat = '', $category_str = '')
21 21
 {
22 22
 
23
-    $post_cat_ids = geodir_get_post_meta($post_id, $taxonomy);
24
-    if (!empty($post_cat_ids))
25
-        $post_cat_array = explode(",", trim($post_cat_ids, ","));
26
-
27
-    if (!isset($default_cat) || empty($default_cat)) {
28
-        $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
-    }else{
30
-        if(!is_int($default_cat)){
31
-            $category = get_term_by('name', $default_cat, $taxonomy);
32
-            if(isset($category->term_id)){
33
-                $default_cat =  $category->term_id;
34
-            }
35
-        }
23
+	$post_cat_ids = geodir_get_post_meta($post_id, $taxonomy);
24
+	if (!empty($post_cat_ids))
25
+		$post_cat_array = explode(",", trim($post_cat_ids, ","));
26
+
27
+	if (!isset($default_cat) || empty($default_cat)) {
28
+		$default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
+	}else{
30
+		if(!is_int($default_cat)){
31
+			$category = get_term_by('name', $default_cat, $taxonomy);
32
+			if(isset($category->term_id)){
33
+				$default_cat =  $category->term_id;
34
+			}
35
+		}
36 36
 
37
-    }
37
+	}
38 38
 
39 39
 
40
-    geodir_save_post_meta($post_id, 'default_category', $default_cat);
40
+	geodir_save_post_meta($post_id, 'default_category', $default_cat);
41 41
 
42
-    if (isset($category_str) && empty($category_str)) {
42
+	if (isset($category_str) && empty($category_str)) {
43 43
 
44
-        $post_cat_str = '';
45
-        $post_categories = array();
46
-        if (isset($post_cat_array) && is_array($post_cat_array) && !empty($post_cat_array)) {
47
-            $post_cat_str = implode(",y:#", $post_cat_array);
48
-            $post_cat_str .= ",y:";
49
-            $post_cat_str = substr_replace($post_cat_str, ',y,d:', strpos($post_cat_str, ',y:'), strlen(',y:'));
50
-        }
51
-        $post_categories[$taxonomy] = $post_cat_str;
52
-        $category_str = $post_categories;
53
-    }
44
+		$post_cat_str = '';
45
+		$post_categories = array();
46
+		if (isset($post_cat_array) && is_array($post_cat_array) && !empty($post_cat_array)) {
47
+			$post_cat_str = implode(",y:#", $post_cat_array);
48
+			$post_cat_str .= ",y:";
49
+			$post_cat_str = substr_replace($post_cat_str, ',y,d:', strpos($post_cat_str, ',y:'), strlen(',y:'));
50
+		}
51
+		$post_categories[$taxonomy] = $post_cat_str;
52
+		$category_str = $post_categories;
53
+	}
54 54
 
55
-    $change_cat_str = $category_str[$taxonomy];
55
+	$change_cat_str = $category_str[$taxonomy];
56 56
 
57
-    $default_pos = strpos($change_cat_str, 'd:');
57
+	$default_pos = strpos($change_cat_str, 'd:');
58 58
 
59
-    if ($default_pos === false) {
59
+	if ($default_pos === false) {
60 60
 
61
-        $change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str);
61
+		$change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str);
62 62
 
63
-    }
63
+	}
64 64
 
65
-    $category_str[$taxonomy] = $change_cat_str;
65
+	$category_str[$taxonomy] = $change_cat_str;
66 66
 
67
-    update_post_meta($post_id, 'post_categories', $category_str);
67
+	update_post_meta($post_id, 'post_categories', $category_str);
68 68
 
69 69
 }
70 70
 
71 71
 
72 72
 if (!function_exists('geodir_save_listing')) {
73
-    /**
74
-     * Saves listing in the database using given information.
75
-     *
76
-     * @since 1.0.0
77
-     * @since 1.5.4 New parameter $wp_error added.
78
-     * @package GeoDirectory
79
-     * @global object $wpdb WordPress Database object.
80
-     * @global object $post The current post object.
81
-     * @global object $current_user Current user object.
73
+	/**
74
+	 * Saves listing in the database using given information.
75
+	 *
76
+	 * @since 1.0.0
77
+	 * @since 1.5.4 New parameter $wp_error added.
78
+	 * @package GeoDirectory
79
+	 * @global object $wpdb WordPress Database object.
80
+	 * @global object $post The current post object.
81
+	 * @global object $current_user Current user object.
82 82
 	 * @global object $gd_session GeoDirectory Session object.
83
-     * @param array $request_info {
84
-     *    Array of request info arguments.
85
-     *
86
-     *    @type string $action                                  Ajax action name.
87
-     *    @type string $geodir_ajax                             Ajax type.
88
-     *    @type string $ajax_action                             Ajax action.
89
-     *    @type string $listing_type                            Listing type.
90
-     *    @type string $pid                                     Default Post ID.
91
-     *    @type string $preview                                 Todo Desc needed.
92
-     *    @type string $add_listing_page_id                     Add listing page ID.
93
-     *    @type string $post_title                              Listing title.
94
-     *    @type string $post_desc                               Listing Description.
95
-     *    @type string $post_tags                               Listing tags.
96
-     *    @type array  $cat_limit                               Category limit.
97
-     *    @type array  $post_category                           Category IDs.
98
-     *    @type array  $post_category_str                       Category string.
99
-     *    @type string $post_default_category                   Default category ID.
100
-     *    @type string $post_address                            Listing address.
101
-     *    @type string $geodir_location_add_listing_country_val Add listing country value.
102
-     *    @type string $post_country                            Listing country.
103
-     *    @type string $geodir_location_add_listing_region_val  Add listing region value.
104
-     *    @type string $post_region                             Listing region.
105
-     *    @type string $geodir_location_add_listing_city_val    Add listing city value.
106
-     *    @type string $post_city                               Listing city.
107
-     *    @type string $post_zip                                Listing zip.
108
-     *    @type string $post_latitude                           Listing latitude.
109
-     *    @type string $post_longitude                          Listing longitude.
110
-     *    @type string $post_mapview                            Listing mapview. Default "ROADMAP".
111
-     *    @type string $post_mapzoom                            Listing mapzoom Default "9".
112
-     *    @type string $geodir_timing                           Business timing info.
113
-     *    @type string $geodir_contact                          Contact number.
114
-     *    @type string $geodir_email                            Business contact email.
115
-     *    @type string $geodir_website                          Business website.
116
-     *    @type string $geodir_twitter                          Twitter link.
117
-     *    @type string $geodir_facebook                         Facebook link.
118
-     *    @type string $geodir_video                            Video link.
119
-     *    @type string $geodir_special_offers                   Speacial offers.
120
-     *    @type string $post_images                             Post image urls.
121
-     *    @type string $post_imagesimage_limit                  Post images limit.
122
-     *    @type string $post_imagestotImg                       Todo Desc needed.
123
-     *    @type string $geodir_accept_term_condition            Has accepted terms and conditions?.
124
-     *    @type string $geodir_spamblocker                      Todo Desc needed.
125
-     *    @type string $geodir_filled_by_spam_bot               Todo Desc needed.
126
-     *
127
-     * }
128
-     * @param bool $dummy Optional. Is this a dummy listing? Default false.
129
-     * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false.
130
-     * @return int|string|WP_Error Created post id or WP_Error on failure.
131
-     */
132
-    function geodir_save_listing($request_info = array(), $dummy = false, $wp_error = false)
133
-    {
134
-        global $wpdb, $current_user, $gd_session;
135
-
136
-        $last_post_id = '';
137
-
138
-        if ($gd_session->get('listing') && !$dummy) {
139
-            $request_info = array();
140
-            $request_session = $gd_session->get('listing');
141
-            $request_info = array_merge($_REQUEST, $request_session);
142
-        } else if (!$gd_session->get('listing') && !$dummy) {
143
-            global $post;
144
-            $request_info['pid'] = !empty($post->ID) ? $post->ID : (!empty($request_info['post_id']) ? $request_info['post_id'] : NULL);
145
-            $request_info['post_title'] = $request_info['post_title'];
146
-            $request_info['listing_type'] = $post->post_type;
147
-            $request_info['post_desc'] = $request_info['content'];
148
-        } else if (!$dummy) {
149
-            return false;
150
-        }
151
-
152
-        /**
153
-         * Filter the request_info array.
154
-         *
155
-         * You can use this filter to modify request_info array.
156
-         *
157
-         * @since 1.0.0
158
-         * @package GeoDirectory
159
-         * @param array $request_info See {@see geodir_save_listing()} for accepted args.
160
-         */
161
-        $request_info = apply_filters('geodir_action_get_request_info', $request_info);
162
-
163
-        // Check if we need to save post location as new location
164
-        $location_result = geodir_get_default_location();
165
-
166
-        if ($location_result->location_id > 0) {
167
-            if (isset($request_info['post_city']) && isset($request_info['post_region'])) {
168
-                $request_info['post_location'] = array(
169
-                    'city' => $request_info['post_city'],
170
-                    'region' => isset($request_info['post_region']) ? $request_info['post_region'] : '',
171
-                    'country' => isset($request_info['post_country']) ? $request_info['post_country'] : '',
172
-                    'geo_lat' => isset($request_info['post_latitude']) ? $request_info['post_latitude'] : '',
173
-                    'geo_lng' => isset($request_info['post_longitude']) ? $request_info['post_longitude'] : ''
174
-                );
175
-
176
-                $post_location_info = $request_info['post_location'];
177
-
178
-                if ($location_id = geodir_add_new_location($post_location_info)) {
179
-                    $post_location_id = $location_id;
180
-                }
181
-            } else {
182
-                $post_location_id = $location_result->location_id;
183
-            }
184
-        } else {
185
-            $post_location_id = $location_result->location_id;
186
-        }
187
-
188
-        if ($dummy) {
189
-            $post_status = 'publish';
190
-        } else {
191
-            $post_status = geodir_new_post_default_status();
192
-        }
193
-
194
-        if (isset($request_info['pid']) && $request_info['pid'] != '') {
195
-            $post_status = get_post_status($request_info['pid']);
196
-        }
197
-
198
-        /* fix change of slug on every title edit */
199
-        if (!isset($request_info['post_name'])) {
200
-            $request_info['post_name'] = $request_info['post_title'];
201
-
202
-            if (!empty($request_info['pid'])) {
203
-                $post_info = get_post($request_info['pid']);
204
-
205
-                if (!empty($post_info) && isset($post_info->post_name)) {
206
-                    $request_info['post_name'] = $post_info->post_name;
207
-                }
208
-            }
209
-        }
210
-
211
-        $post = array(
212
-            'post_content' => $request_info['post_desc'],
213
-            'post_status' => $post_status,
214
-            'post_title' => $request_info['post_title'],
215
-            'post_name' => $request_info['post_name'],
216
-            'post_type' => $request_info['listing_type']
217
-        );
218
-
219
-        /**
220
-         * Called before a listing is saved to the database.
221
-         *
222
-         * @since 1.0.0
223
-         * @param object $post The post object.
224
-         */
225
-        do_action_ref_array('geodir_before_save_listing', $post);
83
+	 * @param array $request_info {
84
+	 *    Array of request info arguments.
85
+	 *
86
+	 *    @type string $action                                  Ajax action name.
87
+	 *    @type string $geodir_ajax                             Ajax type.
88
+	 *    @type string $ajax_action                             Ajax action.
89
+	 *    @type string $listing_type                            Listing type.
90
+	 *    @type string $pid                                     Default Post ID.
91
+	 *    @type string $preview                                 Todo Desc needed.
92
+	 *    @type string $add_listing_page_id                     Add listing page ID.
93
+	 *    @type string $post_title                              Listing title.
94
+	 *    @type string $post_desc                               Listing Description.
95
+	 *    @type string $post_tags                               Listing tags.
96
+	 *    @type array  $cat_limit                               Category limit.
97
+	 *    @type array  $post_category                           Category IDs.
98
+	 *    @type array  $post_category_str                       Category string.
99
+	 *    @type string $post_default_category                   Default category ID.
100
+	 *    @type string $post_address                            Listing address.
101
+	 *    @type string $geodir_location_add_listing_country_val Add listing country value.
102
+	 *    @type string $post_country                            Listing country.
103
+	 *    @type string $geodir_location_add_listing_region_val  Add listing region value.
104
+	 *    @type string $post_region                             Listing region.
105
+	 *    @type string $geodir_location_add_listing_city_val    Add listing city value.
106
+	 *    @type string $post_city                               Listing city.
107
+	 *    @type string $post_zip                                Listing zip.
108
+	 *    @type string $post_latitude                           Listing latitude.
109
+	 *    @type string $post_longitude                          Listing longitude.
110
+	 *    @type string $post_mapview                            Listing mapview. Default "ROADMAP".
111
+	 *    @type string $post_mapzoom                            Listing mapzoom Default "9".
112
+	 *    @type string $geodir_timing                           Business timing info.
113
+	 *    @type string $geodir_contact                          Contact number.
114
+	 *    @type string $geodir_email                            Business contact email.
115
+	 *    @type string $geodir_website                          Business website.
116
+	 *    @type string $geodir_twitter                          Twitter link.
117
+	 *    @type string $geodir_facebook                         Facebook link.
118
+	 *    @type string $geodir_video                            Video link.
119
+	 *    @type string $geodir_special_offers                   Speacial offers.
120
+	 *    @type string $post_images                             Post image urls.
121
+	 *    @type string $post_imagesimage_limit                  Post images limit.
122
+	 *    @type string $post_imagestotImg                       Todo Desc needed.
123
+	 *    @type string $geodir_accept_term_condition            Has accepted terms and conditions?.
124
+	 *    @type string $geodir_spamblocker                      Todo Desc needed.
125
+	 *    @type string $geodir_filled_by_spam_bot               Todo Desc needed.
126
+	 *
127
+	 * }
128
+	 * @param bool $dummy Optional. Is this a dummy listing? Default false.
129
+	 * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false.
130
+	 * @return int|string|WP_Error Created post id or WP_Error on failure.
131
+	 */
132
+	function geodir_save_listing($request_info = array(), $dummy = false, $wp_error = false)
133
+	{
134
+		global $wpdb, $current_user, $gd_session;
135
+
136
+		$last_post_id = '';
137
+
138
+		if ($gd_session->get('listing') && !$dummy) {
139
+			$request_info = array();
140
+			$request_session = $gd_session->get('listing');
141
+			$request_info = array_merge($_REQUEST, $request_session);
142
+		} else if (!$gd_session->get('listing') && !$dummy) {
143
+			global $post;
144
+			$request_info['pid'] = !empty($post->ID) ? $post->ID : (!empty($request_info['post_id']) ? $request_info['post_id'] : NULL);
145
+			$request_info['post_title'] = $request_info['post_title'];
146
+			$request_info['listing_type'] = $post->post_type;
147
+			$request_info['post_desc'] = $request_info['content'];
148
+		} else if (!$dummy) {
149
+			return false;
150
+		}
151
+
152
+		/**
153
+		 * Filter the request_info array.
154
+		 *
155
+		 * You can use this filter to modify request_info array.
156
+		 *
157
+		 * @since 1.0.0
158
+		 * @package GeoDirectory
159
+		 * @param array $request_info See {@see geodir_save_listing()} for accepted args.
160
+		 */
161
+		$request_info = apply_filters('geodir_action_get_request_info', $request_info);
162
+
163
+		// Check if we need to save post location as new location
164
+		$location_result = geodir_get_default_location();
165
+
166
+		if ($location_result->location_id > 0) {
167
+			if (isset($request_info['post_city']) && isset($request_info['post_region'])) {
168
+				$request_info['post_location'] = array(
169
+					'city' => $request_info['post_city'],
170
+					'region' => isset($request_info['post_region']) ? $request_info['post_region'] : '',
171
+					'country' => isset($request_info['post_country']) ? $request_info['post_country'] : '',
172
+					'geo_lat' => isset($request_info['post_latitude']) ? $request_info['post_latitude'] : '',
173
+					'geo_lng' => isset($request_info['post_longitude']) ? $request_info['post_longitude'] : ''
174
+				);
175
+
176
+				$post_location_info = $request_info['post_location'];
177
+
178
+				if ($location_id = geodir_add_new_location($post_location_info)) {
179
+					$post_location_id = $location_id;
180
+				}
181
+			} else {
182
+				$post_location_id = $location_result->location_id;
183
+			}
184
+		} else {
185
+			$post_location_id = $location_result->location_id;
186
+		}
226 187
 
227
-        $send_post_submit_mail = false;
188
+		if ($dummy) {
189
+			$post_status = 'publish';
190
+		} else {
191
+			$post_status = geodir_new_post_default_status();
192
+		}
228 193
 
229
-        // unhook this function so it doesn't loop infinitely
230
-        remove_action('save_post', 'geodir_post_information_save',10,2);
194
+		if (isset($request_info['pid']) && $request_info['pid'] != '') {
195
+			$post_status = get_post_status($request_info['pid']);
196
+		}
231 197
 
232
-        if (isset($request_info['pid']) && $request_info['pid'] != '') {
233
-            $post['ID'] = $request_info['pid'];
198
+		/* fix change of slug on every title edit */
199
+		if (!isset($request_info['post_name'])) {
200
+			$request_info['post_name'] = $request_info['post_title'];
234 201
 
235
-            $last_post_id = wp_update_post($post, $wp_error);
236
-        } else {
237
-            $last_post_id = wp_insert_post($post, $wp_error);
202
+			if (!empty($request_info['pid'])) {
203
+				$post_info = get_post($request_info['pid']);
238 204
 
239
-            if (!$dummy && $last_post_id) {
240
-                $send_post_submit_mail = true; // we move post_submit email from here so the rest of the variables are added to the db first(was breaking permalink in email)
241
-                //geodir_sendEmail('','',$current_user->user_email,$current_user->display_name,'','',$request_info,'post_submit',$last_post_id,$current_user->ID);
242
-            }
243
-        }
205
+				if (!empty($post_info) && isset($post_info->post_name)) {
206
+					$request_info['post_name'] = $post_info->post_name;
207
+				}
208
+			}
209
+		}
210
+
211
+		$post = array(
212
+			'post_content' => $request_info['post_desc'],
213
+			'post_status' => $post_status,
214
+			'post_title' => $request_info['post_title'],
215
+			'post_name' => $request_info['post_name'],
216
+			'post_type' => $request_info['listing_type']
217
+		);
218
+
219
+		/**
220
+		 * Called before a listing is saved to the database.
221
+		 *
222
+		 * @since 1.0.0
223
+		 * @param object $post The post object.
224
+		 */
225
+		do_action_ref_array('geodir_before_save_listing', $post);
226
+
227
+		$send_post_submit_mail = false;
228
+
229
+		// unhook this function so it doesn't loop infinitely
230
+		remove_action('save_post', 'geodir_post_information_save',10,2);
231
+
232
+		if (isset($request_info['pid']) && $request_info['pid'] != '') {
233
+			$post['ID'] = $request_info['pid'];
234
+
235
+			$last_post_id = wp_update_post($post, $wp_error);
236
+		} else {
237
+			$last_post_id = wp_insert_post($post, $wp_error);
238
+
239
+			if (!$dummy && $last_post_id) {
240
+				$send_post_submit_mail = true; // we move post_submit email from here so the rest of the variables are added to the db first(was breaking permalink in email)
241
+				//geodir_sendEmail('','',$current_user->user_email,$current_user->display_name,'','',$request_info,'post_submit',$last_post_id,$current_user->ID);
242
+			}
243
+		}
244 244
 
245
-        if ($wp_error && is_wp_error($last_post_id)) {
246
-            return $last_post_id; // Return WP_Error on save failure.
247
-        }
245
+		if ($wp_error && is_wp_error($last_post_id)) {
246
+			return $last_post_id; // Return WP_Error on save failure.
247
+		}
248 248
 
249
-        if (!$last_post_id) {
250
-            return false; // Save failure.
251
-        }
249
+		if (!$last_post_id) {
250
+			return false; // Save failure.
251
+		}
252 252
 
253
-        // re-hook this function
254
-        add_action('save_post', 'geodir_post_information_save',10,2);
253
+		// re-hook this function
254
+		add_action('save_post', 'geodir_post_information_save',10,2);
255 255
 
256
-        $post_tags = '';
257
-        if (!isset($request_info['post_tags'])) {
256
+		$post_tags = '';
257
+		if (!isset($request_info['post_tags'])) {
258 258
 
259
-            $post_type = $request_info['listing_type'];
260
-            $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
259
+			$post_type = $request_info['listing_type'];
260
+			$post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
261 261
 
262
-        }
262
+		}
263 263
 
264
-        $gd_post_info = array(
265
-            "post_title" => $request_info['post_title'],
266
-            "post_tags" => isset($request_info['post_tags']) ? $request_info['post_tags'] : $post_tags,
267
-            "post_status" => $post_status,
268
-            "post_location_id" => $post_location_id,
269
-            "claimed" => isset($request_info['claimed']) ? $request_info['claimed'] : '',
270
-            "businesses" => isset($request_info['a_businesses']) ? $request_info['a_businesses'] : '',
271
-            "submit_time" => time(),
272
-            "submit_ip" => $_SERVER['REMOTE_ADDR'],
273
-        );
264
+		$gd_post_info = array(
265
+			"post_title" => $request_info['post_title'],
266
+			"post_tags" => isset($request_info['post_tags']) ? $request_info['post_tags'] : $post_tags,
267
+			"post_status" => $post_status,
268
+			"post_location_id" => $post_location_id,
269
+			"claimed" => isset($request_info['claimed']) ? $request_info['claimed'] : '',
270
+			"businesses" => isset($request_info['a_businesses']) ? $request_info['a_businesses'] : '',
271
+			"submit_time" => time(),
272
+			"submit_ip" => $_SERVER['REMOTE_ADDR'],
273
+		);
274 274
 
275
-        $payment_info = array();
276
-        $package_info = array();
275
+		$payment_info = array();
276
+		$package_info = array();
277 277
 
278
-        $package_info = (array)geodir_post_package_info($package_info, $post);
278
+		$package_info = (array)geodir_post_package_info($package_info, $post);
279 279
 
280
-        $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
280
+		$post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
281 281
 
282
-        if (!empty($package_info) && !$post_package_id) {
283
-            if (isset($package_info['days']) && $package_info['days'] != 0) {
284
-                $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
285
-            } else {
286
-                $payment_info['expire_date'] = 'Never';
287
-            }
282
+		if (!empty($package_info) && !$post_package_id) {
283
+			if (isset($package_info['days']) && $package_info['days'] != 0) {
284
+				$payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
285
+			} else {
286
+				$payment_info['expire_date'] = 'Never';
287
+			}
288 288
 
289
-            $payment_info['package_id'] = $package_info['pid'];
290
-            $payment_info['alive_days'] = $package_info['days'];
291
-            $payment_info['is_featured'] = $package_info['is_featured'];
289
+			$payment_info['package_id'] = $package_info['pid'];
290
+			$payment_info['alive_days'] = $package_info['days'];
291
+			$payment_info['is_featured'] = $package_info['is_featured'];
292 292
 
293
-            $gd_post_info = array_merge($gd_post_info, $payment_info);
294
-        }
293
+			$gd_post_info = array_merge($gd_post_info, $payment_info);
294
+		}
295 295
 
296
-        $custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
296
+		$custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
297 297
 
298
-        foreach ($custom_metaboxes as $key => $val):
298
+		foreach ($custom_metaboxes as $key => $val):
299 299
 
300
-            $name = $val['name'];
301
-            $type = $val['type'];
302
-            $extrafields = $val['extra_fields'];
300
+			$name = $val['name'];
301
+			$type = $val['type'];
302
+			$extrafields = $val['extra_fields'];
303 303
 
304
-            if (trim($type) == 'address') {
305
-                $prefix = $name . '_';
306
-                $address = $prefix . 'address';
304
+			if (trim($type) == 'address') {
305
+				$prefix = $name . '_';
306
+				$address = $prefix . 'address';
307 307
 
308
-                if (isset($request_info[$address]) && $request_info[$address] != '') {
309
-                    $gd_post_info[$address] = wp_slash($request_info[$address]);
310
-                }
308
+				if (isset($request_info[$address]) && $request_info[$address] != '') {
309
+					$gd_post_info[$address] = wp_slash($request_info[$address]);
310
+				}
311 311
 
312
-                if ($extrafields != '') {
313
-                    $extrafields = unserialize($extrafields);
312
+				if ($extrafields != '') {
313
+					$extrafields = unserialize($extrafields);
314 314
 
315 315
 
316
-                    if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
316
+					if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
317 317
 
318
-                        $location_result = geodir_get_default_location();
318
+						$location_result = geodir_get_default_location();
319 319
 
320
-                        $gd_post_info[$prefix . 'city'] = $location_result->city;
321
-                        $gd_post_info[$prefix . 'region'] = $location_result->region;
322
-                        $gd_post_info[$prefix . 'country'] = $location_result->country;
320
+						$gd_post_info[$prefix . 'city'] = $location_result->city;
321
+						$gd_post_info[$prefix . 'region'] = $location_result->region;
322
+						$gd_post_info[$prefix . 'country'] = $location_result->country;
323 323
 
324
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
324
+						$gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
325 325
 
326
-                    } else {
326
+					} else {
327 327
 
328
-                        $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];
329
-                        $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];
330
-                        $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];
328
+						$gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];
329
+						$gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];
330
+						$gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];
331 331
 
332
-                        //----------set post locations when import dummy data-------
333
-                        $location_result = geodir_get_default_location();
332
+						//----------set post locations when import dummy data-------
333
+						$location_result = geodir_get_default_location();
334 334
 
335
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
336
-                        //-----------------------------------------------------------------
335
+						$gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
336
+						//-----------------------------------------------------------------
337 337
 
338
-                    }
338
+					}
339 339
 
340 340
 
341
-                    if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
342
-                        $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];
343
-                    }
341
+					if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
342
+						$gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];
343
+					}
344 344
 
345 345
 
346
-                    if (isset($extrafields['show_map']) && $extrafields['show_map']) {
346
+					if (isset($extrafields['show_map']) && $extrafields['show_map']) {
347 347
 
348
-                        if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
349
-                            $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];
350
-                        }
348
+						if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
349
+							$gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];
350
+						}
351 351
 
352
-                        if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
353
-                            $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];
354
-                        }
352
+						if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
353
+							$gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];
354
+						}
355 355
 
356
-                        if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
357
-                            $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];
358
-                        }
356
+						if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
357
+							$gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];
358
+						}
359 359
 
360
-                        if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
361
-                            $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];
362
-                        }
360
+						if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
361
+							$gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];
362
+						}
363 363
 
364
-                    }
364
+					}
365 365
 
366
-                    // show lat lng
367
-                    if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
368
-                        $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];
369
-                    }
370
-                }
366
+					// show lat lng
367
+					if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
368
+						$gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];
369
+					}
370
+				}
371 371
 
372
-            } elseif (trim($type) == 'file') {
373
-                if (isset($request_info[$name])) {
374
-                    $request_files = array();
375
-                    if ($request_info[$name] != '')
376
-                        $request_files = explode(",", $request_info[$name]);
372
+			} elseif (trim($type) == 'file') {
373
+				if (isset($request_info[$name])) {
374
+					$request_files = array();
375
+					if ($request_info[$name] != '')
376
+						$request_files = explode(",", $request_info[$name]);
377 377
 
378
-                    $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
379
-                    geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
378
+					$extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
379
+					geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
380 380
 
381
-                }
382
-            } elseif (trim($type) == 'datepicker') {
383
-                $datetime = '';
384
-                if (isset($request_info[$name]) && $request_info[$name] != '') {
385
-                    $date_format = geodir_default_date_format();
386
-                    if (isset($val['extra_fields']) && $val['extra_fields'] != '') {
387
-                        $extra_fields = unserialize($val['extra_fields']);
388
-                        $date_format = isset($extra_fields['date_format']) && $extra_fields['date_format'] != '' ? $extra_fields['date_format'] : $date_format;
389
-                    }
381
+				}
382
+			} elseif (trim($type) == 'datepicker') {
383
+				$datetime = '';
384
+				if (isset($request_info[$name]) && $request_info[$name] != '') {
385
+					$date_format = geodir_default_date_format();
386
+					if (isset($val['extra_fields']) && $val['extra_fields'] != '') {
387
+						$extra_fields = unserialize($val['extra_fields']);
388
+						$date_format = isset($extra_fields['date_format']) && $extra_fields['date_format'] != '' ? $extra_fields['date_format'] : $date_format;
389
+					}
390 390
 
391
-                    // check if we need to change the format or not
392
-                    $date_format_len = strlen(str_replace(' ', '', $date_format));
393
-                    if($date_format_len>5){// if greater then 5 then it's the old style format.
391
+					// check if we need to change the format or not
392
+					$date_format_len = strlen(str_replace(' ', '', $date_format));
393
+					if($date_format_len>5){// if greater then 5 then it's the old style format.
394 394
 
395
-                        $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
396
-                        $replace = array('d','j','l','m','n','F','Y');//PHP date format
395
+						$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
396
+						$replace = array('d','j','l','m','n','F','Y');//PHP date format
397 397
 
398
-                        $date_format = str_replace($search, $replace, $date_format);
398
+						$date_format = str_replace($search, $replace, $date_format);
399 399
 
400
-                        $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
400
+						$post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
401 401
 
402
-                    }else{
403
-                        $post_htmlvar_value = $request_info[$name];
404
-                    }
402
+					}else{
403
+						$post_htmlvar_value = $request_info[$name];
404
+					}
405 405
 
406
-                    $post_htmlvar_value = geodir_date($post_htmlvar_value, 'Y-m-d', $date_format); // save as sql format Y-m-d
407
-                    $datetime = geodir_maybe_untranslate_date($post_htmlvar_value); // maybe untranslate date string if it was translated
406
+					$post_htmlvar_value = geodir_date($post_htmlvar_value, 'Y-m-d', $date_format); // save as sql format Y-m-d
407
+					$datetime = geodir_maybe_untranslate_date($post_htmlvar_value); // maybe untranslate date string if it was translated
408 408
 
409
-                    //$datetime = date_i18n("Y-m-d", strtotime($post_htmlvar_value)); // save as sql format Y-m-d
409
+					//$datetime = date_i18n("Y-m-d", strtotime($post_htmlvar_value)); // save as sql format Y-m-d
410 410
 
411
-                }
412
-                $gd_post_info[$name] = $datetime;
413
-            } else if ($type == 'multiselect') {
414
-                if (isset($request_info[$name])) {
415
-                    $gd_post_info[$name] = $request_info[$name];
416
-                } else {
417
-                    if (isset($request_info['gd_field_' . $name])) {
418
-                        $gd_post_info[$name] = ''; /* fix de-select for multiselect */
419
-                    }
420
-                }
421
-            } else if (isset($request_info[$name])) {
422
-                $gd_post_info[$name] = $request_info[$name];
423
-            }
411
+				}
412
+				$gd_post_info[$name] = $datetime;
413
+			} else if ($type == 'multiselect') {
414
+				if (isset($request_info[$name])) {
415
+					$gd_post_info[$name] = $request_info[$name];
416
+				} else {
417
+					if (isset($request_info['gd_field_' . $name])) {
418
+						$gd_post_info[$name] = ''; /* fix de-select for multiselect */
419
+					}
420
+				}
421
+			} else if (isset($request_info[$name])) {
422
+				$gd_post_info[$name] = $request_info[$name];
423
+			}
424 424
 
425
-        endforeach;
425
+		endforeach;
426 426
 
427
-        if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
428
-            $gd_post_info['post_dummy'] = $request_info['post_dummy'];
429
-        }
427
+		if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
428
+			$gd_post_info['post_dummy'] = $request_info['post_dummy'];
429
+		}
430 430
 
431
-        // Save post detail info in detail table
432
-        if (!empty($gd_post_info)) {
433
-            geodir_save_post_info($last_post_id, $gd_post_info);
434
-        }
431
+		// Save post detail info in detail table
432
+		if (!empty($gd_post_info)) {
433
+			geodir_save_post_info($last_post_id, $gd_post_info);
434
+		}
435 435
 
436 436
 
437
-        // Set categories to the listing
438
-        if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
439
-            $post_category = array();
437
+		// Set categories to the listing
438
+		if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
439
+			$post_category = array();
440 440
 
441
-            foreach ($request_info['post_category'] as $taxonomy => $cat) {
441
+			foreach ($request_info['post_category'] as $taxonomy => $cat) {
442 442
 
443
-                if ($dummy)
444
-                    $post_category = $cat;
445
-                else {
443
+				if ($dummy)
444
+					$post_category = $cat;
445
+				else {
446 446
 
447
-                    if (!is_array($cat) && strstr($cat, ','))
448
-                        $cat = explode(',', $cat);
447
+					if (!is_array($cat) && strstr($cat, ','))
448
+						$cat = explode(',', $cat);
449 449
 
450
-                    if (!empty($cat) && is_array($cat))
451
-                        $post_category = array_map('intval', $cat);
452
-                }
450
+					if (!empty($cat) && is_array($cat))
451
+						$post_category = array_map('intval', $cat);
452
+				}
453 453
 
454
-                wp_set_object_terms($last_post_id, $post_category, $taxonomy);
455
-            }
454
+				wp_set_object_terms($last_post_id, $post_category, $taxonomy);
455
+			}
456 456
 
457
-            $post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : '';
457
+			$post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : '';
458 458
 
459
-            $post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : '';
460
-            geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str);
459
+			$post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : '';
460
+			geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str);
461 461
 
462
-        }
462
+		}
463 463
 
464
-        $post_tags = '';
465
-        // Set tags to the listing
466
-        if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
467
-            $post_tags = explode(",", $request_info['post_tags']);
468
-        } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
469
-            if ($dummy)
470
-                $post_tags = $request_info['post_tags'];
471
-        } else {
472
-            if ($dummy)
473
-                $post_tags = array($request_info['post_title']);
474
-        }
464
+		$post_tags = '';
465
+		// Set tags to the listing
466
+		if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
467
+			$post_tags = explode(",", $request_info['post_tags']);
468
+		} elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
469
+			if ($dummy)
470
+				$post_tags = $request_info['post_tags'];
471
+		} else {
472
+			if ($dummy)
473
+				$post_tags = array($request_info['post_title']);
474
+		}
475 475
 
476
-        if (is_array($post_tags)) {
477
-            $taxonomy = $request_info['listing_type'] . '_tags';
478
-            wp_set_object_terms($last_post_id, $post_tags, $taxonomy);
479
-        }
476
+		if (is_array($post_tags)) {
477
+			$taxonomy = $request_info['listing_type'] . '_tags';
478
+			wp_set_object_terms($last_post_id, $post_tags, $taxonomy);
479
+		}
480 480
 
481 481
 
482
-        // Insert attechment
482
+		// Insert attechment
483 483
 
484
-        if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
485
-            if (!$dummy) {
486
-                $tmpimgArr = trim($request_info['post_images'], ",");
487
-                $tmpimgArr = explode(",", $tmpimgArr);
488
-                geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
489
-            } else{
490
-                geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
491
-            }
484
+		if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
485
+			if (!$dummy) {
486
+				$tmpimgArr = trim($request_info['post_images'], ",");
487
+				$tmpimgArr = explode(",", $tmpimgArr);
488
+				geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
489
+			} else{
490
+				geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
491
+			}
492 492
 
493 493
 
494
-        } elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
494
+		} elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
495 495
 
496
-            /* Delete Attachments
496
+			/* Delete Attachments
497 497
 			$postcurr_images = geodir_get_images($last_post_id);
498 498
 
499 499
 			$wpdb->query(
@@ -509,34 +509,34 @@  discard block
 block discarded – undo
509 509
 			geodir_save_post_info($last_post_id, $gd_post_featured_img);
510 510
 			*/
511 511
 
512
-        }
512
+		}
513 513
 
514
-        geodir_remove_temp_images();
515
-        geodir_set_wp_featured_image($last_post_id);
514
+		geodir_remove_temp_images();
515
+		geodir_set_wp_featured_image($last_post_id);
516 516
 
517
-        /**
518
-         * Called after a listing is saved to the database and before any email have been sent.
519
-         *
520
-         * @since 1.0.0
521
-         * @param int $last_post_id The saved post ID.
522
-         * @param array $request_info The post details in an array.
523
-         * @see 'geodir_after_save_listinginfo'
524
-         */
525
-        do_action('geodir_after_save_listing', $last_post_id, $request_info);
517
+		/**
518
+		 * Called after a listing is saved to the database and before any email have been sent.
519
+		 *
520
+		 * @since 1.0.0
521
+		 * @param int $last_post_id The saved post ID.
522
+		 * @param array $request_info The post details in an array.
523
+		 * @see 'geodir_after_save_listinginfo'
524
+		 */
525
+		do_action('geodir_after_save_listing', $last_post_id, $request_info);
526 526
 
527
-        //die;
527
+		//die;
528 528
 
529
-        if ($send_post_submit_mail) { // if new post send out email
530
-            $to_name = geodir_get_client_name($current_user->ID);
531
-            geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
532
-        }
533
-        /*
529
+		if ($send_post_submit_mail) { // if new post send out email
530
+			$to_name = geodir_get_client_name($current_user->ID);
531
+			geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
532
+		}
533
+		/*
534 534
          * Unset the session so we don't loop.
535 535
          */
536
-        $gd_session->un_set('listing');
537
-        return $last_post_id;
536
+		$gd_session->un_set('listing');
537
+		return $last_post_id;
538 538
 
539
-    }
539
+	}
540 540
 
541 541
 }
542 542
 
@@ -555,585 +555,585 @@  discard block
 block discarded – undo
555 555
 function geodir_get_post_info($post_id = '')
556 556
 {
557 557
 
558
-    global $wpdb, $plugin_prefix, $post, $post_info;
558
+	global $wpdb, $plugin_prefix, $post, $post_info;
559 559
 
560
-    if ($post_id == '' && !empty($post))
561
-        $post_id = $post->ID;
560
+	if ($post_id == '' && !empty($post))
561
+		$post_id = $post->ID;
562 562
 
563
-    $post_type = get_post_type($post_id);
563
+	$post_type = get_post_type($post_id);
564 564
 
565
-    $all_postypes = geodir_get_posttypes();
565
+	$all_postypes = geodir_get_posttypes();
566 566
 
567
-    if (!in_array($post_type, $all_postypes))
568
-        return false;
567
+	if (!in_array($post_type, $all_postypes))
568
+		return false;
569 569
 
570
-    $table = $plugin_prefix . $post_type . '_detail';
570
+	$table = $plugin_prefix . $post_type . '_detail';
571 571
 
572
-    /**
573
-     * Apply Filter to change Post info
574
-     *
575
-     * You can use this filter to change Post info.
576
-     *
577
-     * @since 1.0.0
578
-     * @package GeoDirectory
579
-     */
580
-    $query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
572
+	/**
573
+	 * Apply Filter to change Post info
574
+	 *
575
+	 * You can use this filter to change Post info.
576
+	 *
577
+	 * @since 1.0.0
578
+	 * @package GeoDirectory
579
+	 */
580
+	$query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
581 581
 			  WHERE p.ID = pd.post_id
582 582
 			  AND post_id = " . $post_id);
583 583
 
584
-    $post_detail = $wpdb->get_row($query);
584
+	$post_detail = $wpdb->get_row($query);
585 585
 
586
-    return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false;
586
+	return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false;
587 587
 
588 588
 }
589 589
 
590 590
 
591 591
 if (!function_exists('geodir_save_post_info')) {
592
-    /**
593
-     * Saves post detail info in detail table.
594
-     *
595
-     * @since 1.0.0
596
-     * @package GeoDirectory
597
-     * @global object $wpdb WordPress Database object.
598
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
599
-     * @param int $post_id The post ID.
600
-     * @param array $postinfo_array {
601
-     *    Post info that needs to be saved in detail table.
602
-     *
603
-     *    @type string $post_title              Listing title.
604
-     *    @type string $post_tags               Listing tags.
605
-     *    @type string $post_status             Listing post status.
606
-     *    @type string $post_location_id        Listing location ID.
607
-     *    @type string $claimed                 Todo Desc needed.
608
-     *    @type string $businesses              Todo Desc needed.
609
-     *    @type int    $submit_time             Submitted time in unix timestamp.
610
-     *    @type string $submit_ip               Submitted IP.
611
-     *    @type string $expire_date             Listing expiration date.
612
-     *    @type int    $package_id              Listing package ID.
613
-     *    @type int    $alive_days              Todo Desc needed.
614
-     *    @type int    $is_featured             Is this a featured listing?.
615
-     *    @type string $post_address            Listing address.
616
-     *    @type string $post_city               Listing city.
617
-     *    @type string $post_region             Listing region.
618
-     *    @type string $post_country            Listing country.
619
-     *    @type string $post_locations          Listing locations.
620
-     *    @type string $post_zip                Listing zip.
621
-     *    @type string $post_latitude           Listing latitude.
622
-     *    @type string $post_longitude          Listing longitude.
623
-     *    @type string $post_mapview            Listing mapview. Default "ROADMAP".
624
-     *    @type string $post_mapzoom            Listing mapzoom Default "9".
625
-     *    @type string $geodir_timing           Business timing info.
626
-     *    @type string $geodir_contact          Contact number.
627
-     *    @type string $geodir_email            Business contact email.
628
-     *    @type string $geodir_website          Business website.
629
-     *    @type string $geodir_twitter          Twitter link.
630
-     *    @type string $geodir_facebook         Facebook link.
631
-     *    @type string $geodir_video            Video link.
632
-     *    @type string $geodir_special_offers   Speacial offers.
633
-     *
634
-     * }
635
-     * @return bool
636
-     */
637
-    function geodir_save_post_info($post_id, $postinfo_array = array())
638
-    {
639
-        global $wpdb, $plugin_prefix;
640
-
641
-        $post_type = get_post_type($post_id);
642
-
643
-        $table = $plugin_prefix . $post_type . '_detail';
644
-
645
-        /**
646
-         * Filter to change Post info
647
-         *
648
-         * You can use this filter to change Post info.
649
-         *
650
-         * @since 1.0.0
651
-         * @package GeoDirectory
652
-         * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
653
-         * @param int $post_id The post ID.
654
-         */
655
-        $postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
592
+	/**
593
+	 * Saves post detail info in detail table.
594
+	 *
595
+	 * @since 1.0.0
596
+	 * @package GeoDirectory
597
+	 * @global object $wpdb WordPress Database object.
598
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
599
+	 * @param int $post_id The post ID.
600
+	 * @param array $postinfo_array {
601
+	 *    Post info that needs to be saved in detail table.
602
+	 *
603
+	 *    @type string $post_title              Listing title.
604
+	 *    @type string $post_tags               Listing tags.
605
+	 *    @type string $post_status             Listing post status.
606
+	 *    @type string $post_location_id        Listing location ID.
607
+	 *    @type string $claimed                 Todo Desc needed.
608
+	 *    @type string $businesses              Todo Desc needed.
609
+	 *    @type int    $submit_time             Submitted time in unix timestamp.
610
+	 *    @type string $submit_ip               Submitted IP.
611
+	 *    @type string $expire_date             Listing expiration date.
612
+	 *    @type int    $package_id              Listing package ID.
613
+	 *    @type int    $alive_days              Todo Desc needed.
614
+	 *    @type int    $is_featured             Is this a featured listing?.
615
+	 *    @type string $post_address            Listing address.
616
+	 *    @type string $post_city               Listing city.
617
+	 *    @type string $post_region             Listing region.
618
+	 *    @type string $post_country            Listing country.
619
+	 *    @type string $post_locations          Listing locations.
620
+	 *    @type string $post_zip                Listing zip.
621
+	 *    @type string $post_latitude           Listing latitude.
622
+	 *    @type string $post_longitude          Listing longitude.
623
+	 *    @type string $post_mapview            Listing mapview. Default "ROADMAP".
624
+	 *    @type string $post_mapzoom            Listing mapzoom Default "9".
625
+	 *    @type string $geodir_timing           Business timing info.
626
+	 *    @type string $geodir_contact          Contact number.
627
+	 *    @type string $geodir_email            Business contact email.
628
+	 *    @type string $geodir_website          Business website.
629
+	 *    @type string $geodir_twitter          Twitter link.
630
+	 *    @type string $geodir_facebook         Facebook link.
631
+	 *    @type string $geodir_video            Video link.
632
+	 *    @type string $geodir_special_offers   Speacial offers.
633
+	 *
634
+	 * }
635
+	 * @return bool
636
+	 */
637
+	function geodir_save_post_info($post_id, $postinfo_array = array())
638
+	{
639
+		global $wpdb, $plugin_prefix;
640
+
641
+		$post_type = get_post_type($post_id);
642
+
643
+		$table = $plugin_prefix . $post_type . '_detail';
644
+
645
+		/**
646
+		 * Filter to change Post info
647
+		 *
648
+		 * You can use this filter to change Post info.
649
+		 *
650
+		 * @since 1.0.0
651
+		 * @package GeoDirectory
652
+		 * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
653
+		 * @param int $post_id The post ID.
654
+		 */
655
+		$postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
656
+
657
+		if (!empty($postmeta) && $post_id) {
658
+			$post_meta_set_query = '';
659
+
660
+			foreach ($postmeta as $mkey => $mval) {
661
+				if (geodir_column_exist($table, $mkey)) {
662
+					if (is_array($mval)) {
663
+						$mval = implode(",", $mval);
664
+					}
665
+
666
+					$post_meta_set_query .= $mkey . " = '" . $mval . "', ";
667
+				}
668
+			}
656 669
 
657
-        if (!empty($postmeta) && $post_id) {
658
-            $post_meta_set_query = '';
670
+			$post_meta_set_query = trim($post_meta_set_query, ", ");
659 671
 
660
-            foreach ($postmeta as $mkey => $mval) {
661
-                if (geodir_column_exist($table, $mkey)) {
662
-                    if (is_array($mval)) {
663
-                        $mval = implode(",", $mval);
664
-                    }
672
+			$post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
665 673
 
666
-                    $post_meta_set_query .= $mkey . " = '" . $mval . "', ";
667
-                }
668
-            }
674
+			/**
675
+			 * Called before saving the listing info.
676
+			 *
677
+			 * @since 1.0.0
678
+			 * @package GeoDirectory
679
+			 * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
680
+			 * @param int $post_id The post ID.
681
+			 */
682
+			do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
669 683
 
670
-            $post_meta_set_query = trim($post_meta_set_query, ", ");
684
+			if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
671 685
 
672
-            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
686
+				$wpdb->query(
687
+					$wpdb->prepare(
688
+						"UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id =%d",
689
+						array($post_id)
690
+					)
691
+				);
673 692
 
674
-            /**
675
-             * Called before saving the listing info.
676
-             *
677
-             * @since 1.0.0
678
-             * @package GeoDirectory
679
-             * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
680
-             * @param int $post_id The post ID.
681
-             */
682
-            do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
683 693
 
684
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
694
+			} else {
685 695
 
686
-                $wpdb->query(
687
-                    $wpdb->prepare(
688
-                        "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id =%d",
689
-                        array($post_id)
690
-                    )
691
-                );
696
+				$wpdb->query(
697
+					$wpdb->prepare(
698
+						"INSERT INTO " . $table . " SET post_id = %d," . $post_meta_set_query,
699
+						array($post_id)
700
+					)
701
+				);
692 702
 
703
+			}
693 704
 
694
-            } else {
705
+			/**
706
+			 * Called after saving the listing info.
707
+			 *
708
+			 * @since 1.0.0
709
+			 * @package GeoDirectory
710
+			 * @param array $postinfo_array Post info that needs to be saved in detail table.
711
+			 * @param int $post_id The post ID.
712
+			 * @see 'geodir_after_save_listing'
713
+			 */
714
+			do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
715
+
716
+			return true;
717
+		} else
718
+			return false;
695 719
 
696
-                $wpdb->query(
697
-                    $wpdb->prepare(
698
-                        "INSERT INTO " . $table . " SET post_id = %d," . $post_meta_set_query,
699
-                        array($post_id)
700
-                    )
701
-                );
720
+	}
721
+}
702 722
 
703
-            }
704 723
 
705
-            /**
706
-             * Called after saving the listing info.
707
-             *
708
-             * @since 1.0.0
709
-             * @package GeoDirectory
710
-             * @param array $postinfo_array Post info that needs to be saved in detail table.
711
-             * @param int $post_id The post ID.
712
-             * @see 'geodir_after_save_listing'
713
-             */
714
-            do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
724
+if (!function_exists('geodir_save_post_meta')) {
725
+	/**
726
+	 * Save or update post custom fields.
727
+	 *
728
+	 * @since 1.0.0
729
+	 * @package GeoDirectory
730
+	 * @global object $wpdb WordPress Database object.
731
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
732
+	 * @param int $post_id The post ID.
733
+	 * @param string $postmeta Detail table column name.
734
+	 * @param string $meta_value Detail table column value.
735
+	 * @return void|bool
736
+	 */
737
+	function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
738
+	{
739
+
740
+		global $wpdb, $plugin_prefix;
741
+
742
+		$post_type = get_post_type($post_id);
743
+
744
+		$table = $plugin_prefix . $post_type . '_detail';
745
+
746
+		if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
747
+
748
+			if (is_array($meta_value)) {
749
+				$meta_value = implode(",", $meta_value);
750
+			}
715 751
 
716
-            return true;
717
-        } else
718
-            return false;
752
+			if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
719 753
 
720
-    }
721
-}
754
+				$wpdb->query(
755
+					$wpdb->prepare(
756
+						"UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",
757
+						array($post_id)
758
+					)
759
+				);
722 760
 
761
+			} else {
723 762
 
724
-if (!function_exists('geodir_save_post_meta')) {
725
-    /**
726
-     * Save or update post custom fields.
727
-     *
728
-     * @since 1.0.0
729
-     * @package GeoDirectory
730
-     * @global object $wpdb WordPress Database object.
731
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
732
-     * @param int $post_id The post ID.
733
-     * @param string $postmeta Detail table column name.
734
-     * @param string $meta_value Detail table column value.
735
-     * @return void|bool
736
-     */
737
-    function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
738
-    {
739
-
740
-        global $wpdb, $plugin_prefix;
741
-
742
-        $post_type = get_post_type($post_id);
743
-
744
-        $table = $plugin_prefix . $post_type . '_detail';
745
-
746
-        if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
747
-
748
-            if (is_array($meta_value)) {
749
-                $meta_value = implode(",", $meta_value);
750
-            }
751
-
752
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
753
-
754
-                $wpdb->query(
755
-                    $wpdb->prepare(
756
-                        "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",
757
-                        array($post_id)
758
-                    )
759
-                );
760
-
761
-            } else {
762
-
763
-                $wpdb->query(
764
-                    $wpdb->prepare(
765
-                        "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",
766
-                        array($post_id)
767
-                    )
768
-                );
769
-            }
770
-
771
-
772
-        } else
773
-            return false;
774
-    }
763
+				$wpdb->query(
764
+					$wpdb->prepare(
765
+						"INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",
766
+						array($post_id)
767
+					)
768
+				);
769
+			}
770
+
771
+
772
+		} else
773
+			return false;
774
+	}
775 775
 }
776 776
 
777 777
 if (!function_exists('geodir_delete_post_meta')) {
778
-    /**
779
-     * Delete post custom fields.
780
-     *
781
-     * @since 1.0.0
782
-     * @package GeoDirectory
783
-     * @global object $wpdb WordPress Database object.
784
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
785
-     * @param int $post_id The post ID.
786
-     * @param string $postmeta Detail table column name.
787
-     * @todo check if this is depreciated
788
-     * @todo Fix unknown variable mval
789
-     * @return bool
790
-     */
791
-    function geodir_delete_post_meta($post_id, $postmeta)
792
-    {
793
-
794
-        global $wpdb, $plugin_prefix;
795
-
796
-        $post_type = get_post_type($post_id);
797
-
798
-        $table = $plugin_prefix . $post_type . '_detail';
799
-
800
-        if (is_array($postmeta) && !empty($postmeta) && $post_id) {
801
-            $post_meta_set_query = '';
802
-
803
-            foreach ($postmeta as $mkey) {
804
-                if ($mval != '')
805
-                    $post_meta_set_query .= $mkey . " = '', ";
806
-            }
807
-
808
-            $post_meta_set_query = trim($post_meta_set_query, ", ");
809
-
810
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
811
-
812
-                $wpdb->query(
813
-                    $wpdb->prepare(
814
-                        "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",
815
-                        array($post_id)
816
-                    )
817
-                );
818
-
819
-                return true;
820
-            }
821
-
822
-        } elseif ($postmeta != '' && $post_id) {
823
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
824
-
825
-                $wpdb->query(
826
-                    $wpdb->prepare(
827
-                        "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",
828
-                        array($post_id)
829
-                    )
830
-                );
831
-
832
-                return true;
833
-            }
834
-
835
-        } else
836
-            return false;
837
-    }
778
+	/**
779
+	 * Delete post custom fields.
780
+	 *
781
+	 * @since 1.0.0
782
+	 * @package GeoDirectory
783
+	 * @global object $wpdb WordPress Database object.
784
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
785
+	 * @param int $post_id The post ID.
786
+	 * @param string $postmeta Detail table column name.
787
+	 * @todo check if this is depreciated
788
+	 * @todo Fix unknown variable mval
789
+	 * @return bool
790
+	 */
791
+	function geodir_delete_post_meta($post_id, $postmeta)
792
+	{
793
+
794
+		global $wpdb, $plugin_prefix;
795
+
796
+		$post_type = get_post_type($post_id);
797
+
798
+		$table = $plugin_prefix . $post_type . '_detail';
799
+
800
+		if (is_array($postmeta) && !empty($postmeta) && $post_id) {
801
+			$post_meta_set_query = '';
802
+
803
+			foreach ($postmeta as $mkey) {
804
+				if ($mval != '')
805
+					$post_meta_set_query .= $mkey . " = '', ";
806
+			}
807
+
808
+			$post_meta_set_query = trim($post_meta_set_query, ", ");
809
+
810
+			if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
811
+
812
+				$wpdb->query(
813
+					$wpdb->prepare(
814
+						"UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",
815
+						array($post_id)
816
+					)
817
+				);
818
+
819
+				return true;
820
+			}
821
+
822
+		} elseif ($postmeta != '' && $post_id) {
823
+			if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
824
+
825
+				$wpdb->query(
826
+					$wpdb->prepare(
827
+						"UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",
828
+						array($post_id)
829
+					)
830
+				);
831
+
832
+				return true;
833
+			}
834
+
835
+		} else
836
+			return false;
837
+	}
838 838
 }
839 839
 
840 840
 
841 841
 if (!function_exists('geodir_get_post_meta')) {
842
-    /**
843
-     * Get post custom meta.
844
-     *
845
-     * @since 1.0.0
846
-     * @package GeoDirectory
847
-     * @global object $wpdb WordPress Database object.
848
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
849
-     * @param int $post_id The post ID.
850
-     * @param string $meta_key The meta key to retrieve.
851
-     * @param bool $single Optional. Whether to return a single value. Default false.
852
-     * @todo single variable not yet implemented.
853
-     * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true.
854
-     */
855
-    function geodir_get_post_meta($post_id, $meta_key, $single = false)
856
-    {
857
-        if (!$post_id) {
858
-            return false;
859
-        }
860
-        global $wpdb, $plugin_prefix;
861
-
862
-        $all_postypes = geodir_get_posttypes();
863
-
864
-        $post_type = get_post_type($post_id);
865
-
866
-        if (!in_array($post_type, $all_postypes))
867
-            return false;
868
-
869
-        $table = $plugin_prefix . $post_type . '_detail';
870
-
871
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
872
-            $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
842
+	/**
843
+	 * Get post custom meta.
844
+	 *
845
+	 * @since 1.0.0
846
+	 * @package GeoDirectory
847
+	 * @global object $wpdb WordPress Database object.
848
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
849
+	 * @param int $post_id The post ID.
850
+	 * @param string $meta_key The meta key to retrieve.
851
+	 * @param bool $single Optional. Whether to return a single value. Default false.
852
+	 * @todo single variable not yet implemented.
853
+	 * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true.
854
+	 */
855
+	function geodir_get_post_meta($post_id, $meta_key, $single = false)
856
+	{
857
+		if (!$post_id) {
858
+			return false;
859
+		}
860
+		global $wpdb, $plugin_prefix;
861
+
862
+		$all_postypes = geodir_get_posttypes();
863
+
864
+		$post_type = get_post_type($post_id);
865
+
866
+		if (!in_array($post_type, $all_postypes))
867
+			return false;
868
+
869
+		$table = $plugin_prefix . $post_type . '_detail';
870
+
871
+		if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
872
+			$meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
873 873
             
874
-            if ($meta_value && $meta_value !== '') {
875
-                return maybe_serialize($meta_value);
876
-            } else
877
-                return $meta_value;
878
-        } else {
879
-            return false;
880
-        }
881
-    }
874
+			if ($meta_value && $meta_value !== '') {
875
+				return maybe_serialize($meta_value);
876
+			} else
877
+				return $meta_value;
878
+		} else {
879
+			return false;
880
+		}
881
+	}
882 882
 }
883 883
 
884 884
 
885 885
 if (!function_exists('geodir_save_post_images')) {
886
-    /**
887
-     * Save post attachments.
888
-     *
889
-     * @since 1.0.0
890
-     * @package GeoDirectory
891
-     * @global object $wpdb WordPress Database object.
892
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
893
-     * @global object $current_user Current user object.
894
-     * @param int $post_id The post ID.
895
-     * @param array $post_image Post image urls as an array.
896
-     * @param bool $dummy Optional. Is this a dummy listing? Default false.
897
-     */
898
-    function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false)
899
-    {
900
-
886
+	/**
887
+	 * Save post attachments.
888
+	 *
889
+	 * @since 1.0.0
890
+	 * @package GeoDirectory
891
+	 * @global object $wpdb WordPress Database object.
892
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
893
+	 * @global object $current_user Current user object.
894
+	 * @param int $post_id The post ID.
895
+	 * @param array $post_image Post image urls as an array.
896
+	 * @param bool $dummy Optional. Is this a dummy listing? Default false.
897
+	 */
898
+	function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false)
899
+	{
901 900
 
902
-        global $wpdb, $plugin_prefix, $current_user;
903 901
 
904
-        $post_type = get_post_type($post_id);
902
+		global $wpdb, $plugin_prefix, $current_user;
905 903
 
906
-        $table = $plugin_prefix . $post_type . '_detail';
904
+		$post_type = get_post_type($post_id);
907 905
 
908
-        $post_images = geodir_get_images($post_id);
906
+		$table = $plugin_prefix . $post_type . '_detail';
909 907
 
910
-        $wpdb->query(
911
-            $wpdb->prepare(
912
-                "UPDATE " . $table . " SET featured_image = '' where post_id =%d",
913
-                array($post_id)
914
-            )
915
-        );
908
+		$post_images = geodir_get_images($post_id);
916 909
 
917
-        $invalid_files = $post_images;
918
-        $valid_file_ids = array();
919
-        $valid_files_condition = '';
920
-        $geodir_uploaddir = '';
910
+		$wpdb->query(
911
+			$wpdb->prepare(
912
+				"UPDATE " . $table . " SET featured_image = '' where post_id =%d",
913
+				array($post_id)
914
+			)
915
+		);
921 916
 
922
-        $remove_files = array();
917
+		$invalid_files = $post_images;
918
+		$valid_file_ids = array();
919
+		$valid_files_condition = '';
920
+		$geodir_uploaddir = '';
923 921
 
924
-        if (!empty($post_image)) {
922
+		$remove_files = array();
925 923
 
926
-            $uploads = wp_upload_dir();
927
-            $uploads_dir = $uploads['path'];
924
+		if (!empty($post_image)) {
928 925
 
929
-            $geodir_uploadpath = $uploads['path'];
930
-            $geodir_uploadurl = $uploads['url'];
931
-            $sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : '';
926
+			$uploads = wp_upload_dir();
927
+			$uploads_dir = $uploads['path'];
932 928
 
933
-            $invalid_files = array();
934
-            $postcurr_images = array();
929
+			$geodir_uploadpath = $uploads['path'];
930
+			$geodir_uploadurl = $uploads['url'];
931
+			$sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : '';
935 932
 
936
-            for ($m = 0; $m < count($post_image); $m++) {
937
-                $menu_order = $m + 1;
933
+			$invalid_files = array();
934
+			$postcurr_images = array();
938 935
 
939
-                $file_path = '';
940
-                /* --------- start ------- */
936
+			for ($m = 0; $m < count($post_image); $m++) {
937
+				$menu_order = $m + 1;
941 938
 
942
-                $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
939
+				$file_path = '';
940
+				/* --------- start ------- */
943 941
 
944
-                $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
942
+				$split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
945 943
 
944
+				$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
946 945
 
947
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
948 946
 
949
-                    /* --------- end ------- */
950
-                    $curr_img_url = $post_image[$m];
947
+				if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
951 948
 
952
-                    $image_name_arr = explode('/', $curr_img_url);
949
+					/* --------- end ------- */
950
+					$curr_img_url = $post_image[$m];
953 951
 
954
-                    $count_image_name_arr = count($image_name_arr) - 2;
952
+					$image_name_arr = explode('/', $curr_img_url);
955 953
 
956
-                    $count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0;
954
+					$count_image_name_arr = count($image_name_arr) - 2;
957 955
 
958
-                    $curr_img_dir = $image_name_arr[$count_image_name_arr];
956
+					$count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0;
959 957
 
960
-                    $filename = end($image_name_arr);
961
-                    if (strpos($filename, '?') !== false) {
962
-                        list($filename) = explode('?', $filename);
963
-                    }
958
+					$curr_img_dir = $image_name_arr[$count_image_name_arr];
964 959
 
965
-                    $curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url);
966
-                    $curr_img_dir = str_replace($filename, "", $curr_img_dir);
960
+					$filename = end($image_name_arr);
961
+					if (strpos($filename, '?') !== false) {
962
+						list($filename) = explode('?', $filename);
963
+					}
967 964
 
968
-                    $img_name_arr = explode('.', $filename);
965
+					$curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url);
966
+					$curr_img_dir = str_replace($filename, "", $curr_img_dir);
969 967
 
970
-                    $file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename;
971
-                    if (!empty($img_name_arr) && count($img_name_arr) > 2) {
972
-                        $new_img_name_arr = $img_name_arr;
973
-                        if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
974
-                            unset($new_img_name_arr[count($img_name_arr) - 1]);
975
-                            $file_title = implode('.', $new_img_name_arr);
976
-                        }
977
-                    }
978
-                    $file_title = sanitize_file_name($file_title);
979
-                    $file_name = sanitize_file_name($filename);
968
+					$img_name_arr = explode('.', $filename);
980 969
 
981
-                    $arr_file_type = wp_check_filetype($filename);
970
+					$file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename;
971
+					if (!empty($img_name_arr) && count($img_name_arr) > 2) {
972
+						$new_img_name_arr = $img_name_arr;
973
+						if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
974
+							unset($new_img_name_arr[count($img_name_arr) - 1]);
975
+							$file_title = implode('.', $new_img_name_arr);
976
+						}
977
+					}
978
+					$file_title = sanitize_file_name($file_title);
979
+					$file_name = sanitize_file_name($filename);
982 980
 
983
-                    $uploaded_file_type = $arr_file_type['type'];
981
+					$arr_file_type = wp_check_filetype($filename);
984 982
 
985
-                    // Set an array containing a list of acceptable formats
986
-                    $allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
983
+					$uploaded_file_type = $arr_file_type['type'];
987 984
 
988
-                    // If the uploaded file is the right format
989
-                    if (in_array($uploaded_file_type, $allowed_file_types)) {
990
-                        if (!function_exists('wp_handle_upload')) {
991
-                            require_once(ABSPATH . 'wp-admin/includes/file.php');
992
-                        }
985
+					// Set an array containing a list of acceptable formats
986
+					$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
993 987
 
994
-                        if (!is_dir($geodir_uploadpath)) {
995
-                            mkdir($geodir_uploadpath);
996
-                        }
988
+					// If the uploaded file is the right format
989
+					if (in_array($uploaded_file_type, $allowed_file_types)) {
990
+						if (!function_exists('wp_handle_upload')) {
991
+							require_once(ABSPATH . 'wp-admin/includes/file.php');
992
+						}
997 993
 
998
-                        $external_img = false;
999
-                        if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
1000
-                        } else {
1001
-                            $external_img = true;
1002
-                        }
994
+						if (!is_dir($geodir_uploadpath)) {
995
+							mkdir($geodir_uploadpath);
996
+						}
1003 997
 
1004
-                        if ($dummy || $external_img) {
1005
-                            $uploaded_file = array();
1006
-                            $uploaded = (array)fetch_remote_file($curr_img_url);
998
+						$external_img = false;
999
+						if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
1000
+						} else {
1001
+							$external_img = true;
1002
+						}
1007 1003
 
1008
-                            if (isset($uploaded['error']) && empty($uploaded['error'])) {
1009
-                                $new_name = basename($uploaded['file']);
1010
-                                $uploaded_file = $uploaded;
1011
-                            }else{
1012
-                                print_r($uploaded);exit;
1013
-                            }
1014
-                            $external_img = false;
1015
-                        } else {
1016
-                            $new_name = $post_id . '_' . $file_name;
1004
+						if ($dummy || $external_img) {
1005
+							$uploaded_file = array();
1006
+							$uploaded = (array)fetch_remote_file($curr_img_url);
1017 1007
 
1018
-                            if ($curr_img_dir == $sub_dir) {
1019
-                                $img_path = $geodir_uploadpath . '/' . $filename;
1020
-                                $img_url = $geodir_uploadurl . '/' . $filename;
1021
-                            } else {
1022
-                                $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1023
-                                $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1024
-                            }
1008
+							if (isset($uploaded['error']) && empty($uploaded['error'])) {
1009
+								$new_name = basename($uploaded['file']);
1010
+								$uploaded_file = $uploaded;
1011
+							}else{
1012
+								print_r($uploaded);exit;
1013
+							}
1014
+							$external_img = false;
1015
+						} else {
1016
+							$new_name = $post_id . '_' . $file_name;
1025 1017
 
1026
-                            $uploaded_file = '';
1018
+							if ($curr_img_dir == $sub_dir) {
1019
+								$img_path = $geodir_uploadpath . '/' . $filename;
1020
+								$img_url = $geodir_uploadurl . '/' . $filename;
1021
+							} else {
1022
+								$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1023
+								$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1024
+							}
1027 1025
 
1028
-                            if (file_exists($img_path)) {
1029
-                                $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1030
-                                $file_path = '';
1031
-                            } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
1032
-                                $uploaded_file = true;
1033
-                                $file_path = $curr_img_dir . '/' . $filename;
1034
-                            }
1026
+							$uploaded_file = '';
1035 1027
 
1036
-                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1037
-                                unlink($img_path);
1038
-                        }
1028
+							if (file_exists($img_path)) {
1029
+								$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1030
+								$file_path = '';
1031
+							} else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
1032
+								$uploaded_file = true;
1033
+								$file_path = $curr_img_dir . '/' . $filename;
1034
+							}
1039 1035
 
1040
-                        if (!empty($uploaded_file)) {
1041
-                            if (!isset($file_path) || !$file_path) {
1042
-                                $file_path = $sub_dir . '/' . $new_name;
1043
-                            }
1036
+							if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1037
+								unlink($img_path);
1038
+						}
1044 1039
 
1045
-                            $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1040
+						if (!empty($uploaded_file)) {
1041
+							if (!isset($file_path) || !$file_path) {
1042
+								$file_path = $sub_dir . '/' . $new_name;
1043
+							}
1046 1044
 
1047
-                            if ($menu_order == 1) {
1045
+							$postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1048 1046
 
1049
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1047
+							if ($menu_order == 1) {
1050 1048
 
1051
-                            }
1049
+								$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1052 1050
 
1053
-                            // Set up options array to add this file as an attachment
1054
-                            $attachment = array();
1055
-                            $attachment['post_id'] = $post_id;
1056
-                            $attachment['title'] = $file_title;
1057
-                            $attachment['content'] = '';
1058
-                            $attachment['file'] = $file_path;
1059
-                            $attachment['mime_type'] = $uploaded_file_type;
1060
-                            $attachment['menu_order'] = $menu_order;
1061
-                            $attachment['is_featured'] = 0;
1051
+							}
1062 1052
 
1063
-                            $attachment_set = '';
1053
+							// Set up options array to add this file as an attachment
1054
+							$attachment = array();
1055
+							$attachment['post_id'] = $post_id;
1056
+							$attachment['title'] = $file_title;
1057
+							$attachment['content'] = '';
1058
+							$attachment['file'] = $file_path;
1059
+							$attachment['mime_type'] = $uploaded_file_type;
1060
+							$attachment['menu_order'] = $menu_order;
1061
+							$attachment['is_featured'] = 0;
1064 1062
 
1065
-                            foreach ($attachment as $key => $val) {
1066
-                                if ($val != '')
1067
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1068
-                            }
1063
+							$attachment_set = '';
1069 1064
 
1070
-                            $attachment_set = trim($attachment_set, ", ");
1065
+							foreach ($attachment as $key => $val) {
1066
+								if ($val != '')
1067
+									$attachment_set .= $key . " = '" . $val . "', ";
1068
+							}
1071 1069
 
1072
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1070
+							$attachment_set = trim($attachment_set, ", ");
1071
+
1072
+							$wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1073 1073
 
1074
-                            $valid_file_ids[] = $wpdb->insert_id;
1075
-                        }
1074
+							$valid_file_ids[] = $wpdb->insert_id;
1075
+						}
1076 1076
 
1077
-                    }
1077
+					}
1078 1078
 
1079 1079
 
1080
-                } else {
1081
-                    $valid_file_ids[] = $find_image;
1080
+				} else {
1081
+					$valid_file_ids[] = $find_image;
1082 1082
 
1083
-                    $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1083
+					$postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1084 1084
 
1085
-                    $wpdb->query(
1086
-                        $wpdb->prepare(
1087
-                            "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",
1088
-                            array($menu_order, $split_img_path[1], $post_id)
1089
-                        )
1090
-                    );
1085
+					$wpdb->query(
1086
+						$wpdb->prepare(
1087
+							"UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",
1088
+							array($menu_order, $split_img_path[1], $post_id)
1089
+						)
1090
+					);
1091 1091
 
1092
-                    if ($menu_order == 1)
1093
-                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1092
+					if ($menu_order == 1)
1093
+						$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1094 1094
 
1095
-                }
1095
+				}
1096 1096
 
1097 1097
 
1098
-            }
1098
+			}
1099 1099
 
1100
-            if (!empty($valid_file_ids)) {
1100
+			if (!empty($valid_file_ids)) {
1101 1101
 
1102
-                $remove_files = $valid_file_ids;
1102
+				$remove_files = $valid_file_ids;
1103 1103
 
1104
-                $remove_files_length = count($remove_files);
1105
-                $remove_files_format = array_fill(0, $remove_files_length, '%d');
1106
-                $format = implode(',', $remove_files_format);
1107
-                $valid_files_condition = " ID NOT IN ($format) AND ";
1104
+				$remove_files_length = count($remove_files);
1105
+				$remove_files_format = array_fill(0, $remove_files_length, '%d');
1106
+				$format = implode(',', $remove_files_format);
1107
+				$valid_files_condition = " ID NOT IN ($format) AND ";
1108 1108
 
1109
-            }
1109
+			}
1110 1110
 
1111
-            //Get and remove all old images of post from database to set by new order
1111
+			//Get and remove all old images of post from database to set by new order
1112 1112
 
1113
-            if (!empty($post_images)) {
1113
+			if (!empty($post_images)) {
1114 1114
 
1115
-                foreach ($post_images as $img) {
1115
+				foreach ($post_images as $img) {
1116 1116
 
1117
-                    if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1117
+					if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1118 1118
 
1119
-                        $invalid_files[] = (object)array('src' => $img->src);
1119
+						$invalid_files[] = (object)array('src' => $img->src);
1120 1120
 
1121
-                    }
1121
+					}
1122 1122
 
1123
-                }
1123
+				}
1124 1124
 
1125
-            }
1125
+			}
1126 1126
 
1127
-            $invalid_files = (object)$invalid_files;
1128
-        }
1127
+			$invalid_files = (object)$invalid_files;
1128
+		}
1129 1129
 
1130
-        $remove_files[] = $post_id;
1130
+		$remove_files[] = $post_id;
1131 1131
 
1132
-        $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1132
+		$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1133 1133
 
1134
-        if (!empty($invalid_files))
1135
-            geodir_remove_attachments($invalid_files);
1136
-    }
1134
+		if (!empty($invalid_files))
1135
+			geodir_remove_attachments($invalid_files);
1136
+	}
1137 1137
 
1138 1138
 }
1139 1139
 
@@ -1147,12 +1147,12 @@  discard block
 block discarded – undo
1147 1147
 function geodir_remove_temp_images()
1148 1148
 {
1149 1149
 
1150
-    global $current_user;
1150
+	global $current_user;
1151 1151
 
1152
-    $uploads = wp_upload_dir();
1153
-    $uploads_dir = $uploads['path'];
1152
+	$uploads = wp_upload_dir();
1153
+	$uploads_dir = $uploads['path'];
1154 1154
 
1155
-    /*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
1155
+	/*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
1156 1156
 
1157 1157
 			$dirPath = $uploads_dir.'/temp_'.$current_user->data->ID;
1158 1158
 			if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
@@ -1169,8 +1169,8 @@  discard block
 block discarded – undo
1169 1169
 			rmdir($dirPath);
1170 1170
 	}	*/
1171 1171
 
1172
-    $dirname = $uploads_dir . '/temp_' . $current_user->ID;
1173
-    geodir_delete_directory($dirname);
1172
+	$dirname = $uploads_dir . '/temp_' . $current_user->ID;
1173
+	geodir_delete_directory($dirname);
1174 1174
 }
1175 1175
 
1176 1176
 
@@ -1184,116 +1184,116 @@  discard block
 block discarded – undo
1184 1184
  */
1185 1185
 function geodir_delete_directory($dirname)
1186 1186
 {
1187
-    $dir_handle = '';
1188
-    if (is_dir($dirname))
1189
-        $dir_handle = opendir($dirname);
1190
-    if (!$dir_handle)
1191
-        return false;
1192
-    while ($file = readdir($dir_handle)) {
1193
-        if ($file != "." && $file != "..") {
1194
-            if (!is_dir($dirname . "/" . $file))
1195
-                unlink($dirname . "/" . $file);
1196
-            else
1197
-                geodir_delete_directory($dirname . '/' . $file);
1198
-        }
1199
-    }
1200
-    closedir($dir_handle);
1201
-    rmdir($dirname);
1202
-    return true;
1187
+	$dir_handle = '';
1188
+	if (is_dir($dirname))
1189
+		$dir_handle = opendir($dirname);
1190
+	if (!$dir_handle)
1191
+		return false;
1192
+	while ($file = readdir($dir_handle)) {
1193
+		if ($file != "." && $file != "..") {
1194
+			if (!is_dir($dirname . "/" . $file))
1195
+				unlink($dirname . "/" . $file);
1196
+			else
1197
+				geodir_delete_directory($dirname . '/' . $file);
1198
+		}
1199
+	}
1200
+	closedir($dir_handle);
1201
+	rmdir($dirname);
1202
+	return true;
1203 1203
 
1204 1204
 }
1205 1205
 
1206 1206
 
1207 1207
 if (!function_exists('geodir_remove_attachments')) {
1208
-    /**
1209
-     * Remove post attachments.
1210
-     *
1211
-     * @since 1.0.0
1212
-     * @package GeoDirectory
1213
-     * @param array $postcurr_images Array of image objects.
1214
-     */
1215
-    function geodir_remove_attachments($postcurr_images = array())
1216
-    {
1217
-        // Unlink all past images of post
1218
-        if (!empty($postcurr_images)) {
1219
-
1220
-            $uploads = wp_upload_dir();
1221
-            $uploads_dir = $uploads['path'];
1222
-
1223
-            foreach ($postcurr_images as $postimg) {
1224
-                $image_name_arr = explode('/', $postimg->src);
1225
-                $filename = end($image_name_arr);
1226
-                if (file_exists($uploads_dir . '/' . $filename))
1227
-                    unlink($uploads_dir . '/' . $filename);
1228
-            }
1229
-
1230
-        } // endif
1231
-        // Unlink all past images of post end
1232
-    }
1208
+	/**
1209
+	 * Remove post attachments.
1210
+	 *
1211
+	 * @since 1.0.0
1212
+	 * @package GeoDirectory
1213
+	 * @param array $postcurr_images Array of image objects.
1214
+	 */
1215
+	function geodir_remove_attachments($postcurr_images = array())
1216
+	{
1217
+		// Unlink all past images of post
1218
+		if (!empty($postcurr_images)) {
1219
+
1220
+			$uploads = wp_upload_dir();
1221
+			$uploads_dir = $uploads['path'];
1222
+
1223
+			foreach ($postcurr_images as $postimg) {
1224
+				$image_name_arr = explode('/', $postimg->src);
1225
+				$filename = end($image_name_arr);
1226
+				if (file_exists($uploads_dir . '/' . $filename))
1227
+					unlink($uploads_dir . '/' . $filename);
1228
+			}
1229
+
1230
+		} // endif
1231
+		// Unlink all past images of post end
1232
+	}
1233 1233
 }
1234 1234
 
1235 1235
 if (!function_exists('geodir_get_featured_image')) {
1236
-    /**
1237
-     * Gets the post featured image.
1238
-     *
1239
-     * @since 1.0.0
1240
-     * @package GeoDirectory
1241
-     * @global object $wpdb WordPress Database object.
1242
-     * @global object $post The current post object.
1243
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1244
-     * @param int|string $post_id The post ID.
1245
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1246
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1247
-     * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false.
1248
-     * @return bool|object Image details as an object.
1249
-     */
1250
-    function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false)
1251
-    {
1252
-
1253
-        /*$img_arr['src'] = get_the_post_thumbnail_url( $post_id,  'medium');//medium/thumbnail
1236
+	/**
1237
+	 * Gets the post featured image.
1238
+	 *
1239
+	 * @since 1.0.0
1240
+	 * @package GeoDirectory
1241
+	 * @global object $wpdb WordPress Database object.
1242
+	 * @global object $post The current post object.
1243
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1244
+	 * @param int|string $post_id The post ID.
1245
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1246
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1247
+	 * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false.
1248
+	 * @return bool|object Image details as an object.
1249
+	 */
1250
+	function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false)
1251
+	{
1252
+
1253
+		/*$img_arr['src'] = get_the_post_thumbnail_url( $post_id,  'medium');//medium/thumbnail
1254 1254
         $img_arr['path'] = '';
1255 1255
         $img_arr['width'] = '';
1256 1256
         $img_arr['height'] = '';
1257 1257
         $img_arr['title'] = '';
1258 1258
         return (object)$img_arr;*/
1259
-        global $wpdb, $plugin_prefix, $post;
1259
+		global $wpdb, $plugin_prefix, $post;
1260 1260
 
1261
-        if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
1262
-            $post_type = $post->post_type;
1263
-        } else {
1264
-            $post_type = get_post_type($post_id);
1265
-        }
1261
+		if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
1262
+			$post_type = $post->post_type;
1263
+		} else {
1264
+			$post_type = get_post_type($post_id);
1265
+		}
1266 1266
 
1267
-        if (!in_array($post_type, geodir_get_posttypes())) {
1268
-            return false;// if not a GD CPT return;
1269
-        }
1267
+		if (!in_array($post_type, geodir_get_posttypes())) {
1268
+			return false;// if not a GD CPT return;
1269
+		}
1270 1270
 
1271
-        $table = $plugin_prefix . $post_type . '_detail';
1271
+		$table = $plugin_prefix . $post_type . '_detail';
1272 1272
 
1273
-        if (!$file) {
1274
-            if (isset($post->featured_image)) {
1275
-                $file = $post->featured_image;
1276
-            } else {
1277
-                $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
1278
-            }
1279
-        }
1273
+		if (!$file) {
1274
+			if (isset($post->featured_image)) {
1275
+				$file = $post->featured_image;
1276
+			} else {
1277
+				$file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
1278
+			}
1279
+		}
1280 1280
 
1281
-        if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
1282
-            $img_arr = array();
1281
+		if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
1282
+			$img_arr = array();
1283 1283
 
1284
-            $file_info = pathinfo($file);
1285
-            $sub_dir = '';
1286
-            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1287
-                $sub_dir = stripslashes_deep($file_info['dirname']);
1284
+			$file_info = pathinfo($file);
1285
+			$sub_dir = '';
1286
+			if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1287
+				$sub_dir = stripslashes_deep($file_info['dirname']);
1288 1288
 
1289
-            $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1290
-            $uploads_baseurl = $uploads['baseurl'];
1291
-            $uploads_path = $uploads['path'];
1289
+			$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1290
+			$uploads_baseurl = $uploads['baseurl'];
1291
+			$uploads_path = $uploads['path'];
1292 1292
 
1293
-            $file_name = $file_info['basename'];
1293
+			$file_name = $file_info['basename'];
1294 1294
 
1295
-            $uploads_url = $uploads_baseurl . $sub_dir;
1296
-            /*
1295
+			$uploads_url = $uploads_baseurl . $sub_dir;
1296
+			/*
1297 1297
              * Allows the filter of image src for such things as CDN change.
1298 1298
              *
1299 1299
              * @since 1.5.7
@@ -1302,158 +1302,158 @@  discard block
 block discarded – undo
1302 1302
              * @param string $uploads_url The server upload directory url.
1303 1303
              * @param string $uploads_baseurl The uploads dir base url.
1304 1304
              */
1305
-            $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1306
-            $img_arr['path'] = $uploads_path . '/' . $file_name;
1307
-            $width = 0;
1308
-            $height = 0;
1309
-            if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1310
-                $imagesize = getimagesize($img_arr['path']);
1311
-                $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1312
-                $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1313
-            }
1314
-            $img_arr['width'] = $width;
1315
-            $img_arr['height'] = $height;
1316
-            $img_arr['title'] = '';
1317
-        } elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
1318
-            foreach ($post_images as $image) {
1319
-                return $image;
1320
-            }
1321
-        } else if ($no_image) {
1322
-            $img_arr = array();
1323
-
1324
-            $default_img = '';
1325
-            if (isset($post->default_category) && $post->default_category) {
1326
-                $default_cat = $post->default_category;
1327
-            } else {
1328
-                $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1329
-            }
1330
-
1331
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1332
-                $default_img = $default_catimg['src'];
1333
-            elseif ($no_image) {
1334
-                $default_img = get_option('geodir_listing_no_img');
1335
-            }
1336
-
1337
-            if (!empty($default_img)) {
1338
-                $uploads = wp_upload_dir(); // Array of key => value pairs
1339
-                $uploads_baseurl = $uploads['baseurl'];
1340
-                $uploads_path = $uploads['path'];
1341
-
1342
-                $img_arr = array();
1343
-
1344
-                $file_info = pathinfo($default_img);
1345
-
1346
-                $file_name = $file_info['basename'];
1347
-
1348
-                $img_arr['src'] = $default_img;
1349
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1350
-
1351
-                $width = 0;
1352
-                $height = 0;
1353
-                if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1354
-                    $imagesize = getimagesize($img_arr['path']);
1355
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1356
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1357
-                }
1358
-                $img_arr['width'] = $width;
1359
-                $img_arr['height'] = $height;
1360
-
1361
-                $img_arr['title'] = ''; // add the title to the array
1362
-            }
1363
-        }
1364
-
1365
-        if (!empty($img_arr))
1366
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1367
-        else
1368
-            return false;
1369
-    }
1305
+			$img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1306
+			$img_arr['path'] = $uploads_path . '/' . $file_name;
1307
+			$width = 0;
1308
+			$height = 0;
1309
+			if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1310
+				$imagesize = getimagesize($img_arr['path']);
1311
+				$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1312
+				$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1313
+			}
1314
+			$img_arr['width'] = $width;
1315
+			$img_arr['height'] = $height;
1316
+			$img_arr['title'] = '';
1317
+		} elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
1318
+			foreach ($post_images as $image) {
1319
+				return $image;
1320
+			}
1321
+		} else if ($no_image) {
1322
+			$img_arr = array();
1323
+
1324
+			$default_img = '';
1325
+			if (isset($post->default_category) && $post->default_category) {
1326
+				$default_cat = $post->default_category;
1327
+			} else {
1328
+				$default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1329
+			}
1330
+
1331
+			if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1332
+				$default_img = $default_catimg['src'];
1333
+			elseif ($no_image) {
1334
+				$default_img = get_option('geodir_listing_no_img');
1335
+			}
1336
+
1337
+			if (!empty($default_img)) {
1338
+				$uploads = wp_upload_dir(); // Array of key => value pairs
1339
+				$uploads_baseurl = $uploads['baseurl'];
1340
+				$uploads_path = $uploads['path'];
1341
+
1342
+				$img_arr = array();
1343
+
1344
+				$file_info = pathinfo($default_img);
1345
+
1346
+				$file_name = $file_info['basename'];
1347
+
1348
+				$img_arr['src'] = $default_img;
1349
+				$img_arr['path'] = $uploads_path . '/' . $file_name;
1350
+
1351
+				$width = 0;
1352
+				$height = 0;
1353
+				if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1354
+					$imagesize = getimagesize($img_arr['path']);
1355
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1356
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1357
+				}
1358
+				$img_arr['width'] = $width;
1359
+				$img_arr['height'] = $height;
1360
+
1361
+				$img_arr['title'] = ''; // add the title to the array
1362
+			}
1363
+		}
1364
+
1365
+		if (!empty($img_arr))
1366
+			return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1367
+		else
1368
+			return false;
1369
+	}
1370 1370
 }
1371 1371
 
1372 1372
 if (!function_exists('geodir_show_featured_image')) {
1373
-    /**
1374
-     * Gets the post featured image.
1375
-     *
1376
-     * @since 1.0.0
1377
-     * @package GeoDirectory
1378
-     * @param int|string $post_id The post ID.
1379
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1380
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1381
-     * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1382
-     * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false.
1383
-     * @return bool|string Returns image html.
1384
-     */
1385
-    function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false)
1386
-    {
1387
-        $image = geodir_get_featured_image($post_id, $size, $no_image, $fimage);
1388
-
1389
-        $html = geodir_show_image($image, $size, $no_image, false);
1390
-
1391
-        if (!empty($html) && $echo) {
1392
-            echo $html;
1393
-        } elseif (!empty($html)) {
1394
-            return $html;
1395
-        } else
1396
-            return false;
1397
-    }
1373
+	/**
1374
+	 * Gets the post featured image.
1375
+	 *
1376
+	 * @since 1.0.0
1377
+	 * @package GeoDirectory
1378
+	 * @param int|string $post_id The post ID.
1379
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1380
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1381
+	 * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1382
+	 * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false.
1383
+	 * @return bool|string Returns image html.
1384
+	 */
1385
+	function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false)
1386
+	{
1387
+		$image = geodir_get_featured_image($post_id, $size, $no_image, $fimage);
1388
+
1389
+		$html = geodir_show_image($image, $size, $no_image, false);
1390
+
1391
+		if (!empty($html) && $echo) {
1392
+			echo $html;
1393
+		} elseif (!empty($html)) {
1394
+			return $html;
1395
+		} else
1396
+			return false;
1397
+	}
1398 1398
 }
1399 1399
 
1400 1400
 if (!function_exists('geodir_get_images')) {
1401
-    /**
1402
-     * Gets the post images.
1403
-     *
1404
-     * @since 1.0.0
1405
-     * @package GeoDirectory
1406
-     * @global object $wpdb WordPress Database object.
1407
-     * @param int $post_id The post ID.
1408
-     * @param string $img_size Optional. Thumbnail size.
1409
-     * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false.
1410
-     * @param bool $add_featured Optional. Do you want to include featured images too? Default: true.
1411
-     * @param int|string $limit Optional. Number of images.
1412
-     * @return array|bool Returns images as an array. Each item is an object.
1413
-     */
1414
-    function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '')
1415
-    {
1416
-        global $wpdb;
1417
-        if ($limit) {
1418
-            $limit_q = " LIMIT $limit ";
1419
-        } else {
1420
-            $limit_q = '';
1421
-        }
1422
-        $not_featured = '';
1423
-        $sub_dir = '';
1424
-        if (!$add_featured)
1425
-            $not_featured = " AND is_featured = 0 ";
1426
-
1427
-        $arrImages = $wpdb->get_results(
1428
-            $wpdb->prepare(
1429
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ",
1430
-                array('%image%', $post_id)
1431
-            )
1432
-        );
1433
-
1434
-        $counter = 0;
1435
-        $return_arr = array();
1436
-
1437
-        if (!empty($arrImages)) {
1438
-            foreach ($arrImages as $attechment) {
1439
-
1440
-                $img_arr = array();
1441
-                $img_arr['id'] = $attechment->ID;
1442
-                $img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0;
1443
-
1444
-                $file_info = pathinfo($attechment->file);
1445
-
1446
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1447
-                    $sub_dir = stripslashes_deep($file_info['dirname']);
1448
-
1449
-                $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1450
-                $uploads_baseurl = $uploads['baseurl'];
1451
-                $uploads_path = $uploads['path'];
1452
-
1453
-                $file_name = $file_info['basename'];
1454
-
1455
-                $uploads_url = $uploads_baseurl . $sub_dir;
1456
-                /*
1401
+	/**
1402
+	 * Gets the post images.
1403
+	 *
1404
+	 * @since 1.0.0
1405
+	 * @package GeoDirectory
1406
+	 * @global object $wpdb WordPress Database object.
1407
+	 * @param int $post_id The post ID.
1408
+	 * @param string $img_size Optional. Thumbnail size.
1409
+	 * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false.
1410
+	 * @param bool $add_featured Optional. Do you want to include featured images too? Default: true.
1411
+	 * @param int|string $limit Optional. Number of images.
1412
+	 * @return array|bool Returns images as an array. Each item is an object.
1413
+	 */
1414
+	function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '')
1415
+	{
1416
+		global $wpdb;
1417
+		if ($limit) {
1418
+			$limit_q = " LIMIT $limit ";
1419
+		} else {
1420
+			$limit_q = '';
1421
+		}
1422
+		$not_featured = '';
1423
+		$sub_dir = '';
1424
+		if (!$add_featured)
1425
+			$not_featured = " AND is_featured = 0 ";
1426
+
1427
+		$arrImages = $wpdb->get_results(
1428
+			$wpdb->prepare(
1429
+				"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ",
1430
+				array('%image%', $post_id)
1431
+			)
1432
+		);
1433
+
1434
+		$counter = 0;
1435
+		$return_arr = array();
1436
+
1437
+		if (!empty($arrImages)) {
1438
+			foreach ($arrImages as $attechment) {
1439
+
1440
+				$img_arr = array();
1441
+				$img_arr['id'] = $attechment->ID;
1442
+				$img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0;
1443
+
1444
+				$file_info = pathinfo($attechment->file);
1445
+
1446
+				if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1447
+					$sub_dir = stripslashes_deep($file_info['dirname']);
1448
+
1449
+				$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1450
+				$uploads_baseurl = $uploads['baseurl'];
1451
+				$uploads_path = $uploads['path'];
1452
+
1453
+				$file_name = $file_info['basename'];
1454
+
1455
+				$uploads_url = $uploads_baseurl . $sub_dir;
1456
+				/*
1457 1457
                 * Allows the filter of image src for such things as CDN change.
1458 1458
                 *
1459 1459
                 * @since 1.5.7
@@ -1462,516 +1462,516 @@  discard block
 block discarded – undo
1462 1462
                 * @param string $uploads_url The server upload directory url.
1463 1463
                 * @param string $uploads_baseurl The uploads dir base url.
1464 1464
                 */
1465
-                $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1466
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1467
-                $width = 0;
1468
-                $height = 0;
1469
-                if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1470
-                    $imagesize = getimagesize($img_arr['path']);
1471
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1472
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1473
-                }
1474
-                $img_arr['width'] = $width;
1475
-                $img_arr['height'] = $height;
1476
-
1477
-                $img_arr['file'] = $file_name; // add the title to the array
1478
-                $img_arr['title'] = $attechment->title; // add the title to the array
1479
-                $img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array
1480
-                $img_arr['content'] = $attechment->content; // add the description to the array
1481
-                $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1482
-
1483
-                $return_arr[] = (object)$img_arr;
1484
-
1485
-                $counter++;
1486
-            }
1487
-            return (object)$return_arr;
1488
-        } else if ($no_images) {
1489
-            $default_img = '';
1490
-            $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1491
-            $post_type = get_post_type($post_id);
1492
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1493
-                $default_img = $default_catimg['src'];
1494
-            elseif ($no_images) {
1495
-                $default_img = get_option('geodir_listing_no_img');
1496
-            }
1497
-
1498
-            if (!empty($default_img)) {
1499
-                $uploads = wp_upload_dir(); // Array of key => value pairs
1465
+				$img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1466
+				$img_arr['path'] = $uploads_path . '/' . $file_name;
1467
+				$width = 0;
1468
+				$height = 0;
1469
+				if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1470
+					$imagesize = getimagesize($img_arr['path']);
1471
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1472
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1473
+				}
1474
+				$img_arr['width'] = $width;
1475
+				$img_arr['height'] = $height;
1476
+
1477
+				$img_arr['file'] = $file_name; // add the title to the array
1478
+				$img_arr['title'] = $attechment->title; // add the title to the array
1479
+				$img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array
1480
+				$img_arr['content'] = $attechment->content; // add the description to the array
1481
+				$img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1482
+
1483
+				$return_arr[] = (object)$img_arr;
1484
+
1485
+				$counter++;
1486
+			}
1487
+			return (object)$return_arr;
1488
+		} else if ($no_images) {
1489
+			$default_img = '';
1490
+			$default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1491
+			$post_type = get_post_type($post_id);
1492
+			if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1493
+				$default_img = $default_catimg['src'];
1494
+			elseif ($no_images) {
1495
+				$default_img = get_option('geodir_listing_no_img');
1496
+			}
1497
+
1498
+			if (!empty($default_img)) {
1499
+				$uploads = wp_upload_dir(); // Array of key => value pairs
1500 1500
                 
1501
-                $image_path = $default_img;
1502
-                if (!path_is_absolute($image_path)) {
1503
-                    $image_path = str_replace($uploads['baseurl'], $uploads['basedir'], $image_path);
1504
-                }
1505
-
1506
-                $file_info = pathinfo($default_img);
1507
-                $file_name = $file_info['basename'];
1508
-
1509
-                $width = '';
1510
-                $height = '';
1511
-                if (is_file($image_path) && file_exists($image_path)) {
1512
-                    $imagesize = getimagesize($image_path);
1513
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1514
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1515
-                }
1501
+				$image_path = $default_img;
1502
+				if (!path_is_absolute($image_path)) {
1503
+					$image_path = str_replace($uploads['baseurl'], $uploads['basedir'], $image_path);
1504
+				}
1505
+
1506
+				$file_info = pathinfo($default_img);
1507
+				$file_name = $file_info['basename'];
1508
+
1509
+				$width = '';
1510
+				$height = '';
1511
+				if (is_file($image_path) && file_exists($image_path)) {
1512
+					$imagesize = getimagesize($image_path);
1513
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1514
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1515
+				}
1516 1516
                 
1517
-                $img_arr = array();
1518
-                $img_arr['src'] = $default_img;
1519
-                $img_arr['path'] = $image_path;
1520
-                $img_arr['width'] = $width;
1521
-                $img_arr['height'] = $height;
1522
-                $img_arr['file'] = $file_name; // add the title to the array
1523
-                $img_arr['title'] = $file_info['filename']; // add the title to the array
1524
-                $img_arr['content'] = $file_info['filename']; // add the description to the array
1525
-
1526
-                $return_arr[] = (object)$img_arr;
1527
-
1528
-                return $return_arr;
1529
-            } else
1530
-                return false;
1531
-        }
1532
-    }
1517
+				$img_arr = array();
1518
+				$img_arr['src'] = $default_img;
1519
+				$img_arr['path'] = $image_path;
1520
+				$img_arr['width'] = $width;
1521
+				$img_arr['height'] = $height;
1522
+				$img_arr['file'] = $file_name; // add the title to the array
1523
+				$img_arr['title'] = $file_info['filename']; // add the title to the array
1524
+				$img_arr['content'] = $file_info['filename']; // add the description to the array
1525
+
1526
+				$return_arr[] = (object)$img_arr;
1527
+
1528
+				return $return_arr;
1529
+			} else
1530
+				return false;
1531
+		}
1532
+	}
1533 1533
 }
1534 1534
 
1535 1535
 if (!function_exists('geodir_show_image')) {
1536
-    /**
1537
-     * Show image using image details.
1538
-     *
1539
-     * @since 1.0.0
1540
-     * @package GeoDirectory
1541
-     * @param array|object $request Image info either as an array or object.
1542
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1543
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1544
-     * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1545
-     * @return bool|string Returns image html.
1546
-     */
1547
-    function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true)
1548
-    {
1549
-        $image = new stdClass();
1550
-
1551
-        $html = '';
1552
-        if (!empty($request)) {
1553
-            if (!is_object($request)){
1554
-                $request = (object)$request;
1555
-            }
1556
-
1557
-            if (isset($request->src) && !isset($request->path)) {
1558
-                $request->path = $request->src;
1559
-            }
1560
-
1561
-            /*
1536
+	/**
1537
+	 * Show image using image details.
1538
+	 *
1539
+	 * @since 1.0.0
1540
+	 * @package GeoDirectory
1541
+	 * @param array|object $request Image info either as an array or object.
1542
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1543
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1544
+	 * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1545
+	 * @return bool|string Returns image html.
1546
+	 */
1547
+	function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true)
1548
+	{
1549
+		$image = new stdClass();
1550
+
1551
+		$html = '';
1552
+		if (!empty($request)) {
1553
+			if (!is_object($request)){
1554
+				$request = (object)$request;
1555
+			}
1556
+
1557
+			if (isset($request->src) && !isset($request->path)) {
1558
+				$request->path = $request->src;
1559
+			}
1560
+
1561
+			/*
1562 1562
              * getimagesize() works faster from path than url so we try and get path if we can.
1563 1563
              */
1564
-            $upload_dir = wp_upload_dir();
1565
-            $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1566
-            $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1567
-            if (strpos($img_no_http, $upload_no_http) !== false) {
1568
-                $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);
1569
-            }
1564
+			$upload_dir = wp_upload_dir();
1565
+			$img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1566
+			$upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1567
+			if (strpos($img_no_http, $upload_no_http) !== false) {
1568
+				$request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);
1569
+			}
1570 1570
             
1571
-            $width = 0;
1572
-            $height = 0;
1573
-            if (is_file($request->path) && file_exists($request->path)) {
1574
-                $imagesize = getimagesize($request->path);
1575
-                $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1576
-                $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1577
-            }
1578
-
1579
-            $image->src = $request->src;
1580
-            $image->width = $width;
1581
-            $image->height = $height;
1582
-
1583
-            $max_size = (object)geodir_get_imagesize($size);
1584
-
1585
-            if (!is_wp_error($max_size)) {
1586
-                if ($image->width) {
1587
-                    if ($image->height >= $image->width) {
1588
-                        $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1589
-                    } else if ($image->width < ($max_size->h)) {
1590
-                        $width_per = round((($image->width / $max_size->w) * 100), 2);
1591
-                    } else
1592
-                        $width_per = 100;
1593
-                }
1594
-
1595
-                if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1596
-                    $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1597
-                } else {
1598
-                    if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
1599
-                        $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1600
-                    }else{
1601
-                        //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1602
-                        //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';
1603
-                        $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
1604
-
1605
-                    }
1606
-
1607
-                }
1608
-            }
1609
-        }
1610
-
1611
-        if (!empty($html) && $echo) {
1612
-            echo $html;
1613
-        } elseif (!empty($html)) {
1614
-            return $html;
1615
-        } else
1616
-            return false;
1617
-    }
1618
-}
1571
+			$width = 0;
1572
+			$height = 0;
1573
+			if (is_file($request->path) && file_exists($request->path)) {
1574
+				$imagesize = getimagesize($request->path);
1575
+				$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1576
+				$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1577
+			}
1619 1578
 
1620
-if (!function_exists('geodir_set_post_terms')) {
1621
-    /**
1622
-     * Set post Categories.
1623
-     *
1624
-     * @since 1.0.0
1625
-     * @package GeoDirectory
1626
-     * @global object $wpdb WordPress Database object.
1627
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1628
-     * @param int $post_id The post ID.
1629
-     * @param array $terms An array of term objects.
1630
-     * @param array $tt_ids An array of term taxonomy IDs.
1631
-     * @param string $taxonomy Taxonomy slug.
1632
-     */
1633
-    function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy)
1634
-    {
1635
-        global $wpdb, $plugin_prefix;
1579
+			$image->src = $request->src;
1580
+			$image->width = $width;
1581
+			$image->height = $height;
1636 1582
 
1637
-        $post_type = get_post_type($post_id);
1583
+			$max_size = (object)geodir_get_imagesize($size);
1638 1584
 
1639
-        $table = $plugin_prefix . $post_type . '_detail';
1585
+			if (!is_wp_error($max_size)) {
1586
+				if ($image->width) {
1587
+					if ($image->height >= $image->width) {
1588
+						$width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1589
+					} else if ($image->width < ($max_size->h)) {
1590
+						$width_per = round((($image->width / $max_size->w) * 100), 2);
1591
+					} else
1592
+						$width_per = 100;
1593
+				}
1594
+
1595
+				if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1596
+					$html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1597
+				} else {
1598
+					if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
1599
+						$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1600
+					}else{
1601
+						//$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1602
+						//$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';
1603
+						$html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
1604
+
1605
+					}
1640 1606
 
1641
-        if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
1607
+				}
1608
+			}
1609
+		}
1610
+
1611
+		if (!empty($html) && $echo) {
1612
+			echo $html;
1613
+		} elseif (!empty($html)) {
1614
+			return $html;
1615
+		} else
1616
+			return false;
1617
+	}
1618
+}
1642 1619
 
1643
-            if ($taxonomy == $post_type . '_tags') {
1644
-                if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1645
-                    geodir_save_post_meta($post_id, 'post_tags', $terms);
1646
-                }
1647
-            } elseif ($taxonomy == $post_type . 'category') {
1648
-                $srcharr = array('"', '\\');
1649
-                $replarr = array("&quot;", '');
1620
+if (!function_exists('geodir_set_post_terms')) {
1621
+	/**
1622
+	 * Set post Categories.
1623
+	 *
1624
+	 * @since 1.0.0
1625
+	 * @package GeoDirectory
1626
+	 * @global object $wpdb WordPress Database object.
1627
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1628
+	 * @param int $post_id The post ID.
1629
+	 * @param array $terms An array of term objects.
1630
+	 * @param array $tt_ids An array of term taxonomy IDs.
1631
+	 * @param string $taxonomy Taxonomy slug.
1632
+	 */
1633
+	function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy)
1634
+	{
1635
+		global $wpdb, $plugin_prefix;
1636
+
1637
+		$post_type = get_post_type($post_id);
1638
+
1639
+		$table = $plugin_prefix . $post_type . '_detail';
1640
+
1641
+		if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
1642
+
1643
+			if ($taxonomy == $post_type . '_tags') {
1644
+				if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1645
+					geodir_save_post_meta($post_id, 'post_tags', $terms);
1646
+				}
1647
+			} elseif ($taxonomy == $post_type . 'category') {
1648
+				$srcharr = array('"', '\\');
1649
+				$replarr = array("&quot;", '');
1650 1650
 
1651
-                $post_obj = get_post($post_id);
1651
+				$post_obj = get_post($post_id);
1652 1652
 
1653
-                $cat_ids = array('0');
1654
-                if (is_array($tt_ids))
1655
-                    $cat_ids = $tt_ids;
1653
+				$cat_ids = array('0');
1654
+				if (is_array($tt_ids))
1655
+					$cat_ids = $tt_ids;
1656 1656
 
1657 1657
 
1658
-                if (!empty($cat_ids)) {
1659
-                    $cat_ids_array = $cat_ids;
1660
-                    $cat_ids_length = count($cat_ids_array);
1661
-                    $cat_ids_format = array_fill(0, $cat_ids_length, '%d');
1662
-                    $format = implode(',', $cat_ids_format);
1658
+				if (!empty($cat_ids)) {
1659
+					$cat_ids_array = $cat_ids;
1660
+					$cat_ids_length = count($cat_ids_array);
1661
+					$cat_ids_format = array_fill(0, $cat_ids_length, '%d');
1662
+					$format = implode(',', $cat_ids_format);
1663 1663
 
1664
-                    $cat_ids_array_del = $cat_ids_array;
1665
-                    $cat_ids_array_del[] = $post_id;
1664
+					$cat_ids_array_del = $cat_ids_array;
1665
+					$cat_ids_array_del[] = $post_id;
1666 1666
 
1667
-                    $wpdb->get_var(
1668
-                        $wpdb->prepare(
1669
-                            "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",
1670
-                            $cat_ids_array_del
1671
-                        )
1672
-                    );
1667
+					$wpdb->get_var(
1668
+						$wpdb->prepare(
1669
+							"DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",
1670
+							$cat_ids_array_del
1671
+						)
1672
+					);
1673 1673
 
1674 1674
 
1675
-                    $post_term = $wpdb->get_col(
1676
-                        $wpdb->prepare(
1677
-                            "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1678
-                            $cat_ids_array
1679
-                        )
1680
-                    );
1675
+					$post_term = $wpdb->get_col(
1676
+						$wpdb->prepare(
1677
+							"SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1678
+							$cat_ids_array
1679
+						)
1680
+					);
1681 1681
 
1682
-                }
1682
+				}
1683 1683
 
1684
-                $post_marker_json = '';
1684
+				$post_marker_json = '';
1685 1685
 
1686
-                if (!empty($post_term)):
1686
+				if (!empty($post_term)):
1687 1687
 
1688
-                    foreach ($post_term as $cat_id):
1688
+					foreach ($post_term as $cat_id):
1689 1689
 
1690
-                        $term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type);
1691
-                        $term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : '';
1690
+						$term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type);
1691
+						$term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : '';
1692 1692
 
1693
-                        $post_title = $post_obj->title;
1694
-                        $title = str_replace($srcharr, $replarr, $post_title);
1693
+						$post_title = $post_obj->title;
1694
+						$title = str_replace($srcharr, $replarr, $post_title);
1695 1695
 
1696
-                        $lat = geodir_get_post_meta($post_id, 'post_latitude', true);
1697
-                        $lng = geodir_get_post_meta($post_id, 'post_longitude', true);
1696
+						$lat = geodir_get_post_meta($post_id, 'post_latitude', true);
1697
+						$lng = geodir_get_post_meta($post_id, 'post_longitude', true);
1698 1698
 
1699
-                        $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1700
-                        $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);
1699
+						$timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1700
+						$timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);
1701 1701
 
1702
-                        $json = '{';
1703
-                        $json .= '"id":"' . $post_id . '",';
1704
-                        $json .= '"lat_pos": "' . $lat . '",';
1705
-                        $json .= '"long_pos": "' . $lng . '",';
1706
-                        $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';
1707
-                        $json .= '"icon":"' . $term_icon . '",';
1708
-                        $json .= '"group":"catgroup' . $cat_id . '"';
1709
-                        $json .= '}';
1702
+						$json = '{';
1703
+						$json .= '"id":"' . $post_id . '",';
1704
+						$json .= '"lat_pos": "' . $lat . '",';
1705
+						$json .= '"long_pos": "' . $lng . '",';
1706
+						$json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';
1707
+						$json .= '"icon":"' . $term_icon . '",';
1708
+						$json .= '"group":"catgroup' . $cat_id . '"';
1709
+						$json .= '}';
1710 1710
 
1711 1711
 
1712
-                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1713
-                            $post_marker_json = $json;
1712
+						if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1713
+							$post_marker_json = $json;
1714 1714
 
1715 1715
 
1716
-                        if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
1716
+						if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
1717 1717
 
1718
-                            $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
1718
+							$json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
1719 1719
 										post_title = %s,
1720 1720
 										json = %s
1721 1721
 										WHERE post_id = %d AND cat_id = %d ",
1722
-                                array($post_title, $json, $post_id, $cat_id));
1722
+								array($post_title, $json, $post_id, $cat_id));
1723 1723
 
1724
-                        } else {
1724
+						} else {
1725 1725
 
1726
-                            $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
1726
+							$json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
1727 1727
 										post_id = %d,
1728 1728
 										post_title = %s,
1729 1729
 										cat_id = %d,
1730 1730
 										json = %s",
1731
-                                array($post_id, $post_title, $cat_id, $json));
1731
+								array($post_id, $post_title, $cat_id, $json));
1732 1732
 
1733
-                        }
1733
+						}
1734 1734
 
1735
-                        $wpdb->query($json_query);
1735
+						$wpdb->query($json_query);
1736 1736
 
1737
-                    endforeach;
1737
+					endforeach;
1738 1738
 
1739
-                endif;
1739
+				endif;
1740 1740
 
1741
-                if (!empty($post_term) && is_array($post_term)) {
1742
-                    $categories = implode(',', $post_term);
1741
+				if (!empty($post_term) && is_array($post_term)) {
1742
+					$categories = implode(',', $post_term);
1743 1743
 
1744
-                    if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1744
+					if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1745 1745
 
1746
-                    if (empty($post_marker_json))
1747
-                        $post_marker_json = isset($json) ? $json : '';
1746
+					if (empty($post_marker_json))
1747
+						$post_marker_json = isset($json) ? $json : '';
1748 1748
 
1749
-                    if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1749
+					if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1750 1750
 
1751
-                        $wpdb->query(
1752
-                            $wpdb->prepare(
1753
-                                "UPDATE " . $table . " SET
1751
+						$wpdb->query(
1752
+							$wpdb->prepare(
1753
+								"UPDATE " . $table . " SET
1754 1754
 								" . $taxonomy . " = %s,
1755 1755
 								marker_json = %s
1756 1756
 								where post_id = %d",
1757
-                                array($categories, $post_marker_json, $post_id)
1758
-                            )
1759
-                        );
1757
+								array($categories, $post_marker_json, $post_id)
1758
+							)
1759
+						);
1760 1760
 
1761
-                        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
1761
+						if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
1762 1762
 
1763
-                            $categories = trim($categories, ',');
1763
+							$categories = trim($categories, ',');
1764 1764
 
1765
-                            if ($categories) {
1765
+							if ($categories) {
1766 1766
 
1767
-                                $categories = explode(',', $categories);
1767
+								$categories = explode(',', $categories);
1768 1768
 
1769
-                                $default_category = geodir_get_post_meta($post_id, 'default_category', true);
1769
+								$default_category = geodir_get_post_meta($post_id, 'default_category', true);
1770 1770
 
1771
-                                if (!in_array($default_category, $categories)) {
1771
+								if (!in_array($default_category, $categories)) {
1772 1772
 
1773
-                                    $wpdb->query(
1774
-                                        $wpdb->prepare(
1775
-                                            "UPDATE " . $table . " SET
1773
+									$wpdb->query(
1774
+										$wpdb->prepare(
1775
+											"UPDATE " . $table . " SET
1776 1776
 											default_category = %s
1777 1777
 											where post_id = %d",
1778
-                                            array($categories[0], $post_id)
1779
-                                        )
1780
-                                    );
1778
+											array($categories[0], $post_id)
1779
+										)
1780
+									);
1781 1781
 
1782
-                                    $default_category = $categories[0];
1782
+									$default_category = $categories[0];
1783 1783
 
1784
-                                }
1784
+								}
1785 1785
 
1786
-                                if ($default_category == '')
1787
-                                    $default_category = $categories[0];
1786
+								if ($default_category == '')
1787
+									$default_category = $categories[0];
1788 1788
 
1789
-                                geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1789
+								geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1790 1790
 
1791
-                            }
1791
+							}
1792 1792
 
1793
-                        }
1793
+						}
1794 1794
 
1795 1795
 
1796
-                    } else {
1796
+					} else {
1797 1797
 
1798
-                        $wpdb->query(
1799
-                            $wpdb->prepare(
1800
-                                "INSERT INTO " . $table . " SET
1798
+						$wpdb->query(
1799
+							$wpdb->prepare(
1800
+								"INSERT INTO " . $table . " SET
1801 1801
 								post_id = %d,
1802 1802
 								" . $taxonomy . " = %s,
1803 1803
 								marker_json = %s ",
1804 1804
 
1805
-                                array($post_id, $categories, $post_marker_json)
1806
-                            )
1807
-                        );
1808
-                    }
1809
-                }
1810
-            }
1811
-        }
1812
-    }
1805
+								array($post_id, $categories, $post_marker_json)
1806
+							)
1807
+						);
1808
+					}
1809
+				}
1810
+			}
1811
+		}
1812
+	}
1813 1813
 }
1814 1814
 
1815 1815
 if (!function_exists('geodir_get_infowindow_html')) {
1816
-    /**
1817
-     * Set post Map Marker info html.
1818
-     *
1819
-     * @since 1.0.0
1820
-     * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before".
1821
-     * @package GeoDirectory
1822
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
1823
-     * @global object $gd_session GeoDirectory Session object.
1824
-     * @param object $postinfo_obj The post details object.
1825
-     * @param string $post_preview Is this a post preview?.
1826
-     * @return mixed|string|void
1827
-     */
1828
-    function geodir_get_infowindow_html($postinfo_obj, $post_preview = '')
1829
-    {
1830
-        global $preview, $gd_session;
1831
-        $srcharr = array("'", "/", "-", '"', '\\');
1832
-        $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
1833
-
1834
-        if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1835
-            $ID = '';
1836
-            $plink = '';
1837
-
1838
-            if (isset($postinfo_obj->pid)) {
1839
-                $ID = $postinfo_obj->pid;
1840
-                $plink = get_permalink($ID);
1841
-            }
1842
-
1843
-            $title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title));
1844
-            $lat = $postinfo_obj->post_latitude;
1845
-            $lng = $postinfo_obj->post_longitude;
1846
-        } else {
1847
-            $ID = $postinfo_obj->post_id;
1848
-            $title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1849
-            $plink = get_permalink($ID);
1850
-            $lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));
1851
-            $lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));
1852
-        }
1853
-
1854
-        // filter field as per price package
1855
-        global $geodir_addon_list;
1856
-        if (isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1857
-            $post_type = get_post_type($ID);
1858
-            $package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL;
1859
-            $field_name = 'geodir_contact';
1860
-            if (!check_field_visibility($package_id, $field_name, $post_type)) {
1861
-                $contact = '';
1862
-            }
1863
-
1864
-            $field_name = 'geodir_timing';
1865
-            if (!check_field_visibility($package_id, $field_name, $post_type)) {
1866
-                $timing = '';
1867
-            }
1868
-        }
1869
-
1870
-        if ($lat && $lng) {
1871
-            ob_start(); ?>
1816
+	/**
1817
+	 * Set post Map Marker info html.
1818
+	 *
1819
+	 * @since 1.0.0
1820
+	 * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before".
1821
+	 * @package GeoDirectory
1822
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
1823
+	 * @global object $gd_session GeoDirectory Session object.
1824
+	 * @param object $postinfo_obj The post details object.
1825
+	 * @param string $post_preview Is this a post preview?.
1826
+	 * @return mixed|string|void
1827
+	 */
1828
+	function geodir_get_infowindow_html($postinfo_obj, $post_preview = '')
1829
+	{
1830
+		global $preview, $gd_session;
1831
+		$srcharr = array("'", "/", "-", '"', '\\');
1832
+		$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
1833
+
1834
+		if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1835
+			$ID = '';
1836
+			$plink = '';
1837
+
1838
+			if (isset($postinfo_obj->pid)) {
1839
+				$ID = $postinfo_obj->pid;
1840
+				$plink = get_permalink($ID);
1841
+			}
1842
+
1843
+			$title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title));
1844
+			$lat = $postinfo_obj->post_latitude;
1845
+			$lng = $postinfo_obj->post_longitude;
1846
+		} else {
1847
+			$ID = $postinfo_obj->post_id;
1848
+			$title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1849
+			$plink = get_permalink($ID);
1850
+			$lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));
1851
+			$lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));
1852
+		}
1853
+
1854
+		// filter field as per price package
1855
+		global $geodir_addon_list;
1856
+		if (isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1857
+			$post_type = get_post_type($ID);
1858
+			$package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL;
1859
+			$field_name = 'geodir_contact';
1860
+			if (!check_field_visibility($package_id, $field_name, $post_type)) {
1861
+				$contact = '';
1862
+			}
1863
+
1864
+			$field_name = 'geodir_timing';
1865
+			if (!check_field_visibility($package_id, $field_name, $post_type)) {
1866
+				$timing = '';
1867
+			}
1868
+		}
1869
+
1870
+		if ($lat && $lng) {
1871
+			ob_start(); ?>
1872 1872
             <div class="gd-bubble" style="">
1873 1873
                 <div class="gd-bubble-inside">
1874 1874
                     <?php
1875
-                    $comment_count = '';
1876
-                    $rating_star = '';
1877
-                    if ($ID != '') {
1878
-                        $rating_star = '';
1879
-                        $comment_count = geodir_get_review_count_total($ID);
1880
-
1881
-                        if (!$preview) {
1882
-                            $post_avgratings = geodir_get_post_rating($ID);
1883
-
1884
-                            $rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);
1885
-
1886
-                            /**
1887
-                             * Filter to change rating stars
1888
-                             *
1889
-                             * You can use this filter to change Rating stars.
1890
-                             *
1891
-                             * @since 1.0.0
1892
-                             * @package GeoDirectory
1893
-                             * @param string $rating_star Rating stars.
1894
-                             * @param float $post_avgratings Average ratings of the post.
1895
-                             * @param int $ID The post ID.
1896
-                             */
1897
-                            $rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
1898
-                        }
1899
-                    }
1900
-                    ?>
1875
+					$comment_count = '';
1876
+					$rating_star = '';
1877
+					if ($ID != '') {
1878
+						$rating_star = '';
1879
+						$comment_count = geodir_get_review_count_total($ID);
1880
+
1881
+						if (!$preview) {
1882
+							$post_avgratings = geodir_get_post_rating($ID);
1883
+
1884
+							$rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);
1885
+
1886
+							/**
1887
+							 * Filter to change rating stars
1888
+							 *
1889
+							 * You can use this filter to change Rating stars.
1890
+							 *
1891
+							 * @since 1.0.0
1892
+							 * @package GeoDirectory
1893
+							 * @param string $rating_star Rating stars.
1894
+							 * @param float $post_avgratings Average ratings of the post.
1895
+							 * @param int $ID The post ID.
1896
+							 */
1897
+							$rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
1898
+						}
1899
+					}
1900
+					?>
1901 1901
                     <div class="geodir-bubble_desc">
1902 1902
                         <h4>
1903 1903
                             <a href="<?php if ($plink != '') {
1904
-                                echo $plink;
1905
-                            } else {
1906
-                                echo 'javascript:void(0);';
1907
-                            } ?>"><?php echo $title; ?></a>
1904
+								echo $plink;
1905
+							} else {
1906
+								echo 'javascript:void(0);';
1907
+							} ?>"><?php echo $title; ?></a>
1908 1908
                         </h4>
1909 1909
                         <?php
1910
-                        if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1911
-                            $post_images = array();
1912
-                            if (!empty($postinfo_obj->post_images)) {
1913
-                                $post_images = explode(",", $postinfo_obj->post_images);
1914
-                            }
1915
-
1916
-                            if (!empty($post_images)) {
1917
-                                ?>
1910
+						if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1911
+							$post_images = array();
1912
+							if (!empty($postinfo_obj->post_images)) {
1913
+								$post_images = explode(",", $postinfo_obj->post_images);
1914
+							}
1915
+
1916
+							if (!empty($post_images)) {
1917
+								?>
1918 1918
                                 <div class="geodir-bubble_image"><a href="<?php if ($plink != '') {
1919
-                                        echo $plink;
1920
-                                    } else {
1921
-                                        echo 'javascript:void(0);';
1922
-                                    } ?>"><img alt="bubble image" style="max-height:50px;"
1919
+										echo $plink;
1920
+									} else {
1921
+										echo 'javascript:void(0);';
1922
+									} ?>"><img alt="bubble image" style="max-height:50px;"
1923 1923
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1924 1924
                             <?php
1925
-                            }else{
1926
-                                echo '<div class="geodir-bubble_image"></div>';
1927
-                            }
1928
-                        } else {
1929
-                            if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
1930
-                                ?>
1925
+							}else{
1926
+								echo '<div class="geodir-bubble_image"></div>';
1927
+							}
1928
+						} else {
1929
+							if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
1930
+								?>
1931 1931
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1932 1932
                             <?php
1933
-                            }else{
1934
-                                echo '<div class="geodir-bubble_image"></div>';
1935
-                            }
1936
-                        }
1937
-                        ?>
1933
+							}else{
1934
+								echo '<div class="geodir-bubble_image"></div>';
1935
+							}
1936
+						}
1937
+						?>
1938 1938
                         <div class="geodir-bubble-meta-side">
1939 1939
                             <?php
1940
-                            /**
1941
-                             * Fires before the meta info in the map info window.
1942
-                             *
1943
-                             * This can be used to add more info to the map info window before the normal meta info.
1944
-                             *
1945
-                             * @since 1.5.4
1946
-                             * @param int $ID The post id.
1947
-                             * @param object $postinfo_obj The posts info as an object.
1948
-                             * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1949
-                             */
1950
-                            do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
1951
-
1952
-
1953
-                            echo geodir_show_listing_info('mapbubble');
1940
+							/**
1941
+							 * Fires before the meta info in the map info window.
1942
+							 *
1943
+							 * This can be used to add more info to the map info window before the normal meta info.
1944
+							 *
1945
+							 * @since 1.5.4
1946
+							 * @param int $ID The post id.
1947
+							 * @param object $postinfo_obj The posts info as an object.
1948
+							 * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1949
+							 */
1950
+							do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
1951
+
1952
+
1953
+							echo geodir_show_listing_info('mapbubble');
1954 1954
                             
1955 1955
                                                       
1956 1956
 
1957
-                            /**
1958
-                             * Fires after the meta info in the map info window.
1959
-                             *
1960
-                             * This can be used to add more info to the map info window after the normal meta info.
1961
-                             *
1962
-                             * @since 1.4.2
1963
-                             * @param object $postinfo_obj The posts info as an object.
1964
-                             * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1965
-                             */
1966
-                            do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1967
-                            ?>
1957
+							/**
1958
+							 * Fires after the meta info in the map info window.
1959
+							 *
1960
+							 * This can be used to add more info to the map info window after the normal meta info.
1961
+							 *
1962
+							 * @since 1.4.2
1963
+							 * @param object $postinfo_obj The posts info as an object.
1964
+							 * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1965
+							 */
1966
+							do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1967
+							?>
1968 1968
                         </div>
1969 1969
                         <?php
1970 1970
 
1971
-                        if ($ID) {
1971
+						if ($ID) {
1972 1972
 
1973
-                            $post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
1974
-                            ?>
1973
+							$post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
1974
+							?>
1975 1975
                             <div class="geodir-bubble-meta-fade"></div>
1976 1976
 
1977 1977
                             <div class="geodir-bubble-meta-bottom">
@@ -1991,69 +1991,69 @@  discard block
 block discarded – undo
1991 1991
                 </div>
1992 1992
             </div>
1993 1993
             <?php
1994
-            $html = ob_get_clean();
1995
-            /**
1996
-             * Filter to change infowindow html
1997
-             *
1998
-             * You can use this filter to change infowindow html.
1999
-             *
2000
-             * @since 1.0.0
2001
-             * @package GeoDirectory
2002
-             * @param string $html Infowindow html.
2003
-             * @param object $postinfo_obj The Post object.
2004
-             * @param bool|string $post_preview Is this a post preview?
2005
-             */
2006
-            $html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
2007
-            return $html;
2008
-        }
2009
-    }
1994
+			$html = ob_get_clean();
1995
+			/**
1996
+			 * Filter to change infowindow html
1997
+			 *
1998
+			 * You can use this filter to change infowindow html.
1999
+			 *
2000
+			 * @since 1.0.0
2001
+			 * @package GeoDirectory
2002
+			 * @param string $html Infowindow html.
2003
+			 * @param object $postinfo_obj The Post object.
2004
+			 * @param bool|string $post_preview Is this a post preview?
2005
+			 */
2006
+			$html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
2007
+			return $html;
2008
+		}
2009
+	}
2010 2010
 }
2011 2011
 
2012 2012
 
2013 2013
 if (!function_exists('geodir_new_post_default_status')) {
2014
-    /**
2015
-     * Default post status for new posts.
2016
-     *
2017
-     * @since 1.0.0
2018
-     * @package GeoDirectory
2019
-     * @return string Returns the default post status for new posts. Ex: draft, publish etc.
2020
-     */
2021
-    function geodir_new_post_default_status()
2022
-    {
2023
-        if (get_option('geodir_new_post_default_status'))
2024
-            return get_option('geodir_new_post_default_status');
2025
-        else
2026
-            return 'publish';
2027
-
2028
-    }
2014
+	/**
2015
+	 * Default post status for new posts.
2016
+	 *
2017
+	 * @since 1.0.0
2018
+	 * @package GeoDirectory
2019
+	 * @return string Returns the default post status for new posts. Ex: draft, publish etc.
2020
+	 */
2021
+	function geodir_new_post_default_status()
2022
+	{
2023
+		if (get_option('geodir_new_post_default_status'))
2024
+			return get_option('geodir_new_post_default_status');
2025
+		else
2026
+			return 'publish';
2027
+
2028
+	}
2029 2029
 }
2030 2030
 
2031 2031
 if (!function_exists('geodir_change_post_status')) {
2032
-    /**
2033
-     * Change post status of a post.
2034
-     *
2035
-     * @global object $wpdb WordPress Database object.
2036
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2037
-     * @param int|string $post_id The post ID.
2038
-     * @param string $status New post status. Ex: draft, publish etc.
2039
-     */
2040
-    function geodir_change_post_status($post_id = '', $status = '')
2041
-    {
2042
-        global $wpdb, $plugin_prefix;
2043
-
2044
-        $post_type = get_post_type($post_id);
2045
-
2046
-        $table = $plugin_prefix . $post_type . '_detail';
2047
-
2048
-        $wpdb->query(
2049
-            $wpdb->prepare(
2050
-                "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",
2051
-                array($status, $post_id)
2052
-            )
2053
-        );
2054
-
2055
-
2056
-    }
2032
+	/**
2033
+	 * Change post status of a post.
2034
+	 *
2035
+	 * @global object $wpdb WordPress Database object.
2036
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2037
+	 * @param int|string $post_id The post ID.
2038
+	 * @param string $status New post status. Ex: draft, publish etc.
2039
+	 */
2040
+	function geodir_change_post_status($post_id = '', $status = '')
2041
+	{
2042
+		global $wpdb, $plugin_prefix;
2043
+
2044
+		$post_type = get_post_type($post_id);
2045
+
2046
+		$table = $plugin_prefix . $post_type . '_detail';
2047
+
2048
+		$wpdb->query(
2049
+			$wpdb->prepare(
2050
+				"UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",
2051
+				array($status, $post_id)
2052
+			)
2053
+		);
2054
+
2055
+
2056
+	}
2057 2057
 }
2058 2058
 
2059 2059
 /**
@@ -2067,13 +2067,13 @@  discard block
 block discarded – undo
2067 2067
  */
2068 2068
 function geodir_set_post_status($pid, $status)
2069 2069
 {
2070
-    if ($pid) {
2071
-        global $wpdb;
2072
-        $my_post = array();
2073
-        $my_post['post_status'] = $status;
2074
-        $my_post['ID'] = $pid;
2075
-        $last_postid = wp_update_post($my_post);
2076
-    }
2070
+	if ($pid) {
2071
+		global $wpdb;
2072
+		$my_post = array();
2073
+		$my_post['post_status'] = $status;
2074
+		$my_post['ID'] = $pid;
2075
+		$last_postid = wp_update_post($my_post);
2076
+	}
2077 2077
 }
2078 2078
 
2079 2079
 
@@ -2089,384 +2089,384 @@  discard block
 block discarded – undo
2089 2089
  */
2090 2090
 function geodir_update_poststatus($new_status, $old_status, $post)
2091 2091
 {
2092
-    global $wpdb;
2092
+	global $wpdb;
2093 2093
 
2094
-    $geodir_posttypes = geodir_get_posttypes();
2094
+	$geodir_posttypes = geodir_get_posttypes();
2095 2095
 
2096
-    if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
2096
+	if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
2097 2097
 
2098
-        geodir_change_post_status($post->ID, $new_status);
2099
-    }
2098
+		geodir_change_post_status($post->ID, $new_status);
2099
+	}
2100 2100
 }
2101 2101
 
2102 2102
 
2103 2103
 if (!function_exists('geodir_update_listing_info')) {
2104
-    /**
2105
-     * Update post info.
2106
-     *
2107
-     * @since 1.0.0
2108
-     * @package GeoDirectory
2109
-     * @global object $wpdb WordPress Database object.
2110
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2111
-     * @param int $updatingpost The updating post ID.
2112
-     * @param int $temppost The temporary post ID.
2113
-     * @todo fix post_id variable
2114
-     */
2115
-    function geodir_update_listing_info($updatingpost, $temppost)
2116
-    {
2117
-
2118
-        global $wpdb, $plugin_prefix;
2119
-
2120
-        $post_type = get_post_type($post_id);
2121
-
2122
-        $table = $plugin_prefix . $post_type . '_detail';
2123
-
2124
-        $wpdb->query(
2125
-            $wpdb->prepare(
2126
-                "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",
2127
-                array($updatingpost, $temppost)
2128
-            )
2129
-        );
2130
-
2131
-        $wpdb->query(
2132
-            $wpdb->prepare(
2133
-                "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2134
-                array($updatingpost, $temppost)
2135
-            )
2136
-        );
2137
-
2138
-        /* Update Attachments*/
2139
-
2140
-        $wpdb->query(
2141
-            $wpdb->prepare(
2142
-                "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2143
-                array($updatingpost, $temppost)
2144
-            )
2145
-        );
2146
-
2147
-    }
2104
+	/**
2105
+	 * Update post info.
2106
+	 *
2107
+	 * @since 1.0.0
2108
+	 * @package GeoDirectory
2109
+	 * @global object $wpdb WordPress Database object.
2110
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2111
+	 * @param int $updatingpost The updating post ID.
2112
+	 * @param int $temppost The temporary post ID.
2113
+	 * @todo fix post_id variable
2114
+	 */
2115
+	function geodir_update_listing_info($updatingpost, $temppost)
2116
+	{
2117
+
2118
+		global $wpdb, $plugin_prefix;
2119
+
2120
+		$post_type = get_post_type($post_id);
2121
+
2122
+		$table = $plugin_prefix . $post_type . '_detail';
2123
+
2124
+		$wpdb->query(
2125
+			$wpdb->prepare(
2126
+				"UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",
2127
+				array($updatingpost, $temppost)
2128
+			)
2129
+		);
2130
+
2131
+		$wpdb->query(
2132
+			$wpdb->prepare(
2133
+				"UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2134
+				array($updatingpost, $temppost)
2135
+			)
2136
+		);
2137
+
2138
+		/* Update Attachments*/
2139
+
2140
+		$wpdb->query(
2141
+			$wpdb->prepare(
2142
+				"UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2143
+				array($updatingpost, $temppost)
2144
+			)
2145
+		);
2146
+
2147
+	}
2148 2148
 }
2149 2149
 
2150 2150
 
2151 2151
 if (!function_exists('geodir_delete_listing_info')) {
2152
-    /**
2153
-     * Delete Listing info from details table for the given post id.
2154
-     *
2155
-     * @since 1.0.0
2156
-     * @package GeoDirectory
2157
-     * @global object $wpdb WordPress Database object.
2158
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2159
-     * @param int $deleted_postid The post ID.
2160
-     * @param bool $force Optional. Do you want to force delete it? Default: false.
2161
-     * @return bool|void
2162
-     */
2163
-    function geodir_delete_listing_info($deleted_postid, $force = false)
2164
-    {
2165
-        global $wpdb, $plugin_prefix;
2166
-
2167
-        // check for multisite deletions
2168
-        if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
2169
-        } else {
2170
-            return;
2171
-        }
2172
-
2173
-        $post_type = get_post_type($deleted_postid);
2174
-
2175
-        $all_postypes = geodir_get_posttypes();
2176
-
2177
-        if (!in_array($post_type, $all_postypes))
2178
-            return false;
2179
-
2180
-        $table = $plugin_prefix . $post_type . '_detail';
2181
-
2182
-        /* Delete custom post meta*/
2183
-        $wpdb->query(
2184
-            $wpdb->prepare(
2185
-                "DELETE FROM " . $table . " WHERE `post_id` = %d",
2186
-                array($deleted_postid)
2187
-            )
2188
-        );
2189
-
2190
-        /* Delete post map icons*/
2191
-
2192
-        $wpdb->query(
2193
-            $wpdb->prepare(
2194
-                "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",
2195
-                array($deleted_postid)
2196
-            )
2197
-        );
2198
-
2199
-        /* Delete Attachments*/
2200
-        $postcurr_images = geodir_get_images($deleted_postid);
2201
-
2202
-        $wpdb->query(
2203
-            $wpdb->prepare(
2204
-                "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",
2205
-                array($deleted_postid)
2206
-            )
2207
-        );
2208
-        geodir_remove_attachments($postcurr_images);
2209
-
2210
-    }
2152
+	/**
2153
+	 * Delete Listing info from details table for the given post id.
2154
+	 *
2155
+	 * @since 1.0.0
2156
+	 * @package GeoDirectory
2157
+	 * @global object $wpdb WordPress Database object.
2158
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2159
+	 * @param int $deleted_postid The post ID.
2160
+	 * @param bool $force Optional. Do you want to force delete it? Default: false.
2161
+	 * @return bool|void
2162
+	 */
2163
+	function geodir_delete_listing_info($deleted_postid, $force = false)
2164
+	{
2165
+		global $wpdb, $plugin_prefix;
2166
+
2167
+		// check for multisite deletions
2168
+		if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
2169
+		} else {
2170
+			return;
2171
+		}
2172
+
2173
+		$post_type = get_post_type($deleted_postid);
2174
+
2175
+		$all_postypes = geodir_get_posttypes();
2176
+
2177
+		if (!in_array($post_type, $all_postypes))
2178
+			return false;
2179
+
2180
+		$table = $plugin_prefix . $post_type . '_detail';
2181
+
2182
+		/* Delete custom post meta*/
2183
+		$wpdb->query(
2184
+			$wpdb->prepare(
2185
+				"DELETE FROM " . $table . " WHERE `post_id` = %d",
2186
+				array($deleted_postid)
2187
+			)
2188
+		);
2189
+
2190
+		/* Delete post map icons*/
2191
+
2192
+		$wpdb->query(
2193
+			$wpdb->prepare(
2194
+				"DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",
2195
+				array($deleted_postid)
2196
+			)
2197
+		);
2198
+
2199
+		/* Delete Attachments*/
2200
+		$postcurr_images = geodir_get_images($deleted_postid);
2201
+
2202
+		$wpdb->query(
2203
+			$wpdb->prepare(
2204
+				"DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",
2205
+				array($deleted_postid)
2206
+			)
2207
+		);
2208
+		geodir_remove_attachments($postcurr_images);
2209
+
2210
+	}
2211 2211
 }
2212 2212
 
2213 2213
 
2214 2214
 if (!function_exists('geodir_add_to_favorite')) {
2215
-    /**
2216
-     * This function would add listing to favorite listing.
2217
-     *
2218
-     * @since 1.0.0
2219
-     * @package GeoDirectory
2220
-     * @global object $current_user Current user object.
2221
-     * @param int $post_id The post ID.
2222
-     */
2223
-    function geodir_add_to_favorite($post_id)
2224
-    {
2225
-
2226
-        global $current_user;
2227
-
2228
-        /**
2229
-         * Filter to modify "Unfavorite" text
2230
-         *
2231
-         * You can use this filter to rename "Unfavorite" text to something else.
2232
-         *
2233
-         * @since 1.0.0
2234
-         * @package GeoDirectory
2235
-         */
2236
-        $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2237
-
2238
-        /**
2239
-         * Filter to modify "Remove from Favorites" text
2240
-         *
2241
-         * You can use this filter to rename "Remove from Favorites" text to something else.
2242
-         *
2243
-         * @since 1.0.0
2244
-         * @package GeoDirectory
2245
-         */
2246
-        $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2247
-
2248
-        /**
2249
-         * Filter to modify "fa fa-heart" icon
2250
-         *
2251
-         * You can use this filter to change "fa fa-heart" icon to something else.
2252
-         *
2253
-         * @since 1.0.0
2254
-         * @package GeoDirectory
2255
-         */
2256
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2257
-
2258
-        $user_meta_data = array();
2259
-        $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2215
+	/**
2216
+	 * This function would add listing to favorite listing.
2217
+	 *
2218
+	 * @since 1.0.0
2219
+	 * @package GeoDirectory
2220
+	 * @global object $current_user Current user object.
2221
+	 * @param int $post_id The post ID.
2222
+	 */
2223
+	function geodir_add_to_favorite($post_id)
2224
+	{
2225
+
2226
+		global $current_user;
2227
+
2228
+		/**
2229
+		 * Filter to modify "Unfavorite" text
2230
+		 *
2231
+		 * You can use this filter to rename "Unfavorite" text to something else.
2232
+		 *
2233
+		 * @since 1.0.0
2234
+		 * @package GeoDirectory
2235
+		 */
2236
+		$remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2237
+
2238
+		/**
2239
+		 * Filter to modify "Remove from Favorites" text
2240
+		 *
2241
+		 * You can use this filter to rename "Remove from Favorites" text to something else.
2242
+		 *
2243
+		 * @since 1.0.0
2244
+		 * @package GeoDirectory
2245
+		 */
2246
+		$unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2247
+
2248
+		/**
2249
+		 * Filter to modify "fa fa-heart" icon
2250
+		 *
2251
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2252
+		 *
2253
+		 * @since 1.0.0
2254
+		 * @package GeoDirectory
2255
+		 */
2256
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2257
+
2258
+		$user_meta_data = array();
2259
+		$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2260
+
2261
+		if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
2262
+			$user_meta_data[] = $post_id;
2263
+		}
2264
+
2265
+		update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2266
+
2267
+		/**
2268
+		 * Called before adding the post from favourites.
2269
+		 *
2270
+		 * @since 1.0.0
2271
+		 * @package GeoDirectory
2272
+		 * @param int $post_id The post ID.
2273
+		 */
2274
+		do_action('geodir_before_add_from_favorite', $post_id);
2275
+
2276
+		echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2277
+
2278
+		/**
2279
+		 * Called after adding the post from favourites.
2280
+		 *
2281
+		 * @since 1.0.0
2282
+		 * @package GeoDirectory
2283
+		 * @param int $post_id The post ID.
2284
+		 */
2285
+		do_action('geodir_after_add_from_favorite', $post_id);
2260 2286
 
2261
-        if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
2262
-            $user_meta_data[] = $post_id;
2263
-        }
2264
-
2265
-        update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2266
-
2267
-        /**
2268
-         * Called before adding the post from favourites.
2269
-         *
2270
-         * @since 1.0.0
2271
-         * @package GeoDirectory
2272
-         * @param int $post_id The post ID.
2273
-         */
2274
-        do_action('geodir_before_add_from_favorite', $post_id);
2275
-
2276
-        echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2277
-
2278
-        /**
2279
-         * Called after adding the post from favourites.
2280
-         *
2281
-         * @since 1.0.0
2282
-         * @package GeoDirectory
2283
-         * @param int $post_id The post ID.
2284
-         */
2285
-        do_action('geodir_after_add_from_favorite', $post_id);
2286
-
2287
-    }
2287
+	}
2288 2288
 }
2289 2289
 
2290 2290
 if (!function_exists('geodir_remove_from_favorite')) {
2291
-    /**
2292
-     * This function would remove the favourited property earlier.
2293
-     *
2294
-     * @since 1.0.0
2295
-     * @package GeoDirectory
2296
-     * @global object $current_user Current user object.
2297
-     * @param int $post_id The post ID.
2298
-     */
2299
-    function geodir_remove_from_favorite($post_id)
2300
-    {
2301
-        global $current_user;
2302
-
2303
-        /**
2304
-         * Filter to modify "Add to Favorites" text
2305
-         *
2306
-         * You can use this filter to rename "Add to Favorites" text to something else.
2307
-         *
2308
-         * @since 1.0.0
2309
-         * @package GeoDirectory
2310
-         */
2311
-        $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2312
-
2313
-        /**
2314
-         * Filter to modify "Favourite" text
2315
-         *
2316
-         * You can use this filter to rename "Favourite" text to something else.
2317
-         *
2318
-         * @since 1.0.0
2319
-         * @package GeoDirectory
2320
-         */
2321
-        $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2322
-
2323
-        /**
2324
-         * Filter to modify "fa fa-heart" icon
2325
-         *
2326
-         * You can use this filter to change "fa fa-heart" icon to something else.
2327
-         *
2328
-         * @since 1.0.0
2329
-         * @package GeoDirectory
2330
-         */
2331
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2332
-
2333
-        $user_meta_data = array();
2334
-        $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2335
-
2336
-        if (!empty($user_meta_data)) {
2337
-
2338
-            if (($key = array_search($post_id, $user_meta_data)) !== false) {
2339
-                unset($user_meta_data[$key]);
2340
-            }
2291
+	/**
2292
+	 * This function would remove the favourited property earlier.
2293
+	 *
2294
+	 * @since 1.0.0
2295
+	 * @package GeoDirectory
2296
+	 * @global object $current_user Current user object.
2297
+	 * @param int $post_id The post ID.
2298
+	 */
2299
+	function geodir_remove_from_favorite($post_id)
2300
+	{
2301
+		global $current_user;
2302
+
2303
+		/**
2304
+		 * Filter to modify "Add to Favorites" text
2305
+		 *
2306
+		 * You can use this filter to rename "Add to Favorites" text to something else.
2307
+		 *
2308
+		 * @since 1.0.0
2309
+		 * @package GeoDirectory
2310
+		 */
2311
+		$add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2312
+
2313
+		/**
2314
+		 * Filter to modify "Favourite" text
2315
+		 *
2316
+		 * You can use this filter to rename "Favourite" text to something else.
2317
+		 *
2318
+		 * @since 1.0.0
2319
+		 * @package GeoDirectory
2320
+		 */
2321
+		$favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2322
+
2323
+		/**
2324
+		 * Filter to modify "fa fa-heart" icon
2325
+		 *
2326
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2327
+		 *
2328
+		 * @since 1.0.0
2329
+		 * @package GeoDirectory
2330
+		 */
2331
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2332
+
2333
+		$user_meta_data = array();
2334
+		$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2335
+
2336
+		if (!empty($user_meta_data)) {
2337
+
2338
+			if (($key = array_search($post_id, $user_meta_data)) !== false) {
2339
+				unset($user_meta_data[$key]);
2340
+			}
2341 2341
 
2342
-        }
2342
+		}
2343 2343
 
2344
-        update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2344
+		update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2345 2345
 
2346
-        /**
2347
-         * Called before removing the post from favourites.
2348
-         *
2349
-         * @since 1.0.0
2350
-         * @package GeoDirectory
2351
-         * @param int $post_id The post ID.
2352
-         */
2353
-        do_action('geodir_before_remove_from_favorite', $post_id);
2346
+		/**
2347
+		 * Called before removing the post from favourites.
2348
+		 *
2349
+		 * @since 1.0.0
2350
+		 * @package GeoDirectory
2351
+		 * @param int $post_id The post ID.
2352
+		 */
2353
+		do_action('geodir_before_remove_from_favorite', $post_id);
2354 2354
 
2355
-        echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2355
+		echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2356 2356
 
2357
-        /**
2358
-         * Called after removing the post from favourites.
2359
-         *
2360
-         * @since 1.0.0
2361
-         * @package GeoDirectory
2362
-         * @param int $post_id The post ID.
2363
-         */
2364
-        do_action('geodir_after_remove_from_favorite', $post_id);
2357
+		/**
2358
+		 * Called after removing the post from favourites.
2359
+		 *
2360
+		 * @since 1.0.0
2361
+		 * @package GeoDirectory
2362
+		 * @param int $post_id The post ID.
2363
+		 */
2364
+		do_action('geodir_after_remove_from_favorite', $post_id);
2365 2365
 
2366
-    }
2366
+	}
2367 2367
 }
2368 2368
 
2369 2369
 if (!function_exists('geodir_favourite_html')) {
2370
-    /**
2371
-     * This function would display the html content for add to favorite or remove from favorite.
2372
-     *
2373
-     * @since 1.0.0
2374
-     * @package GeoDirectory
2375
-     * @global object $current_user Current user object.
2376
-     * @global object $post The current post object.
2377
-     * @param int $user_id The user ID.
2378
-     * @param int $post_id The post ID.
2379
-     */
2380
-    function geodir_favourite_html($user_id, $post_id)
2381
-    {
2382
-
2383
-        global $current_user, $post;
2384
-
2385
-        /**
2386
-         * Filter to modify "Add to Favorites" text
2387
-         *
2388
-         * You can use this filter to rename "Add to Favorites" text to something else.
2389
-         *
2390
-         * @since 1.0.0
2391
-         * @package GeoDirectory
2392
-         */
2393
-        $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2394
-
2395
-        /**
2396
-         * Filter to modify "Favourite" text
2397
-         *
2398
-         * You can use this filter to rename "Favourite" text to something else.
2399
-         *
2400
-         * @since 1.0.0
2401
-         * @package GeoDirectory
2402
-         */
2403
-        $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2404
-
2405
-        /**
2406
-         * Filter to modify "Unfavorite" text
2407
-         *
2408
-         * You can use this filter to rename "Unfavorite" text to something else.
2409
-         *
2410
-         * @since 1.0.0
2411
-         * @package GeoDirectory
2412
-         */
2413
-        $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2414
-
2415
-        /**
2416
-         * Filter to modify "Remove from Favorites" text
2417
-         *
2418
-         * You can use this filter to rename "Remove from Favorites" text to something else.
2419
-         *
2420
-         * @since 1.0.0
2421
-         * @package GeoDirectory
2422
-         */
2423
-        $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2424
-
2425
-        /**
2426
-         * Filter to modify "fa fa-heart" icon
2427
-         *
2428
-         * You can use this filter to change "fa fa-heart" icon to something else.
2429
-         *
2430
-         * @since 1.0.0
2431
-         * @package GeoDirectory
2432
-         */
2433
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2434
-
2435
-        /**
2436
-         * Filter to modify "fa fa-heart" icon for "remove from favorites" link
2437
-         *
2438
-         * You can use this filter to change "fa fa-heart" icon to something else.
2439
-         *
2440
-         * @since 1.0.0
2441
-         * @package GeoDirectory
2442
-         */
2443
-        $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2444
-
2445
-        $user_meta_data = '';
2446
-        if (isset($current_user->data->ID))
2447
-            $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2448
-
2449
-        if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2450
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2370
+	/**
2371
+	 * This function would display the html content for add to favorite or remove from favorite.
2372
+	 *
2373
+	 * @since 1.0.0
2374
+	 * @package GeoDirectory
2375
+	 * @global object $current_user Current user object.
2376
+	 * @global object $post The current post object.
2377
+	 * @param int $user_id The user ID.
2378
+	 * @param int $post_id The post ID.
2379
+	 */
2380
+	function geodir_favourite_html($user_id, $post_id)
2381
+	{
2382
+
2383
+		global $current_user, $post;
2384
+
2385
+		/**
2386
+		 * Filter to modify "Add to Favorites" text
2387
+		 *
2388
+		 * You can use this filter to rename "Add to Favorites" text to something else.
2389
+		 *
2390
+		 * @since 1.0.0
2391
+		 * @package GeoDirectory
2392
+		 */
2393
+		$add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2394
+
2395
+		/**
2396
+		 * Filter to modify "Favourite" text
2397
+		 *
2398
+		 * You can use this filter to rename "Favourite" text to something else.
2399
+		 *
2400
+		 * @since 1.0.0
2401
+		 * @package GeoDirectory
2402
+		 */
2403
+		$favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2404
+
2405
+		/**
2406
+		 * Filter to modify "Unfavorite" text
2407
+		 *
2408
+		 * You can use this filter to rename "Unfavorite" text to something else.
2409
+		 *
2410
+		 * @since 1.0.0
2411
+		 * @package GeoDirectory
2412
+		 */
2413
+		$remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2414
+
2415
+		/**
2416
+		 * Filter to modify "Remove from Favorites" text
2417
+		 *
2418
+		 * You can use this filter to rename "Remove from Favorites" text to something else.
2419
+		 *
2420
+		 * @since 1.0.0
2421
+		 * @package GeoDirectory
2422
+		 */
2423
+		$unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2424
+
2425
+		/**
2426
+		 * Filter to modify "fa fa-heart" icon
2427
+		 *
2428
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2429
+		 *
2430
+		 * @since 1.0.0
2431
+		 * @package GeoDirectory
2432
+		 */
2433
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2434
+
2435
+		/**
2436
+		 * Filter to modify "fa fa-heart" icon for "remove from favorites" link
2437
+		 *
2438
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2439
+		 *
2440
+		 * @since 1.0.0
2441
+		 * @package GeoDirectory
2442
+		 */
2443
+		$unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2444
+
2445
+		$user_meta_data = '';
2446
+		if (isset($current_user->data->ID))
2447
+			$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2448
+
2449
+		if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2450
+			?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2451 2451
                 class="geodir-removetofav-icon" href="javascript:void(0);"
2452 2452
                 onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');"
2453 2453
                 title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?>
2454 2454
             </a>   </span><?php
2455 2455
 
2456
-        } else {
2456
+		} else {
2457 2457
 
2458
-            if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2459
-                $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2460
-            } else
2461
-                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2458
+			if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2459
+				$script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2460
+			} else
2461
+				$script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2462 2462
 
2463
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2463
+			?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2464 2464
                                                                                         href="javascript:void(0);"
2465 2465
                                                                                         onclick="<?php echo $script_text;?>"
2466 2466
                                                                                         title="<?php echo $add_favourite_text;?>"><i
2467 2467
                     class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span>
2468 2468
         <?php }
2469
-    }
2469
+	}
2470 2470
 }
2471 2471
 
2472 2472
 
@@ -2483,54 +2483,54 @@  discard block
 block discarded – undo
2483 2483
 function geodir_get_cat_postcount($term = array())
2484 2484
 {
2485 2485
 
2486
-    if (!empty($term)) {
2486
+	if (!empty($term)) {
2487 2487
 
2488
-        global $wpdb, $plugin_prefix;
2488
+		global $wpdb, $plugin_prefix;
2489 2489
 
2490
-        $where = '';
2491
-        $join = '';
2492
-        if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
2493
-            $taxonomy_obj = get_taxonomy($term->taxonomy);
2490
+		$where = '';
2491
+		$join = '';
2492
+		if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
2493
+			$taxonomy_obj = get_taxonomy($term->taxonomy);
2494 2494
 
2495
-            $post_type = $taxonomy_obj->object_type[0];
2495
+			$post_type = $taxonomy_obj->object_type[0];
2496 2496
 
2497
-            $table = $plugin_prefix . $post_type . '_detail';
2497
+			$table = $plugin_prefix . $post_type . '_detail';
2498 2498
 
2499
-            /**
2500
-             * Filter to modify the 'join' query
2501
-             *
2502
-             * @since 1.0.0
2503
-             * @package GeoDirectory
2504
-             * @param object|array $term category / term object that need to be processed.
2505
-             * @param string $join The join query.
2506
-             */
2507
-            $join = apply_filters('geodir_cat_post_count_join', $join, $term);
2499
+			/**
2500
+			 * Filter to modify the 'join' query
2501
+			 *
2502
+			 * @since 1.0.0
2503
+			 * @package GeoDirectory
2504
+			 * @param object|array $term category / term object that need to be processed.
2505
+			 * @param string $join The join query.
2506
+			 */
2507
+			$join = apply_filters('geodir_cat_post_count_join', $join, $term);
2508 2508
 
2509
-            /**
2510
-             * Filter to modify the 'where' query
2511
-             *
2512
-             * @since 1.0.0
2513
-             * @package GeoDirectory
2514
-             * @param object|array $term category / term object that need to be processed.
2515
-             * @param string $where The where query.
2516
-             */
2517
-            $where = apply_filters('geodir_cat_post_count_where', $where, $term);
2509
+			/**
2510
+			 * Filter to modify the 'where' query
2511
+			 *
2512
+			 * @since 1.0.0
2513
+			 * @package GeoDirectory
2514
+			 * @param object|array $term category / term object that need to be processed.
2515
+			 * @param string $where The where query.
2516
+			 */
2517
+			$where = apply_filters('geodir_cat_post_count_where', $where, $term);
2518 2518
 
2519
-            $count_query = "SELECT count(post_id) FROM
2519
+			$count_query = "SELECT count(post_id) FROM
2520 2520
 							" . $table . " as pd " . $join . "
2521 2521
 							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
2522 2522
 
2523
-            $cat_post_count = $wpdb->get_var($count_query);
2524
-            if (empty($cat_post_count) || is_wp_error($cat_post_count))
2525
-                $cat_post_count = 0;
2523
+			$cat_post_count = $wpdb->get_var($count_query);
2524
+			if (empty($cat_post_count) || is_wp_error($cat_post_count))
2525
+				$cat_post_count = 0;
2526 2526
 
2527
-            return $cat_post_count;
2527
+			return $cat_post_count;
2528 2528
 
2529
-        } else
2529
+		} else
2530 2530
 
2531
-            return $term->count;
2532
-    }
2533
-    return false;
2531
+			return $term->count;
2532
+	}
2533
+	return false;
2534 2534
 
2535 2535
 }
2536 2536
 
@@ -2543,17 +2543,17 @@  discard block
 block discarded – undo
2543 2543
  */
2544 2544
 function geodir_allow_post_type_frontend()
2545 2545
 {
2546
-    $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2546
+	$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2547 2547
 
2548
-    if (!is_admin() && isset($_REQUEST['listing_type'])
2549
-        && !empty($geodir_allow_posttype_frontend)
2550
-        && !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend)
2551
-    ) {
2548
+	if (!is_admin() && isset($_REQUEST['listing_type'])
2549
+		&& !empty($geodir_allow_posttype_frontend)
2550
+		&& !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend)
2551
+	) {
2552 2552
 
2553
-        wp_redirect(home_url());
2554
-        exit;
2553
+		wp_redirect(home_url());
2554
+		exit;
2555 2555
 
2556
-    }
2556
+	}
2557 2557
 
2558 2558
 }
2559 2559
 
@@ -2570,20 +2570,20 @@  discard block
 block discarded – undo
2570 2570
  */
2571 2571
 function geodir_excerpt_length($length)
2572 2572
 {
2573
-    global $wp_query, $geodir_is_widget_listing;
2573
+	global $wp_query, $geodir_is_widget_listing;
2574 2574
 	if ($geodir_is_widget_listing) {
2575 2575
 		return $length;
2576 2576
 	}
2577 2577
 	
2578
-    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2579
-        $length = get_option('geodir_desc_word_limit');
2580
-    elseif (get_query_var('excerpt_length'))
2581
-        $length = get_query_var('excerpt_length');
2578
+	if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2579
+		$length = get_option('geodir_desc_word_limit');
2580
+	elseif (get_query_var('excerpt_length'))
2581
+		$length = get_query_var('excerpt_length');
2582 2582
 
2583
-    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2584
-        $length = get_option('geodir_author_desc_word_limit');
2583
+	if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2584
+		$length = get_option('geodir_author_desc_word_limit');
2585 2585
 
2586
-    return $length;
2586
+	return $length;
2587 2587
 }
2588 2588
 
2589 2589
 /**
@@ -2598,13 +2598,13 @@  discard block
 block discarded – undo
2598 2598
  */
2599 2599
 function geodir_excerpt_more($more)
2600 2600
 {
2601
-    global $post;
2602
-    $all_postypes = geodir_get_posttypes();
2603
-    if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
2604
-        return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';
2605
-    }
2601
+	global $post;
2602
+	$all_postypes = geodir_get_posttypes();
2603
+	if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
2604
+		return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';
2605
+	}
2606 2606
 
2607
-    return $more;
2607
+	return $more;
2608 2608
 }
2609 2609
 
2610 2610
 
@@ -2621,63 +2621,63 @@  discard block
 block discarded – undo
2621 2621
  */
2622 2622
 function geodir_update_markers_oncatedit($term_id, $tt_id, $taxonomy)
2623 2623
 {
2624
-    global $plugin_prefix, $wpdb;
2624
+	global $plugin_prefix, $wpdb;
2625 2625
 
2626
-    $gd_taxonomies = geodir_get_taxonomies();
2626
+	$gd_taxonomies = geodir_get_taxonomies();
2627 2627
 
2628
-    if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
2628
+	if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
2629 2629
 
2630
-        $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
2631
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
2630
+		$geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
2631
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
2632 2632
 
2633
-        $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
2634
-        $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
2633
+		$path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
2634
+		$term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
2635 2635
 
2636
-        $posts = $wpdb->get_results(
2637
-            $wpdb->prepare(
2638
-                "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",
2639
-                array($term_id, $taxonomy)
2640
-            )
2641
-        );
2636
+		$posts = $wpdb->get_results(
2637
+			$wpdb->prepare(
2638
+				"SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",
2639
+				array($term_id, $taxonomy)
2640
+			)
2641
+		);
2642 2642
 
2643
-        if (!empty($posts)):
2644
-            foreach ($posts as $post_obj) {
2643
+		if (!empty($posts)):
2644
+			foreach ($posts as $post_obj) {
2645 2645
 
2646
-                $lat = $post_obj->post_latitude;
2647
-                $lng = $post_obj->post_longitude;
2646
+				$lat = $post_obj->post_latitude;
2647
+				$lng = $post_obj->post_longitude;
2648 2648
 
2649
-                $json = '{';
2650
-                $json .= '"id":"' . $post_obj->post_id . '",';
2651
-                $json .= '"lat_pos": "' . $lat . '",';
2652
-                $json .= '"long_pos": "' . $lng . '",';
2653
-                $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
2654
-                $json .= '"icon":"' . $term_icon . '",';
2655
-                $json .= '"group":"catgroup' . $term_id . '"';
2656
-                $json .= '}';
2649
+				$json = '{';
2650
+				$json .= '"id":"' . $post_obj->post_id . '",';
2651
+				$json .= '"lat_pos": "' . $lat . '",';
2652
+				$json .= '"long_pos": "' . $lng . '",';
2653
+				$json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
2654
+				$json .= '"icon":"' . $term_icon . '",';
2655
+				$json .= '"group":"catgroup' . $term_id . '"';
2656
+				$json .= '}';
2657 2657
 
2658
-                if ($post_obj->default_category == $term_id) {
2658
+				if ($post_obj->default_category == $term_id) {
2659 2659
 
2660
-                    $wpdb->query(
2661
-                        $wpdb->prepare(
2662
-                            "UPDATE " . $table . " SET marker_json = %s where post_id = %d",
2663
-                            array($json, $post_obj->post_id)
2664
-                        )
2665
-                    );
2666
-                }
2660
+					$wpdb->query(
2661
+						$wpdb->prepare(
2662
+							"UPDATE " . $table . " SET marker_json = %s where post_id = %d",
2663
+							array($json, $post_obj->post_id)
2664
+						)
2665
+					);
2666
+				}
2667 2667
 
2668
-                $wpdb->query(
2669
-                    $wpdb->prepare(
2670
-                        "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",
2671
-                        array($json, $post_obj->post_id, $term_id)
2672
-                    )
2673
-                );
2668
+				$wpdb->query(
2669
+					$wpdb->prepare(
2670
+						"UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",
2671
+						array($json, $post_obj->post_id, $term_id)
2672
+					)
2673
+				);
2674 2674
 
2675
-            }
2675
+			}
2676 2676
 
2677 2677
 
2678
-        endif;
2678
+		endif;
2679 2679
 
2680
-    }
2680
+	}
2681 2681
 
2682 2682
 }
2683 2683
 
@@ -2691,14 +2691,14 @@  discard block
 block discarded – undo
2691 2691
  */
2692 2692
 function geodir_get_listing_author($listing_id = '')
2693 2693
 {
2694
-    if ($listing_id == '') {
2695
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2696
-            $listing_id = $_REQUEST['pid'];
2697
-        }
2698
-    }
2699
-    $listing = get_post(strip_tags($listing_id));
2700
-    $listing_author_id = $listing->post_author;
2701
-    return $listing_author_id;
2694
+	if ($listing_id == '') {
2695
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2696
+			$listing_id = $_REQUEST['pid'];
2697
+		}
2698
+	}
2699
+	$listing = get_post(strip_tags($listing_id));
2700
+	$listing_author_id = $listing->post_author;
2701
+	return $listing_author_id;
2702 2702
 }
2703 2703
 
2704 2704
 
@@ -2713,11 +2713,11 @@  discard block
 block discarded – undo
2713 2713
  */
2714 2714
 function geodir_lisiting_belong_to_user($listing_id, $user_id)
2715 2715
 {
2716
-    $listing_author_id = geodir_get_listing_author($listing_id);
2717
-    if ($listing_author_id == $user_id)
2718
-        return true;
2719
-    else
2720
-        return false;
2716
+	$listing_author_id = geodir_get_listing_author($listing_id);
2717
+	if ($listing_author_id == $user_id)
2718
+		return true;
2719
+	else
2720
+		return false;
2721 2721
 
2722 2722
 }
2723 2723
 
@@ -2733,17 +2733,17 @@  discard block
 block discarded – undo
2733 2733
  */
2734 2734
 function geodir_listing_belong_to_current_user($listing_id = '', $exclude_admin = true)
2735 2735
 {
2736
-    global $current_user;
2737
-    if ($exclude_admin) {
2738
-        foreach ($current_user->caps as $key => $caps) {
2739
-            if (geodir_strtolower($key) == 'administrator') {
2740
-                return true;
2741
-                break;
2742
-            }
2743
-        }
2744
-    }
2745
-
2746
-    return geodir_lisiting_belong_to_user($listing_id, $current_user->ID);
2736
+	global $current_user;
2737
+	if ($exclude_admin) {
2738
+		foreach ($current_user->caps as $key => $caps) {
2739
+			if (geodir_strtolower($key) == 'administrator') {
2740
+				return true;
2741
+				break;
2742
+			}
2743
+		}
2744
+	}
2745
+
2746
+	return geodir_lisiting_belong_to_user($listing_id, $current_user->ID);
2747 2747
 }
2748 2748
 
2749 2749
 
@@ -2759,17 +2759,17 @@  discard block
 block discarded – undo
2759 2759
 function geodir_only_supportable_attachments_remove($file)
2760 2760
 {
2761 2761
 
2762
-    global $wpdb;
2762
+	global $wpdb;
2763 2763
 
2764
-    $matches = array();
2764
+	$matches = array();
2765 2765
 
2766
-    $pattern = '/-\d+x\d+\./';
2767
-    preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2766
+	$pattern = '/-\d+x\d+\./';
2767
+	preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2768 2768
 
2769
-    if (empty($matches))
2770
-        return '';
2771
-    else
2772
-        return $file;
2769
+	if (empty($matches))
2770
+		return '';
2771
+	else
2772
+		return $file;
2773 2773
 
2774 2774
 }
2775 2775
 
@@ -2786,78 +2786,78 @@  discard block
 block discarded – undo
2786 2786
 function geodir_set_wp_featured_image($post_id)
2787 2787
 {
2788 2788
 
2789
-    global $wpdb, $plugin_prefix;
2790
-    $uploads = wp_upload_dir();
2789
+	global $wpdb, $plugin_prefix;
2790
+	$uploads = wp_upload_dir();
2791 2791
 //	print_r($uploads ) ;
2792
-    $post_first_image = $wpdb->get_results(
2793
-        $wpdb->prepare(
2794
-            "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1  ", array($post_id)
2795
-        )
2796
-    );
2792
+	$post_first_image = $wpdb->get_results(
2793
+		$wpdb->prepare(
2794
+			"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1  ", array($post_id)
2795
+		)
2796
+	);
2797 2797
 
2798
-    $old_attachment_name = '';
2799
-    $post_thumbnail_id = '';
2800
-    if (has_post_thumbnail($post_id)) {
2798
+	$old_attachment_name = '';
2799
+	$post_thumbnail_id = '';
2800
+	if (has_post_thumbnail($post_id)) {
2801 2801
 
2802
-        if (has_post_thumbnail($post_id)) {
2802
+		if (has_post_thumbnail($post_id)) {
2803 2803
 
2804
-            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2804
+			$post_thumbnail_id = get_post_thumbnail_id($post_id);
2805 2805
 
2806
-            $old_attachment_name = basename(get_attached_file($post_thumbnail_id));
2806
+			$old_attachment_name = basename(get_attached_file($post_thumbnail_id));
2807 2807
 
2808
-        }
2809
-    }
2810
-
2811
-    if (!empty($post_first_image)) {
2808
+		}
2809
+	}
2812 2810
 
2813
-        $post_type = get_post_type($post_id);
2811
+	if (!empty($post_first_image)) {
2814 2812
 
2815
-        $table_name = $plugin_prefix . $post_type . '_detail';
2813
+		$post_type = get_post_type($post_id);
2816 2814
 
2817
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
2815
+		$table_name = $plugin_prefix . $post_type . '_detail';
2818 2816
 
2819
-        $new_attachment_name = basename($post_first_image[0]->file);
2817
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
2820 2818
 
2821
-        if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
2819
+		$new_attachment_name = basename($post_first_image[0]->file);
2822 2820
 
2823
-            if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2821
+		if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
2824 2822
 
2825
-                add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
2823
+			if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2826 2824
 
2827
-                wp_delete_attachment($post_thumbnail_id);
2825
+				add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
2828 2826
 
2829
-            }
2830
-            $filename = $uploads['basedir'] . $post_first_image[0]->file;
2827
+				wp_delete_attachment($post_thumbnail_id);
2831 2828
 
2832
-            $attachment = array(
2833
-                'post_mime_type' => $post_first_image[0]->mime_type,
2834
-                'guid' => $uploads['baseurl'] . $post_first_image[0]->file,
2835
-                'post_parent' => $post_id,
2836
-                'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
2837
-                'post_content' => ''
2838
-            );
2829
+			}
2830
+			$filename = $uploads['basedir'] . $post_first_image[0]->file;
2831
+
2832
+			$attachment = array(
2833
+				'post_mime_type' => $post_first_image[0]->mime_type,
2834
+				'guid' => $uploads['baseurl'] . $post_first_image[0]->file,
2835
+				'post_parent' => $post_id,
2836
+				'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
2837
+				'post_content' => ''
2838
+			);
2839 2839
 
2840 2840
 
2841
-            $id = wp_insert_attachment($attachment, $filename, $post_id);
2841
+			$id = wp_insert_attachment($attachment, $filename, $post_id);
2842 2842
 
2843
-            if (!is_wp_error($id)) {
2843
+			if (!is_wp_error($id)) {
2844 2844
 
2845
-                set_post_thumbnail($post_id, $id);
2845
+				set_post_thumbnail($post_id, $id);
2846 2846
 
2847
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
2848
-                wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
2847
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
2848
+				wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
2849 2849
 
2850
-            }
2850
+			}
2851 2851
 
2852
-        }
2852
+		}
2853 2853
 
2854
-    } else {
2855
-        //set_post_thumbnail($post_id,-1);
2854
+	} else {
2855
+		//set_post_thumbnail($post_id,-1);
2856 2856
 
2857
-        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2858
-            wp_delete_attachment($post_thumbnail_id);
2857
+		if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2858
+			wp_delete_attachment($post_thumbnail_id);
2859 2859
 
2860
-    }
2860
+	}
2861 2861
 }
2862 2862
 
2863 2863
 
@@ -2872,53 +2872,53 @@  discard block
 block discarded – undo
2872 2872
  */
2873 2873
 function gd_copy_original_translation()
2874 2874
 {
2875
-    if (function_exists('icl_object_id')) {
2876
-        global $wpdb, $table_prefix, $plugin_prefix;
2877
-        $post_id = absint($_POST['post_id']);
2878
-        $upload_dir = wp_upload_dir();
2879
-        $post_type = get_post_type($_POST['post_id']);
2880
-        $table = $plugin_prefix . $post_type . '_detail';
2881
-
2882
-        $post_arr = $wpdb->get_results($wpdb->prepare(
2883
-            "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2884
-            array($post_id)
2885
-        )
2886
-            , ARRAY_A);
2887
-
2888
-        $arrImages = $wpdb->get_results(
2889
-            $wpdb->prepare(
2890
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2891
-                array('%image%', $post_id)
2892
-            )
2893
-        );
2894
-        if ($arrImages) {
2895
-            $image_arr = array();
2896
-            foreach ($arrImages as $img) {
2897
-                $image_arr[] = $upload_dir['baseurl'] . $img->file;
2898
-            }
2899
-            $comma_separated = implode(",", $image_arr);
2900
-            $post_arr[0]['post_images'] = $comma_separated;
2901
-        }
2902
-
2903
-
2904
-        $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];
2905
-        $cat_arr = array_filter(explode(",", $cats));
2906
-        $trans_cat = array();
2907
-        foreach ($cat_arr as $cat) {
2908
-            $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);
2909
-        }
2910
-
2911
-
2912
-        $post_arr[0]['categories'] = array_filter($trans_cat);
2875
+	if (function_exists('icl_object_id')) {
2876
+		global $wpdb, $table_prefix, $plugin_prefix;
2877
+		$post_id = absint($_POST['post_id']);
2878
+		$upload_dir = wp_upload_dir();
2879
+		$post_type = get_post_type($_POST['post_id']);
2880
+		$table = $plugin_prefix . $post_type . '_detail';
2881
+
2882
+		$post_arr = $wpdb->get_results($wpdb->prepare(
2883
+			"SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2884
+			array($post_id)
2885
+		)
2886
+			, ARRAY_A);
2887
+
2888
+		$arrImages = $wpdb->get_results(
2889
+			$wpdb->prepare(
2890
+				"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2891
+				array('%image%', $post_id)
2892
+			)
2893
+		);
2894
+		if ($arrImages) {
2895
+			$image_arr = array();
2896
+			foreach ($arrImages as $img) {
2897
+				$image_arr[] = $upload_dir['baseurl'] . $img->file;
2898
+			}
2899
+			$comma_separated = implode(",", $image_arr);
2900
+			$post_arr[0]['post_images'] = $comma_separated;
2901
+		}
2902
+
2903
+
2904
+		$cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];
2905
+		$cat_arr = array_filter(explode(",", $cats));
2906
+		$trans_cat = array();
2907
+		foreach ($cat_arr as $cat) {
2908
+			$trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);
2909
+		}
2910
+
2911
+
2912
+		$post_arr[0]['categories'] = array_filter($trans_cat);
2913 2913
 //print_r($image_arr);
2914
-        //print_r($arrImages);
2915
-        //echo $_REQUEST['lang'];
2914
+		//print_r($arrImages);
2915
+		//echo $_REQUEST['lang'];
2916 2916
 //print_r($post_arr);
2917 2917
 //print_r($trans_cat);
2918
-        echo json_encode($post_arr[0]);
2918
+		echo json_encode($post_arr[0]);
2919 2919
 
2920
-    }
2921
-    die();
2920
+	}
2921
+	die();
2922 2922
 }
2923 2923
 
2924 2924
 
@@ -2938,54 +2938,54 @@  discard block
 block discarded – undo
2938 2938
 function geodir_get_custom_fields_type($listing_type = '')
2939 2939
 {
2940 2940
 
2941
-    global $wpdb;
2941
+	global $wpdb;
2942 2942
 
2943
-    if ($listing_type == '')
2944
-        $listing_type = 'gd_place';
2943
+	if ($listing_type == '')
2944
+		$listing_type = 'gd_place';
2945 2945
 
2946
-    $fields_info = array();
2946
+	$fields_info = array();
2947 2947
 
2948
-    $get_data = $wpdb->get_results(
2949
-        $wpdb->prepare(
2950
-            "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",
2951
-            array($listing_type)
2952
-        )
2953
-    );
2948
+	$get_data = $wpdb->get_results(
2949
+		$wpdb->prepare(
2950
+			"SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",
2951
+			array($listing_type)
2952
+		)
2953
+	);
2954 2954
 
2955
-    if (!empty($get_data)) {
2955
+	if (!empty($get_data)) {
2956 2956
 
2957
-        foreach ($get_data as $data) {
2957
+		foreach ($get_data as $data) {
2958 2958
 
2959
-            if ($data->field_type == 'address') {
2959
+			if ($data->field_type == 'address') {
2960 2960
 
2961
-                $extra_fields = unserialize($data->extra_fields);
2961
+				$extra_fields = unserialize($data->extra_fields);
2962 2962
 
2963
-                $prefix = $data->htmlvar_name . '_';
2963
+				$prefix = $data->htmlvar_name . '_';
2964 2964
 
2965
-                $fields_info[$prefix . 'address'] = $data->field_type;
2965
+				$fields_info[$prefix . 'address'] = $data->field_type;
2966 2966
 
2967
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2968
-                    $fields_info[$prefix . 'zip'] = $data->field_type;
2967
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2968
+					$fields_info[$prefix . 'zip'] = $data->field_type;
2969 2969
 
2970
-            } else {
2970
+			} else {
2971 2971
 
2972
-                $fields_info[$data->htmlvar_name] = $data->field_type;
2972
+				$fields_info[$data->htmlvar_name] = $data->field_type;
2973 2973
 
2974
-            }
2974
+			}
2975 2975
 
2976
-        }
2976
+		}
2977 2977
 
2978
-    }
2978
+	}
2979 2979
 
2980
-    /**
2981
-     * Filter to modify custom fields info using listing post type.
2982
-     *
2983
-     * @since 1.0.0
2984
-     * @package GeoDirectory
2985
-     * @return array $fields_info Custom fields info.
2986
-     * @param string $listing_type The listing post type.
2987
-     */
2988
-    return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
2980
+	/**
2981
+	 * Filter to modify custom fields info using listing post type.
2982
+	 *
2983
+	 * @since 1.0.0
2984
+	 * @package GeoDirectory
2985
+	 * @return array $fields_info Custom fields info.
2986
+	 * @param string $listing_type The listing post type.
2987
+	 */
2988
+	return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
2989 2989
 }
2990 2990
 
2991 2991
 
@@ -3000,58 +3000,58 @@  discard block
 block discarded – undo
3000 3000
  */
3001 3001
 function geodir_function_post_updated($post_ID, $post_after, $post_before)
3002 3002
 {
3003
-    $post_type = get_post_type($post_ID);
3003
+	$post_type = get_post_type($post_ID);
3004 3004
 
3005
-    if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
3006
-        // send notification to client when post moves from draft to publish
3007
-        if (!empty($post_after->post_status) && $post_after->post_status == 'publish' && !empty($post_before->post_status) && ($post_before->post_status == 'draft' || $post_before->post_status == 'auto-draft')) {
3008
-            $post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;
3009
-            $post_author_data = get_userdata($post_author_id);
3005
+	if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
3006
+		// send notification to client when post moves from draft to publish
3007
+		if (!empty($post_after->post_status) && $post_after->post_status == 'publish' && !empty($post_before->post_status) && ($post_before->post_status == 'draft' || $post_before->post_status == 'auto-draft')) {
3008
+			$post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;
3009
+			$post_author_data = get_userdata($post_author_id);
3010 3010
 
3011
-            $to_name = geodir_get_client_name($post_author_id);
3011
+			$to_name = geodir_get_client_name($post_author_id);
3012 3012
 
3013
-            $from_email = geodir_get_site_email_id();
3014
-            $from_name = get_site_emailName();
3015
-            $to_email = $post_author_data->user_email;
3013
+			$from_email = geodir_get_site_email_id();
3014
+			$from_name = get_site_emailName();
3015
+			$to_email = $post_author_data->user_email;
3016 3016
 
3017
-            if (!is_email($to_email) && !empty($post_author_data->user_email)) {
3018
-                $to_email = $post_author_data->user_email;
3019
-            }
3017
+			if (!is_email($to_email) && !empty($post_author_data->user_email)) {
3018
+				$to_email = $post_author_data->user_email;
3019
+			}
3020 3020
 
3021
-            $message_type = 'listing_published';
3021
+			$message_type = 'listing_published';
3022 3022
 
3023
-            if (get_option('geodir_post_published_email_subject') == '') {
3024
-                update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
3025
-            }
3023
+			if (get_option('geodir_post_published_email_subject') == '') {
3024
+				update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
3025
+			}
3026 3026
 
3027
-            if (get_option('geodir_post_published_email_content') == '') {
3028
-                update_option('geodir_post_published_email_content', __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory'));
3029
-            }
3027
+			if (get_option('geodir_post_published_email_content') == '') {
3028
+				update_option('geodir_post_published_email_content', __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory'));
3029
+			}
3030 3030
 
3031
-            /**
3032
-             * Called before sending the email when listing gets published.
3033
-             *
3034
-             * @since 1.0.0
3035
-             * @package GeoDirectory
3036
-             * @param object $post_after The post object after update.
3037
-             * @param object $post_before The post object before update.
3038
-             */
3039
-            do_action('geodir_before_listing_published_email', $post_after, $post_before);
3040
-            if (is_email($to_email)) {
3041
-                geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
3042
-            }
3031
+			/**
3032
+			 * Called before sending the email when listing gets published.
3033
+			 *
3034
+			 * @since 1.0.0
3035
+			 * @package GeoDirectory
3036
+			 * @param object $post_after The post object after update.
3037
+			 * @param object $post_before The post object before update.
3038
+			 */
3039
+			do_action('geodir_before_listing_published_email', $post_after, $post_before);
3040
+			if (is_email($to_email)) {
3041
+				geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
3042
+			}
3043 3043
 
3044
-            /**
3045
-             * Called after sending the email when listing gets published.
3046
-             *
3047
-             * @since 1.0.0
3048
-             * @package GeoDirectory
3049
-             * @param object $post_after The post object after update.
3050
-             * @param object $post_before The post object before update.
3051
-             */
3052
-            do_action('geodir_after_listing_published_email', $post_after, $post_before);
3053
-        }
3054
-    }
3044
+			/**
3045
+			 * Called after sending the email when listing gets published.
3046
+			 *
3047
+			 * @since 1.0.0
3048
+			 * @package GeoDirectory
3049
+			 * @param object $post_after The post object after update.
3050
+			 * @param object $post_before The post object before update.
3051
+			 */
3052
+			do_action('geodir_after_listing_published_email', $post_after, $post_before);
3053
+		}
3054
+	}
3055 3055
 }
3056 3056
 
3057 3057
 add_action('wp_head', 'geodir_fb_like_thumbnail');
@@ -3065,14 +3065,14 @@  discard block
 block discarded – undo
3065 3065
  */
3066 3066
 function geodir_fb_like_thumbnail(){
3067 3067
 
3068
-    // return if not a single post
3069
-    if(!is_single()){return;}
3068
+	// return if not a single post
3069
+	if(!is_single()){return;}
3070 3070
 
3071
-    global $post;
3072
-    if(isset($post->featured_image) && $post->featured_image){
3073
-        $upload_dir = wp_upload_dir();
3074
-        $thumb = $upload_dir['baseurl'].$post->featured_image;
3075
-        echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3071
+	global $post;
3072
+	if(isset($post->featured_image) && $post->featured_image){
3073
+		$upload_dir = wp_upload_dir();
3074
+		$thumb = $upload_dir['baseurl'].$post->featured_image;
3075
+		echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3076 3076
 
3077
-    }
3077
+	}
3078 3078
 }
3079 3079
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 
27 27
     if (!isset($default_cat) || empty($default_cat)) {
28 28
         $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
-    }else{
30
-        if(!is_int($default_cat)){
29
+    } else {
30
+        if (!is_int($default_cat)) {
31 31
             $category = get_term_by('name', $default_cat, $taxonomy);
32
-            if(isset($category->term_id)){
33
-                $default_cat =  $category->term_id;
32
+            if (isset($category->term_id)) {
33
+                $default_cat = $category->term_id;
34 34
             }
35 35
         }
36 36
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
     if ($default_pos === false) {
60 60
 
61
-        $change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str);
61
+        $change_cat_str = str_replace($default_cat.',y:', $default_cat.',y,d:', $change_cat_str);
62 62
 
63 63
     }
64 64
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         $send_post_submit_mail = false;
228 228
 
229 229
         // unhook this function so it doesn't loop infinitely
230
-        remove_action('save_post', 'geodir_post_information_save',10,2);
230
+        remove_action('save_post', 'geodir_post_information_save', 10, 2);
231 231
 
232 232
         if (isset($request_info['pid']) && $request_info['pid'] != '') {
233 233
             $post['ID'] = $request_info['pid'];
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
         }
252 252
 
253 253
         // re-hook this function
254
-        add_action('save_post', 'geodir_post_information_save',10,2);
254
+        add_action('save_post', 'geodir_post_information_save', 10, 2);
255 255
 
256 256
         $post_tags = '';
257 257
         if (!isset($request_info['post_tags'])) {
258 258
 
259 259
             $post_type = $request_info['listing_type'];
260
-            $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
260
+            $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type.'_tags', array('fields' => 'names')));
261 261
 
262 262
         }
263 263
 
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
         $payment_info = array();
276 276
         $package_info = array();
277 277
 
278
-        $package_info = (array)geodir_post_package_info($package_info, $post);
278
+        $package_info = (array) geodir_post_package_info($package_info, $post);
279 279
 
280 280
         $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
281 281
 
282 282
         if (!empty($package_info) && !$post_package_id) {
283 283
             if (isset($package_info['days']) && $package_info['days'] != 0) {
284
-                $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
284
+                $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['days']." days"));
285 285
             } else {
286 286
                 $payment_info['expire_date'] = 'Never';
287 287
             }
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
             $extrafields = $val['extra_fields'];
303 303
 
304 304
             if (trim($type) == 'address') {
305
-                $prefix = $name . '_';
306
-                $address = $prefix . 'address';
305
+                $prefix = $name.'_';
306
+                $address = $prefix.'address';
307 307
 
308 308
                 if (isset($request_info[$address]) && $request_info[$address] != '') {
309 309
                     $gd_post_info[$address] = wp_slash($request_info[$address]);
@@ -313,59 +313,59 @@  discard block
 block discarded – undo
313 313
                     $extrafields = unserialize($extrafields);
314 314
 
315 315
 
316
-                    if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
316
+                    if (!isset($request_info[$prefix.'city']) || $request_info[$prefix.'city'] == '') {
317 317
 
318 318
                         $location_result = geodir_get_default_location();
319 319
 
320
-                        $gd_post_info[$prefix . 'city'] = $location_result->city;
321
-                        $gd_post_info[$prefix . 'region'] = $location_result->region;
322
-                        $gd_post_info[$prefix . 'country'] = $location_result->country;
320
+                        $gd_post_info[$prefix.'city'] = $location_result->city;
321
+                        $gd_post_info[$prefix.'region'] = $location_result->region;
322
+                        $gd_post_info[$prefix.'country'] = $location_result->country;
323 323
 
324
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
324
+                        $gd_post_info['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // set all overall post location
325 325
 
326 326
                     } else {
327 327
 
328
-                        $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];
329
-                        $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];
330
-                        $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];
328
+                        $gd_post_info[$prefix.'city'] = $request_info[$prefix.'city'];
329
+                        $gd_post_info[$prefix.'region'] = $request_info[$prefix.'region'];
330
+                        $gd_post_info[$prefix.'country'] = $request_info[$prefix.'country'];
331 331
 
332 332
                         //----------set post locations when import dummy data-------
333 333
                         $location_result = geodir_get_default_location();
334 334
 
335
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
335
+                        $gd_post_info['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // set all overall post location
336 336
                         //-----------------------------------------------------------------
337 337
 
338 338
                     }
339 339
 
340 340
 
341
-                    if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
342
-                        $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];
341
+                    if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix.'zip'])) {
342
+                        $gd_post_info[$prefix.'zip'] = $request_info[$prefix.'zip'];
343 343
                     }
344 344
 
345 345
 
346 346
                     if (isset($extrafields['show_map']) && $extrafields['show_map']) {
347 347
 
348
-                        if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
349
-                            $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];
348
+                        if (isset($request_info[$prefix.'latitude']) && $request_info[$prefix.'latitude'] != '') {
349
+                            $gd_post_info[$prefix.'latitude'] = $request_info[$prefix.'latitude'];
350 350
                         }
351 351
 
352
-                        if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
353
-                            $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];
352
+                        if (isset($request_info[$prefix.'longitude']) && $request_info[$prefix.'longitude'] != '') {
353
+                            $gd_post_info[$prefix.'longitude'] = $request_info[$prefix.'longitude'];
354 354
                         }
355 355
 
356
-                        if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
357
-                            $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];
356
+                        if (isset($request_info[$prefix.'mapview']) && $request_info[$prefix.'mapview'] != '') {
357
+                            $gd_post_info[$prefix.'mapview'] = $request_info[$prefix.'mapview'];
358 358
                         }
359 359
 
360
-                        if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
361
-                            $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];
360
+                        if (isset($request_info[$prefix.'mapzoom']) && $request_info[$prefix.'mapzoom'] != '') {
361
+                            $gd_post_info[$prefix.'mapzoom'] = $request_info[$prefix.'mapzoom'];
362 362
                         }
363 363
 
364 364
                     }
365 365
 
366 366
                     // show lat lng
367
-                    if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
368
-                        $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];
367
+                    if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix.'latlng'])) {
368
+                        $gd_post_info[$prefix.'latlng'] = $request_info[$prefix.'latlng'];
369 369
                     }
370 370
                 }
371 371
 
@@ -390,16 +390,16 @@  discard block
 block discarded – undo
390 390
 
391 391
                     // check if we need to change the format or not
392 392
                     $date_format_len = strlen(str_replace(' ', '', $date_format));
393
-                    if($date_format_len>5){// if greater then 5 then it's the old style format.
393
+                    if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
394 394
 
395
-                        $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
396
-                        $replace = array('d','j','l','m','n','F','Y');//PHP date format
395
+                        $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
396
+                        $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
397 397
 
398 398
                         $date_format = str_replace($search, $replace, $date_format);
399 399
 
400 400
                         $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
401 401
 
402
-                    }else{
402
+                    } else {
403 403
                         $post_htmlvar_value = $request_info[$name];
404 404
                     }
405 405
 
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
                 if (isset($request_info[$name])) {
415 415
                     $gd_post_info[$name] = $request_info[$name];
416 416
                 } else {
417
-                    if (isset($request_info['gd_field_' . $name])) {
417
+                    if (isset($request_info['gd_field_'.$name])) {
418 418
                         $gd_post_info[$name] = ''; /* fix de-select for multiselect */
419 419
                     }
420 420
                 }
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
         }
475 475
 
476 476
         if (is_array($post_tags)) {
477
-            $taxonomy = $request_info['listing_type'] . '_tags';
477
+            $taxonomy = $request_info['listing_type'].'_tags';
478 478
             wp_set_object_terms($last_post_id, $post_tags, $taxonomy);
479 479
         }
480 480
 
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
                 $tmpimgArr = trim($request_info['post_images'], ",");
487 487
                 $tmpimgArr = explode(",", $tmpimgArr);
488 488
                 geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
489
-            } else{
489
+            } else {
490 490
                 geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
491 491
             }
492 492
 
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
     if (!in_array($post_type, $all_postypes))
568 568
         return false;
569 569
 
570
-    $table = $plugin_prefix . $post_type . '_detail';
570
+    $table = $plugin_prefix.$post_type.'_detail';
571 571
 
572 572
     /**
573 573
      * Apply Filter to change Post info
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
      * @since 1.0.0
578 578
      * @package GeoDirectory
579 579
      */
580
-    $query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
580
+    $query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM ".$wpdb->posts." p,".$table." pd
581 581
 			  WHERE p.ID = pd.post_id
582 582
 			  AND post_id = " . $post_id);
583 583
 
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 
641 641
         $post_type = get_post_type($post_id);
642 642
 
643
-        $table = $plugin_prefix . $post_type . '_detail';
643
+        $table = $plugin_prefix.$post_type.'_detail';
644 644
 
645 645
         /**
646 646
          * Filter to change Post info
@@ -663,13 +663,13 @@  discard block
 block discarded – undo
663 663
                         $mval = implode(",", $mval);
664 664
                     }
665 665
 
666
-                    $post_meta_set_query .= $mkey . " = '" . $mval . "', ";
666
+                    $post_meta_set_query .= $mkey." = '".$mval."', ";
667 667
                 }
668 668
             }
669 669
 
670 670
             $post_meta_set_query = trim($post_meta_set_query, ", ");
671 671
 
672
-            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
672
+            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query); // escape %
673 673
 
674 674
             /**
675 675
              * Called before saving the listing info.
@@ -681,11 +681,11 @@  discard block
 block discarded – undo
681 681
              */
682 682
             do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
683 683
 
684
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
684
+            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
685 685
 
686 686
                 $wpdb->query(
687 687
                     $wpdb->prepare(
688
-                        "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id =%d",
688
+                        "UPDATE ".$table." SET ".$post_meta_set_query." where post_id =%d",
689 689
                         array($post_id)
690 690
                     )
691 691
                 );
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 
696 696
                 $wpdb->query(
697 697
                     $wpdb->prepare(
698
-                        "INSERT INTO " . $table . " SET post_id = %d," . $post_meta_set_query,
698
+                        "INSERT INTO ".$table." SET post_id = %d,".$post_meta_set_query,
699 699
                         array($post_id)
700 700
                     )
701 701
                 );
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 
742 742
         $post_type = get_post_type($post_id);
743 743
 
744
-        $table = $plugin_prefix . $post_type . '_detail';
744
+        $table = $plugin_prefix.$post_type.'_detail';
745 745
 
746 746
         if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
747 747
 
@@ -749,11 +749,11 @@  discard block
 block discarded – undo
749 749
                 $meta_value = implode(",", $meta_value);
750 750
             }
751 751
 
752
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
752
+            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
753 753
 
754 754
                 $wpdb->query(
755 755
                     $wpdb->prepare(
756
-                        "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",
756
+                        "UPDATE ".$table." SET ".$postmeta." = '".$meta_value."' where post_id =%d",
757 757
                         array($post_id)
758 758
                     )
759 759
                 );
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 
763 763
                 $wpdb->query(
764 764
                     $wpdb->prepare(
765
-                        "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",
765
+                        "INSERT INTO ".$table." SET post_id = %d, ".$postmeta." = '".$meta_value."'",
766 766
                         array($post_id)
767 767
                     )
768 768
                 );
@@ -795,23 +795,23 @@  discard block
 block discarded – undo
795 795
 
796 796
         $post_type = get_post_type($post_id);
797 797
 
798
-        $table = $plugin_prefix . $post_type . '_detail';
798
+        $table = $plugin_prefix.$post_type.'_detail';
799 799
 
800 800
         if (is_array($postmeta) && !empty($postmeta) && $post_id) {
801 801
             $post_meta_set_query = '';
802 802
 
803 803
             foreach ($postmeta as $mkey) {
804 804
                 if ($mval != '')
805
-                    $post_meta_set_query .= $mkey . " = '', ";
805
+                    $post_meta_set_query .= $mkey." = '', ";
806 806
             }
807 807
 
808 808
             $post_meta_set_query = trim($post_meta_set_query, ", ");
809 809
 
810
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
810
+            if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$postmeta."'") != '') {
811 811
 
812 812
                 $wpdb->query(
813 813
                     $wpdb->prepare(
814
-                        "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",
814
+                        "UPDATE ".$table." SET ".$post_meta_set_query." where post_id = %d",
815 815
                         array($post_id)
816 816
                     )
817 817
                 );
@@ -820,11 +820,11 @@  discard block
 block discarded – undo
820 820
             }
821 821
 
822 822
         } elseif ($postmeta != '' && $post_id) {
823
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
823
+            if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$postmeta."'") != '') {
824 824
 
825 825
                 $wpdb->query(
826 826
                     $wpdb->prepare(
827
-                        "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",
827
+                        "UPDATE ".$table." SET ".$postmeta."= '' where post_id = %d",
828 828
                         array($post_id)
829 829
                     )
830 830
                 );
@@ -866,10 +866,10 @@  discard block
 block discarded – undo
866 866
         if (!in_array($post_type, $all_postypes))
867 867
             return false;
868 868
 
869
-        $table = $plugin_prefix . $post_type . '_detail';
869
+        $table = $plugin_prefix.$post_type.'_detail';
870 870
 
871
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
872
-            $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
871
+        if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$meta_key."'") != '') {
872
+            $meta_value = $wpdb->get_var($wpdb->prepare("SELECT ".$meta_key." from ".$table." where post_id = %d", array($post_id)));
873 873
             
874 874
             if ($meta_value && $meta_value !== '') {
875 875
                 return maybe_serialize($meta_value);
@@ -903,13 +903,13 @@  discard block
 block discarded – undo
903 903
 
904 904
         $post_type = get_post_type($post_id);
905 905
 
906
-        $table = $plugin_prefix . $post_type . '_detail';
906
+        $table = $plugin_prefix.$post_type.'_detail';
907 907
 
908 908
         $post_images = geodir_get_images($post_id);
909 909
 
910 910
         $wpdb->query(
911 911
             $wpdb->prepare(
912
-                "UPDATE " . $table . " SET featured_image = '' where post_id =%d",
912
+                "UPDATE ".$table." SET featured_image = '' where post_id =%d",
913 913
                 array($post_id)
914 914
             )
915 915
         );
@@ -939,12 +939,12 @@  discard block
 block discarded – undo
939 939
                 $file_path = '';
940 940
                 /* --------- start ------- */
941 941
 
942
-                $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
942
+                $split_img_path = explode(str_replace(array('http://', 'https://'), '', $uploads['baseurl']), str_replace(array('http://', 'https://'), '', $post_image[$m]));
943 943
 
944 944
                 $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
945 945
 
946 946
 
947
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
947
+                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM ".GEODIR_ATTACHMENT_TABLE." WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
948 948
 
949 949
                     /* --------- end ------- */
950 950
                     $curr_img_url = $post_image[$m];
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
                     // If the uploaded file is the right format
989 989
                     if (in_array($uploaded_file_type, $allowed_file_types)) {
990 990
                         if (!function_exists('wp_handle_upload')) {
991
-                            require_once(ABSPATH . 'wp-admin/includes/file.php');
991
+                            require_once(ABSPATH.'wp-admin/includes/file.php');
992 992
                         }
993 993
 
994 994
                         if (!is_dir($geodir_uploadpath)) {
@@ -996,41 +996,41 @@  discard block
 block discarded – undo
996 996
                         }
997 997
 
998 998
                         $external_img = false;
999
-                        if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
999
+                        if (strpos(str_replace(array('http://', 'https://'), '', $curr_img_url), str_replace(array('http://', 'https://'), '', $uploads['baseurl'])) !== false) {
1000 1000
                         } else {
1001 1001
                             $external_img = true;
1002 1002
                         }
1003 1003
 
1004 1004
                         if ($dummy || $external_img) {
1005 1005
                             $uploaded_file = array();
1006
-                            $uploaded = (array)fetch_remote_file($curr_img_url);
1006
+                            $uploaded = (array) fetch_remote_file($curr_img_url);
1007 1007
 
1008 1008
                             if (isset($uploaded['error']) && empty($uploaded['error'])) {
1009 1009
                                 $new_name = basename($uploaded['file']);
1010 1010
                                 $uploaded_file = $uploaded;
1011
-                            }else{
1012
-                                print_r($uploaded);exit;
1011
+                            } else {
1012
+                                print_r($uploaded); exit;
1013 1013
                             }
1014 1014
                             $external_img = false;
1015 1015
                         } else {
1016
-                            $new_name = $post_id . '_' . $file_name;
1016
+                            $new_name = $post_id.'_'.$file_name;
1017 1017
 
1018 1018
                             if ($curr_img_dir == $sub_dir) {
1019
-                                $img_path = $geodir_uploadpath . '/' . $filename;
1020
-                                $img_url = $geodir_uploadurl . '/' . $filename;
1019
+                                $img_path = $geodir_uploadpath.'/'.$filename;
1020
+                                $img_url = $geodir_uploadurl.'/'.$filename;
1021 1021
                             } else {
1022
-                                $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1023
-                                $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1022
+                                $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
1023
+                                $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename;
1024 1024
                             }
1025 1025
 
1026 1026
                             $uploaded_file = '';
1027 1027
 
1028 1028
                             if (file_exists($img_path)) {
1029
-                                $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1029
+                                $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name);
1030 1030
                                 $file_path = '';
1031
-                            } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
1031
+                            } else if (file_exists($uploads['basedir'].$curr_img_dir.$filename)) {
1032 1032
                                 $uploaded_file = true;
1033
-                                $file_path = $curr_img_dir . '/' . $filename;
1033
+                                $file_path = $curr_img_dir.'/'.$filename;
1034 1034
                             }
1035 1035
 
1036 1036
                             if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
@@ -1039,14 +1039,14 @@  discard block
 block discarded – undo
1039 1039
 
1040 1040
                         if (!empty($uploaded_file)) {
1041 1041
                             if (!isset($file_path) || !$file_path) {
1042
-                                $file_path = $sub_dir . '/' . $new_name;
1042
+                                $file_path = $sub_dir.'/'.$new_name;
1043 1043
                             }
1044 1044
 
1045
-                            $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1045
+                            $postcurr_images[] = str_replace(array('http://', 'https://'), '', $uploads['baseurl'].$file_path);
1046 1046
 
1047 1047
                             if ($menu_order == 1) {
1048 1048
 
1049
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1049
+                                $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1050 1050
 
1051 1051
                             }
1052 1052
 
@@ -1064,12 +1064,12 @@  discard block
 block discarded – undo
1064 1064
 
1065 1065
                             foreach ($attachment as $key => $val) {
1066 1066
                                 if ($val != '')
1067
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1067
+                                    $attachment_set .= $key." = '".$val."', ";
1068 1068
                             }
1069 1069
 
1070 1070
                             $attachment_set = trim($attachment_set, ", ");
1071 1071
 
1072
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1072
+                            $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
1073 1073
 
1074 1074
                             $valid_file_ids[] = $wpdb->insert_id;
1075 1075
                         }
@@ -1080,17 +1080,17 @@  discard block
 block discarded – undo
1080 1080
                 } else {
1081 1081
                     $valid_file_ids[] = $find_image;
1082 1082
 
1083
-                    $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1083
+                    $postcurr_images[] = str_replace(array('http://', 'https://'), '', $post_image[$m]);
1084 1084
 
1085 1085
                     $wpdb->query(
1086 1086
                         $wpdb->prepare(
1087
-                            "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",
1087
+                            "UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order = %d where file =%s AND post_id =%d",
1088 1088
                             array($menu_order, $split_img_path[1], $post_id)
1089 1089
                         )
1090 1090
                     );
1091 1091
 
1092 1092
                     if ($menu_order == 1)
1093
-                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1093
+                        $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1094 1094
 
1095 1095
                 }
1096 1096
 
@@ -1114,9 +1114,9 @@  discard block
 block discarded – undo
1114 1114
 
1115 1115
                 foreach ($post_images as $img) {
1116 1116
 
1117
-                    if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1117
+                    if (!in_array(str_replace(array('http://', 'https://'), '', $img->src), $postcurr_images)) {
1118 1118
 
1119
-                        $invalid_files[] = (object)array('src' => $img->src);
1119
+                        $invalid_files[] = (object) array('src' => $img->src);
1120 1120
 
1121 1121
                     }
1122 1122
 
@@ -1124,12 +1124,12 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
             }
1126 1126
 
1127
-            $invalid_files = (object)$invalid_files;
1127
+            $invalid_files = (object) $invalid_files;
1128 1128
         }
1129 1129
 
1130 1130
         $remove_files[] = $post_id;
1131 1131
 
1132
-        $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1132
+        $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ".$valid_files_condition." post_id = %d", $remove_files));
1133 1133
 
1134 1134
         if (!empty($invalid_files))
1135 1135
             geodir_remove_attachments($invalid_files);
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
 			rmdir($dirPath);
1170 1170
 	}	*/
1171 1171
 
1172
-    $dirname = $uploads_dir . '/temp_' . $current_user->ID;
1172
+    $dirname = $uploads_dir.'/temp_'.$current_user->ID;
1173 1173
     geodir_delete_directory($dirname);
1174 1174
 }
1175 1175
 
@@ -1191,10 +1191,10 @@  discard block
 block discarded – undo
1191 1191
         return false;
1192 1192
     while ($file = readdir($dir_handle)) {
1193 1193
         if ($file != "." && $file != "..") {
1194
-            if (!is_dir($dirname . "/" . $file))
1195
-                unlink($dirname . "/" . $file);
1194
+            if (!is_dir($dirname."/".$file))
1195
+                unlink($dirname."/".$file);
1196 1196
             else
1197
-                geodir_delete_directory($dirname . '/' . $file);
1197
+                geodir_delete_directory($dirname.'/'.$file);
1198 1198
         }
1199 1199
     }
1200 1200
     closedir($dir_handle);
@@ -1223,8 +1223,8 @@  discard block
 block discarded – undo
1223 1223
             foreach ($postcurr_images as $postimg) {
1224 1224
                 $image_name_arr = explode('/', $postimg->src);
1225 1225
                 $filename = end($image_name_arr);
1226
-                if (file_exists($uploads_dir . '/' . $filename))
1227
-                    unlink($uploads_dir . '/' . $filename);
1226
+                if (file_exists($uploads_dir.'/'.$filename))
1227
+                    unlink($uploads_dir.'/'.$filename);
1228 1228
             }
1229 1229
 
1230 1230
         } // endif
@@ -1265,16 +1265,16 @@  discard block
 block discarded – undo
1265 1265
         }
1266 1266
 
1267 1267
         if (!in_array($post_type, geodir_get_posttypes())) {
1268
-            return false;// if not a GD CPT return;
1268
+            return false; // if not a GD CPT return;
1269 1269
         }
1270 1270
 
1271
-        $table = $plugin_prefix . $post_type . '_detail';
1271
+        $table = $plugin_prefix.$post_type.'_detail';
1272 1272
 
1273 1273
         if (!$file) {
1274 1274
             if (isset($post->featured_image)) {
1275 1275
                 $file = $post->featured_image;
1276 1276
             } else {
1277
-                $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
1277
+                $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM ".$table." WHERE post_id = %d", array($post_id)));
1278 1278
             }
1279 1279
         }
1280 1280
 
@@ -1292,7 +1292,7 @@  discard block
 block discarded – undo
1292 1292
 
1293 1293
             $file_name = $file_info['basename'];
1294 1294
 
1295
-            $uploads_url = $uploads_baseurl . $sub_dir;
1295
+            $uploads_url = $uploads_baseurl.$sub_dir;
1296 1296
             /*
1297 1297
              * Allows the filter of image src for such things as CDN change.
1298 1298
              *
@@ -1302,8 +1302,8 @@  discard block
 block discarded – undo
1302 1302
              * @param string $uploads_url The server upload directory url.
1303 1303
              * @param string $uploads_baseurl The uploads dir base url.
1304 1304
              */
1305
-            $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1306
-            $img_arr['path'] = $uploads_path . '/' . $file_name;
1305
+            $img_arr['src'] = apply_filters('geodir_get_featured_image_src', $uploads_url.'/'.$file_name, $file_name, $uploads_url, $uploads_baseurl);
1306
+            $img_arr['path'] = $uploads_path.'/'.$file_name;
1307 1307
             $width = 0;
1308 1308
             $height = 0;
1309 1309
             if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
                 $file_name = $file_info['basename'];
1347 1347
 
1348 1348
                 $img_arr['src'] = $default_img;
1349
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1349
+                $img_arr['path'] = $uploads_path.'/'.$file_name;
1350 1350
 
1351 1351
                 $width = 0;
1352 1352
                 $height = 0;
@@ -1363,7 +1363,7 @@  discard block
 block discarded – undo
1363 1363
         }
1364 1364
 
1365 1365
         if (!empty($img_arr))
1366
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1366
+            return (object) $img_arr; //return (object)array( 'src' => $file_url, 'path' => $file_path );
1367 1367
         else
1368 1368
             return false;
1369 1369
     }
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
 
1427 1427
         $arrImages = $wpdb->get_results(
1428 1428
             $wpdb->prepare(
1429
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ",
1429
+                "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d".$not_featured." ORDER BY menu_order ASC, ID DESC $limit_q ",
1430 1430
                 array('%image%', $post_id)
1431 1431
             )
1432 1432
         );
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
 
1453 1453
                 $file_name = $file_info['basename'];
1454 1454
 
1455
-                $uploads_url = $uploads_baseurl . $sub_dir;
1455
+                $uploads_url = $uploads_baseurl.$sub_dir;
1456 1456
                 /*
1457 1457
                 * Allows the filter of image src for such things as CDN change.
1458 1458
                 *
@@ -1462,8 +1462,8 @@  discard block
 block discarded – undo
1462 1462
                 * @param string $uploads_url The server upload directory url.
1463 1463
                 * @param string $uploads_baseurl The uploads dir base url.
1464 1464
                 */
1465
-                $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1466
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1465
+                $img_arr['src'] = apply_filters('geodir_get_images_src', $uploads_url.'/'.$file_name, $file_name, $uploads_url, $uploads_baseurl);
1466
+                $img_arr['path'] = $uploads_path.'/'.$file_name;
1467 1467
                 $width = 0;
1468 1468
                 $height = 0;
1469 1469
                 if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
@@ -1480,11 +1480,11 @@  discard block
 block discarded – undo
1480 1480
                 $img_arr['content'] = $attechment->content; // add the description to the array
1481 1481
                 $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1482 1482
 
1483
-                $return_arr[] = (object)$img_arr;
1483
+                $return_arr[] = (object) $img_arr;
1484 1484
 
1485 1485
                 $counter++;
1486 1486
             }
1487
-            return (object)$return_arr;
1487
+            return (object) $return_arr;
1488 1488
         } else if ($no_images) {
1489 1489
             $default_img = '';
1490 1490
             $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
@@ -1523,7 +1523,7 @@  discard block
 block discarded – undo
1523 1523
                 $img_arr['title'] = $file_info['filename']; // add the title to the array
1524 1524
                 $img_arr['content'] = $file_info['filename']; // add the description to the array
1525 1525
 
1526
-                $return_arr[] = (object)$img_arr;
1526
+                $return_arr[] = (object) $img_arr;
1527 1527
 
1528 1528
                 return $return_arr;
1529 1529
             } else
@@ -1550,8 +1550,8 @@  discard block
 block discarded – undo
1550 1550
 
1551 1551
         $html = '';
1552 1552
         if (!empty($request)) {
1553
-            if (!is_object($request)){
1554
-                $request = (object)$request;
1553
+            if (!is_object($request)) {
1554
+                $request = (object) $request;
1555 1555
             }
1556 1556
 
1557 1557
             if (isset($request->src) && !isset($request->path)) {
@@ -1565,7 +1565,7 @@  discard block
 block discarded – undo
1565 1565
             $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1566 1566
             $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1567 1567
             if (strpos($img_no_http, $upload_no_http) !== false) {
1568
-                $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);
1568
+                $request->path = str_replace($img_no_http, $upload_dir['basedir'], $request->path);
1569 1569
             }
1570 1570
             
1571 1571
             $width = 0;
@@ -1580,7 +1580,7 @@  discard block
 block discarded – undo
1580 1580
             $image->width = $width;
1581 1581
             $image->height = $height;
1582 1582
 
1583
-            $max_size = (object)geodir_get_imagesize($size);
1583
+            $max_size = (object) geodir_get_imagesize($size);
1584 1584
 
1585 1585
             if (!is_wp_error($max_size)) {
1586 1586
                 if ($image->width) {
@@ -1592,15 +1592,15 @@  discard block
 block discarded – undo
1592 1592
                         $width_per = 100;
1593 1593
                 }
1594 1594
 
1595
-                if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1596
-                    $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1595
+                if (is_admin() && !isset($_REQUEST['geodir_ajax'])) {
1596
+                    $html = '<div class="geodir_thumbnail"><img style="max-height:'.$max_size->h.'px;" alt="place image" src="'.$image->src.'"  /></div>';
1597 1597
                 } else {
1598
-                    if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
1599
-                        $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1600
-                    }else{
1598
+                    if ($size == 'widget-thumb' || !get_option('geodir_lazy_load', 1)) {
1599
+                        $html = '<div class="geodir_thumbnail" style="background-image:url(\''.$image->src.'\');"></div>';
1600
+                    } else {
1601 1601
                         //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1602 1602
                         //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';
1603
-                        $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
1603
+                        $html = '<div data-src="'.str_replace(' ', '%20', $image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
1604 1604
 
1605 1605
                     }
1606 1606
 
@@ -1636,15 +1636,15 @@  discard block
 block discarded – undo
1636 1636
 
1637 1637
         $post_type = get_post_type($post_id);
1638 1638
 
1639
-        $table = $plugin_prefix . $post_type . '_detail';
1639
+        $table = $plugin_prefix.$post_type.'_detail';
1640 1640
 
1641 1641
         if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
1642 1642
 
1643
-            if ($taxonomy == $post_type . '_tags') {
1643
+            if ($taxonomy == $post_type.'_tags') {
1644 1644
                 if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1645 1645
                     geodir_save_post_meta($post_id, 'post_tags', $terms);
1646 1646
                 }
1647
-            } elseif ($taxonomy == $post_type . 'category') {
1647
+            } elseif ($taxonomy == $post_type.'category') {
1648 1648
                 $srcharr = array('"', '\\');
1649 1649
                 $replarr = array("&quot;", '');
1650 1650
 
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
 
1667 1667
                     $wpdb->get_var(
1668 1668
                         $wpdb->prepare(
1669
-                            "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",
1669
+                            "DELETE from ".GEODIR_ICON_TABLE." WHERE cat_id NOT IN ($format) AND post_id = %d ",
1670 1670
                             $cat_ids_array_del
1671 1671
                         )
1672 1672
                     );
@@ -1674,7 +1674,7 @@  discard block
 block discarded – undo
1674 1674
 
1675 1675
                     $post_term = $wpdb->get_col(
1676 1676
                         $wpdb->prepare(
1677
-                            "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1677
+                            "SELECT term_id FROM ".$wpdb->term_taxonomy." WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1678 1678
                             $cat_ids_array
1679 1679
                         )
1680 1680
                     );
@@ -1696,16 +1696,16 @@  discard block
 block discarded – undo
1696 1696
                         $lat = geodir_get_post_meta($post_id, 'post_latitude', true);
1697 1697
                         $lng = geodir_get_post_meta($post_id, 'post_longitude', true);
1698 1698
 
1699
-                        $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1700
-                        $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);
1699
+                        $timing = ' - '.date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1700
+                        $timing .= ' - '.geodir_get_post_meta($post_id, 'st_time', true);
1701 1701
 
1702 1702
                         $json = '{';
1703
-                        $json .= '"id":"' . $post_id . '",';
1704
-                        $json .= '"lat_pos": "' . $lat . '",';
1705
-                        $json .= '"long_pos": "' . $lng . '",';
1706
-                        $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';
1707
-                        $json .= '"icon":"' . $term_icon . '",';
1708
-                        $json .= '"group":"catgroup' . $cat_id . '"';
1703
+                        $json .= '"id":"'.$post_id.'",';
1704
+                        $json .= '"lat_pos": "'.$lat.'",';
1705
+                        $json .= '"long_pos": "'.$lng.'",';
1706
+                        $json .= '"marker_id":"'.$post_id.'_'.$cat_id.'",';
1707
+                        $json .= '"icon":"'.$term_icon.'",';
1708
+                        $json .= '"group":"catgroup'.$cat_id.'"';
1709 1709
                         $json .= '}';
1710 1710
 
1711 1711
 
@@ -1713,9 +1713,9 @@  discard block
 block discarded – undo
1713 1713
                             $post_marker_json = $json;
1714 1714
 
1715 1715
 
1716
-                        if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
1716
+                        if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".GEODIR_ICON_TABLE." WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
1717 1717
 
1718
-                            $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
1718
+                            $json_query = $wpdb->prepare("UPDATE ".GEODIR_ICON_TABLE." SET
1719 1719
 										post_title = %s,
1720 1720
 										json = %s
1721 1721
 										WHERE post_id = %d AND cat_id = %d ",
@@ -1723,7 +1723,7 @@  discard block
 block discarded – undo
1723 1723
 
1724 1724
                         } else {
1725 1725
 
1726
-                            $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
1726
+                            $json_query = $wpdb->prepare("INSERT INTO ".GEODIR_ICON_TABLE." SET
1727 1727
 										post_id = %d,
1728 1728
 										post_title = %s,
1729 1729
 										cat_id = %d,
@@ -1741,17 +1741,17 @@  discard block
 block discarded – undo
1741 1741
                 if (!empty($post_term) && is_array($post_term)) {
1742 1742
                     $categories = implode(',', $post_term);
1743 1743
 
1744
-                    if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1744
+                    if ($categories != '' && $categories != 0) $categories = ','.$categories.',';
1745 1745
 
1746 1746
                     if (empty($post_marker_json))
1747 1747
                         $post_marker_json = isset($json) ? $json : '';
1748 1748
 
1749
-                    if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1749
+                    if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
1750 1750
 
1751 1751
                         $wpdb->query(
1752 1752
                             $wpdb->prepare(
1753
-                                "UPDATE " . $table . " SET
1754
-								" . $taxonomy . " = %s,
1753
+                                "UPDATE ".$table." SET
1754
+								" . $taxonomy." = %s,
1755 1755
 								marker_json = %s
1756 1756
 								where post_id = %d",
1757 1757
                                 array($categories, $post_marker_json, $post_id)
@@ -1772,7 +1772,7 @@  discard block
 block discarded – undo
1772 1772
 
1773 1773
                                     $wpdb->query(
1774 1774
                                         $wpdb->prepare(
1775
-                                            "UPDATE " . $table . " SET
1775
+                                            "UPDATE ".$table." SET
1776 1776
 											default_category = %s
1777 1777
 											where post_id = %d",
1778 1778
                                             array($categories[0], $post_id)
@@ -1797,9 +1797,9 @@  discard block
 block discarded – undo
1797 1797
 
1798 1798
                         $wpdb->query(
1799 1799
                             $wpdb->prepare(
1800
-                                "INSERT INTO " . $table . " SET
1800
+                                "INSERT INTO ".$table." SET
1801 1801
 								post_id = %d,
1802
-								" . $taxonomy . " = %s,
1802
+								" . $taxonomy." = %s,
1803 1803
 								marker_json = %s ",
1804 1804
 
1805 1805
                                 array($post_id, $categories, $post_marker_json)
@@ -1922,7 +1922,7 @@  discard block
 block discarded – undo
1922 1922
                                     } ?>"><img alt="bubble image" style="max-height:50px;"
1923 1923
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1924 1924
                             <?php
1925
-                            }else{
1925
+                            } else {
1926 1926
                                 echo '<div class="geodir-bubble_image"></div>';
1927 1927
                             }
1928 1928
                         } else {
@@ -1930,7 +1930,7 @@  discard block
 block discarded – undo
1930 1930
                                 ?>
1931 1931
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1932 1932
                             <?php
1933
-                            }else{
1933
+                            } else {
1934 1934
                                 echo '<div class="geodir-bubble_image"></div>';
1935 1935
                             }
1936 1936
                         }
@@ -1963,7 +1963,7 @@  discard block
 block discarded – undo
1963 1963
                              * @param object $postinfo_obj The posts info as an object.
1964 1964
                              * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1965 1965
                              */
1966
-                            do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1966
+                            do_action('geodir_infowindow_meta_after', $postinfo_obj, $post_preview);
1967 1967
                             ?>
1968 1968
                         </div>
1969 1969
                         <?php
@@ -1975,10 +1975,10 @@  discard block
 block discarded – undo
1975 1975
                             <div class="geodir-bubble-meta-fade"></div>
1976 1976
 
1977 1977
                             <div class="geodir-bubble-meta-bottom">
1978
-                                <span class="geodir-bubble-rating"><?php echo $rating_star;?></span>
1978
+                                <span class="geodir-bubble-rating"><?php echo $rating_star; ?></span>
1979 1979
 
1980 1980
                                 <span
1981
-                                    class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID);?></span>
1981
+                                    class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID); ?></span>
1982 1982
                   <span class="geodir-bubble-reviews"><a href="<?php echo get_comments_link($ID); ?>"
1983 1983
                                                          class="geodir-pcomments"><i class="fa fa-comments"></i>
1984 1984
                           <?php echo get_comments_number($ID); ?>
@@ -2043,11 +2043,11 @@  discard block
 block discarded – undo
2043 2043
 
2044 2044
         $post_type = get_post_type($post_id);
2045 2045
 
2046
-        $table = $plugin_prefix . $post_type . '_detail';
2046
+        $table = $plugin_prefix.$post_type.'_detail';
2047 2047
 
2048 2048
         $wpdb->query(
2049 2049
             $wpdb->prepare(
2050
-                "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",
2050
+                "UPDATE ".$table." SET post_status=%s WHERE post_id=%d",
2051 2051
                 array($status, $post_id)
2052 2052
             )
2053 2053
         );
@@ -2119,18 +2119,18 @@  discard block
 block discarded – undo
2119 2119
 
2120 2120
         $post_type = get_post_type($post_id);
2121 2121
 
2122
-        $table = $plugin_prefix . $post_type . '_detail';
2122
+        $table = $plugin_prefix.$post_type.'_detail';
2123 2123
 
2124 2124
         $wpdb->query(
2125 2125
             $wpdb->prepare(
2126
-                "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",
2126
+                "UPDATE ".$table." SET `post_id` = %d WHERE `post_id` = %d",
2127 2127
                 array($updatingpost, $temppost)
2128 2128
             )
2129 2129
         );
2130 2130
 
2131 2131
         $wpdb->query(
2132 2132
             $wpdb->prepare(
2133
-                "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2133
+                "UPDATE ".GEODIR_ICON_TABLE." SET `post_id` = %d WHERE `post_id` = %d",
2134 2134
                 array($updatingpost, $temppost)
2135 2135
             )
2136 2136
         );
@@ -2139,7 +2139,7 @@  discard block
 block discarded – undo
2139 2139
 
2140 2140
         $wpdb->query(
2141 2141
             $wpdb->prepare(
2142
-                "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2142
+                "UPDATE ".GEODIR_ATTACHMENT_TABLE." SET `post_id` = %d WHERE `post_id` = %d",
2143 2143
                 array($updatingpost, $temppost)
2144 2144
             )
2145 2145
         );
@@ -2177,12 +2177,12 @@  discard block
 block discarded – undo
2177 2177
         if (!in_array($post_type, $all_postypes))
2178 2178
             return false;
2179 2179
 
2180
-        $table = $plugin_prefix . $post_type . '_detail';
2180
+        $table = $plugin_prefix.$post_type.'_detail';
2181 2181
 
2182 2182
         /* Delete custom post meta*/
2183 2183
         $wpdb->query(
2184 2184
             $wpdb->prepare(
2185
-                "DELETE FROM " . $table . " WHERE `post_id` = %d",
2185
+                "DELETE FROM ".$table." WHERE `post_id` = %d",
2186 2186
                 array($deleted_postid)
2187 2187
             )
2188 2188
         );
@@ -2191,7 +2191,7 @@  discard block
 block discarded – undo
2191 2191
 
2192 2192
         $wpdb->query(
2193 2193
             $wpdb->prepare(
2194
-                "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",
2194
+                "DELETE FROM ".GEODIR_ICON_TABLE." WHERE `post_id` = %d",
2195 2195
                 array($deleted_postid)
2196 2196
             )
2197 2197
         );
@@ -2201,7 +2201,7 @@  discard block
 block discarded – undo
2201 2201
 
2202 2202
         $wpdb->query(
2203 2203
             $wpdb->prepare(
2204
-                "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",
2204
+                "DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE `post_id` = %d",
2205 2205
                 array($deleted_postid)
2206 2206
             )
2207 2207
         );
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
          */
2274 2274
         do_action('geodir_before_add_from_favorite', $post_id);
2275 2275
 
2276
-        echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2276
+        echo '<a href="javascript:void(0);" title="'.$remove_favourite_text.'" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\''.$post_id.'\',\'remove\');"><i class="'.$favourite_icon.'"></i> '.$unfavourite_text.'</a>';
2277 2277
 
2278 2278
         /**
2279 2279
          * Called after adding the post from favourites.
@@ -2352,7 +2352,7 @@  discard block
 block discarded – undo
2352 2352
          */
2353 2353
         do_action('geodir_before_remove_from_favorite', $post_id);
2354 2354
 
2355
-        echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2355
+        echo '<a href="javascript:void(0);"  title="'.$add_favourite_text.'" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\''.$post_id.'\',\'add\');"><i class="'.$favourite_icon.'"></i> '.$favourite_text.'</a>';
2356 2356
 
2357 2357
         /**
2358 2358
          * Called after removing the post from favourites.
@@ -2447,24 +2447,24 @@  discard block
 block discarded – undo
2447 2447
             $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2448 2448
 
2449 2449
         if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2450
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2450
+            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"  ><a
2451 2451
                 class="geodir-removetofav-icon" href="javascript:void(0);"
2452
-                onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');"
2453
-                title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?>
2452
+                onclick="javascript:addToFavourite(<?php echo $post_id; ?>,'remove');"
2453
+                title="<?php echo $remove_favourite_text; ?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text; ?>
2454 2454
             </a>   </span><?php
2455 2455
 
2456 2456
         } else {
2457 2457
 
2458 2458
             if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2459
-                $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2459
+                $script_text = 'javascript:window.location.href=\''.geodir_login_url().'\'';
2460 2460
             } else
2461
-                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2461
+                $script_text = 'javascript:addToFavourite('.$post_id.',\'add\')';
2462 2462
 
2463
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2463
+            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"><a class="geodir-addtofav-icon"
2464 2464
                                                                                         href="javascript:void(0);"
2465
-                                                                                        onclick="<?php echo $script_text;?>"
2466
-                                                                                        title="<?php echo $add_favourite_text;?>"><i
2467
-                    class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span>
2465
+                                                                                        onclick="<?php echo $script_text; ?>"
2466
+                                                                                        title="<?php echo $add_favourite_text; ?>"><i
2467
+                    class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text; ?></a></span>
2468 2468
         <?php }
2469 2469
     }
2470 2470
 }
@@ -2494,7 +2494,7 @@  discard block
 block discarded – undo
2494 2494
 
2495 2495
             $post_type = $taxonomy_obj->object_type[0];
2496 2496
 
2497
-            $table = $plugin_prefix . $post_type . '_detail';
2497
+            $table = $plugin_prefix.$post_type.'_detail';
2498 2498
 
2499 2499
             /**
2500 2500
              * Filter to modify the 'join' query
@@ -2517,8 +2517,8 @@  discard block
 block discarded – undo
2517 2517
             $where = apply_filters('geodir_cat_post_count_where', $where, $term);
2518 2518
 
2519 2519
             $count_query = "SELECT count(post_id) FROM
2520
-							" . $table . " as pd " . $join . "
2521
-							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
2520
+							" . $table." as pd ".$join."
2521
+							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id."',".$term->taxonomy.") ".$where;
2522 2522
 
2523 2523
             $cat_post_count = $wpdb->get_var($count_query);
2524 2524
             if (empty($cat_post_count) || is_wp_error($cat_post_count))
@@ -2601,7 +2601,7 @@  discard block
 block discarded – undo
2601 2601
     global $post;
2602 2602
     $all_postypes = geodir_get_posttypes();
2603 2603
     if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
2604
-        return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';
2604
+        return ' <a href="'.get_permalink($post->ID).'">'.READ_MORE_TXT.'</a>';
2605 2605
     }
2606 2606
 
2607 2607
     return $more;
@@ -2628,14 +2628,14 @@  discard block
 block discarded – undo
2628 2628
     if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
2629 2629
 
2630 2630
         $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
2631
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
2631
+        $table = $plugin_prefix.$geodir_post_type.'_detail';
2632 2632
 
2633 2633
         $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
2634
-        $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
2634
+        $term_icon = $path_parts['dirname'].'/cat_icon_'.$term_id.'.png';
2635 2635
 
2636 2636
         $posts = $wpdb->get_results(
2637 2637
             $wpdb->prepare(
2638
-                "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",
2638
+                "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM ".$table." WHERE FIND_IN_SET(%s,%1\$s ) ",
2639 2639
                 array($term_id, $taxonomy)
2640 2640
             )
2641 2641
         );
@@ -2647,19 +2647,19 @@  discard block
 block discarded – undo
2647 2647
                 $lng = $post_obj->post_longitude;
2648 2648
 
2649 2649
                 $json = '{';
2650
-                $json .= '"id":"' . $post_obj->post_id . '",';
2651
-                $json .= '"lat_pos": "' . $lat . '",';
2652
-                $json .= '"long_pos": "' . $lng . '",';
2653
-                $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
2654
-                $json .= '"icon":"' . $term_icon . '",';
2655
-                $json .= '"group":"catgroup' . $term_id . '"';
2650
+                $json .= '"id":"'.$post_obj->post_id.'",';
2651
+                $json .= '"lat_pos": "'.$lat.'",';
2652
+                $json .= '"long_pos": "'.$lng.'",';
2653
+                $json .= '"marker_id":"'.$post_obj->post_id.'_'.$term_id.'",';
2654
+                $json .= '"icon":"'.$term_icon.'",';
2655
+                $json .= '"group":"catgroup'.$term_id.'"';
2656 2656
                 $json .= '}';
2657 2657
 
2658 2658
                 if ($post_obj->default_category == $term_id) {
2659 2659
 
2660 2660
                     $wpdb->query(
2661 2661
                         $wpdb->prepare(
2662
-                            "UPDATE " . $table . " SET marker_json = %s where post_id = %d",
2662
+                            "UPDATE ".$table." SET marker_json = %s where post_id = %d",
2663 2663
                             array($json, $post_obj->post_id)
2664 2664
                         )
2665 2665
                     );
@@ -2667,7 +2667,7 @@  discard block
 block discarded – undo
2667 2667
 
2668 2668
                 $wpdb->query(
2669 2669
                     $wpdb->prepare(
2670
-                        "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",
2670
+                        "UPDATE ".GEODIR_ICON_TABLE." SET json = %s WHERE post_id = %d AND cat_id = %d",
2671 2671
                         array($json, $post_obj->post_id, $term_id)
2672 2672
                     )
2673 2673
                 );
@@ -2791,7 +2791,7 @@  discard block
 block discarded – undo
2791 2791
 //	print_r($uploads ) ;
2792 2792
     $post_first_image = $wpdb->get_results(
2793 2793
         $wpdb->prepare(
2794
-            "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1  ", array($post_id)
2794
+            "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d and menu_order = 1  ", array($post_id)
2795 2795
         )
2796 2796
     );
2797 2797
 
@@ -2812,9 +2812,9 @@  discard block
 block discarded – undo
2812 2812
 
2813 2813
         $post_type = get_post_type($post_id);
2814 2814
 
2815
-        $table_name = $plugin_prefix . $post_type . '_detail';
2815
+        $table_name = $plugin_prefix.$post_type.'_detail';
2816 2816
 
2817
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
2817
+        $wpdb->query("UPDATE ".$table_name." SET featured_image='".$post_first_image[0]->file."' WHERE post_id =".$post_id);
2818 2818
 
2819 2819
         $new_attachment_name = basename($post_first_image[0]->file);
2820 2820
 
@@ -2827,11 +2827,11 @@  discard block
 block discarded – undo
2827 2827
                 wp_delete_attachment($post_thumbnail_id);
2828 2828
 
2829 2829
             }
2830
-            $filename = $uploads['basedir'] . $post_first_image[0]->file;
2830
+            $filename = $uploads['basedir'].$post_first_image[0]->file;
2831 2831
 
2832 2832
             $attachment = array(
2833 2833
                 'post_mime_type' => $post_first_image[0]->mime_type,
2834
-                'guid' => $uploads['baseurl'] . $post_first_image[0]->file,
2834
+                'guid' => $uploads['baseurl'].$post_first_image[0]->file,
2835 2835
                 'post_parent' => $post_id,
2836 2836
                 'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
2837 2837
                 'post_content' => ''
@@ -2844,7 +2844,7 @@  discard block
 block discarded – undo
2844 2844
 
2845 2845
                 set_post_thumbnail($post_id, $id);
2846 2846
 
2847
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
2847
+                require_once(ABSPATH.'wp-admin/includes/image.php');
2848 2848
                 wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
2849 2849
 
2850 2850
             }
@@ -2877,35 +2877,35 @@  discard block
 block discarded – undo
2877 2877
         $post_id = absint($_POST['post_id']);
2878 2878
         $upload_dir = wp_upload_dir();
2879 2879
         $post_type = get_post_type($_POST['post_id']);
2880
-        $table = $plugin_prefix . $post_type . '_detail';
2880
+        $table = $plugin_prefix.$post_type.'_detail';
2881 2881
 
2882 2882
         $post_arr = $wpdb->get_results($wpdb->prepare(
2883
-            "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2883
+            "SELECT * FROM $wpdb->posts p JOIN ".$table." gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2884 2884
             array($post_id)
2885 2885
         )
2886 2886
             , ARRAY_A);
2887 2887
 
2888 2888
         $arrImages = $wpdb->get_results(
2889 2889
             $wpdb->prepare(
2890
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2890
+                "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2891 2891
                 array('%image%', $post_id)
2892 2892
             )
2893 2893
         );
2894 2894
         if ($arrImages) {
2895 2895
             $image_arr = array();
2896 2896
             foreach ($arrImages as $img) {
2897
-                $image_arr[] = $upload_dir['baseurl'] . $img->file;
2897
+                $image_arr[] = $upload_dir['baseurl'].$img->file;
2898 2898
             }
2899 2899
             $comma_separated = implode(",", $image_arr);
2900 2900
             $post_arr[0]['post_images'] = $comma_separated;
2901 2901
         }
2902 2902
 
2903 2903
 
2904
-        $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];
2904
+        $cats = $post_arr[0][$post_arr[0]['post_type'].'category'];
2905 2905
         $cat_arr = array_filter(explode(",", $cats));
2906 2906
         $trans_cat = array();
2907 2907
         foreach ($cat_arr as $cat) {
2908
-            $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);
2908
+            $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'].'category', false);
2909 2909
         }
2910 2910
 
2911 2911
 
@@ -2947,7 +2947,7 @@  discard block
 block discarded – undo
2947 2947
 
2948 2948
     $get_data = $wpdb->get_results(
2949 2949
         $wpdb->prepare(
2950
-            "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",
2950
+            "SELECT htmlvar_name, field_type, extra_fields FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND is_active='1'",
2951 2951
             array($listing_type)
2952 2952
         )
2953 2953
     );
@@ -2960,12 +2960,12 @@  discard block
 block discarded – undo
2960 2960
 
2961 2961
                 $extra_fields = unserialize($data->extra_fields);
2962 2962
 
2963
-                $prefix = $data->htmlvar_name . '_';
2963
+                $prefix = $data->htmlvar_name.'_';
2964 2964
 
2965
-                $fields_info[$prefix . 'address'] = $data->field_type;
2965
+                $fields_info[$prefix.'address'] = $data->field_type;
2966 2966
 
2967 2967
                 if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2968
-                    $fields_info[$prefix . 'zip'] = $data->field_type;
2968
+                    $fields_info[$prefix.'zip'] = $data->field_type;
2969 2969
 
2970 2970
             } else {
2971 2971
 
@@ -3063,13 +3063,13 @@  discard block
 block discarded – undo
3063 3063
  * @since 1.4.9
3064 3064
  * @package GeoDirectory
3065 3065
  */
3066
-function geodir_fb_like_thumbnail(){
3066
+function geodir_fb_like_thumbnail() {
3067 3067
 
3068 3068
     // return if not a single post
3069
-    if(!is_single()){return;}
3069
+    if (!is_single()) {return; }
3070 3070
 
3071 3071
     global $post;
3072
-    if(isset($post->featured_image) && $post->featured_image){
3072
+    if (isset($post->featured_image) && $post->featured_image) {
3073 3073
         $upload_dir = wp_upload_dir();
3074 3074
         $thumb = $upload_dir['baseurl'].$post->featured_image;
3075 3075
         echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_functions.php 2 patches
Indentation   +2150 added lines, -2150 removed lines patch added patch discarded remove patch
@@ -10,52 +10,52 @@  discard block
 block discarded – undo
10 10
 global $wpdb, $table_prefix;
11 11
 
12 12
 if (!function_exists('geodir_column_exist')) {
13
-    /**
14
-     * Check table column exist or not.
15
-     *
16
-     * @since 1.0.0
17
-     * @package GeoDirectory
18
-     * @global object $wpdb WordPress Database object.
19
-     * @param string $db The table name.
20
-     * @param string $column The column name.
21
-     * @return bool If column exists returns true. Otherwise false.
22
-     */
23
-    function geodir_column_exist($db, $column)
24
-    {
25
-        global $wpdb;
26
-        $exists = false;
27
-        $columns = $wpdb->get_col("show columns from $db");
28
-        foreach ($columns as $c) {
29
-            if ($c == $column) {
30
-                $exists = true;
31
-                break;
32
-            }
33
-        }
34
-        return $exists;
35
-    }
13
+	/**
14
+	 * Check table column exist or not.
15
+	 *
16
+	 * @since 1.0.0
17
+	 * @package GeoDirectory
18
+	 * @global object $wpdb WordPress Database object.
19
+	 * @param string $db The table name.
20
+	 * @param string $column The column name.
21
+	 * @return bool If column exists returns true. Otherwise false.
22
+	 */
23
+	function geodir_column_exist($db, $column)
24
+	{
25
+		global $wpdb;
26
+		$exists = false;
27
+		$columns = $wpdb->get_col("show columns from $db");
28
+		foreach ($columns as $c) {
29
+			if ($c == $column) {
30
+				$exists = true;
31
+				break;
32
+			}
33
+		}
34
+		return $exists;
35
+	}
36 36
 }
37 37
 
38 38
 if (!function_exists('geodir_add_column_if_not_exist')) {
39
-    /**
40
-     * Add column if table column not exist.
41
-     *
42
-     * @since 1.0.0
43
-     * @package GeoDirectory
44
-     * @global object $wpdb WordPress Database object.
45
-     * @param string $db The table name.
46
-     * @param string $column The column name.
47
-     * @param string $column_attr The column attributes.
48
-     */
49
-    function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50
-    {
51
-        global $wpdb;
52
-        $result = 0;// no rows affected
53
-        if (!geodir_column_exist($db, $column)) {
54
-            if (!empty($db) && !empty($column))
55
-                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
-        }
57
-        return $result;
58
-    }
39
+	/**
40
+	 * Add column if table column not exist.
41
+	 *
42
+	 * @since 1.0.0
43
+	 * @package GeoDirectory
44
+	 * @global object $wpdb WordPress Database object.
45
+	 * @param string $db The table name.
46
+	 * @param string $column The column name.
47
+	 * @param string $column_attr The column attributes.
48
+	 */
49
+	function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50
+	{
51
+		global $wpdb;
52
+		$result = 0;// no rows affected
53
+		if (!geodir_column_exist($db, $column)) {
54
+			if (!empty($db) && !empty($column))
55
+				$result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
+		}
57
+		return $result;
58
+	}
59 59
 }
60 60
 
61 61
 /**
@@ -72,705 +72,705 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function geodir_post_custom_fields($package_id = '', $default = 'all', $post_type = 'gd_place', $fields_location = 'none')
74 74
 {
75
-    global $wpdb, $geodir_post_custom_fields_cache;
76
-
77
-    $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
78
-
79
-    if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80
-        return $geodir_post_custom_fields_cache[$cache_stored];
81
-    }
82
-
83
-    $default_query = '';
84
-
85
-    if ($default == 'default')
86
-        $default_query .= " and is_admin IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query .= " and is_admin = '0' ";
89
-
90
-    if ($fields_location == 'none') {
91
-    } else{
92
-        $fields_location = esc_sql( $fields_location );
93
-        $default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
94
-    }
95
-
96
-    $post_meta_info = $wpdb->get_results(
97
-        $wpdb->prepare(
98
-            "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99
-            array($post_type)
100
-        )
101
-    );
102
-
103
-
104
-    $return_arr = array();
105
-    if ($post_meta_info) {
106
-
107
-        foreach ($post_meta_info as $post_meta_info_obj) {
108
-
109
-            $custom_fields = array(
110
-                "name" => $post_meta_info_obj->htmlvar_name,
111
-                "label" => $post_meta_info_obj->clabels,
112
-                "default" => $post_meta_info_obj->default_value,
113
-                "type" => $post_meta_info_obj->field_type,
114
-                "desc" => $post_meta_info_obj->admin_desc);
115
-
116
-            if ($post_meta_info_obj->field_type) {
117
-                $options = explode(',', $post_meta_info_obj->option_values);
118
-                $custom_fields["options"] = $options;
119
-            }
120
-
121
-            foreach ($post_meta_info_obj as $key => $val) {
122
-                $custom_fields[$key] = $val;
123
-            }
124
-
125
-            $pricearr = array();
126
-            $pricearr = explode(',', $post_meta_info_obj->packages);
127
-
128
-            if ($package_id != '' && in_array($package_id, $pricearr)) {
129
-                $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
130
-            } elseif ($package_id == '') {
131
-                $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
132
-            }
133
-        }
134
-    }
135
-    $geodir_post_custom_fields_cache[$cache_stored] = $return_arr;
136
-
137
-    if (has_filter('geodir_filter_geodir_post_custom_fields')) {
138
-        /**
139
-         * Filter the post custom fields array.
140
-         *
141
-         * @since 1.0.0
142
-         *
143
-         * @param array $return_arr Post custom fields array.
144
-         * @param int|string $package_id The package ID.
145
-         * @param string $post_type Optional. The wordpress post type.
146
-         * @param string $fields_location Optional. Where exactly are you going to place this custom fields?.
147
-         */
148
-        $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
149
-    }
150
-
151
-    return $return_arr;
75
+	global $wpdb, $geodir_post_custom_fields_cache;
76
+
77
+	$cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
78
+
79
+	if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80
+		return $geodir_post_custom_fields_cache[$cache_stored];
81
+	}
82
+
83
+	$default_query = '';
84
+
85
+	if ($default == 'default')
86
+		$default_query .= " and is_admin IN ('1') ";
87
+	elseif ($default == 'custom')
88
+		$default_query .= " and is_admin = '0' ";
89
+
90
+	if ($fields_location == 'none') {
91
+	} else{
92
+		$fields_location = esc_sql( $fields_location );
93
+		$default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
94
+	}
95
+
96
+	$post_meta_info = $wpdb->get_results(
97
+		$wpdb->prepare(
98
+			"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99
+			array($post_type)
100
+		)
101
+	);
102
+
103
+
104
+	$return_arr = array();
105
+	if ($post_meta_info) {
106
+
107
+		foreach ($post_meta_info as $post_meta_info_obj) {
108
+
109
+			$custom_fields = array(
110
+				"name" => $post_meta_info_obj->htmlvar_name,
111
+				"label" => $post_meta_info_obj->clabels,
112
+				"default" => $post_meta_info_obj->default_value,
113
+				"type" => $post_meta_info_obj->field_type,
114
+				"desc" => $post_meta_info_obj->admin_desc);
115
+
116
+			if ($post_meta_info_obj->field_type) {
117
+				$options = explode(',', $post_meta_info_obj->option_values);
118
+				$custom_fields["options"] = $options;
119
+			}
120
+
121
+			foreach ($post_meta_info_obj as $key => $val) {
122
+				$custom_fields[$key] = $val;
123
+			}
124
+
125
+			$pricearr = array();
126
+			$pricearr = explode(',', $post_meta_info_obj->packages);
127
+
128
+			if ($package_id != '' && in_array($package_id, $pricearr)) {
129
+				$return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
130
+			} elseif ($package_id == '') {
131
+				$return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
132
+			}
133
+		}
134
+	}
135
+	$geodir_post_custom_fields_cache[$cache_stored] = $return_arr;
136
+
137
+	if (has_filter('geodir_filter_geodir_post_custom_fields')) {
138
+		/**
139
+		 * Filter the post custom fields array.
140
+		 *
141
+		 * @since 1.0.0
142
+		 *
143
+		 * @param array $return_arr Post custom fields array.
144
+		 * @param int|string $package_id The package ID.
145
+		 * @param string $post_type Optional. The wordpress post type.
146
+		 * @param string $fields_location Optional. Where exactly are you going to place this custom fields?.
147
+		 */
148
+		$return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
149
+	}
150
+
151
+	return $return_arr;
152 152
 }
153 153
 
154
-    /**
155
-     * Adds admin html for custom fields.
156
-     *
157
-     * @since 1.0.0
158
-     * @package GeoDirectory
159
-     * @global object $wpdb WordPress Database object.
160
-     * @param string $field_type The form field type.
161
-     * @param object|int $result_str The custom field results object or row id.
162
-     * @param string $field_ins_upd When set to "submit" displays form.
163
-     * @param string $field_type_key The key of the custom field.
164
-     */
165
-    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
166
-    {
167
-        global $wpdb;
168
-        $cf = $result_str;
169
-        if (!is_object($cf)) {
170
-
171
-            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
172
-
173
-        } else {
174
-            $field_info = $cf;
175
-            $result_str = $cf->id;
176
-        }
177
-        /**
178
-         * Contains custom field html.
179
-         *
180
-         * @since 1.0.0
181
-         */
182
-        include('custom_field_html.php');
183
-
184
-    }
154
+	/**
155
+	 * Adds admin html for custom fields.
156
+	 *
157
+	 * @since 1.0.0
158
+	 * @package GeoDirectory
159
+	 * @global object $wpdb WordPress Database object.
160
+	 * @param string $field_type The form field type.
161
+	 * @param object|int $result_str The custom field results object or row id.
162
+	 * @param string $field_ins_upd When set to "submit" displays form.
163
+	 * @param string $field_type_key The key of the custom field.
164
+	 */
165
+	function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
166
+	{
167
+		global $wpdb;
168
+		$cf = $result_str;
169
+		if (!is_object($cf)) {
170
+
171
+			$field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
172
+
173
+		} else {
174
+			$field_info = $cf;
175
+			$result_str = $cf->id;
176
+		}
177
+		/**
178
+		 * Contains custom field html.
179
+		 *
180
+		 * @since 1.0.0
181
+		 */
182
+		include('custom_field_html.php');
183
+
184
+	}
185 185
 
186 186
 
187 187
 if (!function_exists('geodir_custom_field_delete')) {
188
-    /**
189
-     * Delete custom field using field id.
190
-     *
191
-     * @since 1.0.0
192
-     * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
193
-     * @package GeoDirectory
194
-     * @global object $wpdb WordPress Database object.
195
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
196
-     * @param string $field_id The custom field ID.
197
-     * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
198
-     */
199
-    function geodir_custom_field_delete($field_id = '') {
200
-        global $wpdb, $plugin_prefix;
201
-
202
-        if ($field_id != '') {
203
-            $cf = trim($field_id, '_');
204
-
205
-            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
-                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
207
-
208
-                $post_type = $field->post_type;
209
-                $htmlvar_name = $field->htmlvar_name;
210
-
211
-                if ($post_type != '' && $htmlvar_name != '') {
212
-                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
213
-                }
214
-
215
-                /**
216
-                 * Called after a custom field is deleted.
217
-                 *
218
-                 * @since 1.0.0
219
-                 * @param string $cf The fields ID.
220
-                 * @param string $field->htmlvar_name The html variable name for the field.
221
-                 * @param string $post_type The post type the field belongs to.
222
-                 */
223
-                do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224
-
225
-                if ($field->field_type == 'address') {
226
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
235
-                } else {
236
-                    if ($field->field_type != 'fieldset') {
237
-                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
238
-                    }
239
-                }
240
-
241
-                return $field_id;
242
-            } else
243
-                return 0;
244
-        } else
245
-            return 0;
246
-    }
188
+	/**
189
+	 * Delete custom field using field id.
190
+	 *
191
+	 * @since 1.0.0
192
+	 * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
193
+	 * @package GeoDirectory
194
+	 * @global object $wpdb WordPress Database object.
195
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
196
+	 * @param string $field_id The custom field ID.
197
+	 * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
198
+	 */
199
+	function geodir_custom_field_delete($field_id = '') {
200
+		global $wpdb, $plugin_prefix;
201
+
202
+		if ($field_id != '') {
203
+			$cf = trim($field_id, '_');
204
+
205
+			if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
+				$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
207
+
208
+				$post_type = $field->post_type;
209
+				$htmlvar_name = $field->htmlvar_name;
210
+
211
+				if ($post_type != '' && $htmlvar_name != '') {
212
+					$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
213
+				}
214
+
215
+				/**
216
+				 * Called after a custom field is deleted.
217
+				 *
218
+				 * @since 1.0.0
219
+				 * @param string $cf The fields ID.
220
+				 * @param string $field->htmlvar_name The html variable name for the field.
221
+				 * @param string $post_type The post type the field belongs to.
222
+				 */
223
+				do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224
+
225
+				if ($field->field_type == 'address') {
226
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
235
+				} else {
236
+					if ($field->field_type != 'fieldset') {
237
+						$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
238
+					}
239
+				}
240
+
241
+				return $field_id;
242
+			} else
243
+				return 0;
244
+		} else
245
+			return 0;
246
+	}
247 247
 }
248 248
 
249 249
 if (!function_exists('geodir_custom_field_save')) {
250
-    /**
251
-     * Save or Update custom fields into the database.
252
-     *
253
-     * @since 1.0.0
254
-     * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
255
-     * @package GeoDirectory
256
-     * @global object $wpdb WordPress Database object.
257
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
258
-     * @param array $request_field {
259
-     *    Attributes of the request field array.
260
-     *
261
-     *    @type string $action Ajax Action name. Default "geodir_ajax_action".
262
-     *    @type string $manage_field_type Field type Default "custom_fields".
263
-     *    @type string $create_field Create field Default "true".
264
-     *    @type string $field_ins_upd Field ins upd Default "submit".
265
-     *    @type string $_wpnonce WP nonce value.
266
-     *    @type string $listing_type Listing type Example "gd_place".
267
-     *    @type string $field_type Field type Example "radio".
268
-     *    @type string $field_id Field id Example "12".
269
-     *    @type string $data_type Data type Example "VARCHAR".
270
-     *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
271
-     *    @type array $show_on_pkg Package list to display this field.
272
-     *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
273
-     *    @type string $site_title Section title which you wish to display in frontend.
274
-     *    @type string $admin_desc Section description which will appear in frontend.
275
-     *    @type string $htmlvar_name Html variable name. This should be a unique name.
276
-     *    @type string $clabels Section Title which will appear in backend.
277
-     *    @type string $default_value The default value (for "link" this will be used as the link text).
278
-     *    @type string $sort_order The display order of this field in backend. e.g. 5.
279
-     *    @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.
280
-     *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
281
-     *    @type string $is_required Use "1" to set field as required.
282
-     *    @type string $required_msg Enter text for error message if field required and have not full fill requirment.
283
-     *    @type string $show_on_listing Want to show this on listing page?.
284
-     *    @type string $show_in What locations to show the custom field in.
285
-     *    @type string $show_on_detail Want to show this in More Info tab on detail page?.
286
-     *    @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes.
287
-     *    @type string $option_values Option Values should be separated by comma.
288
-     *    @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.
289
-     *    @type string $css_class Enter custom css class for field custom style.
290
-     *
291
-     * }
292
-     * @param bool $default Not yet implemented.
293
-     * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
-     */
295
-    function geodir_custom_field_save($request_field = array(), $default = false)
296
-    {
297
-
298
-        global $wpdb, $plugin_prefix;
299
-
300
-        $old_html_variable = '';
301
-
302
-        $data_type = trim($request_field['data_type']);
303
-
304
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
305
-
306
-        // some servers fail if a POST value is VARCHAR so we change it.
307
-        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
308
-            $request_field['data_type'] = 'VARCHAR';
309
-        }
310
-
311
-        $cf = trim($result_str, '_');
312
-
313
-
314
-        /*-------- check dublicate validation --------*/
315
-
316
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
317
-        $post_type = $request_field['listing_type'];
318
-
319
-        if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
320
-            $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
321
-        }
322
-
323
-        $check_html_variable = $wpdb->get_var(
324
-            $wpdb->prepare(
325
-                "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
326
-                array($cf, $cehhtmlvar_name, $post_type)
327
-            )
328
-        );
329
-
330
-
331
-        if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
332
-
333
-            if ($cf != '') {
334
-
335
-                $post_meta_info = $wpdb->get_row(
336
-                    $wpdb->prepare(
337
-                        "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
338
-                        array($cf)
339
-                    )
340
-                );
341
-
342
-            }
343
-
344
-            if (!empty($post_meta_info)) {
345
-                $post_val = $post_meta_info;
346
-                $old_html_variable = $post_val->htmlvar_name;
347
-
348
-            }
349
-
350
-
351
-
352
-            if ($post_type == '') $post_type = 'gd_place';
353
-
354
-
355
-            $detail_table = $plugin_prefix . $post_type . '_detail';
356
-
357
-            $admin_title = $request_field['admin_title'];
358
-            $site_title = $request_field['site_title'];
359
-            $data_type = $request_field['data_type'];
360
-            $field_type = $request_field['field_type'];
361
-            $field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type;
362
-            $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
363
-            $admin_desc = $request_field['admin_desc'];
364
-            $clabels = $request_field['clabels'];
365
-            $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
366
-            $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
367
-            $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
368
-            $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
369
-            $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
370
-            $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
371
-            $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
372
-            $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
373
-            $show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
374
-            $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
375
-            $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
376
-            $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
377
-            $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
378
-            $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
379
-            $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
380
-            $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
250
+	/**
251
+	 * Save or Update custom fields into the database.
252
+	 *
253
+	 * @since 1.0.0
254
+	 * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
255
+	 * @package GeoDirectory
256
+	 * @global object $wpdb WordPress Database object.
257
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
258
+	 * @param array $request_field {
259
+	 *    Attributes of the request field array.
260
+	 *
261
+	 *    @type string $action Ajax Action name. Default "geodir_ajax_action".
262
+	 *    @type string $manage_field_type Field type Default "custom_fields".
263
+	 *    @type string $create_field Create field Default "true".
264
+	 *    @type string $field_ins_upd Field ins upd Default "submit".
265
+	 *    @type string $_wpnonce WP nonce value.
266
+	 *    @type string $listing_type Listing type Example "gd_place".
267
+	 *    @type string $field_type Field type Example "radio".
268
+	 *    @type string $field_id Field id Example "12".
269
+	 *    @type string $data_type Data type Example "VARCHAR".
270
+	 *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
271
+	 *    @type array $show_on_pkg Package list to display this field.
272
+	 *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
273
+	 *    @type string $site_title Section title which you wish to display in frontend.
274
+	 *    @type string $admin_desc Section description which will appear in frontend.
275
+	 *    @type string $htmlvar_name Html variable name. This should be a unique name.
276
+	 *    @type string $clabels Section Title which will appear in backend.
277
+	 *    @type string $default_value The default value (for "link" this will be used as the link text).
278
+	 *    @type string $sort_order The display order of this field in backend. e.g. 5.
279
+	 *    @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.
280
+	 *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
281
+	 *    @type string $is_required Use "1" to set field as required.
282
+	 *    @type string $required_msg Enter text for error message if field required and have not full fill requirment.
283
+	 *    @type string $show_on_listing Want to show this on listing page?.
284
+	 *    @type string $show_in What locations to show the custom field in.
285
+	 *    @type string $show_on_detail Want to show this in More Info tab on detail page?.
286
+	 *    @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes.
287
+	 *    @type string $option_values Option Values should be separated by comma.
288
+	 *    @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.
289
+	 *    @type string $css_class Enter custom css class for field custom style.
290
+	 *
291
+	 * }
292
+	 * @param bool $default Not yet implemented.
293
+	 * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
+	 */
295
+	function geodir_custom_field_save($request_field = array(), $default = false)
296
+	{
297
+
298
+		global $wpdb, $plugin_prefix;
299
+
300
+		$old_html_variable = '';
301
+
302
+		$data_type = trim($request_field['data_type']);
303
+
304
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
305
+
306
+		// some servers fail if a POST value is VARCHAR so we change it.
307
+		if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
308
+			$request_field['data_type'] = 'VARCHAR';
309
+		}
310
+
311
+		$cf = trim($result_str, '_');
312
+
313
+
314
+		/*-------- check dublicate validation --------*/
315
+
316
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
317
+		$post_type = $request_field['listing_type'];
318
+
319
+		if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
320
+			$cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
321
+		}
322
+
323
+		$check_html_variable = $wpdb->get_var(
324
+			$wpdb->prepare(
325
+				"select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
326
+				array($cf, $cehhtmlvar_name, $post_type)
327
+			)
328
+		);
329
+
330
+
331
+		if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
332
+
333
+			if ($cf != '') {
334
+
335
+				$post_meta_info = $wpdb->get_row(
336
+					$wpdb->prepare(
337
+						"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
338
+						array($cf)
339
+					)
340
+				);
341
+
342
+			}
343
+
344
+			if (!empty($post_meta_info)) {
345
+				$post_val = $post_meta_info;
346
+				$old_html_variable = $post_val->htmlvar_name;
347
+
348
+			}
349
+
350
+
351
+
352
+			if ($post_type == '') $post_type = 'gd_place';
353
+
354
+
355
+			$detail_table = $plugin_prefix . $post_type . '_detail';
356
+
357
+			$admin_title = $request_field['admin_title'];
358
+			$site_title = $request_field['site_title'];
359
+			$data_type = $request_field['data_type'];
360
+			$field_type = $request_field['field_type'];
361
+			$field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type;
362
+			$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
363
+			$admin_desc = $request_field['admin_desc'];
364
+			$clabels = $request_field['clabels'];
365
+			$default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
366
+			$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
367
+			$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
368
+			$is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
369
+			$required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
370
+			$css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
371
+			$field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
372
+			$show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
373
+			$show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
374
+			$show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
375
+			$show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
376
+			$decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
377
+			$decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
378
+			$validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
379
+			$validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
380
+			$for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
381 381
 
382 382
             
383
-            if(is_array($show_in)){
384
-                $show_in = implode(",", $request_field['show_in']);
385
-            }
383
+			if(is_array($show_in)){
384
+				$show_in = implode(",", $request_field['show_in']);
385
+			}
386 386
             
387
-            if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
-                $htmlvar_name = 'geodir_' . $htmlvar_name;
389
-            }
387
+			if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
+				$htmlvar_name = 'geodir_' . $htmlvar_name;
389
+			}
390 390
 
391
-            $option_values = '';
392
-            if (isset($request_field['option_values']))
393
-                $option_values = $request_field['option_values'];
391
+			$option_values = '';
392
+			if (isset($request_field['option_values']))
393
+				$option_values = $request_field['option_values'];
394 394
 
395
-            $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
395
+			$cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
396 396
 
397
-            $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
397
+			$cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
398 398
 
399
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
401
-            else {
402
-                $package_info = array();
399
+			if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
+				$price_pkg = implode(",", $request_field['show_on_pkg']);
401
+			else {
402
+				$package_info = array();
403 403
 
404
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
405
-                $price_pkg = $package_info->pid;
406
-            }
404
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
405
+				$price_pkg = $package_info->pid;
406
+			}
407 407
 
408 408
 
409
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
410
-                $extra_fields = $request_field['extra'];
409
+			if (isset($request_field['extra']) && !empty($request_field['extra']))
410
+				$extra_fields = $request_field['extra'];
411 411
 
412
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
413
-                $is_default = $request_field['is_default'];
414
-            else
415
-                $is_default = '0';
412
+			if (isset($request_field['is_default']) && $request_field['is_default'] != '')
413
+				$is_default = $request_field['is_default'];
414
+			else
415
+				$is_default = '0';
416 416
 
417
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
418
-                $is_admin = $request_field['is_admin'];
419
-            else
420
-                $is_admin = '0';
417
+			if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
418
+				$is_admin = $request_field['is_admin'];
419
+			else
420
+				$is_admin = '0';
421 421
 
422 422
 
423
-            if ($is_active == '') $is_active = 1;
424
-            if ($is_required == '') $is_required = 0;
423
+			if ($is_active == '') $is_active = 1;
424
+			if ($is_required == '') $is_required = 0;
425 425
 
426 426
 
427
-            if ($sort_order == '') {
427
+			if ($sort_order == '') {
428 428
 
429
-                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
429
+				$last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
430 430
 
431
-                $sort_order = (int)$last_order + 1;
432
-            }
431
+				$sort_order = (int)$last_order + 1;
432
+			}
433 433
 
434
-            $default_value_add = '';
434
+			$default_value_add = '';
435 435
 
436 436
 
437
-            if (!empty($post_meta_info)) {
438
-                switch ($field_type):
437
+			if (!empty($post_meta_info)) {
438
+				switch ($field_type):
439 439
 
440
-                    case 'address':
440
+					case 'address':
441 441
 
442
-                        if ($htmlvar_name != '') {
443
-                            $prefix = $htmlvar_name . '_';
444
-                        }
445
-                        $old_prefix = $old_html_variable . '_';
442
+						if ($htmlvar_name != '') {
443
+							$prefix = $htmlvar_name . '_';
444
+						}
445
+						$old_prefix = $old_html_variable . '_';
446 446
 
447 447
 
448
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
448
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
449 449
 
450
-                        if ($default_value != '') {
451
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
452
-                        }
450
+						if ($default_value != '') {
451
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
452
+						}
453 453
 
454
-                        $wpdb->query($meta_field_add);
454
+						$wpdb->query($meta_field_add);
455 455
 
456
-                        if ($extra_fields != '') {
456
+						if ($extra_fields != '') {
457 457
 
458
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
458
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
459 459
 
460
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
461
-                                if ($is_column) {
462
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
460
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
461
+								if ($is_column) {
462
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
463 463
 
464
-                                    if ($default_value != '') {
465
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
466
-                                    }
464
+									if ($default_value != '') {
465
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
466
+									}
467 467
 
468
-                                    $wpdb->query($meta_field_add);
469
-                                } else {
468
+									$wpdb->query($meta_field_add);
469
+								} else {
470 470
 
471
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
472
-                                    if ($default_value != '') {
473
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
474
-                                    }
475
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
471
+									$meta_field_add = "VARCHAR( 50 ) NULL";
472
+									if ($default_value != '') {
473
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
474
+									}
475
+									geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
476 476
 
477
-                                }
477
+								}
478 478
 
479 479
 
480
-                            }
480
+							}
481 481
 
482 482
 
483
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
483
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
484 484
 
485
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
485
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
486 486
 
487
-                                if ($is_column) {
488
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
487
+								if ($is_column) {
488
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
489 489
 
490
-                                    if ($default_value != '') {
491
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
492
-                                    }
490
+									if ($default_value != '') {
491
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
492
+									}
493 493
 
494
-                                    $wpdb->query($meta_field_add);
495
-                                } else {
496
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
497
-                                    if ($default_value != '') {
498
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
499
-                                    }
494
+									$wpdb->query($meta_field_add);
495
+								} else {
496
+									$meta_field_add = "VARCHAR( 50 ) NULL";
497
+									if ($default_value != '') {
498
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
499
+									}
500 500
 
501
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
502
-                                }
501
+									geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
502
+								}
503 503
 
504
-                            }
505
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
504
+							}
505
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
506 506
 
507
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
507
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
508 508
 
509
-                                if ($is_column) {
509
+								if ($is_column) {
510 510
 
511
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
511
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
512 512
 
513
-                                    if ($default_value != '') {
514
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
515
-                                    }
513
+									if ($default_value != '') {
514
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
515
+									}
516 516
 
517
-                                    $wpdb->query($meta_field_add);
518
-                                } else {
517
+									$wpdb->query($meta_field_add);
518
+								} else {
519 519
 
520
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
521
-                                    if ($default_value != '') {
522
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
523
-                                    }
520
+									$meta_field_add = "VARCHAR( 50 ) NULL";
521
+									if ($default_value != '') {
522
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
523
+									}
524 524
 
525
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
525
+									geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
526 526
 
527
-                                }
527
+								}
528 528
 
529
-                            }
530
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
529
+							}
530
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
531 531
 
532
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
532
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
533 533
 
534
-                                if ($is_column) {
534
+								if ($is_column) {
535 535
 
536
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
536
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
537 537
 
538
-                                    if ($default_value != '') {
539
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
540
-                                    }
538
+									if ($default_value != '') {
539
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
540
+									}
541 541
 
542
-                                    $wpdb->query($meta_field_add);
543
-                                } else {
542
+									$wpdb->query($meta_field_add);
543
+								} else {
544 544
 
545
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
546
-                                    if ($default_value != '') {
547
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
548
-                                    }
545
+									$meta_field_add = "VARCHAR( 50 ) NULL";
546
+									if ($default_value != '') {
547
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
548
+									}
549 549
 
550
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
550
+									geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
551 551
 
552
-                                }
552
+								}
553 553
 
554
-                            }
555
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
554
+							}
555
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
556 556
 
557
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
558
-                                if ($is_column) {
557
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
558
+								if ($is_column) {
559 559
 
560
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
560
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
561 561
 
562
-                                    if ($default_value != '') {
563
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
564
-                                    }
562
+									if ($default_value != '') {
563
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
564
+									}
565 565
 
566
-                                    $wpdb->query($meta_field_add);
567
-                                } else {
566
+									$wpdb->query($meta_field_add);
567
+								} else {
568 568
 
569
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
570
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
571
-                                    if ($default_value != '') {
572
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
573
-                                    }
569
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
570
+									$meta_field_add = "VARCHAR( 20 ) NULL";
571
+									if ($default_value != '') {
572
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
573
+									}
574 574
 
575
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
575
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
576 576
 
577
-                                }
577
+								}
578 578
 
579 579
 
580
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
580
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
581 581
 
582
-                                if ($is_column) {
583
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
582
+								if ($is_column) {
583
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
584 584
 
585
-                                    if ($default_value != '') {
586
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
587
-                                    }
585
+									if ($default_value != '') {
586
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
587
+									}
588 588
 
589
-                                    $wpdb->query($meta_field_add);
590
-                                } else {
589
+									$wpdb->query($meta_field_add);
590
+								} else {
591 591
 
592
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
593
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
594
-                                    if ($default_value != '') {
595
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
596
-                                    }
592
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
593
+									$meta_field_add = "VARCHAR( 20 ) NULL";
594
+									if ($default_value != '') {
595
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
596
+									}
597 597
 
598
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
599
-                                }
598
+									geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
599
+								}
600 600
 
601
-                            }
602
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
601
+							}
602
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
603 603
 
604
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
604
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
605 605
 
606
-                                if ($is_column) {
607
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
606
+								if ($is_column) {
607
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
608 608
 
609
-                                    if ($default_value != '') {
610
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
611
-                                    }
609
+									if ($default_value != '') {
610
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
611
+									}
612 612
 
613
-                                    $wpdb->query($meta_field_add);
614
-                                } else {
613
+									$wpdb->query($meta_field_add);
614
+								} else {
615 615
 
616
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
616
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
617 617
 
618
-                                    $meta_field_add = "VARCHAR( 15 ) NULL";
619
-                                    if ($default_value != '') {
620
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
621
-                                    }
618
+									$meta_field_add = "VARCHAR( 15 ) NULL";
619
+									if ($default_value != '') {
620
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
621
+									}
622 622
 
623
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
624
-                                }
623
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
624
+								}
625 625
 
626 626
 
627
-                            }
628
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
627
+							}
628
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
629 629
 
630
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
631
-                                if ($is_column) {
632
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
630
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
631
+								if ($is_column) {
632
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
633 633
 
634
-                                    if ($default_value != '') {
635
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
636
-                                    }
634
+									if ($default_value != '') {
635
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
636
+									}
637 637
 
638
-                                    $wpdb->query($meta_field_add);
638
+									$wpdb->query($meta_field_add);
639 639
 
640
-                                } else {
640
+								} else {
641 641
 
642
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
642
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
643 643
 
644
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
645
-                                    if ($default_value != '') {
646
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
647
-                                    }
644
+									$meta_field_add = "VARCHAR( 3 ) NULL";
645
+									if ($default_value != '') {
646
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
647
+									}
648 648
 
649
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
650
-                                }
649
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
650
+								}
651 651
 
652
-                            }
653
-                            // show lat lng
654
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
655
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
652
+							}
653
+							// show lat lng
654
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
655
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
656 656
 
657
-                                if ($is_column) {
658
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
659
-                                    $meta_field_add .= " DEFAULT '1'";
657
+								if ($is_column) {
658
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
659
+									$meta_field_add .= " DEFAULT '1'";
660 660
 
661
-                                    $wpdb->query($meta_field_add);
662
-                                } else {
663
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
661
+									$wpdb->query($meta_field_add);
662
+								} else {
663
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
664 664
 
665
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
666
-                                    $meta_field_add .= " DEFAULT '1'";
665
+									$meta_field_add = "VARCHAR( 3 ) NULL";
666
+									$meta_field_add .= " DEFAULT '1'";
667 667
 
668
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
669
-                                }
668
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
669
+								}
670 670
 
671
-                            }
672
-                        }// end extra
671
+							}
672
+						}// end extra
673 673
 
674
-                        break;
674
+						break;
675 675
 
676
-                    case 'checkbox':
677
-                    case 'multiselect':
678
-                    case 'select':
679
-                    case 'taxonomy':
676
+					case 'checkbox':
677
+					case 'multiselect':
678
+					case 'select':
679
+					case 'taxonomy':
680 680
 
681
-                        $op_size = '500';
681
+						$op_size = '500';
682 682
 
683
-                        // only make the field as big as it needs to be.
684
-                        if(isset($option_values) && $option_values && $field_type=='select'){
685
-                            $option_values_arr = explode(',',$option_values);
686
-                            if(is_array($option_values_arr)){
687
-                                $op_max = 0;
688
-                                foreach($option_values_arr as $op_val){
689
-                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
690
-                                }
691
-                                if($op_max){$op_size =$op_max; }
692
-                            }
693
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694
-                            if(strlen($option_values)){
695
-                                $op_size =  strlen($option_values);
696
-                            }
697
-                        }
683
+						// only make the field as big as it needs to be.
684
+						if(isset($option_values) && $option_values && $field_type=='select'){
685
+							$option_values_arr = explode(',',$option_values);
686
+							if(is_array($option_values_arr)){
687
+								$op_max = 0;
688
+								foreach($option_values_arr as $op_val){
689
+									if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
690
+								}
691
+								if($op_max){$op_size =$op_max; }
692
+							}
693
+						}elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694
+							if(strlen($option_values)){
695
+								$op_size =  strlen($option_values);
696
+							}
697
+						}
698 698
 
699
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
699
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
700 700
 
701
-                        if ($default_value != '') {
702
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
703
-                        }
701
+						if ($default_value != '') {
702
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
703
+						}
704 704
 
705
-                        $alter_result = $wpdb->query($meta_field_add);
706
-                        if($alter_result===false){
707
-                            return __('Column change failed, you may have too many columns.','geodirectory');
708
-                        }
705
+						$alter_result = $wpdb->query($meta_field_add);
706
+						if($alter_result===false){
707
+							return __('Column change failed, you may have too many columns.','geodirectory');
708
+						}
709 709
 
710
-                        if (isset($request_field['cat_display_type']))
711
-                            $extra_fields = $request_field['cat_display_type'];
710
+						if (isset($request_field['cat_display_type']))
711
+							$extra_fields = $request_field['cat_display_type'];
712 712
 
713
-                        if (isset($request_field['multi_display_type']))
714
-                            $extra_fields = $request_field['multi_display_type'];
713
+						if (isset($request_field['multi_display_type']))
714
+							$extra_fields = $request_field['multi_display_type'];
715 715
 
716 716
 
717
-                        break;
717
+						break;
718 718
 
719
-                    case 'textarea':
720
-                    case 'html':
721
-                    case 'url':
722
-                    case 'file':
719
+					case 'textarea':
720
+					case 'html':
721
+					case 'url':
722
+					case 'file':
723 723
 
724
-                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
725
-                        if($alter_result===false){
726
-                            return __('Column change failed, you may have too many columns.','geodirectory');
727
-                        }
728
-                        if (isset($request_field['advanced_editor']))
729
-                            $extra_fields = $request_field['advanced_editor'];
730
-
731
-                        break;
724
+						$alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
725
+						if($alter_result===false){
726
+							return __('Column change failed, you may have too many columns.','geodirectory');
727
+						}
728
+						if (isset($request_field['advanced_editor']))
729
+							$extra_fields = $request_field['advanced_editor'];
730
+
731
+						break;
732 732
 
733
-                    case 'fieldset':
734
-                        // Nothig happend for fieldset
735
-                        break;
733
+					case 'fieldset':
734
+						// Nothig happend for fieldset
735
+						break;
736 736
 
737
-                    default:
738
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
739
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
740
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
741
-                            } else {
742
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
743
-                            }
744
-
745
-                            if (is_numeric($default_value) && $default_value != '') {
746
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
747
-                            }
748
-                        } else {
749
-                            $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
750
-                            if ($default_value != '') {
751
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
752
-                            }
753
-                        }
754
-
755
-                        $alter_result = $wpdb->query($default_value_add);
756
-                        if($alter_result===false){
757
-                            return __('Column change failed, you may have too many columns.','geodirectory');
758
-                        }
759
-                        break;
760
-                endswitch;
761
-
762
-                $extra_field_query = '';
763
-                if (!empty($extra_fields)) {
764
-                    $extra_field_query = serialize($extra_fields);
765
-                }
766
-
767
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
768
-
769
-                $wpdb->query(
770
-
771
-                    $wpdb->prepare(
772
-
773
-                        "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
737
+					default:
738
+						if ($data_type != 'VARCHAR' && $data_type != '') {
739
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
740
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
741
+							} else {
742
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
743
+							}
744
+
745
+							if (is_numeric($default_value) && $default_value != '') {
746
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
747
+							}
748
+						} else {
749
+							$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
750
+							if ($default_value != '') {
751
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
752
+							}
753
+						}
754
+
755
+						$alter_result = $wpdb->query($default_value_add);
756
+						if($alter_result===false){
757
+							return __('Column change failed, you may have too many columns.','geodirectory');
758
+						}
759
+						break;
760
+				endswitch;
761
+
762
+				$extra_field_query = '';
763
+				if (!empty($extra_fields)) {
764
+					$extra_field_query = serialize($extra_fields);
765
+				}
766
+
767
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
768
+
769
+				$wpdb->query(
770
+
771
+					$wpdb->prepare(
772
+
773
+						"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
774 774
 					post_type = %s,
775 775
 					admin_title = %s,
776 776
 					site_title = %s,
@@ -804,308 +804,308 @@  discard block
 block discarded – undo
804 804
 					for_admin_use = %s
805 805
 					where id = %d",
806 806
 
807
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
808
-                    )
807
+						array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
808
+					)
809 809
 
810
-                );
810
+				);
811 811
 
812
-                $lastid = trim($cf);
812
+				$lastid = trim($cf);
813 813
 
814 814
 
815
-                $wpdb->query(
816
-                    $wpdb->prepare(
817
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
815
+				$wpdb->query(
816
+					$wpdb->prepare(
817
+						"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
818 818
 					 	site_title=%s
819 819
 					where post_type = %s and htmlvar_name = %s",
820
-                        array($site_title, $post_type, $htmlvar_name)
821
-                    )
822
-                );
823
-
824
-
825
-                if ($cat_sort == '')
826
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827
-
828
-
829
-                /**
830
-                 * Called after all custom fields are saved for a post.
831
-                 *
832
-                 * @since 1.0.0
833
-                 * @param int $lastid The post ID.
834
-                 */
835
-                do_action('geodir_after_custom_fields_updated', $lastid);
836
-
837
-            } else {
838
-
839
-                switch ($field_type):
840
-
841
-                    case 'address':
842
-
843
-                        $data_type = '';
844
-
845
-                        if ($htmlvar_name != '') {
846
-                            $prefix = $htmlvar_name . '_';
847
-                        }
848
-                        $old_prefix = $old_html_variable;
849
-
850
-                        //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
851
-
852
-                        $meta_field_add = "VARCHAR( 254 ) NULL";
853
-                        if ($default_value != '') {
854
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
855
-                        }
856
-
857
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
858
-                        //$wpdb->query($meta_field_add);
859
-
860
-
861
-                        if (!empty($extra_fields)) {
820
+						array($site_title, $post_type, $htmlvar_name)
821
+					)
822
+				);
823
+
824
+
825
+				if ($cat_sort == '')
826
+					$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827
+
828
+
829
+				/**
830
+				 * Called after all custom fields are saved for a post.
831
+				 *
832
+				 * @since 1.0.0
833
+				 * @param int $lastid The post ID.
834
+				 */
835
+				do_action('geodir_after_custom_fields_updated', $lastid);
836
+
837
+			} else {
838
+
839
+				switch ($field_type):
840
+
841
+					case 'address':
842
+
843
+						$data_type = '';
844
+
845
+						if ($htmlvar_name != '') {
846
+							$prefix = $htmlvar_name . '_';
847
+						}
848
+						$old_prefix = $old_html_variable;
849
+
850
+						//$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
851
+
852
+						$meta_field_add = "VARCHAR( 254 ) NULL";
853
+						if ($default_value != '') {
854
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
855
+						}
856
+
857
+						geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
858
+						//$wpdb->query($meta_field_add);
859
+
860
+
861
+						if (!empty($extra_fields)) {
862 862
 
863
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
864
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
865
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
866
-                                if ($default_value != '') {
867
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
868
-                                }
869
-
870
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
871
-                                //$wpdb->query($meta_field_add);
872
-                            }
873
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
874
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
875
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
876
-                                if ($default_value != '') {
877
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
878
-                                }
879
-
880
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
881
-                                //$wpdb->query($meta_field_add);
882
-                            }
883
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
884
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
885
-
886
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
887
-                                if ($default_value != '') {
888
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
889
-                                }
890
-
891
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
892
-                                //$wpdb->query($meta_field_add);
893
-                            }
894
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
895
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
896
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
897
-                                if ($default_value != '') {
898
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
899
-                                }
900
-
901
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
902
-                                //$wpdb->query($meta_field_add);
903
-                            }
904
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
905
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
906
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
907
-                                if ($default_value != '') {
908
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
909
-                                }
910
-
911
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
912
-                                //$wpdb->query($meta_field_add);
913
-
914
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
915
-
916
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
917
-                                if ($default_value != '') {
918
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
919
-                                }
920
-
921
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
922
-
923
-                                //$wpdb->query($meta_field_add);
924
-                            }
925
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
926
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
927
-
928
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
929
-                                if ($default_value != '') {
930
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
931
-                                }
932
-
933
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
934
-
935
-                                //$wpdb->query($meta_field_add);
936
-                            }
937
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
938
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
939
-
940
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
941
-                                if ($default_value != '') {
942
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
943
-                                }
944
-
945
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
946
-
947
-                                //$wpdb->query($meta_field_add);
948
-                            }
949
-                            // show lat lng
950
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
951
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
952
-
953
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
954
-                                $meta_field_add .= " DEFAULT '1'";
955
-
956
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
957
-                                //$wpdb->query($meta_field_add);
958
-                            }
959
-                        }
960
-
961
-                        break;
962
-
963
-                    case 'checkbox':
964
-                        $data_type = 'TINYINT';
965
-
966
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
967
-                        if ((int)$default_value === 1) {
968
-                            $meta_field_add .= " DEFAULT '1'";
969
-                        }
970
-
971
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
972
-                        if ($add_result === false) {
973
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
974
-                        }
975
-                        break;
976
-                    case 'multiselect':
977
-                    case 'select':
978
-                        $data_type = 'VARCHAR';
979
-                        $op_size = '500';
980
-
981
-                        // only make the field as big as it needs to be.
982
-                        if (isset($option_values) && $option_values && $field_type == 'select') {
983
-                            $option_values_arr = explode(',', $option_values);
984
-
985
-                            if (is_array($option_values_arr)) {
986
-                                $op_max = 0;
987
-
988
-                                foreach ($option_values_arr as $op_val) {
989
-                                    if (strlen($op_val) && strlen($op_val) > $op_max) {
990
-                                        $op_max = strlen($op_val);
991
-                                    }
992
-                                }
993
-
994
-                                if ($op_max) {
995
-                                    $op_size = $op_max;
996
-                                }
997
-                            }
998
-                        } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
999
-                            if (strlen($option_values)) {
1000
-                                $op_size =  strlen($option_values);
1001
-                            }
1002
-
1003
-                            if (isset($request_field['multi_display_type'])) {
1004
-                                $extra_fields = $request_field['multi_display_type'];
1005
-                            }
1006
-                        }
1007
-
1008
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1009
-                        if ($default_value != '') {
1010
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1011
-                        }
1012
-
1013
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1014
-                        if ($add_result === false) {
1015
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1016
-                        }
1017
-                        break;
1018
-                    case 'textarea':
1019
-                    case 'html':
1020
-                    case 'url':
1021
-                    case 'file':
1022
-
1023
-                        $data_type = 'TEXT';
1024
-
1025
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1026
-
1027
-                        $meta_field_add = $data_type . " NULL ";
1028
-                        /*if($default_value != '')
863
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
864
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
865
+								$meta_field_add = "VARCHAR( 30 ) NULL";
866
+								if ($default_value != '') {
867
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
868
+								}
869
+
870
+								geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
871
+								//$wpdb->query($meta_field_add);
872
+							}
873
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
874
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
875
+								$meta_field_add = "VARCHAR( 30 ) NULL";
876
+								if ($default_value != '') {
877
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
878
+								}
879
+
880
+								geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
881
+								//$wpdb->query($meta_field_add);
882
+							}
883
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
884
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
885
+
886
+								$meta_field_add = "VARCHAR( 30 ) NULL";
887
+								if ($default_value != '') {
888
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
889
+								}
890
+
891
+								geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
892
+								//$wpdb->query($meta_field_add);
893
+							}
894
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
895
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
896
+								$meta_field_add = "VARCHAR( 15 ) NULL";
897
+								if ($default_value != '') {
898
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
899
+								}
900
+
901
+								geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
902
+								//$wpdb->query($meta_field_add);
903
+							}
904
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
905
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
906
+								$meta_field_add = "VARCHAR( 20 ) NULL";
907
+								if ($default_value != '') {
908
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
909
+								}
910
+
911
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
912
+								//$wpdb->query($meta_field_add);
913
+
914
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
915
+
916
+								$meta_field_add = "VARCHAR( 20 ) NULL";
917
+								if ($default_value != '') {
918
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
919
+								}
920
+
921
+								geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
922
+
923
+								//$wpdb->query($meta_field_add);
924
+							}
925
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
926
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
927
+
928
+								$meta_field_add = "VARCHAR( 15 ) NULL";
929
+								if ($default_value != '') {
930
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
931
+								}
932
+
933
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
934
+
935
+								//$wpdb->query($meta_field_add);
936
+							}
937
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
938
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
939
+
940
+								$meta_field_add = "VARCHAR( 3 ) NULL";
941
+								if ($default_value != '') {
942
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
943
+								}
944
+
945
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
946
+
947
+								//$wpdb->query($meta_field_add);
948
+							}
949
+							// show lat lng
950
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
951
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
952
+
953
+								$meta_field_add = "VARCHAR( 3 ) NULL";
954
+								$meta_field_add .= " DEFAULT '1'";
955
+
956
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
957
+								//$wpdb->query($meta_field_add);
958
+							}
959
+						}
960
+
961
+						break;
962
+
963
+					case 'checkbox':
964
+						$data_type = 'TINYINT';
965
+
966
+						$meta_field_add = $data_type . "( 1 ) NOT NULL ";
967
+						if ((int)$default_value === 1) {
968
+							$meta_field_add .= " DEFAULT '1'";
969
+						}
970
+
971
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
972
+						if ($add_result === false) {
973
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
974
+						}
975
+						break;
976
+					case 'multiselect':
977
+					case 'select':
978
+						$data_type = 'VARCHAR';
979
+						$op_size = '500';
980
+
981
+						// only make the field as big as it needs to be.
982
+						if (isset($option_values) && $option_values && $field_type == 'select') {
983
+							$option_values_arr = explode(',', $option_values);
984
+
985
+							if (is_array($option_values_arr)) {
986
+								$op_max = 0;
987
+
988
+								foreach ($option_values_arr as $op_val) {
989
+									if (strlen($op_val) && strlen($op_val) > $op_max) {
990
+										$op_max = strlen($op_val);
991
+									}
992
+								}
993
+
994
+								if ($op_max) {
995
+									$op_size = $op_max;
996
+								}
997
+							}
998
+						} elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
999
+							if (strlen($option_values)) {
1000
+								$op_size =  strlen($option_values);
1001
+							}
1002
+
1003
+							if (isset($request_field['multi_display_type'])) {
1004
+								$extra_fields = $request_field['multi_display_type'];
1005
+							}
1006
+						}
1007
+
1008
+						$meta_field_add = $data_type . "( $op_size ) NULL ";
1009
+						if ($default_value != '') {
1010
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
1011
+						}
1012
+
1013
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1014
+						if ($add_result === false) {
1015
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1016
+						}
1017
+						break;
1018
+					case 'textarea':
1019
+					case 'html':
1020
+					case 'url':
1021
+					case 'file':
1022
+
1023
+						$data_type = 'TEXT';
1024
+
1025
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1026
+
1027
+						$meta_field_add = $data_type . " NULL ";
1028
+						/*if($default_value != '')
1029 1029
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1030 1030
 
1031
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1032
-                        if ($add_result === false) {
1033
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1034
-                        }
1031
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1032
+						if ($add_result === false) {
1033
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1034
+						}
1035 1035
 
1036
-                        break;
1036
+						break;
1037 1037
 
1038
-                    case 'datepicker':
1038
+					case 'datepicker':
1039 1039
 
1040
-                        $data_type = 'DATE';
1040
+						$data_type = 'DATE';
1041 1041
 
1042
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1042
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1043 1043
 
1044
-                        $meta_field_add = $data_type . " NULL ";
1044
+						$meta_field_add = $data_type . " NULL ";
1045 1045
 
1046
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1047
-                        if ($add_result === false) {
1048
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1049
-                        }
1046
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1047
+						if ($add_result === false) {
1048
+							return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1049
+						}
1050 1050
 
1051
-                        break;
1051
+						break;
1052 1052
 
1053
-                    case 'time':
1053
+					case 'time':
1054 1054
 
1055
-                        $data_type = 'TIME';
1055
+						$data_type = 'TIME';
1056 1056
 
1057
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1057
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1058 1058
 
1059
-                        $meta_field_add = $data_type . " NULL ";
1059
+						$meta_field_add = $data_type . " NULL ";
1060 1060
 
1061
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1062
-                        if ($add_result === false) {
1063
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1064
-                        }
1061
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1062
+						if ($add_result === false) {
1063
+							return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1064
+						}
1065 1065
 
1066
-                        break;
1066
+						break;
1067 1067
 
1068
-                    default:
1068
+					default:
1069 1069
 
1070
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
1071
-                            $meta_field_add = $data_type . " NULL ";
1070
+						if ($data_type != 'VARCHAR' && $data_type != '') {
1071
+							$meta_field_add = $data_type . " NULL ";
1072 1072
 
1073
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
1074
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1075
-                            }
1073
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
1074
+								$meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1075
+							}
1076 1076
 
1077
-                            if (is_numeric($default_value) && $default_value != '') {
1078
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1079
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1080
-                            }
1081
-                        } else {
1082
-                            $meta_field_add = " VARCHAR( 254 ) NULL ";
1077
+							if (is_numeric($default_value) && $default_value != '') {
1078
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1079
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1080
+							}
1081
+						} else {
1082
+							$meta_field_add = " VARCHAR( 254 ) NULL ";
1083 1083
 
1084
-                            if ($default_value != '') {
1085
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1086
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1087
-                            }
1088
-                        }
1084
+							if ($default_value != '') {
1085
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1086
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1087
+							}
1088
+						}
1089 1089
 
1090
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1091
-                        if ($add_result === false) {
1092
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1093
-                        }
1094
-                        break;
1095
-                endswitch;
1090
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1091
+						if ($add_result === false) {
1092
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1093
+						}
1094
+						break;
1095
+				endswitch;
1096 1096
 
1097
-                $extra_field_query = '';
1098
-                if (!empty($extra_fields)) {
1099
-                    $extra_field_query = serialize($extra_fields);
1100
-                }
1097
+				$extra_field_query = '';
1098
+				if (!empty($extra_fields)) {
1099
+					$extra_field_query = serialize($extra_fields);
1100
+				}
1101 1101
 
1102
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1102
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1103 1103
 
1104
-                $wpdb->query(
1104
+				$wpdb->query(
1105 1105
 
1106
-                    $wpdb->prepare(
1106
+					$wpdb->prepare(
1107 1107
 
1108
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1108
+						"insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1109 1109
 					post_type = %s,
1110 1110
 					admin_title = %s,
1111 1111
 					site_title = %s,
@@ -1138,26 +1138,26 @@  discard block
 block discarded – undo
1138 1138
 					validation_msg = %s,
1139 1139
 					for_admin_use = %s ",
1140 1140
 
1141
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1141
+						array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1142 1142
 
1143
-                    )
1143
+					)
1144 1144
 
1145
-                );
1145
+				);
1146 1146
 
1147
-                $lastid = $wpdb->insert_id;
1147
+				$lastid = $wpdb->insert_id;
1148 1148
 
1149
-                $lastid = trim($lastid);
1149
+				$lastid = trim($lastid);
1150 1150
 
1151
-            }
1151
+			}
1152 1152
 
1153
-            return (int)$lastid;
1153
+			return (int)$lastid;
1154 1154
 
1155 1155
 
1156
-        } else {
1157
-            return 'HTML Variable Name should be a unique name';
1158
-        }
1156
+		} else {
1157
+			return 'HTML Variable Name should be a unique name';
1158
+		}
1159 1159
 
1160
-    }
1160
+	}
1161 1161
 }
1162 1162
 
1163 1163
 /**
@@ -1172,54 +1172,54 @@  discard block
 block discarded – undo
1172 1172
 function godir_set_field_order($field_ids = array())
1173 1173
 {
1174 1174
 
1175
-    global $wpdb;
1175
+	global $wpdb;
1176 1176
 
1177
-    $count = 0;
1178
-    if (!empty($field_ids)):
1179
-        $post_meta_info = false;
1180
-        foreach ($field_ids as $id) {
1177
+	$count = 0;
1178
+	if (!empty($field_ids)):
1179
+		$post_meta_info = false;
1180
+		foreach ($field_ids as $id) {
1181 1181
 
1182
-            $cf = trim($id, '_');
1182
+			$cf = trim($id, '_');
1183 1183
 
1184
-            $post_meta_info = $wpdb->query(
1185
-                $wpdb->prepare(
1186
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1184
+			$post_meta_info = $wpdb->query(
1185
+				$wpdb->prepare(
1186
+					"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1187 1187
 															sort_order=%d 
1188 1188
 															where id= %d",
1189
-                    array($count, $cf)
1190
-                )
1191
-            );
1192
-            $count++;
1193
-        }
1194
-
1195
-        return $post_meta_info;
1196
-    else:
1197
-        return false;
1198
-    endif;
1189
+					array($count, $cf)
1190
+				)
1191
+			);
1192
+			$count++;
1193
+		}
1194
+
1195
+		return $post_meta_info;
1196
+	else:
1197
+		return false;
1198
+	endif;
1199 1199
 }
1200 1200
 
1201 1201
 
1202 1202
 function geodir_get_cf_value($cf){
1203
-    global $gd_session;
1204
-    $value = '';
1205
-    if (is_admin()) {
1206
-        global $post,$gd_session;
1207
-
1208
-        if (isset($_REQUEST['post']))
1209
-            $_REQUEST['pid'] = $_REQUEST['post'];
1210
-    }
1211
-
1212
-    if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1213
-        $post = $gd_ses_listing;
1214
-        $value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1215
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1216
-        $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1217
-    } else {
1218
-        if ($value == '') {
1219
-            $value = $cf['default'];
1220
-        }
1221
-    }
1222
-    return $value;
1203
+	global $gd_session;
1204
+	$value = '';
1205
+	if (is_admin()) {
1206
+		global $post,$gd_session;
1207
+
1208
+		if (isset($_REQUEST['post']))
1209
+			$_REQUEST['pid'] = $_REQUEST['post'];
1210
+	}
1211
+
1212
+	if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1213
+		$post = $gd_ses_listing;
1214
+		$value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1215
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1216
+		$value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1217
+	} else {
1218
+		if ($value == '') {
1219
+			$value = $cf['default'];
1220
+		}
1221
+	}
1222
+	return $value;
1223 1223
 }
1224 1224
 
1225 1225
 /**
@@ -1238,411 +1238,411 @@  discard block
 block discarded – undo
1238 1238
  * @param string $post_type Optional. The wordpress post type.
1239 1239
  */
1240 1240
 function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
1241
-    global $is_default, $mapzoom, $gd_session;
1241
+	global $is_default, $mapzoom, $gd_session;
1242 1242
 
1243
-    $listing_type = $post_type;
1243
+	$listing_type = $post_type;
1244 1244
 
1245
-    $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1245
+	$custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1246 1246
 
1247
-    foreach ($custom_fields as $key => $val) {
1248
-        $val = stripslashes_deep($val); // strip slashes from labels
1249
-        $name = $val['name'];
1250
-        $type = $val['type'];
1251
-        $is_default = $val['is_default'];
1247
+	foreach ($custom_fields as $key => $val) {
1248
+		$val = stripslashes_deep($val); // strip slashes from labels
1249
+		$name = $val['name'];
1250
+		$type = $val['type'];
1251
+		$is_default = $val['is_default'];
1252 1252
 
1253
-        /* field available to site admin only for edit */
1254
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1255
-        if ($for_admin_use && !is_super_admin()) {
1256
-            continue;
1257
-        }
1253
+		/* field available to site admin only for edit */
1254
+		$for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1255
+		if ($for_admin_use && !is_super_admin()) {
1256
+			continue;
1257
+		}
1258 1258
 
1259
-        if (is_admin()) {
1260
-            global $post;
1259
+		if (is_admin()) {
1260
+			global $post;
1261 1261
 
1262
-            if (isset($_REQUEST['post']))
1263
-                $_REQUEST['pid'] = $_REQUEST['post'];
1264
-        }
1262
+			if (isset($_REQUEST['post']))
1263
+				$_REQUEST['pid'] = $_REQUEST['post'];
1264
+		}
1265 1265
 
1266 1266
         
1267 1267
 
1268
-        /**
1269
-         * Called before the custom fields info is output for submitting a post.
1270
-         *
1271
-         * Used dynamic hook type geodir_before_custom_form_field_$name.
1272
-         *
1273
-         * @since 1.0.0
1274
-         * @param string $listing_type The post post type.
1275
-         * @param int $package_id The price package ID for the post.
1276
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1277
-         * @see 'geodir_after_custom_form_field_$name'
1278
-         */
1279
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1280
-
1281
-
1282
-        $custom_field = $val;
1283
-        $html ='';
1284
-        /**
1285
-         * Filter the output for custom fields.
1286
-         *
1287
-         * Here we can remove or add new functions depending on the field type.
1288
-         *
1289
-         * @param string $html The html to be filtered (blank).
1290
-         * @param array $custom_field The custom field array values.
1291
-         */
1292
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1293
-
1294
-
1295
-
1296
-        /**
1297
-         * Called after the custom fields info is output for submitting a post.
1298
-         *
1299
-         * Used dynamic hook type geodir_after_custom_form_field_$name.
1300
-         *
1301
-         * @since 1.0.0
1302
-         * @param string $listing_type The post post type.
1303
-         * @param int $package_id The price package ID for the post.
1304
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1305
-         * @see 'geodir_before_custom_form_field_$name'
1306
-         */
1307
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1308
-
1309
-    }
1268
+		/**
1269
+		 * Called before the custom fields info is output for submitting a post.
1270
+		 *
1271
+		 * Used dynamic hook type geodir_before_custom_form_field_$name.
1272
+		 *
1273
+		 * @since 1.0.0
1274
+		 * @param string $listing_type The post post type.
1275
+		 * @param int $package_id The price package ID for the post.
1276
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1277
+		 * @see 'geodir_after_custom_form_field_$name'
1278
+		 */
1279
+		do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1280
+
1281
+
1282
+		$custom_field = $val;
1283
+		$html ='';
1284
+		/**
1285
+		 * Filter the output for custom fields.
1286
+		 *
1287
+		 * Here we can remove or add new functions depending on the field type.
1288
+		 *
1289
+		 * @param string $html The html to be filtered (blank).
1290
+		 * @param array $custom_field The custom field array values.
1291
+		 */
1292
+		echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1293
+
1294
+
1295
+
1296
+		/**
1297
+		 * Called after the custom fields info is output for submitting a post.
1298
+		 *
1299
+		 * Used dynamic hook type geodir_after_custom_form_field_$name.
1300
+		 *
1301
+		 * @since 1.0.0
1302
+		 * @param string $listing_type The post post type.
1303
+		 * @param int $package_id The price package ID for the post.
1304
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1305
+		 * @see 'geodir_before_custom_form_field_$name'
1306
+		 */
1307
+		do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1308
+
1309
+	}
1310 1310
 
1311 1311
 }
1312 1312
 
1313 1313
 
1314 1314
 if (!function_exists('geodir_get_field_infoby')) {
1315
-    /**
1316
-     * Get custom field using key and value.
1317
-     *
1318
-     * @since 1.0.0
1319
-     * @package GeoDirectory
1320
-     * @global object $wpdb WordPress Database object.
1321
-     * @param string $key The key you want to look for.
1322
-     * @param string $value The value of the key you want to look for.
1323
-     * @param string $geodir_post_type The post type.
1324
-     * @return bool|mixed Returns field info when available. otherwise returns false.
1325
-     */
1326
-    function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1327
-    {
1328
-
1329
-        global $wpdb;
1330
-
1331
-        $filter = $wpdb->get_row(
1332
-            $wpdb->prepare(
1333
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1334
-                array($geodir_post_type)
1335
-            )
1336
-        );
1337
-
1338
-        if ($filter) {
1339
-            return $filter;
1340
-        } else {
1341
-            return false;
1342
-        }
1343
-
1344
-    }
1315
+	/**
1316
+	 * Get custom field using key and value.
1317
+	 *
1318
+	 * @since 1.0.0
1319
+	 * @package GeoDirectory
1320
+	 * @global object $wpdb WordPress Database object.
1321
+	 * @param string $key The key you want to look for.
1322
+	 * @param string $value The value of the key you want to look for.
1323
+	 * @param string $geodir_post_type The post type.
1324
+	 * @return bool|mixed Returns field info when available. otherwise returns false.
1325
+	 */
1326
+	function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1327
+	{
1328
+
1329
+		global $wpdb;
1330
+
1331
+		$filter = $wpdb->get_row(
1332
+			$wpdb->prepare(
1333
+				"SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1334
+				array($geodir_post_type)
1335
+			)
1336
+		);
1337
+
1338
+		if ($filter) {
1339
+			return $filter;
1340
+		} else {
1341
+			return false;
1342
+		}
1343
+
1344
+	}
1345 1345
 }
1346 1346
 
1347 1347
 
1348 1348
 function geodir_field_icon_proccess($cf){
1349 1349
 
1350 1350
 
1351
-    if (strpos($cf['field_icon'], 'http') !== false) {
1352
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353
-    } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
-    }else{
1356
-        $field_icon = $cf['field_icon'];
1357
-    }
1351
+	if (strpos($cf['field_icon'], 'http') !== false) {
1352
+		$field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353
+	} elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354
+		$field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
+	}else{
1356
+		$field_icon = $cf['field_icon'];
1357
+	}
1358 1358
 
1359
-    return $field_icon;
1359
+	return $field_icon;
1360 1360
 }
1361 1361
 
1362 1362
 if (!function_exists('geodir_show_listing_info')) {
1363
-    /**
1364
-     * Show listing info depending on field location.
1365
-     *
1366
-     * @since 1.0.0
1367
-     * @since 1.5.7 Custom fields option values added to db translation.
1368
-     *              Changes to display url fields title.
1369
-     * @package GeoDirectory
1370
-     * @global object $wpdb WordPress Database object.
1371
-     * @global object $post The current post object.
1372
-     * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1373
-     *
1374
-     * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1375
-     * @return string Returns listing info html.
1376
-     */
1377
-    function geodir_show_listing_info($fields_location = '') {
1378
-        global $post, $preview, $wpdb, $send_to_friend;
1379
-
1380
-        $package_info = array();
1381
-
1382
-        $package_info = geodir_post_package_info($package_info, $post);
1383
-        $post_package_id = $package_info->pid;
1384
-        $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1385
-        $send_to_friend = false;
1386
-
1387
-        ob_start();
1388
-        $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1389
-
1390
-        if (!empty($fields_info)) {
1391
-            $post = stripslashes_deep($post); // strip slashes
1363
+	/**
1364
+	 * Show listing info depending on field location.
1365
+	 *
1366
+	 * @since 1.0.0
1367
+	 * @since 1.5.7 Custom fields option values added to db translation.
1368
+	 *              Changes to display url fields title.
1369
+	 * @package GeoDirectory
1370
+	 * @global object $wpdb WordPress Database object.
1371
+	 * @global object $post The current post object.
1372
+	 * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1373
+	 *
1374
+	 * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1375
+	 * @return string Returns listing info html.
1376
+	 */
1377
+	function geodir_show_listing_info($fields_location = '') {
1378
+		global $post, $preview, $wpdb, $send_to_friend;
1379
+
1380
+		$package_info = array();
1381
+
1382
+		$package_info = geodir_post_package_info($package_info, $post);
1383
+		$post_package_id = $package_info->pid;
1384
+		$p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1385
+		$send_to_friend = false;
1386
+
1387
+		ob_start();
1388
+		$fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1389
+
1390
+		if (!empty($fields_info)) {
1391
+			$post = stripslashes_deep($post); // strip slashes
1392 1392
             
1393
-            //echo '<div class="geodir-company_info field-group">';
1394
-            global $field_set_start;
1395
-            $field_set_start = 0;
1396
-
1397
-
1398
-
1399
-            foreach ($fields_info as $type) {
1400
-                $type = stripslashes_deep($type); // strip slashes
1401
-                $html = '';
1402
-                $field_icon = geodir_field_icon_proccess($type);
1403
-                $filed_type = $type['type'];
1404
-                $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1405
-                if($html_var=='post'){$html_var='post_address';}
1406
-
1407
-                /**
1408
-                 * Filter the output for custom fields.
1409
-                 *
1410
-                 * Here we can remove or add new functions depending on the field type.
1411
-                 *
1412
-                 * @param string $html The html to be filtered (blank).
1413
-                 * @param string $fields_location The location the field is to be show.
1414
-                 * @param array $type The array of field values.
1415
-                 */
1416
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1417
-
1418
-                $variables_array = array();
1419
-
1420
-                if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
1421
-                    continue;
1422
-                }
1423
-
1424
-                if ($type['type'] != 'fieldset'):
1425
-                    $variables_array['post_id'] = $post->ID;
1426
-                    $variables_array['label'] = __($type['site_title'], 'geodirectory');
1427
-                    $variables_array['value'] = '';
1428
-                    if (isset($post->{$type['htmlvar_name']}))
1429
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1430
-                endif;
1431
-
1432
-
1433
-                if ($html):
1434
-
1435
-                    /**
1436
-                     * Called before a custom fields is output on the frontend.
1437
-                     *
1438
-                     * @since 1.0.0
1439
-                     * @param string $html_var The HTML variable name for the field.
1440
-                     */
1441
-                    do_action("geodir_before_show_{$html_var}");
1442
-                    /**
1443
-                     * Filter custom field output.
1444
-                     *
1445
-                     * @since 1.0.0
1446
-                     *
1447
-                     * @param string $html_var The HTML variable name for the field.
1448
-                     * @param string $html Custom field unfiltered HTML.
1449
-                     * @param array $variables_array Custom field variables array.
1450
-                     */
1451
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1452
-
1453
-                    /**
1454
-                     * Called after a custom fields is output on the frontend.
1455
-                     *
1456
-                     * @since 1.0.0
1457
-                     * @param string $html_var The HTML variable name for the field.
1458
-                     */
1459
-                    do_action("geodir_after_show_{$html_var}");
1460
-
1461
-                endif;
1462
-
1463
-            }
1464
-
1465
-            //echo '</div>';
1466
-
1467
-        }
1468
-
1469
-
1470
-        return $html = ob_get_clean();
1471
-
1472
-    }
1393
+			//echo '<div class="geodir-company_info field-group">';
1394
+			global $field_set_start;
1395
+			$field_set_start = 0;
1396
+
1397
+
1398
+
1399
+			foreach ($fields_info as $type) {
1400
+				$type = stripslashes_deep($type); // strip slashes
1401
+				$html = '';
1402
+				$field_icon = geodir_field_icon_proccess($type);
1403
+				$filed_type = $type['type'];
1404
+				$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1405
+				if($html_var=='post'){$html_var='post_address';}
1406
+
1407
+				/**
1408
+				 * Filter the output for custom fields.
1409
+				 *
1410
+				 * Here we can remove or add new functions depending on the field type.
1411
+				 *
1412
+				 * @param string $html The html to be filtered (blank).
1413
+				 * @param string $fields_location The location the field is to be show.
1414
+				 * @param array $type The array of field values.
1415
+				 */
1416
+				$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1417
+
1418
+				$variables_array = array();
1419
+
1420
+				if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
1421
+					continue;
1422
+				}
1423
+
1424
+				if ($type['type'] != 'fieldset'):
1425
+					$variables_array['post_id'] = $post->ID;
1426
+					$variables_array['label'] = __($type['site_title'], 'geodirectory');
1427
+					$variables_array['value'] = '';
1428
+					if (isset($post->{$type['htmlvar_name']}))
1429
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
1430
+				endif;
1431
+
1432
+
1433
+				if ($html):
1434
+
1435
+					/**
1436
+					 * Called before a custom fields is output on the frontend.
1437
+					 *
1438
+					 * @since 1.0.0
1439
+					 * @param string $html_var The HTML variable name for the field.
1440
+					 */
1441
+					do_action("geodir_before_show_{$html_var}");
1442
+					/**
1443
+					 * Filter custom field output.
1444
+					 *
1445
+					 * @since 1.0.0
1446
+					 *
1447
+					 * @param string $html_var The HTML variable name for the field.
1448
+					 * @param string $html Custom field unfiltered HTML.
1449
+					 * @param array $variables_array Custom field variables array.
1450
+					 */
1451
+					if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1452
+
1453
+					/**
1454
+					 * Called after a custom fields is output on the frontend.
1455
+					 *
1456
+					 * @since 1.0.0
1457
+					 * @param string $html_var The HTML variable name for the field.
1458
+					 */
1459
+					do_action("geodir_after_show_{$html_var}");
1460
+
1461
+				endif;
1462
+
1463
+			}
1464
+
1465
+			//echo '</div>';
1466
+
1467
+		}
1468
+
1469
+
1470
+		return $html = ob_get_clean();
1471
+
1472
+	}
1473 1473
 }
1474 1474
 
1475 1475
 if (!function_exists('geodir_default_date_format')) {
1476
-    /**
1477
-     * Returns default date format.
1478
-     *
1479
-     * @since 1.0.0
1480
-     * @package GeoDirectory
1481
-     * @return mixed|string|void Returns default date format.
1482
-     */
1483
-    function geodir_default_date_format()
1484
-    {
1485
-        if ($format = get_option('date_format'))
1486
-            return $format;
1487
-        else
1488
-            return 'dd-mm-yy';
1489
-    }
1476
+	/**
1477
+	 * Returns default date format.
1478
+	 *
1479
+	 * @since 1.0.0
1480
+	 * @package GeoDirectory
1481
+	 * @return mixed|string|void Returns default date format.
1482
+	 */
1483
+	function geodir_default_date_format()
1484
+	{
1485
+		if ($format = get_option('date_format'))
1486
+			return $format;
1487
+		else
1488
+			return 'dd-mm-yy';
1489
+	}
1490 1490
 }
1491 1491
 
1492 1492
 if (!function_exists('geodir_get_formated_date')) {
1493
-    /**
1494
-     * Returns formatted date.
1495
-     *
1496
-     * @since 1.0.0
1497
-     * @package GeoDirectory
1498
-     * @param string $date Date string to convert.
1499
-     * @return bool|int|string Returns formatted date.
1500
-     */
1501
-    function geodir_get_formated_date($date)
1502
-    {
1503
-        return mysql2date(get_option('date_format'), $date);
1504
-    }
1493
+	/**
1494
+	 * Returns formatted date.
1495
+	 *
1496
+	 * @since 1.0.0
1497
+	 * @package GeoDirectory
1498
+	 * @param string $date Date string to convert.
1499
+	 * @return bool|int|string Returns formatted date.
1500
+	 */
1501
+	function geodir_get_formated_date($date)
1502
+	{
1503
+		return mysql2date(get_option('date_format'), $date);
1504
+	}
1505 1505
 }
1506 1506
 
1507 1507
 if (!function_exists('geodir_get_formated_time')) {
1508
-    /**
1509
-     * Returns formatted time.
1510
-     *
1511
-     * @since 1.0.0
1512
-     * @package GeoDirectory
1513
-     * @param string $time Time string to convert.
1514
-     * @return bool|int|string Returns formatted time.
1515
-     */
1516
-    function geodir_get_formated_time($time)
1517
-    {
1518
-        return mysql2date(get_option('time_format'), $time, $translate = true);
1519
-    }
1508
+	/**
1509
+	 * Returns formatted time.
1510
+	 *
1511
+	 * @since 1.0.0
1512
+	 * @package GeoDirectory
1513
+	 * @param string $time Time string to convert.
1514
+	 * @return bool|int|string Returns formatted time.
1515
+	 */
1516
+	function geodir_get_formated_time($time)
1517
+	{
1518
+		return mysql2date(get_option('time_format'), $time, $translate = true);
1519
+	}
1520 1520
 }
1521 1521
 
1522 1522
 
1523 1523
 if (!function_exists('geodir_save_post_file_fields')) {
1524
-    /**
1525
-     * Save post file fields
1526
-     *
1527
-     * @since 1.0.0
1528
-     * @since 1.4.7 Added `$extra_fields` parameter.
1529
-     * @package GeoDirectory
1530
-     * @global object $wpdb WordPress Database object.
1531
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1532
-     * @global object $current_user Current user object.
1533
-     * @param int $post_id
1534
-     * @param string $field_id
1535
-     * @param array $post_image
1536
-     * @param array $extra_fields Array of extra fields.
1537
-     */
1538
-    function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1539
-    {
1524
+	/**
1525
+	 * Save post file fields
1526
+	 *
1527
+	 * @since 1.0.0
1528
+	 * @since 1.4.7 Added `$extra_fields` parameter.
1529
+	 * @package GeoDirectory
1530
+	 * @global object $wpdb WordPress Database object.
1531
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1532
+	 * @global object $current_user Current user object.
1533
+	 * @param int $post_id
1534
+	 * @param string $field_id
1535
+	 * @param array $post_image
1536
+	 * @param array $extra_fields Array of extra fields.
1537
+	 */
1538
+	function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1539
+	{
1540 1540
 
1541
-        global $wpdb, $plugin_prefix, $current_user;
1541
+		global $wpdb, $plugin_prefix, $current_user;
1542 1542
 
1543
-        $post_type = get_post_type($post_id);
1544
-        //echo $field_id; exit;
1545
-        $table = $plugin_prefix . $post_type . '_detail';
1543
+		$post_type = get_post_type($post_id);
1544
+		//echo $field_id; exit;
1545
+		$table = $plugin_prefix . $post_type . '_detail';
1546 1546
 
1547
-        $postcurr_images = array();
1548
-        $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1549
-        $file_urls = '';
1547
+		$postcurr_images = array();
1548
+		$postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1549
+		$file_urls = '';
1550 1550
 
1551
-        if (!empty($post_image)) {
1551
+		if (!empty($post_image)) {
1552 1552
 
1553
-            $invalid_files = array();
1553
+			$invalid_files = array();
1554 1554
 
1555
-            //Get and remove all old images of post from database to set by new order
1556
-            $geodir_uploaddir = '';
1557
-            $uploads = wp_upload_dir();
1558
-            $uploads_dir = $uploads['path'];
1555
+			//Get and remove all old images of post from database to set by new order
1556
+			$geodir_uploaddir = '';
1557
+			$uploads = wp_upload_dir();
1558
+			$uploads_dir = $uploads['path'];
1559 1559
 
1560
-            $geodir_uploadpath = $uploads['path'];
1561
-            $geodir_uploadurl = $uploads['url'];
1562
-            $sub_dir = $uploads['subdir'];
1560
+			$geodir_uploadpath = $uploads['path'];
1561
+			$geodir_uploadurl = $uploads['url'];
1562
+			$sub_dir = $uploads['subdir'];
1563 1563
 
1564
-            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1564
+			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1565 1565
 
1566
-            for ($m = 0; $m < count($post_image); $m++) {
1566
+			for ($m = 0; $m < count($post_image); $m++) {
1567 1567
 
1568
-                /* --------- start ------- */
1568
+				/* --------- start ------- */
1569 1569
 
1570
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1570
+				if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1571 1571
 
1572 1572
 
1573
-                    $curr_img_url = $post_image[$m];
1574
-                    $image_name_arr = explode('/', $curr_img_url);
1575
-                    $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1576
-                    $filename = end($image_name_arr);
1577
-                    $img_name_arr = explode('.', $filename);
1573
+					$curr_img_url = $post_image[$m];
1574
+					$image_name_arr = explode('/', $curr_img_url);
1575
+					$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1576
+					$filename = end($image_name_arr);
1577
+					$img_name_arr = explode('.', $filename);
1578 1578
 
1579
-                    $arr_file_type = wp_check_filetype($filename);
1579
+					$arr_file_type = wp_check_filetype($filename);
1580 1580
 
1581
-                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1582
-                        continue;
1583
-                    }
1581
+					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1582
+						continue;
1583
+					}
1584 1584
 
1585
-                    $uploaded_file_type = $arr_file_type['type'];
1586
-                    $uploaded_file_ext = $arr_file_type['ext'];
1585
+					$uploaded_file_type = $arr_file_type['type'];
1586
+					$uploaded_file_ext = $arr_file_type['ext'];
1587 1587
 
1588
-                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1589
-                        continue; // Invalid file type.
1590
-                    }
1588
+					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1589
+						continue; // Invalid file type.
1590
+					}
1591 1591
 
1592
-                    // Set an array containing a list of acceptable formats
1593
-                    //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1592
+					// Set an array containing a list of acceptable formats
1593
+					//$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1594 1594
 
1595
-                    if (!function_exists('wp_handle_upload'))
1596
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1595
+					if (!function_exists('wp_handle_upload'))
1596
+						require_once(ABSPATH . 'wp-admin/includes/file.php');
1597 1597
 
1598
-                    if (!is_dir($geodir_uploadpath))
1599
-                        mkdir($geodir_uploadpath);
1598
+					if (!is_dir($geodir_uploadpath))
1599
+						mkdir($geodir_uploadpath);
1600 1600
 
1601
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1602
-                    $explode_sub_dir = explode("/", $sub_dir);
1603
-                    if ($curr_img_dir == end($explode_sub_dir)) {
1604
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1605
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1606
-                    } else {
1607
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1608
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1609
-                    }
1601
+					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1602
+					$explode_sub_dir = explode("/", $sub_dir);
1603
+					if ($curr_img_dir == end($explode_sub_dir)) {
1604
+						$img_path = $geodir_uploadpath . '/' . $filename;
1605
+						$img_url = $geodir_uploadurl . '/' . $filename;
1606
+					} else {
1607
+						$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1608
+						$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1609
+					}
1610 1610
 
1611
-                    $uploaded_file = '';
1612
-                    if (file_exists($img_path))
1613
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1611
+					$uploaded_file = '';
1612
+					if (file_exists($img_path))
1613
+						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1614 1614
 
1615
-                    if ($curr_img_dir != $geodir_uploaddir) {
1616
-                        if (file_exists($img_path))
1617
-                            unlink($img_path);
1618
-                    }
1615
+					if ($curr_img_dir != $geodir_uploaddir) {
1616
+						if (file_exists($img_path))
1617
+							unlink($img_path);
1618
+					}
1619 1619
 
1620
-                    if (!empty($uploaded_file))
1621
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1620
+					if (!empty($uploaded_file))
1621
+						$file_urls = $geodir_uploadurl . '/' . $new_name;
1622 1622
 
1623
-                } else {
1624
-                    $file_urls = $post_image[$m];
1625
-                }
1626
-            }
1623
+				} else {
1624
+					$file_urls = $post_image[$m];
1625
+				}
1626
+			}
1627 1627
 
1628 1628
 
1629
-        }
1629
+		}
1630 1630
 
1631
-        //Remove all old attachments and temp images
1632
-        if (!empty($postcurr_images)) {
1631
+		//Remove all old attachments and temp images
1632
+		if (!empty($postcurr_images)) {
1633 1633
 
1634
-            if ($file_urls != $postcurr_images) {
1635
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1636
-                $invalid_files = (object)$invalid_files;
1637
-            }
1638
-        }
1634
+			if ($file_urls != $postcurr_images) {
1635
+				$invalid_files[] = (object)array('src' => $postcurr_images);
1636
+				$invalid_files = (object)$invalid_files;
1637
+			}
1638
+		}
1639 1639
 
1640
-        geodir_save_post_meta($post_id, $field_id, $file_urls);
1640
+		geodir_save_post_meta($post_id, $field_id, $file_urls);
1641 1641
 
1642
-        if (!empty($invalid_files))
1643
-            geodir_remove_attachments($invalid_files);
1642
+		if (!empty($invalid_files))
1643
+			geodir_remove_attachments($invalid_files);
1644 1644
 
1645
-    }
1645
+	}
1646 1646
 }
1647 1647
 
1648 1648
 
@@ -1657,76 +1657,76 @@  discard block
 block discarded – undo
1657 1657
  */
1658 1658
 function geodir_custom_upload_mimes($existing_mimes = array())
1659 1659
 {
1660
-    $existing_mimes['wif'] = 'text/plain';
1661
-    $existing_mimes['jpg|jpeg'] = 'image/jpeg';
1662
-    $existing_mimes['gif'] = 'image/gif';
1663
-    $existing_mimes['png'] = 'image/png';
1664
-    $existing_mimes['pdf'] = 'application/pdf';
1665
-    $existing_mimes['txt'] = 'text/text';
1666
-    $existing_mimes['csv'] = 'application/octet-stream';
1667
-    $existing_mimes['doc'] = 'application/msword';
1668
-    $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1669
-    $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1670
-    $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1671
-    return $existing_mimes;
1660
+	$existing_mimes['wif'] = 'text/plain';
1661
+	$existing_mimes['jpg|jpeg'] = 'image/jpeg';
1662
+	$existing_mimes['gif'] = 'image/gif';
1663
+	$existing_mimes['png'] = 'image/png';
1664
+	$existing_mimes['pdf'] = 'application/pdf';
1665
+	$existing_mimes['txt'] = 'text/text';
1666
+	$existing_mimes['csv'] = 'application/octet-stream';
1667
+	$existing_mimes['doc'] = 'application/msword';
1668
+	$existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1669
+	$existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1670
+	$existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1671
+	return $existing_mimes;
1672 1672
 }
1673 1673
 
1674 1674
 if (!function_exists('geodir_plupload_action')) {
1675 1675
 
1676
-    /**
1677
-     * Get upload directory path details
1678
-     *
1679
-     * @since 1.0.0
1680
-     * @package GeoDirectory
1681
-     * @global object $current_user Current user object.
1682
-     * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1683
-     * @return mixed Returns upload directory details as an array.
1684
-     */
1685
-    function geodir_upload_dir($upload)
1686
-    {
1687
-        global $current_user;
1688
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1689
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1690
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1691
-        return $upload;
1692
-    }
1693
-
1694
-    /**
1695
-     * Handles place file and image upload.
1696
-     *
1697
-     * @since 1.0.0
1698
-     * @package GeoDirectory
1699
-     */
1700
-    function geodir_plupload_action()
1701
-    {
1702
-        // check ajax noonce
1703
-        $imgid = $_POST["imgid"];
1704
-
1705
-        check_ajax_referer($imgid . 'pluploadan');
1706
-
1707
-        // handle custom file uploaddir
1708
-        add_filter('upload_dir', 'geodir_upload_dir');
1709
-
1710
-        // change file orinetation if needed
1711
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1712
-
1713
-        // handle file upload
1714
-        $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1715
-        // remove handle custom file uploaddir
1716
-        remove_filter('upload_dir', 'geodir_upload_dir');
1717
-
1718
-        if(!isset($status['url']) && isset($status['error'])){
1719
-            print_r($status);
1720
-        }
1721
-
1722
-        // send the uploaded file url in response
1723
-        if (isset($status['url'])) {
1724
-            echo $status['url'];
1725
-        } else {
1726
-            echo 'x';
1727
-        }
1728
-        exit;
1729
-    }
1676
+	/**
1677
+	 * Get upload directory path details
1678
+	 *
1679
+	 * @since 1.0.0
1680
+	 * @package GeoDirectory
1681
+	 * @global object $current_user Current user object.
1682
+	 * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1683
+	 * @return mixed Returns upload directory details as an array.
1684
+	 */
1685
+	function geodir_upload_dir($upload)
1686
+	{
1687
+		global $current_user;
1688
+		$upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1689
+		$upload['path'] = $upload['basedir'] . $upload['subdir'];
1690
+		$upload['url'] = $upload['baseurl'] . $upload['subdir'];
1691
+		return $upload;
1692
+	}
1693
+
1694
+	/**
1695
+	 * Handles place file and image upload.
1696
+	 *
1697
+	 * @since 1.0.0
1698
+	 * @package GeoDirectory
1699
+	 */
1700
+	function geodir_plupload_action()
1701
+	{
1702
+		// check ajax noonce
1703
+		$imgid = $_POST["imgid"];
1704
+
1705
+		check_ajax_referer($imgid . 'pluploadan');
1706
+
1707
+		// handle custom file uploaddir
1708
+		add_filter('upload_dir', 'geodir_upload_dir');
1709
+
1710
+		// change file orinetation if needed
1711
+		$fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1712
+
1713
+		// handle file upload
1714
+		$status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1715
+		// remove handle custom file uploaddir
1716
+		remove_filter('upload_dir', 'geodir_upload_dir');
1717
+
1718
+		if(!isset($status['url']) && isset($status['error'])){
1719
+			print_r($status);
1720
+		}
1721
+
1722
+		// send the uploaded file url in response
1723
+		if (isset($status['url'])) {
1724
+			echo $status['url'];
1725
+		} else {
1726
+			echo 'x';
1727
+		}
1728
+		exit;
1729
+	}
1730 1730
 }
1731 1731
 
1732 1732
 /**
@@ -1741,17 +1741,17 @@  discard block
 block discarded – undo
1741 1741
  */
1742 1742
 function geodir_get_video($post_id)
1743 1743
 {
1744
-    global $wpdb, $plugin_prefix;
1744
+	global $wpdb, $plugin_prefix;
1745 1745
 
1746
-    $post_type = get_post_type($post_id);
1746
+	$post_type = get_post_type($post_id);
1747 1747
 
1748
-    $table = $plugin_prefix . $post_type . '_detail';
1748
+	$table = $plugin_prefix . $post_type . '_detail';
1749 1749
 
1750
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1750
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1751 1751
 
1752
-    if ($results) {
1753
-        return $results[0]->geodir_video;
1754
-    }
1752
+	if ($results) {
1753
+		return $results[0]->geodir_video;
1754
+	}
1755 1755
 
1756 1756
 }
1757 1757
 
@@ -1767,40 +1767,40 @@  discard block
 block discarded – undo
1767 1767
  */
1768 1768
 function geodir_get_special_offers($post_id)
1769 1769
 {
1770
-    global $wpdb, $plugin_prefix;
1770
+	global $wpdb, $plugin_prefix;
1771 1771
 
1772
-    $post_type = get_post_type($post_id);
1772
+	$post_type = get_post_type($post_id);
1773 1773
 
1774
-    $table = $plugin_prefix . $post_type . '_detail';
1774
+	$table = $plugin_prefix . $post_type . '_detail';
1775 1775
 
1776
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1776
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1777 1777
 
1778
-    if ($results) {
1779
-        return $results[0]->geodir_special_offers;
1780
-    }
1778
+	if ($results) {
1779
+		return $results[0]->geodir_special_offers;
1780
+	}
1781 1781
 
1782 1782
 }
1783 1783
 
1784 1784
 if (!function_exists('geodir_max_upload_size')) {
1785
-    /**
1786
-     * Get max upload file size
1787
-     *
1788
-     * @since 1.0.0
1789
-     * @package GeoDirectory
1790
-     * @return mixed|void Returns max upload file size.
1791
-     */
1792
-    function geodir_max_upload_size()
1793
-    {
1794
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1795
-
1796
-        if ($max_filesize > 0 && $max_filesize < 1) {
1797
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1798
-        } else {
1799
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1800
-        }
1801
-        /** Filter documented in geodirectory-functions/general_functions.php **/
1802
-        return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1803
-    }
1785
+	/**
1786
+	 * Get max upload file size
1787
+	 *
1788
+	 * @since 1.0.0
1789
+	 * @package GeoDirectory
1790
+	 * @return mixed|void Returns max upload file size.
1791
+	 */
1792
+	function geodir_max_upload_size()
1793
+	{
1794
+		$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1795
+
1796
+		if ($max_filesize > 0 && $max_filesize < 1) {
1797
+			$max_filesize = (int)($max_filesize * 1024) . 'kb';
1798
+		} else {
1799
+			$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1800
+		}
1801
+		/** Filter documented in geodirectory-functions/general_functions.php **/
1802
+		return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1803
+	}
1804 1804
 }
1805 1805
 
1806 1806
 
@@ -1818,33 +1818,33 @@  discard block
 block discarded – undo
1818 1818
  */
1819 1819
 function geodir_add_custom_sort_options($fields, $post_type)
1820 1820
 {
1821
-    global $wpdb;
1821
+	global $wpdb;
1822 1822
 
1823
-    if ($post_type != '') {
1823
+	if ($post_type != '') {
1824 1824
 
1825
-        $all_postypes = geodir_get_posttypes();
1825
+		$all_postypes = geodir_get_posttypes();
1826 1826
 
1827
-        if (in_array($post_type, $all_postypes)) {
1827
+		if (in_array($post_type, $all_postypes)) {
1828 1828
 
1829
-            $custom_fields = $wpdb->get_results(
1830
-                $wpdb->prepare(
1831
-                    "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1832
-                    array($post_type)
1833
-                ), 'ARRAY_A'
1834
-            );
1829
+			$custom_fields = $wpdb->get_results(
1830
+				$wpdb->prepare(
1831
+					"select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1832
+					array($post_type)
1833
+				), 'ARRAY_A'
1834
+			);
1835 1835
 
1836
-            if (!empty($custom_fields)) {
1836
+			if (!empty($custom_fields)) {
1837 1837
 
1838
-                foreach ($custom_fields as $val) {
1839
-                    $fields[] = $val;
1840
-                }
1841
-            }
1838
+				foreach ($custom_fields as $val) {
1839
+					$fields[] = $val;
1840
+				}
1841
+			}
1842 1842
 
1843
-        }
1843
+		}
1844 1844
 
1845
-    }
1845
+	}
1846 1846
 
1847
-    return $fields;
1847
+	return $fields;
1848 1848
 }
1849 1849
 
1850 1850
 
@@ -1860,76 +1860,76 @@  discard block
 block discarded – undo
1860 1860
 function geodir_get_custom_sort_options($post_type = '')
1861 1861
 {
1862 1862
 
1863
-    global $wpdb;
1864
-
1865
-    if ($post_type != '') {
1866
-
1867
-        $all_postypes = geodir_get_posttypes();
1868
-
1869
-        if (!in_array($post_type, $all_postypes))
1870
-            return false;
1871
-
1872
-        $fields = array();
1873
-
1874
-        $fields[] = array(
1875
-            'post_type' => $post_type,
1876
-            'data_type' => '',
1877
-            'field_type' => 'random',
1878
-            'site_title' => 'Random',
1879
-            'htmlvar_name' => 'post_title',
1880
-            'field_icon' =>  'fa fa-random',
1881
-            'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1882
-        );
1883
-
1884
-        $fields[] = array(
1885
-            'post_type' => $post_type,
1886
-            'data_type' => '',
1887
-            'field_type' => 'datetime',
1888
-            'site_title' => __('Add date', 'geodirectory'),
1889
-            'htmlvar_name' => 'post_date',
1890
-            'field_icon' =>  'fa fa-calendar',
1891
-            'description' =>  __('Sort by date added', 'geodirectory')
1892
-        );
1893
-        $fields[] = array(
1894
-            'post_type' => $post_type,
1895
-            'data_type' => '',
1896
-            'field_type' => 'bigint',
1897
-            'site_title' => __('Review', 'geodirectory'),
1898
-            'htmlvar_name' => 'comment_count',
1899
-            'field_icon' =>  'fa fa-commenting-o',
1900
-            'description' =>  __('Sort by the number of reviews', 'geodirectory')
1901
-        );
1902
-        $fields[] = array(
1903
-            'post_type' => $post_type,
1904
-            'data_type' => '',
1905
-            'field_type' => 'float',
1906
-            'site_title' => __('Rating', 'geodirectory'),
1907
-            'htmlvar_name' => 'overall_rating',
1908
-            'field_icon' =>  'fa fa-star-o',
1909
-            'description' =>  __('Sort by the overall rating value', 'geodirectory')
1910
-        );
1911
-        $fields[] = array(
1912
-            'post_type' => $post_type,
1913
-            'data_type' => '',
1914
-            'field_type' => 'text',
1915
-            'site_title' => __('Title', 'geodirectory'),
1916
-            'htmlvar_name' => 'post_title',
1917
-            'field_icon' =>  'fa fa-sort-alpha-desc',
1918
-            'description' =>  __('Sort alphabetically by title', 'geodirectory')
1919
-        );
1920
-
1921
-        /**
1922
-         * Hook to add custom sort options.
1923
-         *
1924
-         * @since 1.0.0
1925
-         * @param array $fields Unmodified sort options array.
1926
-         * @param string $post_type Post type.
1927
-         */
1928
-        return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1929
-
1930
-    }
1931
-
1932
-    return false;
1863
+	global $wpdb;
1864
+
1865
+	if ($post_type != '') {
1866
+
1867
+		$all_postypes = geodir_get_posttypes();
1868
+
1869
+		if (!in_array($post_type, $all_postypes))
1870
+			return false;
1871
+
1872
+		$fields = array();
1873
+
1874
+		$fields[] = array(
1875
+			'post_type' => $post_type,
1876
+			'data_type' => '',
1877
+			'field_type' => 'random',
1878
+			'site_title' => 'Random',
1879
+			'htmlvar_name' => 'post_title',
1880
+			'field_icon' =>  'fa fa-random',
1881
+			'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1882
+		);
1883
+
1884
+		$fields[] = array(
1885
+			'post_type' => $post_type,
1886
+			'data_type' => '',
1887
+			'field_type' => 'datetime',
1888
+			'site_title' => __('Add date', 'geodirectory'),
1889
+			'htmlvar_name' => 'post_date',
1890
+			'field_icon' =>  'fa fa-calendar',
1891
+			'description' =>  __('Sort by date added', 'geodirectory')
1892
+		);
1893
+		$fields[] = array(
1894
+			'post_type' => $post_type,
1895
+			'data_type' => '',
1896
+			'field_type' => 'bigint',
1897
+			'site_title' => __('Review', 'geodirectory'),
1898
+			'htmlvar_name' => 'comment_count',
1899
+			'field_icon' =>  'fa fa-commenting-o',
1900
+			'description' =>  __('Sort by the number of reviews', 'geodirectory')
1901
+		);
1902
+		$fields[] = array(
1903
+			'post_type' => $post_type,
1904
+			'data_type' => '',
1905
+			'field_type' => 'float',
1906
+			'site_title' => __('Rating', 'geodirectory'),
1907
+			'htmlvar_name' => 'overall_rating',
1908
+			'field_icon' =>  'fa fa-star-o',
1909
+			'description' =>  __('Sort by the overall rating value', 'geodirectory')
1910
+		);
1911
+		$fields[] = array(
1912
+			'post_type' => $post_type,
1913
+			'data_type' => '',
1914
+			'field_type' => 'text',
1915
+			'site_title' => __('Title', 'geodirectory'),
1916
+			'htmlvar_name' => 'post_title',
1917
+			'field_icon' =>  'fa fa-sort-alpha-desc',
1918
+			'description' =>  __('Sort alphabetically by title', 'geodirectory')
1919
+		);
1920
+
1921
+		/**
1922
+		 * Hook to add custom sort options.
1923
+		 *
1924
+		 * @since 1.0.0
1925
+		 * @param array $fields Unmodified sort options array.
1926
+		 * @param string $post_type Post type.
1927
+		 */
1928
+		return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1929
+
1930
+	}
1931
+
1932
+	return false;
1933 1933
 }
1934 1934
 
1935 1935
 
@@ -1945,117 +1945,117 @@  discard block
 block discarded – undo
1945 1945
 function godir_set_sort_field_order($field_ids = array())
1946 1946
 {
1947 1947
 
1948
-    global $wpdb;
1948
+	global $wpdb;
1949 1949
 
1950
-    $count = 0;
1951
-    if (!empty($field_ids)):
1952
-        foreach ($field_ids as $id) {
1950
+	$count = 0;
1951
+	if (!empty($field_ids)):
1952
+		foreach ($field_ids as $id) {
1953 1953
 
1954
-            $cf = trim($id, '_');
1954
+			$cf = trim($id, '_');
1955 1955
 
1956
-            $post_meta_info = $wpdb->query(
1957
-                $wpdb->prepare(
1958
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1956
+			$post_meta_info = $wpdb->query(
1957
+				$wpdb->prepare(
1958
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1959 1959
 															sort_order=%d 
1960 1960
 															where id= %d",
1961
-                    array($count, $cf)
1962
-                )
1963
-            );
1964
-            $count++;
1965
-        }
1966
-
1967
-        return $field_ids;
1968
-    else:
1969
-        return false;
1970
-    endif;
1961
+					array($count, $cf)
1962
+				)
1963
+			);
1964
+			$count++;
1965
+		}
1966
+
1967
+		return $field_ids;
1968
+	else:
1969
+		return false;
1970
+	endif;
1971 1971
 }
1972 1972
 
1973 1973
 
1974 1974
 if (!function_exists('geodir_custom_sort_field_save')) {
1975
-    /**
1976
-     * Save or Update custom sort fields into the database.
1977
-     *
1978
-     * @since 1.0.0
1979
-     * @package GeoDirectory
1980
-     * @global object $wpdb WordPress Database object.
1981
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1982
-     * @param array $request_field {
1983
-     *    Attributes of the Request field.
1984
-     *
1985
-     *    @type string $action Ajax action name.
1986
-     *    @type string $manage_field_type Manage field type Default "sorting_options".
1987
-     *    @type string $create_field Do you want to create this field?.
1988
-     *    @type string $field_ins_upd Field created or updated?.
1989
-     *    @type string $_wpnonce Nonce value.
1990
-     *    @type string $listing_type The Post type.
1991
-     *    @type string $field_type Field Type.
1992
-     *    @type string $field_id Field ID.
1993
-     *    @type string $data_type Data Type.
1994
-     *    @type string $htmlvar_name HTML variable name.
1995
-     *    @type string $site_title Section title which you wish to display in frontend.
1996
-     *    @type string $is_default Is this default sorting?.
1997
-     *    @type string $is_active If not active then the field will not be displayed anywhere.
1998
-     *    @type string $sort_order Sort Order.
1999
-     *
2000
-     * }
2001
-     * @param bool $default Not yet implemented.
2002
-     * @return int Returns the last affected db table row id.
2003
-     */
2004
-    function geodir_custom_sort_field_save($request_field = array(), $default = false)
2005
-    {
2006
-
2007
-        global $wpdb, $plugin_prefix;
2008
-
2009
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2010
-
2011
-        $cf = trim($result_str, '_');
2012
-
2013
-        /*-------- check dublicate validation --------*/
2014
-
2015
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2016
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2017
-
2018
-        $post_type = $request_field['listing_type'];
2019
-        $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2020
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2021
-        $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2022
-        $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2023
-        $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2024
-        $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2025
-        $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2026
-        $asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2027
-        $desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2028
-        $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2029
-        $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2030
-
2031
-        $default_order = '';
2032
-        if ($is_default != '') {
2033
-            $default_order = $is_default;
2034
-            $is_default = '1';
2035
-        }
2036
-
2037
-
2038
-        $check_html_variable = $wpdb->get_var(
2039
-            $wpdb->prepare(
2040
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2041
-                array($cehhtmlvar_name, $post_type, $field_type)
2042
-            )
2043
-        );
2044
-
2045
-        if ($is_default == 1) {
2046
-
2047
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2048
-
2049
-        }
2050
-
2051
-
2052
-        if (!$check_html_variable) {
2053
-
2054
-            $wpdb->query(
2055
-
2056
-                $wpdb->prepare(
2057
-
2058
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1975
+	/**
1976
+	 * Save or Update custom sort fields into the database.
1977
+	 *
1978
+	 * @since 1.0.0
1979
+	 * @package GeoDirectory
1980
+	 * @global object $wpdb WordPress Database object.
1981
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1982
+	 * @param array $request_field {
1983
+	 *    Attributes of the Request field.
1984
+	 *
1985
+	 *    @type string $action Ajax action name.
1986
+	 *    @type string $manage_field_type Manage field type Default "sorting_options".
1987
+	 *    @type string $create_field Do you want to create this field?.
1988
+	 *    @type string $field_ins_upd Field created or updated?.
1989
+	 *    @type string $_wpnonce Nonce value.
1990
+	 *    @type string $listing_type The Post type.
1991
+	 *    @type string $field_type Field Type.
1992
+	 *    @type string $field_id Field ID.
1993
+	 *    @type string $data_type Data Type.
1994
+	 *    @type string $htmlvar_name HTML variable name.
1995
+	 *    @type string $site_title Section title which you wish to display in frontend.
1996
+	 *    @type string $is_default Is this default sorting?.
1997
+	 *    @type string $is_active If not active then the field will not be displayed anywhere.
1998
+	 *    @type string $sort_order Sort Order.
1999
+	 *
2000
+	 * }
2001
+	 * @param bool $default Not yet implemented.
2002
+	 * @return int Returns the last affected db table row id.
2003
+	 */
2004
+	function geodir_custom_sort_field_save($request_field = array(), $default = false)
2005
+	{
2006
+
2007
+		global $wpdb, $plugin_prefix;
2008
+
2009
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2010
+
2011
+		$cf = trim($result_str, '_');
2012
+
2013
+		/*-------- check dublicate validation --------*/
2014
+
2015
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2016
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2017
+
2018
+		$post_type = $request_field['listing_type'];
2019
+		$data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2020
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2021
+		$site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2022
+		$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2023
+		$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2024
+		$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2025
+		$is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2026
+		$asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2027
+		$desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2028
+		$asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2029
+		$desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2030
+
2031
+		$default_order = '';
2032
+		if ($is_default != '') {
2033
+			$default_order = $is_default;
2034
+			$is_default = '1';
2035
+		}
2036
+
2037
+
2038
+		$check_html_variable = $wpdb->get_var(
2039
+			$wpdb->prepare(
2040
+				"select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2041
+				array($cehhtmlvar_name, $post_type, $field_type)
2042
+			)
2043
+		);
2044
+
2045
+		if ($is_default == 1) {
2046
+
2047
+			$wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2048
+
2049
+		}
2050
+
2051
+
2052
+		if (!$check_html_variable) {
2053
+
2054
+			$wpdb->query(
2055
+
2056
+				$wpdb->prepare(
2057
+
2058
+					"insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2059 2059
 				post_type = %s,
2060 2060
 				data_type = %s,
2061 2061
 				field_type = %s,
@@ -2070,23 +2070,23 @@  discard block
 block discarded – undo
2070 2070
 				asc_title = %s,
2071 2071
 				desc_title = %s",
2072 2072
 
2073
-                    array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title)
2074
-                )
2073
+					array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title)
2074
+				)
2075 2075
 
2076
-            );
2076
+			);
2077 2077
 
2078 2078
 
2079
-            $lastid = $wpdb->insert_id;
2079
+			$lastid = $wpdb->insert_id;
2080 2080
 
2081
-            $lastid = trim($lastid);
2081
+			$lastid = trim($lastid);
2082 2082
 
2083
-        } else {
2083
+		} else {
2084 2084
 
2085
-            $wpdb->query(
2085
+			$wpdb->query(
2086 2086
 
2087
-                $wpdb->prepare(
2087
+				$wpdb->prepare(
2088 2088
 
2089
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2089
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2090 2090
 				post_type = %s,
2091 2091
 				data_type = %s,
2092 2092
 				field_type = %s,
@@ -2102,123 +2102,123 @@  discard block
 block discarded – undo
2102 2102
 				desc_title = %s
2103 2103
 				where id = %d",
2104 2104
 
2105
-                    array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf)
2106
-                )
2105
+					array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf)
2106
+				)
2107 2107
 
2108
-            );
2108
+			);
2109 2109
 
2110
-            $lastid = trim($cf);
2110
+			$lastid = trim($cf);
2111 2111
 
2112
-        }
2112
+		}
2113 2113
 
2114 2114
 
2115
-        return (int)$lastid;
2115
+		return (int)$lastid;
2116 2116
 
2117
-    }
2117
+	}
2118 2118
 }
2119 2119
 
2120 2120
 
2121 2121
 if (!function_exists('geodir_custom_sort_field_delete')) {
2122
-    /**
2123
-     * Delete a custom sort field using field id.
2124
-     * @since 1.0.0
2125
-     * @package GeoDirectory
2126
-     * @global object $wpdb WordPress Database object.
2127
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2128
-     * @param string $field_id The field ID.
2129
-     * @return int|string Returns field id when successful deletion, else returns 0.
2130
-     */
2131
-    function geodir_custom_sort_field_delete($field_id = '')
2132
-    {
2133
-
2134
-        global $wpdb, $plugin_prefix;
2135
-        if ($field_id != '') {
2136
-            $cf = trim($field_id, '_');
2137
-
2138
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2139
-
2140
-            return $field_id;
2141
-
2142
-        } else
2143
-            return 0;
2144
-
2145
-    }
2122
+	/**
2123
+	 * Delete a custom sort field using field id.
2124
+	 * @since 1.0.0
2125
+	 * @package GeoDirectory
2126
+	 * @global object $wpdb WordPress Database object.
2127
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2128
+	 * @param string $field_id The field ID.
2129
+	 * @return int|string Returns field id when successful deletion, else returns 0.
2130
+	 */
2131
+	function geodir_custom_sort_field_delete($field_id = '')
2132
+	{
2133
+
2134
+		global $wpdb, $plugin_prefix;
2135
+		if ($field_id != '') {
2136
+			$cf = trim($field_id, '_');
2137
+
2138
+			$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2139
+
2140
+			return $field_id;
2141
+
2142
+		} else
2143
+			return 0;
2144
+
2145
+	}
2146 2146
 }
2147 2147
 
2148 2148
 
2149 2149
 if (!function_exists('geodir_custom_sort_field_adminhtml')) {
2150
-    /**
2151
-     * Custom sort field admin html.
2152
-     *
2153
-     * @since 1.0.0
2154
-     * @package GeoDirectory
2155
-     * @global object $wpdb WordPress Database object.
2156
-     * @param string $field_type The form field type.
2157
-     * @param object|int $result_str The custom field results object or row id.
2158
-     * @param string $field_ins_upd When set to "submit" displays form.
2159
-     * @param bool $default when set to true field will be for admin use only.
2160
-     */
2161
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2162
-    {
2163
-        global $wpdb;
2164
-        $cf = $result_str;
2165
-        if (!is_object($cf)) {
2166
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2167
-        } else {
2168
-            $field_info = $cf;
2169
-            $result_str = $cf->id;
2170
-        }
2171
-
2172
-        $field_info = stripslashes_deep($field_info); // strip slashes
2173
-
2174
-        if (!isset($field_info->post_type)) {
2175
-            $post_type = sanitize_text_field($_REQUEST['listing_type']);
2176
-        } else {
2177
-            $post_type = $field_info->post_type;
2178
-        }
2179
-
2180
-
2181
-        $htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2182
-
2183
-        $site_title = '';
2184
-        if ($site_title == '')
2185
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2186
-
2187
-        if ($site_title == '') {
2188
-            $fields = geodir_get_custom_sort_options($post_type);
2189
-
2190
-            foreach ($fields as $val) {
2191
-                $val = stripslashes_deep($val); // strip slashes
2192
-
2193
-                if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2194
-                    $site_title = isset($val['site_title']) ? $val['site_title'] : '';
2195
-                }
2196
-            }
2197
-        }
2198
-
2199
-        if ($htmlvar_name == '')
2200
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2201
-
2202
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2203
-
2204
-        $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2205
-        $cso_arr = geodir_get_custom_sort_options($post_type);
2206
-
2207
-        $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2208
-        foreach($cso_arr as $cso){
2209
-            if($cur_field_type==$cso['field_type']){
2210
-
2211
-                if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2212
-                    $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2213
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2214
-                    $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2215
-                }
2216
-
2217
-            }
2218
-        }
2219
-
2220
-        $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2221
-        ?>
2150
+	/**
2151
+	 * Custom sort field admin html.
2152
+	 *
2153
+	 * @since 1.0.0
2154
+	 * @package GeoDirectory
2155
+	 * @global object $wpdb WordPress Database object.
2156
+	 * @param string $field_type The form field type.
2157
+	 * @param object|int $result_str The custom field results object or row id.
2158
+	 * @param string $field_ins_upd When set to "submit" displays form.
2159
+	 * @param bool $default when set to true field will be for admin use only.
2160
+	 */
2161
+	function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2162
+	{
2163
+		global $wpdb;
2164
+		$cf = $result_str;
2165
+		if (!is_object($cf)) {
2166
+			$field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2167
+		} else {
2168
+			$field_info = $cf;
2169
+			$result_str = $cf->id;
2170
+		}
2171
+
2172
+		$field_info = stripslashes_deep($field_info); // strip slashes
2173
+
2174
+		if (!isset($field_info->post_type)) {
2175
+			$post_type = sanitize_text_field($_REQUEST['listing_type']);
2176
+		} else {
2177
+			$post_type = $field_info->post_type;
2178
+		}
2179
+
2180
+
2181
+		$htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2182
+
2183
+		$site_title = '';
2184
+		if ($site_title == '')
2185
+			$site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2186
+
2187
+		if ($site_title == '') {
2188
+			$fields = geodir_get_custom_sort_options($post_type);
2189
+
2190
+			foreach ($fields as $val) {
2191
+				$val = stripslashes_deep($val); // strip slashes
2192
+
2193
+				if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2194
+					$site_title = isset($val['site_title']) ? $val['site_title'] : '';
2195
+				}
2196
+			}
2197
+		}
2198
+
2199
+		if ($htmlvar_name == '')
2200
+			$htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2201
+
2202
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
2203
+
2204
+		$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2205
+		$cso_arr = geodir_get_custom_sort_options($post_type);
2206
+
2207
+		$cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2208
+		foreach($cso_arr as $cso){
2209
+			if($cur_field_type==$cso['field_type']){
2210
+
2211
+				if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2212
+					$field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2213
+				}elseif(isset($cso['field_icon']) && $cso['field_icon']){
2214
+					$field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2215
+				}
2216
+
2217
+			}
2218
+		}
2219
+
2220
+		$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2221
+		?>
2222 2222
 
2223 2223
         <li class="text" id="licontainer_<?php echo $result_str;?>">
2224 2224
             <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
@@ -2227,7 +2227,7 @@  discard block
 block discarded – undo
2227 2227
                  ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2228 2228
                 <?php
2229 2229
 
2230
-                ?>
2230
+				?>
2231 2231
 
2232 2232
                 <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2233 2233
                      onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
@@ -2242,17 +2242,17 @@  discard block
 block discarded – undo
2242 2242
 
2243 2243
             <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2244 2244
                  style="display:<?php if ($field_ins_upd == 'submit') {
2245
-                     echo 'block;';
2246
-                 } else {
2247
-                     echo 'none;';
2248
-                 } ?>">
2245
+					 echo 'block;';
2246
+				 } else {
2247
+					 echo 'none;';
2248
+				 } ?>">
2249 2249
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2250 2250
                 <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2251 2251
                 <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2252 2252
                 <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2253 2253
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2254
-                    echo $field_info->data_type;
2255
-                }?>"/>
2254
+					echo $field_info->data_type;
2255
+				}?>"/>
2256 2256
                 <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2257 2257
 
2258 2258
 
@@ -2275,14 +2275,14 @@  discard block
 block discarded – undo
2275 2275
 
2276 2276
                                 <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled"  value="1"
2277 2277
                                     <?php if ($value == '1') {
2278
-                                        echo 'checked';
2279
-                                    } ?>/>
2278
+										echo 'checked';
2279
+									} ?>/>
2280 2280
                                 <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2281 2281
 
2282 2282
                                 <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0"
2283 2283
                                     <?php if ($value == '0' || !$value) {
2284
-                                        echo 'checked';
2285
-                                    } ?>/>
2284
+										echo 'checked';
2285
+									} ?>/>
2286 2286
                                 <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2287 2287
 
2288 2288
                             </div>
@@ -2319,8 +2319,8 @@  discard block
 block discarded – undo
2319 2319
 
2320 2320
                                 <input type="radio" name="is_default"
2321 2321
                                        value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2322
-                                    echo 'checked="checked"';
2323
-                                } ?>/>
2322
+									echo 'checked="checked"';
2323
+								} ?>/>
2324 2324
                             </div>
2325 2325
 
2326 2326
                         </li>
@@ -2340,14 +2340,14 @@  discard block
 block discarded – undo
2340 2340
 
2341 2341
                                 <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled"  value="1"
2342 2342
                                     <?php if ($value == '1') {
2343
-                                        echo 'checked';
2344
-                                    } ?>/>
2343
+										echo 'checked';
2344
+									} ?>/>
2345 2345
                                 <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2346 2346
 
2347 2347
                                 <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0"
2348 2348
                                     <?php if ($value == '0' || !$value) {
2349
-                                        echo 'checked';
2350
-                                    } ?>/>
2349
+										echo 'checked';
2350
+									} ?>/>
2351 2351
                                 <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2352 2352
 
2353 2353
                             </div>
@@ -2383,8 +2383,8 @@  discard block
 block discarded – undo
2383 2383
 
2384 2384
                                 <input type="radio" name="is_default"
2385 2385
                                        value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2386
-                                    echo 'checked="checked"';
2387
-                                } ?>/>
2386
+									echo 'checked="checked"';
2387
+								} ?>/>
2388 2388
                             </div>
2389 2389
 
2390 2390
                         </li>
@@ -2426,8 +2426,8 @@  discard block
 block discarded – undo
2426 2426
 
2427 2427
                                 <input type="checkbox" name="is_default"
2428 2428
                                        value="<?php echo $field_type; ?>"  <?php if (isset($value) && $value == '1') {
2429
-                                    echo 'checked="checked"';
2430
-                                } ?>/>
2429
+									echo 'checked="checked"';
2430
+								} ?>/>
2431 2431
                             </div>
2432 2432
 
2433 2433
 
@@ -2450,14 +2450,14 @@  discard block
 block discarded – undo
2450 2450
 
2451 2451
                             <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
2452 2452
                                 <?php if ($value == '1') {
2453
-                                    echo 'checked';
2454
-                                } ?>/>
2453
+									echo 'checked';
2454
+								} ?>/>
2455 2455
                             <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2456 2456
 
2457 2457
                             <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
2458 2458
                                 <?php if ($value == '0' || !$value) {
2459
-                                    echo 'checked';
2460
-                                } ?>/>
2459
+									echo 'checked';
2460
+								} ?>/>
2461 2461
                             <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2462 2462
 
2463 2463
                         </div>
@@ -2467,8 +2467,8 @@  discard block
 block discarded – undo
2467 2467
 
2468 2468
                     <input type="hidden" readonly="readonly" name="sort_order" id="sort_order"
2469 2469
                                                 value="<?php if (isset($field_info->sort_order)) {
2470
-                                                    echo esc_attr($field_info->sort_order);
2471
-                                                }?>" size="50"/>
2470
+													echo esc_attr($field_info->sort_order);
2471
+												}?>" size="50"/>
2472 2472
 
2473 2473
 
2474 2474
 
@@ -2492,38 +2492,38 @@  discard block
 block discarded – undo
2492 2492
             </form>
2493 2493
         </li> <?php
2494 2494
 
2495
-    }
2495
+	}
2496 2496
 }
2497 2497
 
2498 2498
 if (!function_exists('check_field_visibility')) {
2499
-    /**
2500
-     * Check field visibility as per price package.
2501
-     *
2502
-     * @since 1.0.0
2503
-     * @package GeoDirectory
2504
-     * @global object $wpdb WordPress Database object.
2505
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
2506
-     * @param int|string $package_id The package ID.
2507
-     * @param string $field_name The field name.
2508
-     * @param string $post_type Optional. The wordpress post type.
2509
-     * @return bool Returns true when field visible, otherwise false.
2510
-     */
2511
-    function check_field_visibility($package_id, $field_name, $post_type)
2512
-    {
2513
-        global $wpdb, $geodir_addon_list;
2514
-        if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2515
-            return true;
2516
-        }
2517
-        if (!$package_id || !$field_name || !$post_type) {
2518
-            return true;
2519
-        }
2520
-        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
2521
-
2522
-        if ($wpdb->get_var($sql)) {
2523
-            return true;
2524
-        }
2525
-        return false;
2526
-    }
2499
+	/**
2500
+	 * Check field visibility as per price package.
2501
+	 *
2502
+	 * @since 1.0.0
2503
+	 * @package GeoDirectory
2504
+	 * @global object $wpdb WordPress Database object.
2505
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
2506
+	 * @param int|string $package_id The package ID.
2507
+	 * @param string $field_name The field name.
2508
+	 * @param string $post_type Optional. The wordpress post type.
2509
+	 * @return bool Returns true when field visible, otherwise false.
2510
+	 */
2511
+	function check_field_visibility($package_id, $field_name, $post_type)
2512
+	{
2513
+		global $wpdb, $geodir_addon_list;
2514
+		if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2515
+			return true;
2516
+		}
2517
+		if (!$package_id || !$field_name || !$post_type) {
2518
+			return true;
2519
+		}
2520
+		$sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
2521
+
2522
+		if ($wpdb->get_var($sql)) {
2523
+			return true;
2524
+		}
2525
+		return false;
2526
+	}
2527 2527
 }
2528 2528
 
2529 2529
 /**
@@ -2538,43 +2538,43 @@  discard block
 block discarded – undo
2538 2538
  */
2539 2539
 function geodir_string_to_options($input = '', $translated = false)
2540 2540
 {
2541
-    $return = array();
2542
-    if ($input != '') {
2543
-        $input = trim($input);
2544
-        $input = rtrim($input, ",");
2545
-        $input = ltrim($input, ",");
2546
-        $input = trim($input);
2547
-    }
2548
-
2549
-    $input_arr = explode(',', $input);
2550
-
2551
-    if (!empty($input_arr)) {
2552
-        foreach ($input_arr as $input_str) {
2553
-            $input_str = trim($input_str);
2554
-
2555
-            if (strpos($input_str, "/") !== false) {
2556
-                $input_str = explode("/", $input_str, 2);
2557
-                $label = trim($input_str[0]);
2558
-                if ($translated && $label != '') {
2559
-                    $label = __($label, 'geodirectory');
2560
-                }
2561
-                $label = ucfirst($label);
2562
-                $value = trim($input_str[1]);
2563
-            } else {
2564
-                if ($translated && $input_str != '') {
2565
-                    $input_str = __($input_str, 'geodirectory');
2566
-                }
2567
-                $label = ucfirst($input_str);
2568
-                $value = $input_str;
2569
-            }
2570
-
2571
-            if ($label != '') {
2572
-                $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2573
-            }
2574
-        }
2575
-    }
2576
-
2577
-    return $return;
2541
+	$return = array();
2542
+	if ($input != '') {
2543
+		$input = trim($input);
2544
+		$input = rtrim($input, ",");
2545
+		$input = ltrim($input, ",");
2546
+		$input = trim($input);
2547
+	}
2548
+
2549
+	$input_arr = explode(',', $input);
2550
+
2551
+	if (!empty($input_arr)) {
2552
+		foreach ($input_arr as $input_str) {
2553
+			$input_str = trim($input_str);
2554
+
2555
+			if (strpos($input_str, "/") !== false) {
2556
+				$input_str = explode("/", $input_str, 2);
2557
+				$label = trim($input_str[0]);
2558
+				if ($translated && $label != '') {
2559
+					$label = __($label, 'geodirectory');
2560
+				}
2561
+				$label = ucfirst($label);
2562
+				$value = trim($input_str[1]);
2563
+			} else {
2564
+				if ($translated && $input_str != '') {
2565
+					$input_str = __($input_str, 'geodirectory');
2566
+				}
2567
+				$label = ucfirst($input_str);
2568
+				$value = $input_str;
2569
+			}
2570
+
2571
+			if ($label != '') {
2572
+				$return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2573
+			}
2574
+		}
2575
+	}
2576
+
2577
+	return $return;
2578 2578
 }
2579 2579
 
2580 2580
 /**
@@ -2589,59 +2589,59 @@  discard block
 block discarded – undo
2589 2589
  */
2590 2590
 function geodir_string_values_to_options($option_values = '', $translated = false)
2591 2591
 {
2592
-    $options = array();
2593
-    if ($option_values == '') {
2594
-        return NULL;
2595
-    }
2596
-
2597
-    if (strpos($option_values, "{/optgroup}") !== false) {
2598
-        $option_values_arr = explode("{/optgroup}", $option_values);
2599
-
2600
-        foreach ($option_values_arr as $optgroup) {
2601
-            if (strpos($optgroup, "{optgroup}") !== false) {
2602
-                $optgroup_arr = explode("{optgroup}", $optgroup);
2603
-
2604
-                $count = 0;
2605
-                foreach ($optgroup_arr as $optgroup_str) {
2606
-                    $count++;
2607
-                    $optgroup_str = trim($optgroup_str);
2608
-
2609
-                    $optgroup_label = '';
2610
-                    if (strpos($optgroup_str, "|") !== false) {
2611
-                        $optgroup_str_arr = explode("|", $optgroup_str, 2);
2612
-                        $optgroup_label = trim($optgroup_str_arr[0]);
2613
-                        if ($translated && $optgroup_label != '') {
2614
-                            $optgroup_label = __($optgroup_label, 'geodirectory');
2615
-                        }
2616
-                        $optgroup_label = ucfirst($optgroup_label);
2617
-                        $optgroup_str = $optgroup_str_arr[1];
2618
-                    }
2619
-
2620
-                    $optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2621
-
2622
-                    if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2623
-                        $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2624
-                        $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2625
-                        $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2626
-                    }
2627
-                    $options = array_merge($options, $optgroup3);
2628
-                }
2629
-            } else {
2630
-                $optgroup1 = geodir_string_to_options($optgroup, $translated);
2631
-                $options = array_merge($options, $optgroup1);
2632
-            }
2633
-        }
2634
-    } else {
2635
-        $options = geodir_string_to_options($option_values, $translated);
2636
-    }
2637
-
2638
-    return $options;
2592
+	$options = array();
2593
+	if ($option_values == '') {
2594
+		return NULL;
2595
+	}
2596
+
2597
+	if (strpos($option_values, "{/optgroup}") !== false) {
2598
+		$option_values_arr = explode("{/optgroup}", $option_values);
2599
+
2600
+		foreach ($option_values_arr as $optgroup) {
2601
+			if (strpos($optgroup, "{optgroup}") !== false) {
2602
+				$optgroup_arr = explode("{optgroup}", $optgroup);
2603
+
2604
+				$count = 0;
2605
+				foreach ($optgroup_arr as $optgroup_str) {
2606
+					$count++;
2607
+					$optgroup_str = trim($optgroup_str);
2608
+
2609
+					$optgroup_label = '';
2610
+					if (strpos($optgroup_str, "|") !== false) {
2611
+						$optgroup_str_arr = explode("|", $optgroup_str, 2);
2612
+						$optgroup_label = trim($optgroup_str_arr[0]);
2613
+						if ($translated && $optgroup_label != '') {
2614
+							$optgroup_label = __($optgroup_label, 'geodirectory');
2615
+						}
2616
+						$optgroup_label = ucfirst($optgroup_label);
2617
+						$optgroup_str = $optgroup_str_arr[1];
2618
+					}
2619
+
2620
+					$optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2621
+
2622
+					if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2623
+						$optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2624
+						$optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2625
+						$optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2626
+					}
2627
+					$options = array_merge($options, $optgroup3);
2628
+				}
2629
+			} else {
2630
+				$optgroup1 = geodir_string_to_options($optgroup, $translated);
2631
+				$options = array_merge($options, $optgroup1);
2632
+			}
2633
+		}
2634
+	} else {
2635
+		$options = geodir_string_to_options($option_values, $translated);
2636
+	}
2637
+
2638
+	return $options;
2639 2639
 }
2640 2640
 
2641 2641
 
2642 2642
 function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2643
-    ob_start();
2644
-    ?>
2643
+	ob_start();
2644
+	?>
2645 2645
     <li>
2646 2646
         <label for="data_type""><?php _e('Field Data Type ? :', 'geodirectory'); ?></label>
2647 2647
         <div class="gd-cf-input-wrap">
@@ -2650,16 +2650,16 @@  discard block
 block discarded – undo
2650 2650
                     onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');">
2651 2651
                 <option
2652 2652
                     value="XVARCHAR" <?php if (isset($field_info->data_type) && $field_info->data_type == 'VARCHAR') {
2653
-                    echo 'selected="selected"';
2654
-                } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2653
+					echo 'selected="selected"';
2654
+				} ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2655 2655
                 <option
2656 2656
                     value="INT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'INT') {
2657
-                    echo 'selected="selected"';
2658
-                } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2657
+					echo 'selected="selected"';
2658
+				} ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2659 2659
                 <option
2660 2660
                     value="FLOAT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'FLOAT') {
2661
-                    echo 'selected="selected"';
2662
-                } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2661
+					echo 'selected="selected"';
2662
+				} ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2663 2663
             </select>
2664 2664
             <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
2665 2665
 
@@ -2672,8 +2672,8 @@  discard block
 block discarded – undo
2672 2672
             <select name="decimal_point" id="decimal_point">
2673 2673
                 <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
2674 2674
                 <?php for ($i = 1; $i <= 10; $i++) {
2675
-                    $decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';
2676
-                    $selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>
2675
+					$decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';
2676
+					$selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>
2677 2677
                     <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
2678 2678
                 <?php } ?>
2679 2679
             </select>
@@ -2682,8 +2682,8 @@  discard block
 block discarded – undo
2682 2682
     </li>
2683 2683
 <?php
2684 2684
 
2685
-    $output = ob_get_clean();
2686
-    return $output;
2685
+	$output = ob_get_clean();
2686
+	return $output;
2687 2687
 }
2688 2688
 add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2689 2689
 
@@ -2721,9 +2721,9 @@  discard block
 block discarded – undo
2721 2721
 
2722 2722
 
2723 2723
 function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2724
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2725
-    ob_start();
2726
-    ?>
2724
+	if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2725
+	ob_start();
2726
+	?>
2727 2727
     <li>
2728 2728
         <label for="advanced_editor" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show advanced editor :', 'geodirectory'); ?>
2729 2729
             <div class="gdcf-tooltip">
@@ -2734,13 +2734,13 @@  discard block
 block discarded – undo
2734 2734
         <div class="gd-cf-input-wrap">
2735 2735
 
2736 2736
             <?php
2737
-            $selected = '';
2738
-            if (isset($field_info->extra_fields))
2739
-                $advanced_editor = unserialize($field_info->extra_fields);
2737
+			$selected = '';
2738
+			if (isset($field_info->extra_fields))
2739
+				$advanced_editor = unserialize($field_info->extra_fields);
2740 2740
 
2741
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2742
-                $selected = 'checked="checked"';
2743
-            ?>
2741
+			if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2742
+				$selected = 'checked="checked"';
2743
+			?>
2744 2744
 
2745 2745
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
2746 2746
                    value="1" <?php echo $selected; ?>/>
@@ -2749,22 +2749,22 @@  discard block
 block discarded – undo
2749 2749
     </li>
2750 2750
     <?php
2751 2751
 
2752
-    $output = ob_get_clean();
2753
-    return $output;
2752
+	$output = ob_get_clean();
2753
+	return $output;
2754 2754
 }
2755 2755
 add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2756 2756
 
2757 2757
 
2758 2758
 function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2759
-    ob_start();
2760
-
2761
-    $value = '';
2762
-    if (isset($field_info->validation_pattern)) {
2763
-        $value = esc_attr($field_info->validation_pattern);
2764
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2765
-        $value = esc_attr($cf['defaults']['validation_pattern']);
2766
-    }
2767
-    ?>
2759
+	ob_start();
2760
+
2761
+	$value = '';
2762
+	if (isset($field_info->validation_pattern)) {
2763
+		$value = esc_attr($field_info->validation_pattern);
2764
+	}elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2765
+		$value = esc_attr($cf['defaults']['validation_pattern']);
2766
+	}
2767
+	?>
2768 2768
     <li>
2769 2769
         <label for="validation_pattern" class="gd-cf-tooltip-wrap">
2770 2770
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Pattern:', 'geodirectory'); ?>
@@ -2778,13 +2778,13 @@  discard block
 block discarded – undo
2778 2778
         </div>
2779 2779
     </li>
2780 2780
     <?php
2781
-    $value = '';
2782
-    if (isset($field_info->validation_msg)) {
2783
-        $value = esc_attr($field_info->validation_msg);
2784
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2785
-        $value = esc_attr($cf['defaults']['validation_msg']);
2786
-    }
2787
-    ?>
2781
+	$value = '';
2782
+	if (isset($field_info->validation_msg)) {
2783
+		$value = esc_attr($field_info->validation_msg);
2784
+	}elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2785
+		$value = esc_attr($cf['defaults']['validation_msg']);
2786
+	}
2787
+	?>
2788 2788
     <li>
2789 2789
         <label for="validation_msg" class="gd-cf-tooltip-wrap">
2790 2790
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Message:', 'geodirectory'); ?>
@@ -2799,21 +2799,21 @@  discard block
 block discarded – undo
2799 2799
     </li>
2800 2800
     <?php
2801 2801
 
2802
-    $output = ob_get_clean();
2803
-    return $output;
2802
+	$output = ob_get_clean();
2803
+	return $output;
2804 2804
 }
2805 2805
 add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2806 2806
 
2807 2807
 
2808 2808
 function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2809
-    ob_start();
2810
-    global $post_type;
2811
-
2812
-    if (!isset($field_info->post_type)) {
2813
-        $post_type = sanitize_text_field($_REQUEST['listing_type']);
2814
-    } else
2815
-        $post_type = $field_info->post_type;
2816
-    ?>
2809
+	ob_start();
2810
+	global $post_type;
2811
+
2812
+	if (!isset($field_info->post_type)) {
2813
+		$post_type = sanitize_text_field($_REQUEST['listing_type']);
2814
+	} else
2815
+		$post_type = $field_info->post_type;
2816
+	?>
2817 2817
     <li style="display: none;">
2818 2818
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
2819 2819
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Select taxonomy:', 'geodirectory'); ?>
@@ -2824,15 +2824,15 @@  discard block
 block discarded – undo
2824 2824
         <div class="gd-cf-input-wrap">
2825 2825
             <select name="htmlvar_name" id="htmlvar_name">
2826 2826
                 <?php
2827
-                $gd_taxonomy = geodir_get_taxonomies($post_type);
2827
+				$gd_taxonomy = geodir_get_taxonomies($post_type);
2828 2828
 
2829
-                foreach ($gd_taxonomy as $gd_tax) {
2830
-                    ?>
2829
+				foreach ($gd_taxonomy as $gd_tax) {
2830
+					?>
2831 2831
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2832
-                        echo 'selected="selected"';
2833
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2834
-                }
2835
-                ?>
2832
+						echo 'selected="selected"';
2833
+					}?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2834
+				}
2835
+				?>
2836 2836
             </select>
2837 2837
         </div>
2838 2838
     </li>
@@ -2848,49 +2848,49 @@  discard block
 block discarded – undo
2848 2848
 
2849 2849
             <select name="cat_display_type" id="cat_display_type">
2850 2850
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2851
-                    echo 'selected="selected"';
2852
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2851
+					echo 'selected="selected"';
2852
+				}?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2853 2853
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2854
-                    echo 'selected="selected"';
2855
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2854
+					echo 'selected="selected"';
2855
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
2856 2856
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2857
-                    echo 'selected="selected"';
2858
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2857
+					echo 'selected="selected"';
2858
+				}?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2859 2859
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2860
-                    echo 'selected="selected"';
2861
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2860
+					echo 'selected="selected"';
2861
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2862 2862
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2863
-                    echo 'selected="selected"';
2864
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2863
+					echo 'selected="selected"';
2864
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2865 2865
             </select>
2866 2866
         </div>
2867 2867
     </li>
2868 2868
     <?php
2869 2869
 
2870
-    $output = ob_get_clean();
2871
-    return $output;
2870
+	$output = ob_get_clean();
2871
+	return $output;
2872 2872
 }
2873 2873
 add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2874 2874
 
2875 2875
 
2876 2876
 function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2877 2877
 
2878
-    ob_start();
2879
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2880
-        $address = unserialize($field_info->extra_fields);
2881
-    }
2878
+	ob_start();
2879
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2880
+		$address = unserialize($field_info->extra_fields);
2881
+	}
2882 2882
 
2883
-    $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2884
-    ?>
2883
+	$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2884
+	?>
2885 2885
     <?php
2886
-    /**
2887
-     * Called on the add custom fields settings page before the address field is output.
2888
-     *
2889
-     * @since 1.0.0
2890
-     * @param array $address The address settings array.
2891
-     * @param object $field_info Extra fields info.
2892
-     */
2893
-    do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2886
+	/**
2887
+	 * Called on the add custom fields settings page before the address field is output.
2888
+	 *
2889
+	 * @since 1.0.0
2890
+	 * @param array $address The address settings array.
2891
+	 * @param object $field_info Extra fields info.
2892
+	 */
2893
+	do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2894 2894
 
2895 2895
     <li>
2896 2896
         <label for="show_zip" class="gd-cf-tooltip-wrap">
@@ -2903,14 +2903,14 @@  discard block
 block discarded – undo
2903 2903
 
2904 2904
             <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2905 2905
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2906
-                    echo 'checked';
2907
-                } ?>/>
2906
+					echo 'checked';
2907
+				} ?>/>
2908 2908
             <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2909 2909
 
2910 2910
             <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2911 2911
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2912
-                    echo 'checked';
2913
-                } ?>/>
2912
+					echo 'checked';
2913
+				} ?>/>
2914 2914
             <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2915 2915
 
2916 2916
 
@@ -2927,8 +2927,8 @@  discard block
 block discarded – undo
2927 2927
         <div class="gd-cf-input-wrap">
2928 2928
             <input type="text" name="extra[zip_lable]" id="zip_lable"
2929 2929
                    value="<?php if (isset($address['zip_lable'])) {
2930
-                       echo esc_attr($address['zip_lable']);
2931
-                   }?>"/>
2930
+					   echo esc_attr($address['zip_lable']);
2931
+				   }?>"/>
2932 2932
         </div>
2933 2933
     </li>
2934 2934
 
@@ -2945,8 +2945,8 @@  discard block
 block discarded – undo
2945 2945
         <div class="gd-cf-input-wrap">
2946 2946
             <input type="text" name="extra[map_lable]" id="map_lable"
2947 2947
                    value="<?php if (isset($address['map_lable'])) {
2948
-                       echo esc_attr($address['map_lable']);
2949
-                   }?>"/>
2948
+					   echo esc_attr($address['map_lable']);
2949
+				   }?>"/>
2950 2950
         </div>
2951 2951
     </li>
2952 2952
 
@@ -2961,14 +2961,14 @@  discard block
 block discarded – undo
2961 2961
 
2962 2962
             <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2963 2963
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
2964
-                    echo 'checked';
2965
-                } ?>/>
2964
+					echo 'checked';
2965
+				} ?>/>
2966 2966
             <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2967 2967
 
2968 2968
             <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2969 2969
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
2970
-                    echo 'checked';
2971
-                } ?>/>
2970
+					echo 'checked';
2971
+				} ?>/>
2972 2972
             <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2973 2973
 
2974 2974
         </div>
@@ -2985,14 +2985,14 @@  discard block
 block discarded – undo
2985 2985
 
2986 2986
             <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
2987 2987
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
2988
-                    echo 'checked';
2989
-                } ?>/>
2988
+					echo 'checked';
2989
+				} ?>/>
2990 2990
             <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2991 2991
 
2992 2992
             <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
2993 2993
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
2994
-                    echo 'checked';
2995
-                } ?>/>
2994
+					echo 'checked';
2995
+				} ?>/>
2996 2996
             <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2997 2997
 
2998 2998
         </div>
@@ -3009,8 +3009,8 @@  discard block
 block discarded – undo
3009 3009
         <div class="gd-cf-input-wrap">
3010 3010
             <input type="text" name="extra[mapview_lable]" id="mapview_lable"
3011 3011
                    value="<?php if (isset($address['mapview_lable'])) {
3012
-                       echo esc_attr($address['mapview_lable']);
3013
-                   }?>"/>
3012
+					   echo esc_attr($address['mapview_lable']);
3013
+				   }?>"/>
3014 3014
         </div>
3015 3015
     </li>
3016 3016
     <li>
@@ -3024,29 +3024,29 @@  discard block
 block discarded – undo
3024 3024
 
3025 3025
             <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3026 3026
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
3027
-                    echo 'checked';
3028
-                } ?>/>
3027
+					echo 'checked';
3028
+				} ?>/>
3029 3029
             <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3030 3030
 
3031 3031
             <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3032 3032
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
3033
-                    echo 'checked';
3034
-                } ?>/>
3033
+					echo 'checked';
3034
+				} ?>/>
3035 3035
             <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3036 3036
 
3037 3037
         </div>
3038 3038
     </li>
3039 3039
     <?php
3040 3040
 
3041
-    $output = ob_get_clean();
3042
-    return $output;
3041
+	$output = ob_get_clean();
3042
+	return $output;
3043 3043
 }
3044 3044
 add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
3045 3045
 
3046 3046
 
3047 3047
 function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
3048
-    ob_start();
3049
-    ?>
3048
+	ob_start();
3049
+	?>
3050 3050
     <li>
3051 3051
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
3052 3052
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
@@ -3058,14 +3058,14 @@  discard block
 block discarded – undo
3058 3058
 
3059 3059
             <select name="multi_display_type" id="multi_display_type">
3060 3060
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
3061
-                    echo 'selected="selected"';
3062
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
3061
+					echo 'selected="selected"';
3062
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
3063 3063
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
3064
-                    echo 'selected="selected"';
3065
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3064
+					echo 'selected="selected"';
3065
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3066 3066
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
3067
-                    echo 'selected="selected"';
3068
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3067
+					echo 'selected="selected"';
3068
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3069 3069
             </select>
3070 3070
 
3071 3071
             <br/>
@@ -3073,17 +3073,17 @@  discard block
 block discarded – undo
3073 3073
     </li>
3074 3074
     <?php
3075 3075
 
3076
-    $output = ob_get_clean();
3077
-    return $output;
3076
+	$output = ob_get_clean();
3077
+	return $output;
3078 3078
 }
3079 3079
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
3080 3080
 
3081 3081
 
3082 3082
 function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
3083 3083
 
3084
-    ob_start();
3085
-    $field_type = isset($field_info->field_type) ? $field_info->field_type : '';
3086
-    ?>
3084
+	ob_start();
3085
+	$field_type = isset($field_info->field_type) ? $field_info->field_type : '';
3086
+	?>
3087 3087
     <li>
3088 3088
         <label for="option_values" class="gd-cf-tooltip-wrap">
3089 3089
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
@@ -3104,16 +3104,16 @@  discard block
 block discarded – undo
3104 3104
         <div class="gd-cf-input-wrap">
3105 3105
             <input type="text" name="option_values" id="option_values"
3106 3106
                    value="<?php if (isset($field_info->option_values)) {
3107
-                       echo esc_attr($field_info->option_values);
3108
-                   }?>"/>
3107
+					   echo esc_attr($field_info->option_values);
3108
+				   }?>"/>
3109 3109
             <br/>
3110 3110
 
3111 3111
         </div>
3112 3112
     </li>
3113 3113
     <?php
3114 3114
 
3115
-    $output = ob_get_clean();
3116
-    return $output;
3115
+	$output = ob_get_clean();
3116
+	return $output;
3117 3117
 }
3118 3118
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
3119 3119
 add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
@@ -3121,12 +3121,12 @@  discard block
 block discarded – undo
3121 3121
 
3122 3122
 
3123 3123
 function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
3124
-    ob_start();
3125
-    $extra = array();
3126
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3127
-        $extra = unserialize($field_info->extra_fields);
3128
-    }
3129
-    ?>
3124
+	ob_start();
3125
+	$extra = array();
3126
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3127
+		$extra = unserialize($field_info->extra_fields);
3128
+	}
3129
+	?>
3130 3130
     <li>
3131 3131
         <label for="date_format" class="gd-cf-tooltip-wrap">
3132 3132
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
@@ -3136,52 +3136,52 @@  discard block
 block discarded – undo
3136 3136
         </label>
3137 3137
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
3138 3138
             <?php
3139
-            $date_formats = array(
3140
-                'm/d/Y',
3141
-                'd/m/Y',
3142
-                'Y/m/d',
3143
-                'm-d-Y',
3144
-                'd-m-Y',
3145
-                'Y-m-d',
3146
-                'F j, Y',
3147
-            );
3148
-            /**
3149
-             * Filter the custom field date format options.
3150
-             *
3151
-             * @since 1.6.5
3152
-             * @param array $date_formats The PHP date format array.
3153
-             */
3154
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
3155
-            ?>
3139
+			$date_formats = array(
3140
+				'm/d/Y',
3141
+				'd/m/Y',
3142
+				'Y/m/d',
3143
+				'm-d-Y',
3144
+				'd-m-Y',
3145
+				'Y-m-d',
3146
+				'F j, Y',
3147
+			);
3148
+			/**
3149
+			 * Filter the custom field date format options.
3150
+			 *
3151
+			 * @since 1.6.5
3152
+			 * @param array $date_formats The PHP date format array.
3153
+			 */
3154
+			$date_formats = apply_filters('geodir_date_formats',$date_formats);
3155
+			?>
3156 3156
             <select name="extra[date_format]" id="date_format">
3157 3157
                 <?php
3158
-                foreach($date_formats as $format){
3159
-                    $selected = '';
3160
-                    if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3161
-                        $selected = "selected='selected'";
3162
-                    }
3163
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3164
-                }
3165
-                ?>
3158
+				foreach($date_formats as $format){
3159
+					$selected = '';
3160
+					if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3161
+						$selected = "selected='selected'";
3162
+					}
3163
+					echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3164
+				}
3165
+				?>
3166 3166
             </select>
3167 3167
 
3168 3168
         </div>
3169 3169
     </li>
3170 3170
     <?php
3171 3171
 
3172
-    $output = ob_get_clean();
3173
-    return $output;
3172
+	$output = ob_get_clean();
3173
+	return $output;
3174 3174
 }
3175 3175
 add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3176 3176
 
3177 3177
 
3178 3178
 function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3179
-    ob_start();
3180
-    $allowed_file_types = geodir_allowed_mime_types();
3179
+	ob_start();
3180
+	$allowed_file_types = geodir_allowed_mime_types();
3181 3181
 
3182
-    $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3183
-    $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3184
-    ?>
3182
+	$extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3183
+	$gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3184
+	?>
3185 3185
     <li>
3186 3186
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3187 3187
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
@@ -3204,182 +3204,182 @@  discard block
 block discarded – undo
3204 3204
     </li>
3205 3205
     <?php
3206 3206
 
3207
-    $output = ob_get_clean();
3208
-    return $output;
3207
+	$output = ob_get_clean();
3208
+	return $output;
3209 3209
 }
3210 3210
 add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3211 3211
 
3212 3212
 function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
3213
-    $fields = array();
3214
-    $package = ($package_id=='') ? '' : array($package_id);
3215
-
3216
-    $fields[] = array('listing_type' => $post_type,
3217
-                      'data_type' => 'VARCHAR',
3218
-                      'field_type' => 'taxonomy',
3219
-                      'admin_title' => __('Category', 'geodirectory'),
3220
-                      'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
3221
-                      'site_title' => __('Category', 'geodirectory'),
3222
-                      'htmlvar_name' => $post_type.'category',
3223
-                      'default_value' => '',
3224
-                      'is_default' => '1',
3225
-                      'is_admin' => '1',
3226
-                      'is_required' => '1',
3227
-                      'show_in'   =>  '[detail]',
3228
-                      'show_on_pkg' => $package,
3229
-                      'clabels' => __('Category', 'geodirectory'));
3230
-
3231
-    $fields[] = array('listing_type' => $post_type,
3232
-                      'data_type' => 'VARCHAR',
3233
-                      'field_type' => 'address',
3234
-                      'admin_title' => __('Address', 'geodirectory'),
3235
-                      'admin_desc' => ADDRESS_MSG,
3236
-                      'site_title' => __('Address', 'geodirectory'),
3237
-                      'htmlvar_name' => 'post',
3238
-                      'default_value' => '',
3239
-                      'option_values' => '',
3240
-                      'is_default' => '1',
3241
-                      'is_admin' => '1',
3242
-                      'is_required' => '1',
3243
-                      'show_in'   =>  '[detail],[mapbubble]',
3244
-                      'show_on_pkg' => $package,
3245
-                      'required_msg' => __('Address fields are required', 'geodirectory'),
3246
-                      'clabels' => __('Address', 'geodirectory'),
3247
-                      'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
3248
-                                       'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
3249
-                                       'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
3250
-                                       'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
3251
-                                       'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
3252
-                                       'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
3253
-                                       'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
3254
-                                       'show_latlng' => 1));
3255
-
3256
-    $fields[] = array('listing_type' => $post_type,
3257
-                      'data_type' => 'VARCHAR',
3258
-                      'field_type' => 'text',
3259
-                      'admin_title' => __('Time', 'geodirectory'),
3260
-                      'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
3261
-                      'site_title' => __('Time', 'geodirectory'),
3262
-                      'htmlvar_name' => 'timing',
3263
-                      'default_value' => '',
3264
-                      'option_values' => '',
3265
-                      'is_default' => '1',
3266
-                      'is_admin' => '1',
3267
-                      'show_in' =>  '[detail],[mapbubble]',
3268
-                      'show_on_pkg' => $package,
3269
-                      'clabels' => __('Time', 'geodirectory'));
3270
-
3271
-    $fields[] = array('listing_type' => $post_type,
3272
-                      'data_type' => 'VARCHAR',
3273
-                      'field_type' => 'phone',
3274
-                      'admin_title' => __('Phone', 'geodirectory'),
3275
-                      'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
3276
-                      'site_title' => __('Phone', 'geodirectory'),
3277
-                      'htmlvar_name' => 'contact',
3278
-                      'default_value' => '',
3279
-                      'option_values' => '',
3280
-                      'is_default' => '1',
3281
-                      'is_admin' => '1',
3282
-                      'show_in' =>  '[detail],[mapbubble]',
3283
-                      'show_on_pkg' => $package,
3284
-                      'clabels' => __('Phone', 'geodirectory'));
3285
-
3286
-    $fields[] = array('listing_type' => $post_type,
3287
-                      'data_type' => 'VARCHAR',
3288
-                      'field_type' => 'email',
3289
-                      'admin_title' => __('Email', 'geodirectory'),
3290
-                      'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
3291
-                      'site_title' => __('Email', 'geodirectory'),
3292
-                      'htmlvar_name' => 'email',
3293
-                      'default_value' => '',
3294
-                      'option_values' => '',
3295
-                      'is_default' => '1',
3296
-                      'is_admin' => '1',
3297
-                      'show_in' => '[detail]',
3298
-                      'show_on_pkg' => $package,
3299
-                      'clabels' => __('Email', 'geodirectory'));
3300
-
3301
-    $fields[] = array('listing_type' => $post_type,
3302
-                      'data_type' => 'VARCHAR',
3303
-                      'field_type' => 'url',
3304
-                      'admin_title' => __('Website', 'geodirectory'),
3305
-                      'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
3306
-                      'site_title' => __('Website', 'geodirectory'),
3307
-                      'htmlvar_name' => 'website',
3308
-                      'default_value' => '',
3309
-                      'option_values' => '',
3310
-                      'is_default' => '1',
3311
-                      'is_admin' => '1',
3312
-                      'show_in' => '[detail]',
3313
-                      'show_on_pkg' => $package,
3314
-                      'clabels' => __('Website', 'geodirectory'));
3315
-
3316
-    $fields[] = array('listing_type' => $post_type,
3317
-                      'data_type' => 'VARCHAR',
3318
-                      'field_type' => 'url',
3319
-                      'admin_title' => __('Twitter', 'geodirectory'),
3320
-                      'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
3321
-                      'site_title' => __('Twitter', 'geodirectory'),
3322
-                      'htmlvar_name' => 'twitter',
3323
-                      'default_value' => '',
3324
-                      'option_values' => '',
3325
-                      'is_default' => '1',
3326
-                      'is_admin' => '1',
3327
-                      'show_in' => '[detail]',
3328
-                      'show_on_pkg' => $package,
3329
-                      'clabels' => __('Twitter', 'geodirectory'));
3330
-
3331
-    $fields[] = array('listing_type' => $post_type,
3332
-                      'data_type' => 'VARCHAR',
3333
-                      'field_type' => 'url',
3334
-                      'admin_title' => __('Facebook', 'geodirectory'),
3335
-                      'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
3336
-                      'site_title' => __('Facebook', 'geodirectory'),
3337
-                      'htmlvar_name' => 'facebook',
3338
-                      'default_value' => '',
3339
-                      'option_values' => '',
3340
-                      'is_default' => '1',
3341
-                      'is_admin' => '1',
3342
-                      'show_in' => '[detail]',
3343
-                      'show_on_pkg' => $package,
3344
-                      'clabels' => __('Facebook', 'geodirectory'));
3345
-
3346
-    $fields[] = array('listing_type' => $post_type,
3347
-                      'data_type' => 'TEXT',
3348
-                      'field_type' => 'textarea',
3349
-                      'admin_title' => __('Video', 'geodirectory'),
3350
-                      'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
3351
-                      'site_title' => __('Video', 'geodirectory'),
3352
-                      'htmlvar_name' => 'video',
3353
-                      'default_value' => '',
3354
-                      'option_values' => '',
3355
-                      'is_default' => '0',
3356
-                      'is_admin' => '1',
3357
-                      'show_in' => '[owntab]',
3358
-                      'show_on_pkg' => $package,
3359
-                      'clabels' => __('Video', 'geodirectory'));
3360
-
3361
-    $fields[] = array('listing_type' => $post_type,
3362
-                      'data_type' => 'TEXT',
3363
-                      'field_type' => 'textarea',
3364
-                      'admin_title' => __('Special Offers', 'geodirectory'),
3365
-                      'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
3366
-                      'site_title' => __('Special Offers', 'geodirectory'),
3367
-                      'htmlvar_name' => 'special_offers',
3368
-                      'default_value' => '',
3369
-                      'option_values' => '',
3370
-                      'is_default' => '0',
3371
-                      'is_admin' => '1',
3372
-                      'show_in' => '[owntab]',
3373
-                      'show_on_pkg' => $package,
3374
-                      'clabels' => __('Special Offers', 'geodirectory'));
3375
-
3376
-    /**
3377
-     * Filter the array of default custom fields DB table data.
3378
-     *
3379
-     * @since 1.6.6
3380
-     * @param string $fields The default custom fields as an array.
3381
-     */
3382
-    $fields = apply_filters('geodir_default_custom_fields', $fields);
3383
-
3384
-    return  $fields;
3213
+	$fields = array();
3214
+	$package = ($package_id=='') ? '' : array($package_id);
3215
+
3216
+	$fields[] = array('listing_type' => $post_type,
3217
+					  'data_type' => 'VARCHAR',
3218
+					  'field_type' => 'taxonomy',
3219
+					  'admin_title' => __('Category', 'geodirectory'),
3220
+					  'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
3221
+					  'site_title' => __('Category', 'geodirectory'),
3222
+					  'htmlvar_name' => $post_type.'category',
3223
+					  'default_value' => '',
3224
+					  'is_default' => '1',
3225
+					  'is_admin' => '1',
3226
+					  'is_required' => '1',
3227
+					  'show_in'   =>  '[detail]',
3228
+					  'show_on_pkg' => $package,
3229
+					  'clabels' => __('Category', 'geodirectory'));
3230
+
3231
+	$fields[] = array('listing_type' => $post_type,
3232
+					  'data_type' => 'VARCHAR',
3233
+					  'field_type' => 'address',
3234
+					  'admin_title' => __('Address', 'geodirectory'),
3235
+					  'admin_desc' => ADDRESS_MSG,
3236
+					  'site_title' => __('Address', 'geodirectory'),
3237
+					  'htmlvar_name' => 'post',
3238
+					  'default_value' => '',
3239
+					  'option_values' => '',
3240
+					  'is_default' => '1',
3241
+					  'is_admin' => '1',
3242
+					  'is_required' => '1',
3243
+					  'show_in'   =>  '[detail],[mapbubble]',
3244
+					  'show_on_pkg' => $package,
3245
+					  'required_msg' => __('Address fields are required', 'geodirectory'),
3246
+					  'clabels' => __('Address', 'geodirectory'),
3247
+					  'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
3248
+									   'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
3249
+									   'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
3250
+									   'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
3251
+									   'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
3252
+									   'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
3253
+									   'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
3254
+									   'show_latlng' => 1));
3255
+
3256
+	$fields[] = array('listing_type' => $post_type,
3257
+					  'data_type' => 'VARCHAR',
3258
+					  'field_type' => 'text',
3259
+					  'admin_title' => __('Time', 'geodirectory'),
3260
+					  'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
3261
+					  'site_title' => __('Time', 'geodirectory'),
3262
+					  'htmlvar_name' => 'timing',
3263
+					  'default_value' => '',
3264
+					  'option_values' => '',
3265
+					  'is_default' => '1',
3266
+					  'is_admin' => '1',
3267
+					  'show_in' =>  '[detail],[mapbubble]',
3268
+					  'show_on_pkg' => $package,
3269
+					  'clabels' => __('Time', 'geodirectory'));
3270
+
3271
+	$fields[] = array('listing_type' => $post_type,
3272
+					  'data_type' => 'VARCHAR',
3273
+					  'field_type' => 'phone',
3274
+					  'admin_title' => __('Phone', 'geodirectory'),
3275
+					  'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
3276
+					  'site_title' => __('Phone', 'geodirectory'),
3277
+					  'htmlvar_name' => 'contact',
3278
+					  'default_value' => '',
3279
+					  'option_values' => '',
3280
+					  'is_default' => '1',
3281
+					  'is_admin' => '1',
3282
+					  'show_in' =>  '[detail],[mapbubble]',
3283
+					  'show_on_pkg' => $package,
3284
+					  'clabels' => __('Phone', 'geodirectory'));
3285
+
3286
+	$fields[] = array('listing_type' => $post_type,
3287
+					  'data_type' => 'VARCHAR',
3288
+					  'field_type' => 'email',
3289
+					  'admin_title' => __('Email', 'geodirectory'),
3290
+					  'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
3291
+					  'site_title' => __('Email', 'geodirectory'),
3292
+					  'htmlvar_name' => 'email',
3293
+					  'default_value' => '',
3294
+					  'option_values' => '',
3295
+					  'is_default' => '1',
3296
+					  'is_admin' => '1',
3297
+					  'show_in' => '[detail]',
3298
+					  'show_on_pkg' => $package,
3299
+					  'clabels' => __('Email', 'geodirectory'));
3300
+
3301
+	$fields[] = array('listing_type' => $post_type,
3302
+					  'data_type' => 'VARCHAR',
3303
+					  'field_type' => 'url',
3304
+					  'admin_title' => __('Website', 'geodirectory'),
3305
+					  'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
3306
+					  'site_title' => __('Website', 'geodirectory'),
3307
+					  'htmlvar_name' => 'website',
3308
+					  'default_value' => '',
3309
+					  'option_values' => '',
3310
+					  'is_default' => '1',
3311
+					  'is_admin' => '1',
3312
+					  'show_in' => '[detail]',
3313
+					  'show_on_pkg' => $package,
3314
+					  'clabels' => __('Website', 'geodirectory'));
3315
+
3316
+	$fields[] = array('listing_type' => $post_type,
3317
+					  'data_type' => 'VARCHAR',
3318
+					  'field_type' => 'url',
3319
+					  'admin_title' => __('Twitter', 'geodirectory'),
3320
+					  'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
3321
+					  'site_title' => __('Twitter', 'geodirectory'),
3322
+					  'htmlvar_name' => 'twitter',
3323
+					  'default_value' => '',
3324
+					  'option_values' => '',
3325
+					  'is_default' => '1',
3326
+					  'is_admin' => '1',
3327
+					  'show_in' => '[detail]',
3328
+					  'show_on_pkg' => $package,
3329
+					  'clabels' => __('Twitter', 'geodirectory'));
3330
+
3331
+	$fields[] = array('listing_type' => $post_type,
3332
+					  'data_type' => 'VARCHAR',
3333
+					  'field_type' => 'url',
3334
+					  'admin_title' => __('Facebook', 'geodirectory'),
3335
+					  'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
3336
+					  'site_title' => __('Facebook', 'geodirectory'),
3337
+					  'htmlvar_name' => 'facebook',
3338
+					  'default_value' => '',
3339
+					  'option_values' => '',
3340
+					  'is_default' => '1',
3341
+					  'is_admin' => '1',
3342
+					  'show_in' => '[detail]',
3343
+					  'show_on_pkg' => $package,
3344
+					  'clabels' => __('Facebook', 'geodirectory'));
3345
+
3346
+	$fields[] = array('listing_type' => $post_type,
3347
+					  'data_type' => 'TEXT',
3348
+					  'field_type' => 'textarea',
3349
+					  'admin_title' => __('Video', 'geodirectory'),
3350
+					  'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
3351
+					  'site_title' => __('Video', 'geodirectory'),
3352
+					  'htmlvar_name' => 'video',
3353
+					  'default_value' => '',
3354
+					  'option_values' => '',
3355
+					  'is_default' => '0',
3356
+					  'is_admin' => '1',
3357
+					  'show_in' => '[owntab]',
3358
+					  'show_on_pkg' => $package,
3359
+					  'clabels' => __('Video', 'geodirectory'));
3360
+
3361
+	$fields[] = array('listing_type' => $post_type,
3362
+					  'data_type' => 'TEXT',
3363
+					  'field_type' => 'textarea',
3364
+					  'admin_title' => __('Special Offers', 'geodirectory'),
3365
+					  'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
3366
+					  'site_title' => __('Special Offers', 'geodirectory'),
3367
+					  'htmlvar_name' => 'special_offers',
3368
+					  'default_value' => '',
3369
+					  'option_values' => '',
3370
+					  'is_default' => '0',
3371
+					  'is_admin' => '1',
3372
+					  'show_in' => '[owntab]',
3373
+					  'show_on_pkg' => $package,
3374
+					  'clabels' => __('Special Offers', 'geodirectory'));
3375
+
3376
+	/**
3377
+	 * Filter the array of default custom fields DB table data.
3378
+	 *
3379
+	 * @since 1.6.6
3380
+	 * @param string $fields The default custom fields as an array.
3381
+	 */
3382
+	$fields = apply_filters('geodir_default_custom_fields', $fields);
3383
+
3384
+	return  $fields;
3385 3385
 }
3386 3386
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +351 added lines, -351 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50 50
     {
51 51
         global $wpdb;
52
-        $result = 0;// no rows affected
52
+        $result = 0; // no rows affected
53 53
         if (!geodir_column_exist($db, $column)) {
54 54
             if (!empty($db) && !empty($column))
55 55
                 $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 {
75 75
     global $wpdb, $geodir_post_custom_fields_cache;
76 76
 
77
-    $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
77
+    $cache_stored = $post_type.'_'.$package_id.'_'.$default.'_'.$fields_location;
78 78
 
79 79
     if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80 80
         return $geodir_post_custom_fields_cache[$cache_stored];
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
         $default_query .= " and is_admin = '0' ";
89 89
 
90 90
     if ($fields_location == 'none') {
91
-    } else{
92
-        $fields_location = esc_sql( $fields_location );
91
+    } else {
92
+        $fields_location = esc_sql($fields_location);
93 93
         $default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
94 94
     }
95 95
 
96 96
     $post_meta_info = $wpdb->get_results(
97 97
         $wpdb->prepare(
98
-            "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
98
+            "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99 99
             array($post_type)
100 100
         )
101 101
     );
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
      * @param string $field_ins_upd When set to "submit" displays form.
163 163
      * @param string $field_type_key The key of the custom field.
164 164
      */
165
-    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
165
+    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '')
166 166
     {
167 167
         global $wpdb;
168 168
         $cf = $result_str;
169 169
         if (!is_object($cf)) {
170 170
 
171
-            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
171
+            $field_info = $wpdb->get_row($wpdb->prepare("select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)));
172 172
 
173 173
         } else {
174 174
             $field_info = $cf;
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
         if ($field_id != '') {
203 203
             $cf = trim($field_id, '_');
204 204
 
205
-            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
-                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
205
+            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)))) {
206
+                $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d ", array($cf)));
207 207
 
208 208
                 $post_type = $field->post_type;
209 209
                 $htmlvar_name = $field->htmlvar_name;
210 210
 
211 211
                 if ($post_type != '' && $htmlvar_name != '') {
212
-                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
212
+                    $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
213 213
                 }
214 214
 
215 215
                 /**
@@ -223,18 +223,18 @@  discard block
 block discarded – undo
223 223
                 do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224 224
 
225 225
                 if ($field->field_type == 'address') {
226
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
226
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_address`");
227
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_city`");
228
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_region`");
229
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_country`");
230
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_zip`");
231
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_latitude`");
232
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_longitude`");
233
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapview`");
234
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapzoom`");
235 235
                 } else {
236 236
                     if ($field->field_type != 'fieldset') {
237
-                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
237
+                        $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."`");
238 238
                     }
239 239
                 }
240 240
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
         $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
305 305
 
306 306
         // some servers fail if a POST value is VARCHAR so we change it.
307
-        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
307
+        if (isset($request_field['data_type']) && $request_field['data_type'] == 'XVARCHAR') {
308 308
             $request_field['data_type'] = 'VARCHAR';
309 309
         }
310 310
 
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
         $post_type = $request_field['listing_type'];
318 318
 
319 319
         if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
320
-            $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
320
+            $cehhtmlvar_name = 'geodir_'.$cehhtmlvar_name;
321 321
         }
322 322
 
323 323
         $check_html_variable = $wpdb->get_var(
324 324
             $wpdb->prepare(
325
-                "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
325
+                "select htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where id <> %d and htmlvar_name = %s and post_type = %s ",
326 326
                 array($cf, $cehhtmlvar_name, $post_type)
327 327
             )
328 328
         );
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 
335 335
                 $post_meta_info = $wpdb->get_row(
336 336
                     $wpdb->prepare(
337
-                        "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
337
+                        "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id = %d",
338 338
                         array($cf)
339 339
                     )
340 340
                 );
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
             if ($post_type == '') $post_type = 'gd_place';
353 353
 
354 354
 
355
-            $detail_table = $plugin_prefix . $post_type . '_detail';
355
+            $detail_table = $plugin_prefix.$post_type.'_detail';
356 356
 
357 357
             $admin_title = $request_field['admin_title'];
358 358
             $site_title = $request_field['site_title'];
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
             $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
381 381
 
382 382
             
383
-            if(is_array($show_in)){
383
+            if (is_array($show_in)) {
384 384
                 $show_in = implode(",", $request_field['show_in']);
385 385
             }
386 386
             
387 387
             if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
-                $htmlvar_name = 'geodir_' . $htmlvar_name;
388
+                $htmlvar_name = 'geodir_'.$htmlvar_name;
389 389
             }
390 390
 
391 391
             $option_values = '';
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 
427 427
             if ($sort_order == '') {
428 428
 
429
-                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
429
+                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM ".GEODIR_CUSTOM_FIELDS_TABLE);
430 430
 
431
-                $sort_order = (int)$last_order + 1;
431
+                $sort_order = (int) $last_order + 1;
432 432
             }
433 433
 
434 434
             $default_value_add = '';
@@ -440,15 +440,15 @@  discard block
 block discarded – undo
440 440
                     case 'address':
441 441
 
442 442
                         if ($htmlvar_name != '') {
443
-                            $prefix = $htmlvar_name . '_';
443
+                            $prefix = $htmlvar_name.'_';
444 444
                         }
445
-                        $old_prefix = $old_html_variable . '_';
445
+                        $old_prefix = $old_html_variable.'_';
446 446
 
447 447
 
448
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
448
+                        $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."address` `".$prefix."address` VARCHAR( 254 ) NULL";
449 449
 
450 450
                         if ($default_value != '') {
451
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
451
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
452 452
                         }
453 453
 
454 454
                         $wpdb->query($meta_field_add);
@@ -457,12 +457,12 @@  discard block
 block discarded – undo
457 457
 
458 458
                             if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
459 459
 
460
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
460
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."city'");
461 461
                                 if ($is_column) {
462
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
462
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."city` `".$prefix."city` VARCHAR( 50 ) NULL";
463 463
 
464 464
                                     if ($default_value != '') {
465
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
465
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
466 466
                                     }
467 467
 
468 468
                                     $wpdb->query($meta_field_add);
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
 
471 471
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
472 472
                                     if ($default_value != '') {
473
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
473
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
474 474
                                     }
475
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
475
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add);
476 476
 
477 477
                                 }
478 478
 
@@ -482,36 +482,36 @@  discard block
 block discarded – undo
482 482
 
483 483
                             if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
484 484
 
485
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
485
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."region'");
486 486
 
487 487
                                 if ($is_column) {
488
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
488
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."region` `".$prefix."region` VARCHAR( 50 ) NULL";
489 489
 
490 490
                                     if ($default_value != '') {
491
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
491
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
492 492
                                     }
493 493
 
494 494
                                     $wpdb->query($meta_field_add);
495 495
                                 } else {
496 496
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
497 497
                                     if ($default_value != '') {
498
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
498
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
499 499
                                     }
500 500
 
501
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
501
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add);
502 502
                                 }
503 503
 
504 504
                             }
505 505
                             if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
506 506
 
507
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
507
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."country'");
508 508
 
509 509
                                 if ($is_column) {
510 510
 
511
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
511
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."country` `".$prefix."country` VARCHAR( 50 ) NULL";
512 512
 
513 513
                                     if ($default_value != '') {
514
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
514
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
515 515
                                     }
516 516
 
517 517
                                     $wpdb->query($meta_field_add);
@@ -519,24 +519,24 @@  discard block
 block discarded – undo
519 519
 
520 520
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
521 521
                                     if ($default_value != '') {
522
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
522
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
523 523
                                     }
524 524
 
525
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
525
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add);
526 526
 
527 527
                                 }
528 528
 
529 529
                             }
530 530
                             if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
531 531
 
532
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
532
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."zip'");
533 533
 
534 534
                                 if ($is_column) {
535 535
 
536
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
536
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."zip` `".$prefix."zip` VARCHAR( 50 ) NULL";
537 537
 
538 538
                                     if ($default_value != '') {
539
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
539
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
540 540
                                     }
541 541
 
542 542
                                     $wpdb->query($meta_field_add);
@@ -544,128 +544,128 @@  discard block
 block discarded – undo
544 544
 
545 545
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
546 546
                                     if ($default_value != '') {
547
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
547
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
548 548
                                     }
549 549
 
550
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
550
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add);
551 551
 
552 552
                                 }
553 553
 
554 554
                             }
555 555
                             if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
556 556
 
557
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
557
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latitude'");
558 558
                                 if ($is_column) {
559 559
 
560
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
560
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latitude` `".$prefix."latitude` VARCHAR( 20 ) NULL";
561 561
 
562 562
                                     if ($default_value != '') {
563
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
563
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
564 564
                                     }
565 565
 
566 566
                                     $wpdb->query($meta_field_add);
567 567
                                 } else {
568 568
 
569
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
569
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL";
570 570
                                     $meta_field_add = "VARCHAR( 20 ) NULL";
571 571
                                     if ($default_value != '') {
572
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
572
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
573 573
                                     }
574 574
 
575
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
575
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add);
576 576
 
577 577
                                 }
578 578
 
579 579
 
580
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
580
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."longitude'");
581 581
 
582 582
                                 if ($is_column) {
583
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
583
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."longitude` `".$prefix."longitude` VARCHAR( 20 ) NULL";
584 584
 
585 585
                                     if ($default_value != '') {
586
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
586
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
587 587
                                     }
588 588
 
589 589
                                     $wpdb->query($meta_field_add);
590 590
                                 } else {
591 591
 
592
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
592
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL";
593 593
                                     $meta_field_add = "VARCHAR( 20 ) NULL";
594 594
                                     if ($default_value != '') {
595
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
595
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
596 596
                                     }
597 597
 
598
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
598
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add);
599 599
                                 }
600 600
 
601 601
                             }
602 602
                             if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
603 603
 
604
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
604
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapview'");
605 605
 
606 606
                                 if ($is_column) {
607
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
607
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapview` `".$prefix."mapview` VARCHAR( 15 ) NULL";
608 608
 
609 609
                                     if ($default_value != '') {
610
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
610
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
611 611
                                     }
612 612
 
613 613
                                     $wpdb->query($meta_field_add);
614 614
                                 } else {
615 615
 
616
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
616
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL";
617 617
 
618 618
                                     $meta_field_add = "VARCHAR( 15 ) NULL";
619 619
                                     if ($default_value != '') {
620
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
620
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
621 621
                                     }
622 622
 
623
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
623
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add);
624 624
                                 }
625 625
 
626 626
 
627 627
                             }
628 628
                             if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
629 629
 
630
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
630
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapzoom'");
631 631
                                 if ($is_column) {
632
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
632
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapzoom` `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
633 633
 
634 634
                                     if ($default_value != '') {
635
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
635
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
636 636
                                     }
637 637
 
638 638
                                     $wpdb->query($meta_field_add);
639 639
 
640 640
                                 } else {
641 641
 
642
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
642
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
643 643
 
644 644
                                     $meta_field_add = "VARCHAR( 3 ) NULL";
645 645
                                     if ($default_value != '') {
646
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
646
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
647 647
                                     }
648 648
 
649
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
649
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add);
650 650
                                 }
651 651
 
652 652
                             }
653 653
                             // show lat lng
654 654
                             if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
655
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
655
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latlng'");
656 656
 
657 657
                                 if ($is_column) {
658
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
658
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latlng` `".$prefix."latlng` VARCHAR( 3 ) NULL";
659 659
                                     $meta_field_add .= " DEFAULT '1'";
660 660
 
661 661
                                     $wpdb->query($meta_field_add);
662 662
                                 } else {
663
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
663
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL";
664 664
 
665 665
                                     $meta_field_add = "VARCHAR( 3 ) NULL";
666 666
                                     $meta_field_add .= " DEFAULT '1'";
667 667
 
668
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
668
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add);
669 669
                                 }
670 670
 
671 671
                             }
@@ -681,30 +681,30 @@  discard block
 block discarded – undo
681 681
                         $op_size = '500';
682 682
 
683 683
                         // only make the field as big as it needs to be.
684
-                        if(isset($option_values) && $option_values && $field_type=='select'){
685
-                            $option_values_arr = explode(',',$option_values);
686
-                            if(is_array($option_values_arr)){
684
+                        if (isset($option_values) && $option_values && $field_type == 'select') {
685
+                            $option_values_arr = explode(',', $option_values);
686
+                            if (is_array($option_values_arr)) {
687 687
                                 $op_max = 0;
688
-                                foreach($option_values_arr as $op_val){
689
-                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
688
+                                foreach ($option_values_arr as $op_val) {
689
+                                    if (strlen($op_val) && strlen($op_val) > $op_max) {$op_max = strlen($op_val); }
690 690
                                 }
691
-                                if($op_max){$op_size =$op_max; }
691
+                                if ($op_max) {$op_size = $op_max; }
692 692
                             }
693
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694
-                            if(strlen($option_values)){
695
-                                $op_size =  strlen($option_values);
693
+                        }elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
694
+                            if (strlen($option_values)) {
695
+                                $op_size = strlen($option_values);
696 696
                             }
697 697
                         }
698 698
 
699
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
699
+                        $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."`VARCHAR( $op_size ) NULL";
700 700
 
701 701
                         if ($default_value != '') {
702
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
702
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
703 703
                         }
704 704
 
705 705
                         $alter_result = $wpdb->query($meta_field_add);
706
-                        if($alter_result===false){
707
-                            return __('Column change failed, you may have too many columns.','geodirectory');
706
+                        if ($alter_result === false) {
707
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
708 708
                         }
709 709
 
710 710
                         if (isset($request_field['cat_display_type']))
@@ -721,9 +721,9 @@  discard block
 block discarded – undo
721 721
                     case 'url':
722 722
                     case 'file':
723 723
 
724
-                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
725
-                        if($alter_result===false){
726
-                            return __('Column change failed, you may have too many columns.','geodirectory');
724
+                        $alter_result = $wpdb->query("ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` TEXT NULL");
725
+                        if ($alter_result === false) {
726
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
727 727
                         }
728 728
                         if (isset($request_field['advanced_editor']))
729 729
                             $extra_fields = $request_field['advanced_editor'];
@@ -737,24 +737,24 @@  discard block
 block discarded – undo
737 737
                     default:
738 738
                         if ($data_type != 'VARCHAR' && $data_type != '') {
739 739
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
740
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
740
+                                $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` DECIMAL(11, ".(int) $decimal_point.") NULL";
741 741
                             } else {
742
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
742
+                                $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` ".$data_type." NULL";
743 743
                             }
744 744
 
745 745
                             if (is_numeric($default_value) && $default_value != '') {
746
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
746
+                                $default_value_add .= " DEFAULT '".$default_value."'";
747 747
                             }
748 748
                         } else {
749
-                            $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
749
+                            $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` VARCHAR( 254 ) NULL";
750 750
                             if ($default_value != '') {
751
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
751
+                                $default_value_add .= " DEFAULT '".$default_value."'";
752 752
                             }
753 753
                         }
754 754
 
755 755
                         $alter_result = $wpdb->query($default_value_add);
756
-                        if($alter_result===false){
757
-                            return __('Column change failed, you may have too many columns.','geodirectory');
756
+                        if ($alter_result === false) {
757
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
758 758
                         }
759 759
                         break;
760 760
                 endswitch;
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 
771 771
                     $wpdb->prepare(
772 772
 
773
-                        "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
773
+                        "update ".GEODIR_CUSTOM_FIELDS_TABLE." set 
774 774
 					post_type = %s,
775 775
 					admin_title = %s,
776 776
 					site_title = %s,
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 					for_admin_use = %s
805 805
 					where id = %d",
806 806
 
807
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
807
+                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use, $cf)
808 808
                     )
809 809
 
810 810
                 );
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 
815 815
                 $wpdb->query(
816 816
                     $wpdb->prepare(
817
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
817
+                        "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
818 818
 					 	site_title=%s
819 819
 					where post_type = %s and htmlvar_name = %s",
820 820
                         array($site_title, $post_type, $htmlvar_name)
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 
824 824
 
825 825
                 if ($cat_sort == '')
826
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
826
+                    $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827 827
 
828 828
 
829 829
                 /**
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
                         $data_type = '';
844 844
 
845 845
                         if ($htmlvar_name != '') {
846
-                            $prefix = $htmlvar_name . '_';
846
+                            $prefix = $htmlvar_name.'_';
847 847
                         }
848 848
                         $old_prefix = $old_html_variable;
849 849
 
@@ -851,109 +851,109 @@  discard block
 block discarded – undo
851 851
 
852 852
                         $meta_field_add = "VARCHAR( 254 ) NULL";
853 853
                         if ($default_value != '') {
854
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
854
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
855 855
                         }
856 856
 
857
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
857
+                        geodir_add_column_if_not_exist($detail_table, $prefix."address", $meta_field_add);
858 858
                         //$wpdb->query($meta_field_add);
859 859
 
860 860
 
861 861
                         if (!empty($extra_fields)) {
862 862
 
863 863
                             if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
864
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
864
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."city` VARCHAR( 30 ) NULL";
865 865
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
866 866
                                 if ($default_value != '') {
867
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
867
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
868 868
                                 }
869 869
 
870
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
870
+                                geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add);
871 871
                                 //$wpdb->query($meta_field_add);
872 872
                             }
873 873
                             if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
874
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
874
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."region` VARCHAR( 30 ) NULL";
875 875
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
876 876
                                 if ($default_value != '') {
877
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
877
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
878 878
                                 }
879 879
 
880
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
880
+                                geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add);
881 881
                                 //$wpdb->query($meta_field_add);
882 882
                             }
883 883
                             if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
884
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
884
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."country` VARCHAR( 30 ) NULL";
885 885
 
886 886
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
887 887
                                 if ($default_value != '') {
888
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
888
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
889 889
                                 }
890 890
 
891
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
891
+                                geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add);
892 892
                                 //$wpdb->query($meta_field_add);
893 893
                             }
894 894
                             if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
895
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
895
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."zip` VARCHAR( 15 ) NULL";
896 896
                                 $meta_field_add = "VARCHAR( 15 ) NULL";
897 897
                                 if ($default_value != '') {
898
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
898
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
899 899
                                 }
900 900
 
901
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
901
+                                geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add);
902 902
                                 //$wpdb->query($meta_field_add);
903 903
                             }
904 904
                             if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
905
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
905
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL";
906 906
                                 $meta_field_add = "VARCHAR( 20 ) NULL";
907 907
                                 if ($default_value != '') {
908
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
908
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
909 909
                                 }
910 910
 
911
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
911
+                                geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add);
912 912
                                 //$wpdb->query($meta_field_add);
913 913
 
914
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
914
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL";
915 915
 
916 916
                                 $meta_field_add = "VARCHAR( 20 ) NULL";
917 917
                                 if ($default_value != '') {
918
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
918
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
919 919
                                 }
920 920
 
921
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
921
+                                geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add);
922 922
 
923 923
                                 //$wpdb->query($meta_field_add);
924 924
                             }
925 925
                             if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
926
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
926
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL";
927 927
 
928 928
                                 $meta_field_add = "VARCHAR( 15 ) NULL";
929 929
                                 if ($default_value != '') {
930
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
930
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
931 931
                                 }
932 932
 
933
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
933
+                                geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add);
934 934
 
935 935
                                 //$wpdb->query($meta_field_add);
936 936
                             }
937 937
                             if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
938
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
938
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
939 939
 
940 940
                                 $meta_field_add = "VARCHAR( 3 ) NULL";
941 941
                                 if ($default_value != '') {
942
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
942
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
943 943
                                 }
944 944
 
945
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
945
+                                geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add);
946 946
 
947 947
                                 //$wpdb->query($meta_field_add);
948 948
                             }
949 949
                             // show lat lng
950 950
                             if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
951
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
951
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL";
952 952
 
953 953
                                 $meta_field_add = "VARCHAR( 3 ) NULL";
954 954
                                 $meta_field_add .= " DEFAULT '1'";
955 955
 
956
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
956
+                                geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add);
957 957
                                 //$wpdb->query($meta_field_add);
958 958
                             }
959 959
                         }
@@ -963,8 +963,8 @@  discard block
 block discarded – undo
963 963
                     case 'checkbox':
964 964
                         $data_type = 'TINYINT';
965 965
 
966
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
967
-                        if ((int)$default_value === 1) {
966
+                        $meta_field_add = $data_type."( 1 ) NOT NULL ";
967
+                        if ((int) $default_value === 1) {
968 968
                             $meta_field_add .= " DEFAULT '1'";
969 969
                         }
970 970
 
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
                             }
998 998
                         } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
999 999
                             if (strlen($option_values)) {
1000
-                                $op_size =  strlen($option_values);
1000
+                                $op_size = strlen($option_values);
1001 1001
                             }
1002 1002
 
1003 1003
                             if (isset($request_field['multi_display_type'])) {
@@ -1005,9 +1005,9 @@  discard block
 block discarded – undo
1005 1005
                             }
1006 1006
                         }
1007 1007
 
1008
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1008
+                        $meta_field_add = $data_type."( $op_size ) NULL ";
1009 1009
                         if ($default_value != '') {
1010
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1010
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
1011 1011
                         }
1012 1012
 
1013 1013
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
@@ -1022,9 +1022,9 @@  discard block
 block discarded – undo
1022 1022
 
1023 1023
                         $data_type = 'TEXT';
1024 1024
 
1025
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1025
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1026 1026
 
1027
-                        $meta_field_add = $data_type . " NULL ";
1027
+                        $meta_field_add = $data_type." NULL ";
1028 1028
                         /*if($default_value != '')
1029 1029
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1030 1030
 
@@ -1039,9 +1039,9 @@  discard block
 block discarded – undo
1039 1039
 
1040 1040
                         $data_type = 'DATE';
1041 1041
 
1042
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1042
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1043 1043
 
1044
-                        $meta_field_add = $data_type . " NULL ";
1044
+                        $meta_field_add = $data_type." NULL ";
1045 1045
 
1046 1046
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1047 1047
                         if ($add_result === false) {
@@ -1054,9 +1054,9 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
                         $data_type = 'TIME';
1056 1056
 
1057
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1057
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1058 1058
 
1059
-                        $meta_field_add = $data_type . " NULL ";
1059
+                        $meta_field_add = $data_type." NULL ";
1060 1060
 
1061 1061
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1062 1062
                         if ($add_result === false) {
@@ -1068,22 +1068,22 @@  discard block
 block discarded – undo
1068 1068
                     default:
1069 1069
 
1070 1070
                         if ($data_type != 'VARCHAR' && $data_type != '') {
1071
-                            $meta_field_add = $data_type . " NULL ";
1071
+                            $meta_field_add = $data_type." NULL ";
1072 1072
 
1073 1073
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
1074
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1074
+                                $meta_field_add = "DECIMAL(11, ".(int) $decimal_point.") NULL ";
1075 1075
                             }
1076 1076
 
1077 1077
                             if (is_numeric($default_value) && $default_value != '') {
1078
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1079
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1078
+                                $default_value_add .= " DEFAULT '".$default_value."'";
1079
+                                $meta_field_add .= " DEFAULT '".$default_value."'";
1080 1080
                             }
1081 1081
                         } else {
1082 1082
                             $meta_field_add = " VARCHAR( 254 ) NULL ";
1083 1083
 
1084 1084
                             if ($default_value != '') {
1085
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1086
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1085
+                                $default_value_add .= " DEFAULT '".$default_value."'";
1086
+                                $meta_field_add .= " DEFAULT '".$default_value."'";
1087 1087
                             }
1088 1088
                         }
1089 1089
 
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 
1106 1106
                     $wpdb->prepare(
1107 1107
 
1108
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1108
+                        "insert into ".GEODIR_CUSTOM_FIELDS_TABLE." set 
1109 1109
 					post_type = %s,
1110 1110
 					admin_title = %s,
1111 1111
 					site_title = %s,
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 					validation_msg = %s,
1139 1139
 					for_admin_use = %s ",
1140 1140
 
1141
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1141
+                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use)
1142 1142
 
1143 1143
                     )
1144 1144
 
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
 
1151 1151
             }
1152 1152
 
1153
-            return (int)$lastid;
1153
+            return (int) $lastid;
1154 1154
 
1155 1155
 
1156 1156
         } else {
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 
1184 1184
             $post_meta_info = $wpdb->query(
1185 1185
                 $wpdb->prepare(
1186
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1186
+                    "update ".GEODIR_CUSTOM_FIELDS_TABLE." set 
1187 1187
 															sort_order=%d 
1188 1188
 															where id= %d",
1189 1189
                     array($count, $cf)
@@ -1199,11 +1199,11 @@  discard block
 block discarded – undo
1199 1199
 }
1200 1200
 
1201 1201
 
1202
-function geodir_get_cf_value($cf){
1202
+function geodir_get_cf_value($cf) {
1203 1203
     global $gd_session;
1204 1204
     $value = '';
1205 1205
     if (is_admin()) {
1206
-        global $post,$gd_session;
1206
+        global $post, $gd_session;
1207 1207
 
1208 1208
         if (isset($_REQUEST['post']))
1209 1209
             $_REQUEST['pid'] = $_REQUEST['post'];
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
         $is_default = $val['is_default'];
1252 1252
 
1253 1253
         /* field available to site admin only for edit */
1254
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1254
+        $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false;
1255 1255
         if ($for_admin_use && !is_super_admin()) {
1256 1256
             continue;
1257 1257
         }
@@ -1276,11 +1276,11 @@  discard block
 block discarded – undo
1276 1276
          * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1277 1277
          * @see 'geodir_after_custom_form_field_$name'
1278 1278
          */
1279
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1279
+        do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
1280 1280
 
1281 1281
 
1282 1282
         $custom_field = $val;
1283
-        $html ='';
1283
+        $html = '';
1284 1284
         /**
1285 1285
          * Filter the output for custom fields.
1286 1286
          *
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
          * @param string $html The html to be filtered (blank).
1290 1290
          * @param array $custom_field The custom field array values.
1291 1291
          */
1292
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1292
+        echo apply_filters("geodir_custom_field_input_{$type}", $html, $custom_field);
1293 1293
 
1294 1294
 
1295 1295
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
          * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1305 1305
          * @see 'geodir_before_custom_form_field_$name'
1306 1306
          */
1307
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1307
+        do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
1308 1308
 
1309 1309
     }
1310 1310
 
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
         $filter = $wpdb->get_row(
1332 1332
             $wpdb->prepare(
1333
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1333
+                "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'",
1334 1334
                 array($geodir_post_type)
1335 1335
             )
1336 1336
         );
@@ -1345,14 +1345,14 @@  discard block
 block discarded – undo
1345 1345
 }
1346 1346
 
1347 1347
 
1348
-function geodir_field_icon_proccess($cf){
1348
+function geodir_field_icon_proccess($cf) {
1349 1349
 
1350 1350
 
1351 1351
     if (strpos($cf['field_icon'], 'http') !== false) {
1352
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1352
+        $field_icon = ' background: url('.$cf['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353 1353
     } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
-    }else{
1354
+        $field_icon = '<i class="'.$cf['field_icon'].'"></i>';
1355
+    } else {
1356 1356
         $field_icon = $cf['field_icon'];
1357 1357
     }
1358 1358
 
@@ -1402,7 +1402,7 @@  discard block
 block discarded – undo
1402 1402
                 $field_icon = geodir_field_icon_proccess($type);
1403 1403
                 $filed_type = $type['type'];
1404 1404
                 $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1405
-                if($html_var=='post'){$html_var='post_address';}
1405
+                if ($html_var == 'post') {$html_var = 'post_address'; }
1406 1406
 
1407 1407
                 /**
1408 1408
                  * Filter the output for custom fields.
@@ -1413,11 +1413,11 @@  discard block
 block discarded – undo
1413 1413
                  * @param string $fields_location The location the field is to be show.
1414 1414
                  * @param array $type The array of field values.
1415 1415
                  */
1416
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1416
+                $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
1417 1417
 
1418 1418
                 $variables_array = array();
1419 1419
 
1420
-                if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
1420
+                if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int) $type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
1421 1421
                     continue;
1422 1422
                 }
1423 1423
 
@@ -1542,7 +1542,7 @@  discard block
 block discarded – undo
1542 1542
 
1543 1543
         $post_type = get_post_type($post_id);
1544 1544
         //echo $field_id; exit;
1545
-        $table = $plugin_prefix . $post_type . '_detail';
1545
+        $table = $plugin_prefix.$post_type.'_detail';
1546 1546
 
1547 1547
         $postcurr_images = array();
1548 1548
         $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
@@ -1561,13 +1561,13 @@  discard block
 block discarded – undo
1561 1561
             $geodir_uploadurl = $uploads['url'];
1562 1562
             $sub_dir = $uploads['subdir'];
1563 1563
 
1564
-            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1564
+            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
1565 1565
 
1566 1566
             for ($m = 0; $m < count($post_image); $m++) {
1567 1567
 
1568 1568
                 /* --------- start ------- */
1569 1569
 
1570
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1570
+                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM ".$table." WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1571 1571
 
1572 1572
 
1573 1573
                     $curr_img_url = $post_image[$m];
@@ -1593,24 +1593,24 @@  discard block
 block discarded – undo
1593 1593
                     //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1594 1594
 
1595 1595
                     if (!function_exists('wp_handle_upload'))
1596
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1596
+                        require_once(ABSPATH.'wp-admin/includes/file.php');
1597 1597
 
1598 1598
                     if (!is_dir($geodir_uploadpath))
1599 1599
                         mkdir($geodir_uploadpath);
1600 1600
 
1601
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1601
+                    $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1];
1602 1602
                     $explode_sub_dir = explode("/", $sub_dir);
1603 1603
                     if ($curr_img_dir == end($explode_sub_dir)) {
1604
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1605
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1604
+                        $img_path = $geodir_uploadpath.'/'.$filename;
1605
+                        $img_url = $geodir_uploadurl.'/'.$filename;
1606 1606
                     } else {
1607
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1608
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1607
+                        $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
1608
+                        $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename;
1609 1609
                     }
1610 1610
 
1611 1611
                     $uploaded_file = '';
1612 1612
                     if (file_exists($img_path))
1613
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1613
+                        $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name);
1614 1614
 
1615 1615
                     if ($curr_img_dir != $geodir_uploaddir) {
1616 1616
                         if (file_exists($img_path))
@@ -1618,7 +1618,7 @@  discard block
 block discarded – undo
1618 1618
                     }
1619 1619
 
1620 1620
                     if (!empty($uploaded_file))
1621
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1621
+                        $file_urls = $geodir_uploadurl.'/'.$new_name;
1622 1622
 
1623 1623
                 } else {
1624 1624
                     $file_urls = $post_image[$m];
@@ -1632,8 +1632,8 @@  discard block
 block discarded – undo
1632 1632
         if (!empty($postcurr_images)) {
1633 1633
 
1634 1634
             if ($file_urls != $postcurr_images) {
1635
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1636
-                $invalid_files = (object)$invalid_files;
1635
+                $invalid_files[] = (object) array('src' => $postcurr_images);
1636
+                $invalid_files = (object) $invalid_files;
1637 1637
             }
1638 1638
         }
1639 1639
 
@@ -1685,9 +1685,9 @@  discard block
 block discarded – undo
1685 1685
     function geodir_upload_dir($upload)
1686 1686
     {
1687 1687
         global $current_user;
1688
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1689
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1690
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1688
+        $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID;
1689
+        $upload['path'] = $upload['basedir'].$upload['subdir'];
1690
+        $upload['url'] = $upload['baseurl'].$upload['subdir'];
1691 1691
         return $upload;
1692 1692
     }
1693 1693
 
@@ -1702,20 +1702,20 @@  discard block
 block discarded – undo
1702 1702
         // check ajax noonce
1703 1703
         $imgid = $_POST["imgid"];
1704 1704
 
1705
-        check_ajax_referer($imgid . 'pluploadan');
1705
+        check_ajax_referer($imgid.'pluploadan');
1706 1706
 
1707 1707
         // handle custom file uploaddir
1708 1708
         add_filter('upload_dir', 'geodir_upload_dir');
1709 1709
 
1710 1710
         // change file orinetation if needed
1711
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1711
+        $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']);
1712 1712
 
1713 1713
         // handle file upload
1714 1714
         $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1715 1715
         // remove handle custom file uploaddir
1716 1716
         remove_filter('upload_dir', 'geodir_upload_dir');
1717 1717
 
1718
-        if(!isset($status['url']) && isset($status['error'])){
1718
+        if (!isset($status['url']) && isset($status['error'])) {
1719 1719
             print_r($status);
1720 1720
         }
1721 1721
 
@@ -1745,9 +1745,9 @@  discard block
 block discarded – undo
1745 1745
 
1746 1746
     $post_type = get_post_type($post_id);
1747 1747
 
1748
-    $table = $plugin_prefix . $post_type . '_detail';
1748
+    $table = $plugin_prefix.$post_type.'_detail';
1749 1749
 
1750
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1750
+    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
1751 1751
 
1752 1752
     if ($results) {
1753 1753
         return $results[0]->geodir_video;
@@ -1771,9 +1771,9 @@  discard block
 block discarded – undo
1771 1771
 
1772 1772
     $post_type = get_post_type($post_id);
1773 1773
 
1774
-    $table = $plugin_prefix . $post_type . '_detail';
1774
+    $table = $plugin_prefix.$post_type.'_detail';
1775 1775
 
1776
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1776
+    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
1777 1777
 
1778 1778
     if ($results) {
1779 1779
         return $results[0]->geodir_special_offers;
@@ -1791,12 +1791,12 @@  discard block
 block discarded – undo
1791 1791
      */
1792 1792
     function geodir_max_upload_size()
1793 1793
     {
1794
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1794
+        $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1795 1795
 
1796 1796
         if ($max_filesize > 0 && $max_filesize < 1) {
1797
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1797
+            $max_filesize = (int) ($max_filesize * 1024).'kb';
1798 1798
         } else {
1799
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1799
+            $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1800 1800
         }
1801 1801
         /** Filter documented in geodirectory-functions/general_functions.php **/
1802 1802
         return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
 
1829 1829
             $custom_fields = $wpdb->get_results(
1830 1830
                 $wpdb->prepare(
1831
-                    "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1831
+                    "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from ".GEODIR_CUSTOM_FIELDS_TABLE." where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1832 1832
                     array($post_type)
1833 1833
                 ), 'ARRAY_A'
1834 1834
             );
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 
1956 1956
             $post_meta_info = $wpdb->query(
1957 1957
                 $wpdb->prepare(
1958
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1958
+                    "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
1959 1959
 															sort_order=%d 
1960 1960
 															where id= %d",
1961 1961
                     array($count, $cf)
@@ -2037,14 +2037,14 @@  discard block
 block discarded – undo
2037 2037
 
2038 2038
         $check_html_variable = $wpdb->get_var(
2039 2039
             $wpdb->prepare(
2040
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2040
+                "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ",
2041 2041
                 array($cehhtmlvar_name, $post_type, $field_type)
2042 2042
             )
2043 2043
         );
2044 2044
 
2045 2045
         if ($is_default == 1) {
2046 2046
 
2047
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2047
+            $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
2048 2048
 
2049 2049
         }
2050 2050
 
@@ -2055,7 +2055,7 @@  discard block
 block discarded – undo
2055 2055
 
2056 2056
                 $wpdb->prepare(
2057 2057
 
2058
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2058
+                    "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2059 2059
 				post_type = %s,
2060 2060
 				data_type = %s,
2061 2061
 				field_type = %s,
@@ -2086,7 +2086,7 @@  discard block
 block discarded – undo
2086 2086
 
2087 2087
                 $wpdb->prepare(
2088 2088
 
2089
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2089
+                    "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2090 2090
 				post_type = %s,
2091 2091
 				data_type = %s,
2092 2092
 				field_type = %s,
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
         }
2113 2113
 
2114 2114
 
2115
-        return (int)$lastid;
2115
+        return (int) $lastid;
2116 2116
 
2117 2117
     }
2118 2118
 }
@@ -2135,7 +2135,7 @@  discard block
 block discarded – undo
2135 2135
         if ($field_id != '') {
2136 2136
             $cf = trim($field_id, '_');
2137 2137
 
2138
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2138
+            $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
2139 2139
 
2140 2140
             return $field_id;
2141 2141
 
@@ -2158,12 +2158,12 @@  discard block
 block discarded – undo
2158 2158
      * @param string $field_ins_upd When set to "submit" displays form.
2159 2159
      * @param bool $default when set to true field will be for admin use only.
2160 2160
      */
2161
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2161
+    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '')
2162 2162
     {
2163 2163
         global $wpdb;
2164 2164
         $cf = $result_str;
2165 2165
         if (!is_object($cf)) {
2166
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2166
+            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
2167 2167
         } else {
2168 2168
             $field_info = $cf;
2169 2169
             $result_str = $cf->id;
@@ -2199,18 +2199,18 @@  discard block
 block discarded – undo
2199 2199
         if ($htmlvar_name == '')
2200 2200
             $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2201 2201
 
2202
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2202
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
2203 2203
 
2204 2204
         $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2205 2205
         $cso_arr = geodir_get_custom_sort_options($post_type);
2206 2206
 
2207 2207
         $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2208
-        foreach($cso_arr as $cso){
2209
-            if($cur_field_type==$cso['field_type']){
2208
+        foreach ($cso_arr as $cso) {
2209
+            if ($cur_field_type == $cso['field_type']) {
2210 2210
 
2211 2211
                 if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2212 2212
                     $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2213
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2213
+                }elseif (isset($cso['field_icon']) && $cso['field_icon']) {
2214 2214
                     $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2215 2215
                 }
2216 2216
 
@@ -2220,40 +2220,40 @@  discard block
 block discarded – undo
2220 2220
         $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2221 2221
         ?>
2222 2222
 
2223
-        <li class="text" id="licontainer_<?php echo $result_str;?>">
2223
+        <li class="text" id="licontainer_<?php echo $result_str; ?>">
2224 2224
             <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
2225
-            <div class="title title<?php echo $result_str;?> gt-fieldset"
2226
-                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
2227
-                 ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2225
+            <div class="title title<?php echo $result_str; ?> gt-fieldset"
2226
+                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
2227
+                 ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
2228 2228
                 <?php
2229 2229
 
2230 2230
                 ?>
2231 2231
 
2232
-                <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2233
-                     onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
2232
+                <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
2233
+                     onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
2234 2234
                      class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
2235 2235
 
2236 2236
 
2237
-                <?php echo $field_icon;?>
2237
+                <?php echo $field_icon; ?>
2238 2238
                 <b style="cursor:pointer;"
2239
-                   onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
2239
+                   onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
2240 2240
 
2241 2241
             </div>
2242 2242
 
2243
-            <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2243
+            <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
2244 2244
                  style="display:<?php if ($field_ins_upd == 'submit') {
2245 2245
                      echo 'block;';
2246 2246
                  } else {
2247 2247
                      echo 'none;';
2248 2248
                  } ?>">
2249 2249
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2250
-                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2251
-                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2252
-                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2250
+                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
2251
+                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
2252
+                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/>
2253 2253
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2254 2254
                     echo $field_info->data_type;
2255 2255
                 }?>"/>
2256
-                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2256
+                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/>
2257 2257
 
2258 2258
 
2259 2259
                 <ul class="widefat post fixed" border="0" style="width:100%;">
@@ -2263,7 +2263,7 @@  discard block
 block discarded – undo
2263 2263
                         <input type="hidden" name="site_title" id="site_title" value="<?php echo esc_attr($site_title); ?>"/>
2264 2264
 
2265 2265
                         <li>
2266
-                            <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0;?>
2266
+                            <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0; ?>
2267 2267
 
2268 2268
                             <label for="asc" class="gd-cf-tooltip-wrap">
2269 2269
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Ascending Sort (low to high)', 'geodirectory'); ?>
@@ -2273,24 +2273,24 @@  discard block
 block discarded – undo
2273 2273
                             </label>
2274 2274
                             <div class="gd-cf-input-wrap gd-switch">
2275 2275
 
2276
-                                <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled"  value="1"
2276
+                                <input type="radio" id="asc_yes<?php echo $radio_id; ?>" name="asc" class="gdri-enabled"  value="1"
2277 2277
                                     <?php if ($value == '1') {
2278 2278
                                         echo 'checked';
2279 2279
                                     } ?>/>
2280
-                                <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2280
+                                <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2281 2281
 
2282
-                                <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0"
2282
+                                <input type="radio" id="asc_no<?php echo $radio_id; ?>" name="asc" class="gdri-disabled" value="0"
2283 2283
                                     <?php if ($value == '0' || !$value) {
2284 2284
                                         echo 'checked';
2285 2285
                                     } ?>/>
2286
-                                <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2286
+                                <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2287 2287
 
2288 2288
                             </div>
2289 2289
 
2290 2290
                         </li>
2291 2291
 
2292
-                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
2293
-                            <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : '';?>
2292
+                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
2293
+                            <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : ''; ?>
2294 2294
 
2295 2295
                             <label for="asc_title" class="gd-cf-tooltip-wrap">
2296 2296
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Ascending title', 'geodirectory'); ?>
@@ -2300,14 +2300,14 @@  discard block
 block discarded – undo
2300 2300
                             </label>
2301 2301
                             <div class="gd-cf-input-wrap">
2302 2302
 
2303
-                                <input type="text" name="asc_title" id="asc_title" value="<?php echo $value;?>" />
2303
+                                <input type="text" name="asc_title" id="asc_title" value="<?php echo $value; ?>" />
2304 2304
                             </div>
2305 2305
 
2306 2306
 
2307 2307
                         </li>
2308 2308
 
2309 2309
 
2310
-                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
2310
+                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
2311 2311
 
2312 2312
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2313 2313
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
                             <div class="gd-cf-input-wrap">
2319 2319
 
2320 2320
                                 <input type="radio" name="is_default"
2321
-                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2321
+                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
2322 2322
                                     echo 'checked="checked"';
2323 2323
                                 } ?>/>
2324 2324
                             </div>
@@ -2328,7 +2328,7 @@  discard block
 block discarded – undo
2328 2328
 
2329 2329
 
2330 2330
                         <li>
2331
-                            <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0;?>
2331
+                            <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0; ?>
2332 2332
 
2333 2333
                             <label for="desc" class="gd-cf-tooltip-wrap">
2334 2334
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Descending Sort (high to low)', 'geodirectory'); ?>
@@ -2338,24 +2338,24 @@  discard block
 block discarded – undo
2338 2338
                             </label>
2339 2339
                             <div class="gd-cf-input-wrap gd-switch">
2340 2340
 
2341
-                                <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled"  value="1"
2341
+                                <input type="radio" id="desc_yes<?php echo $radio_id; ?>" name="desc" class="gdri-enabled"  value="1"
2342 2342
                                     <?php if ($value == '1') {
2343 2343
                                         echo 'checked';
2344 2344
                                     } ?>/>
2345
-                                <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2345
+                                <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2346 2346
 
2347
-                                <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0"
2347
+                                <input type="radio" id="desc_no<?php echo $radio_id; ?>" name="desc" class="gdri-disabled" value="0"
2348 2348
                                     <?php if ($value == '0' || !$value) {
2349 2349
                                         echo 'checked';
2350 2350
                                     } ?>/>
2351
-                                <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2351
+                                <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2352 2352
 
2353 2353
                             </div>
2354 2354
 
2355 2355
                         </li>
2356 2356
 
2357
-                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
2358
-                            <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : '';?>
2357
+                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
2358
+                            <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : ''; ?>
2359 2359
 
2360 2360
                             <label for="desc_title" class="gd-cf-tooltip-wrap">
2361 2361
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Descending title', 'geodirectory'); ?>
@@ -2365,13 +2365,13 @@  discard block
 block discarded – undo
2365 2365
                             </label>
2366 2366
                             <div class="gd-cf-input-wrap">
2367 2367
 
2368
-                                <input type="text" name="desc_title" id="desc_title" value="<?php echo $value;?>" />
2368
+                                <input type="text" name="desc_title" id="desc_title" value="<?php echo $value; ?>" />
2369 2369
                             </div>
2370 2370
 
2371 2371
 
2372 2372
                         </li>
2373 2373
 
2374
-                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
2374
+                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
2375 2375
 
2376 2376
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2377 2377
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2382,7 +2382,7 @@  discard block
 block discarded – undo
2382 2382
                             <div class="gd-cf-input-wrap">
2383 2383
 
2384 2384
                                 <input type="radio" name="is_default"
2385
-                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2385
+                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
2386 2386
                                     echo 'checked="checked"';
2387 2387
                                 } ?>/>
2388 2388
                             </div>
@@ -2407,14 +2407,14 @@  discard block
 block discarded – undo
2407 2407
                             </label>
2408 2408
                             <div class="gd-cf-input-wrap">
2409 2409
 
2410
-                                <input type="text" name="site_title" id="site_title" value="<?php echo $value;?>" />
2410
+                                <input type="text" name="site_title" id="site_title" value="<?php echo $value; ?>" />
2411 2411
                             </div>
2412 2412
 
2413 2413
 
2414 2414
                         </li>
2415 2415
 
2416 2416
                         <li>
2417
-                            <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : '';?>
2417
+                            <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : ''; ?>
2418 2418
 
2419 2419
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2420 2420
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2438,7 +2438,7 @@  discard block
 block discarded – undo
2438 2438
 
2439 2439
 
2440 2440
                     <li>
2441
-                        <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active: 0;?>
2441
+                        <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active : 0; ?>
2442 2442
 
2443 2443
                         <label for="is_active" class="gd-cf-tooltip-wrap">
2444 2444
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active', 'geodirectory'); ?>
@@ -2448,17 +2448,17 @@  discard block
 block discarded – undo
2448 2448
                         </label>
2449 2449
                         <div class="gd-cf-input-wrap gd-switch">
2450 2450
 
2451
-                            <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
2451
+                            <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled"  value="1"
2452 2452
                                 <?php if ($value == '1') {
2453 2453
                                     echo 'checked';
2454 2454
                                 } ?>/>
2455
-                            <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2455
+                            <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2456 2456
 
2457
-                            <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
2457
+                            <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0"
2458 2458
                                 <?php if ($value == '0' || !$value) {
2459 2459
                                     echo 'checked';
2460 2460
                                 } ?>/>
2461
-                            <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2461
+                            <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2462 2462
 
2463 2463
                         </div>
2464 2464
 
@@ -2479,10 +2479,10 @@  discard block
 block discarded – undo
2479 2479
                             <h3></h3>
2480 2480
                         </label>
2481 2481
                         <div class="gd-cf-input-wrap">
2482
-                            <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
2482
+                            <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
2483 2483
                                    onclick="save_sort_field('<?php echo esc_attr($result_str); ?>')"/>
2484
-                                <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
2485
-                                                                    onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
2484
+                                <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
2485
+                                                                    onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
2486 2486
                                                                     class="button"/></a>
2487 2487
                         </div>
2488 2488
                     </li>
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
         if (!$package_id || !$field_name || !$post_type) {
2518 2518
             return true;
2519 2519
         }
2520
-        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
2520
+        $sql = $wpdb->prepare("SELECT id FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int) $package_id));
2521 2521
 
2522 2522
         if ($wpdb->get_var($sql)) {
2523 2523
             return true;
@@ -2639,7 +2639,7 @@  discard block
 block discarded – undo
2639 2639
 }
2640 2640
 
2641 2641
 
2642
-function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2642
+function geodir_cfa_data_type_text($output, $result_str, $cf, $field_info) {
2643 2643
     ob_start();
2644 2644
     ?>
2645 2645
     <li>
@@ -2685,43 +2685,43 @@  discard block
 block discarded – undo
2685 2685
     $output = ob_get_clean();
2686 2686
     return $output;
2687 2687
 }
2688
-add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2688
+add_filter('geodir_cfa_data_type_text', 'geodir_cfa_data_type_text', 10, 4);
2689 2689
 
2690 2690
 // htmlvar not needed for fieldset and taxonomy
2691
-add_filter('geodir_cfa_htmlvar_name_fieldset','__return_empty_string',10,4);
2692
-add_filter('geodir_cfa_htmlvar_name_taxonomy','__return_empty_string',10,4);
2691
+add_filter('geodir_cfa_htmlvar_name_fieldset', '__return_empty_string', 10, 4);
2692
+add_filter('geodir_cfa_htmlvar_name_taxonomy', '__return_empty_string', 10, 4);
2693 2693
 
2694 2694
 
2695 2695
 // default_value not needed for textarea, html, file, fieldset, taxonomy, address
2696
-add_filter('geodir_cfa_default_value_textarea','__return_empty_string',10,4);
2697
-add_filter('geodir_cfa_default_value_html','__return_empty_string',10,4);
2698
-add_filter('geodir_cfa_default_value_file','__return_empty_string',10,4);
2699
-add_filter('geodir_cfa_default_value_taxonomy','__return_empty_string',10,4);
2700
-add_filter('geodir_cfa_default_value_address','__return_empty_string',10,4);
2701
-add_filter('geodir_cfa_default_value_fieldset','__return_empty_string',10,4);
2696
+add_filter('geodir_cfa_default_value_textarea', '__return_empty_string', 10, 4);
2697
+add_filter('geodir_cfa_default_value_html', '__return_empty_string', 10, 4);
2698
+add_filter('geodir_cfa_default_value_file', '__return_empty_string', 10, 4);
2699
+add_filter('geodir_cfa_default_value_taxonomy', '__return_empty_string', 10, 4);
2700
+add_filter('geodir_cfa_default_value_address', '__return_empty_string', 10, 4);
2701
+add_filter('geodir_cfa_default_value_fieldset', '__return_empty_string', 10, 4);
2702 2702
 
2703 2703
 // is_required not needed for fieldset
2704
-add_filter('geodir_cfa_is_required_fieldset','__return_empty_string',10,4);
2705
-add_filter('geodir_cfa_required_msg_fieldset','__return_empty_string',10,4);
2704
+add_filter('geodir_cfa_is_required_fieldset', '__return_empty_string', 10, 4);
2705
+add_filter('geodir_cfa_required_msg_fieldset', '__return_empty_string', 10, 4);
2706 2706
 
2707 2707
 // field_icon not needed for fieldset
2708
-add_filter('geodir_cfa_field_icon_fieldset','__return_empty_string',10,4);
2709
-add_filter('geodir_cfa_css_class_fieldset','__return_empty_string',10,4);
2708
+add_filter('geodir_cfa_field_icon_fieldset', '__return_empty_string', 10, 4);
2709
+add_filter('geodir_cfa_css_class_fieldset', '__return_empty_string', 10, 4);
2710 2710
 
2711 2711
 // cat_sort not needed for some fields
2712
-add_filter('geodir_cfa_cat_sort_html','__return_empty_string',10,4);
2713
-add_filter('geodir_cfa_cat_sort_file','__return_empty_string',10,4);
2714
-add_filter('geodir_cfa_cat_sort_url','__return_empty_string',10,4);
2715
-add_filter('geodir_cfa_cat_sort_fieldset','__return_empty_string',10,4);
2716
-add_filter('geodir_cfa_cat_sort_multiselect','__return_empty_string',10,4);
2717
-add_filter('geodir_cfa_cat_sort_textarea','__return_empty_string',10,4);
2718
-add_filter('geodir_cfa_cat_sort_taxonomy','__return_empty_string',10,4);
2719
-add_filter('geodir_cfa_cat_sort_address','__return_empty_string',10,4);
2712
+add_filter('geodir_cfa_cat_sort_html', '__return_empty_string', 10, 4);
2713
+add_filter('geodir_cfa_cat_sort_file', '__return_empty_string', 10, 4);
2714
+add_filter('geodir_cfa_cat_sort_url', '__return_empty_string', 10, 4);
2715
+add_filter('geodir_cfa_cat_sort_fieldset', '__return_empty_string', 10, 4);
2716
+add_filter('geodir_cfa_cat_sort_multiselect', '__return_empty_string', 10, 4);
2717
+add_filter('geodir_cfa_cat_sort_textarea', '__return_empty_string', 10, 4);
2718
+add_filter('geodir_cfa_cat_sort_taxonomy', '__return_empty_string', 10, 4);
2719
+add_filter('geodir_cfa_cat_sort_address', '__return_empty_string', 10, 4);
2720 2720
 
2721 2721
 
2722 2722
 
2723
-function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2724
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2723
+function geodir_cfa_advanced_editor_geodir_special_offers($output, $result_str, $cf, $field_info) {
2724
+    if ($field_info->htmlvar_name != 'geodir_special_offers') {return ''; }
2725 2725
     ob_start();
2726 2726
     ?>
2727 2727
     <li>
@@ -2752,16 +2752,16 @@  discard block
 block discarded – undo
2752 2752
     $output = ob_get_clean();
2753 2753
     return $output;
2754 2754
 }
2755
-add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2755
+add_filter('geodir_cfa_advanced_editor_textarea', 'geodir_cfa_advanced_editor_geodir_special_offers', 10, 4);
2756 2756
 
2757 2757
 
2758
-function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2758
+function geodir_cfa_validation_pattern_text($output, $result_str, $cf, $field_info) {
2759 2759
     ob_start();
2760 2760
 
2761 2761
     $value = '';
2762 2762
     if (isset($field_info->validation_pattern)) {
2763 2763
         $value = esc_attr($field_info->validation_pattern);
2764
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2764
+    }elseif (isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']) {
2765 2765
         $value = esc_attr($cf['defaults']['validation_pattern']);
2766 2766
     }
2767 2767
     ?>
@@ -2781,7 +2781,7 @@  discard block
 block discarded – undo
2781 2781
     $value = '';
2782 2782
     if (isset($field_info->validation_msg)) {
2783 2783
         $value = esc_attr($field_info->validation_msg);
2784
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2784
+    }elseif (isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']) {
2785 2785
         $value = esc_attr($cf['defaults']['validation_msg']);
2786 2786
     }
2787 2787
     ?>
@@ -2802,10 +2802,10 @@  discard block
 block discarded – undo
2802 2802
     $output = ob_get_clean();
2803 2803
     return $output;
2804 2804
 }
2805
-add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2805
+add_filter('geodir_cfa_validation_pattern_text', 'geodir_cfa_validation_pattern_text', 10, 4);
2806 2806
 
2807 2807
 
2808
-function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2808
+function geodir_cfa_htmlvar_name_taxonomy($output, $result_str, $cf, $field_info) {
2809 2809
     ob_start();
2810 2810
     global $post_type;
2811 2811
 
@@ -2830,7 +2830,7 @@  discard block
 block discarded – undo
2830 2830
                     ?>
2831 2831
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2832 2832
                         echo 'selected="selected"';
2833
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2833
+                    }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php
2834 2834
                 }
2835 2835
                 ?>
2836 2836
             </select>
@@ -2841,7 +2841,7 @@  discard block
 block discarded – undo
2841 2841
         <label for="cat_display_type" class="gd-cf-tooltip-wrap">
2842 2842
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Category display type :', 'geodirectory'); ?>
2843 2843
             <div class="gdcf-tooltip">
2844
-                <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory');?>
2844
+                <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory'); ?>
2845 2845
             </div>
2846 2846
         </label>
2847 2847
         <div class="gd-cf-input-wrap">
@@ -2849,19 +2849,19 @@  discard block
 block discarded – undo
2849 2849
             <select name="cat_display_type" id="cat_display_type">
2850 2850
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2851 2851
                     echo 'selected="selected"';
2852
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2852
+                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
2853 2853
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2854 2854
                     echo 'selected="selected"';
2855
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2855
+                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
2856 2856
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2857 2857
                     echo 'selected="selected"';
2858
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2858
+                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
2859 2859
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2860 2860
                     echo 'selected="selected"';
2861
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2861
+                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
2862 2862
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2863 2863
                     echo 'selected="selected"';
2864
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2864
+                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
2865 2865
             </select>
2866 2866
         </div>
2867 2867
     </li>
@@ -2870,10 +2870,10 @@  discard block
 block discarded – undo
2870 2870
     $output = ob_get_clean();
2871 2871
     return $output;
2872 2872
 }
2873
-add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2873
+add_filter('geodir_cfa_htmlvar_name_taxonomy', 'geodir_cfa_htmlvar_name_taxonomy', 10, 4);
2874 2874
 
2875 2875
 
2876
-function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2876
+function geodir_cfa_extra_fields_address($output, $result_str, $cf, $field_info) {
2877 2877
 
2878 2878
     ob_start();
2879 2879
     if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
@@ -2896,32 +2896,32 @@  discard block
 block discarded – undo
2896 2896
         <label for="show_zip" class="gd-cf-tooltip-wrap">
2897 2897
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display zip/post code :', 'geodirectory'); ?>
2898 2898
             <div class="gdcf-tooltip">
2899
-                <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?>
2899
+                <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?>
2900 2900
             </div>
2901 2901
         </label>
2902 2902
         <div class="gd-cf-input-wrap gd-switch">
2903 2903
 
2904
-            <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2904
+            <input type="radio" id="show_zip_yes<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2905 2905
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2906 2906
                     echo 'checked';
2907 2907
                 } ?>/>
2908
-            <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2908
+            <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2909 2909
 
2910
-            <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2910
+            <input type="radio" id="show_zip_no<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2911 2911
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2912 2912
                     echo 'checked';
2913 2913
                 } ?>/>
2914
-            <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2914
+            <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2915 2915
 
2916 2916
 
2917 2917
         </div>
2918 2918
     </li>
2919 2919
 
2920
-    <li class="cf-zip-lable"  <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'";}?> >
2920
+    <li class="cf-zip-lable"  <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'"; }?> >
2921 2921
         <label for="zip_lable" class="gd-cf-tooltip-wrap">
2922 2922
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Zip/Post code label :', 'geodirectory'); ?>
2923 2923
             <div class="gdcf-tooltip">
2924
-                <?php _e('Enter zip/post code field label in address section.', 'geodirectory');?>
2924
+                <?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?>
2925 2925
             </div>
2926 2926
         </label>
2927 2927
         <div class="gd-cf-input-wrap">
@@ -2939,7 +2939,7 @@  discard block
 block discarded – undo
2939 2939
         <label for="map_lable" class="gd-cf-tooltip-wrap">
2940 2940
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map button label :', 'geodirectory'); ?>
2941 2941
             <div class="gdcf-tooltip">
2942
-                <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?>
2942
+                <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory'); ?>
2943 2943
             </div>
2944 2944
         </label>
2945 2945
         <div class="gd-cf-input-wrap">
@@ -2954,22 +2954,22 @@  discard block
 block discarded – undo
2954 2954
         <label for="show_mapzoom" class="gd-cf-tooltip-wrap">
2955 2955
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Use user zoom level:', 'geodirectory'); ?>
2956 2956
             <div class="gdcf-tooltip">
2957
-                <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory');?>
2957
+                <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory'); ?>
2958 2958
             </div>
2959 2959
         </label>
2960 2960
         <div class="gd-cf-input-wrap gd-switch">
2961 2961
 
2962
-            <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2962
+            <input type="radio" id="show_mapzoom_yes<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2963 2963
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
2964 2964
                     echo 'checked';
2965 2965
                 } ?>/>
2966
-            <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2966
+            <label for="show_mapzoom_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2967 2967
 
2968
-            <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2968
+            <input type="radio" id="show_mapzoom_no<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2969 2969
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
2970 2970
                     echo 'checked';
2971 2971
                 } ?>/>
2972
-            <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2972
+            <label for="show_mapzoom_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2973 2973
 
2974 2974
         </div>
2975 2975
     </li>
@@ -2978,22 +2978,22 @@  discard block
 block discarded – undo
2978 2978
         <label for="show_mapview" class="gd-cf-tooltip-wrap">
2979 2979
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display map view:', 'geodirectory'); ?>
2980 2980
             <div class="gdcf-tooltip">
2981
-                <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory');?>
2981
+                <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory'); ?>
2982 2982
             </div>
2983 2983
         </label>
2984 2984
         <div class="gd-cf-input-wrap gd-switch">
2985 2985
 
2986
-            <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
2986
+            <input type="radio" id="show_mapview_yes<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
2987 2987
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
2988 2988
                     echo 'checked';
2989 2989
                 } ?>/>
2990
-            <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2990
+            <label for="show_mapview_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2991 2991
 
2992
-            <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
2992
+            <input type="radio" id="show_mapview_no<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
2993 2993
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
2994 2994
                     echo 'checked';
2995 2995
                 } ?>/>
2996
-            <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2996
+            <label for="show_mapview_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2997 2997
 
2998 2998
         </div>
2999 2999
     </li>
@@ -3003,7 +3003,7 @@  discard block
 block discarded – undo
3003 3003
         <label for="mapview_lable" class="gd-cf-tooltip-wrap">
3004 3004
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map view label:', 'geodirectory'); ?>
3005 3005
             <div class="gdcf-tooltip">
3006
-                <?php _e('Enter mapview field label in address section.', 'geodirectory');?>
3006
+                <?php _e('Enter mapview field label in address section.', 'geodirectory'); ?>
3007 3007
             </div>
3008 3008
         </label>
3009 3009
         <div class="gd-cf-input-wrap">
@@ -3017,22 +3017,22 @@  discard block
 block discarded – undo
3017 3017
         <label for="show_latlng" class="gd-cf-tooltip-wrap">
3018 3018
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show latitude and longitude', 'geodirectory'); ?>
3019 3019
             <div class="gdcf-tooltip">
3020
-                <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory');?>
3020
+                <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory'); ?>
3021 3021
             </div>
3022 3022
         </label>
3023 3023
         <div class="gd-cf-input-wrap gd-switch">
3024 3024
 
3025
-            <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3025
+            <input type="radio" id="show_latlng_yes<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3026 3026
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
3027 3027
                     echo 'checked';
3028 3028
                 } ?>/>
3029
-            <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3029
+            <label for="show_latlng_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3030 3030
 
3031
-            <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3031
+            <input type="radio" id="show_latlng_no<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3032 3032
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
3033 3033
                     echo 'checked';
3034 3034
                 } ?>/>
3035
-            <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3035
+            <label for="show_latlng_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3036 3036
 
3037 3037
         </div>
3038 3038
     </li>
@@ -3041,17 +3041,17 @@  discard block
 block discarded – undo
3041 3041
     $output = ob_get_clean();
3042 3042
     return $output;
3043 3043
 }
3044
-add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
3044
+add_filter('geodir_cfa_extra_fields_address', 'geodir_cfa_extra_fields_address', 10, 4);
3045 3045
 
3046 3046
 
3047
-function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
3047
+function geodir_cfa_extra_fields_multiselect($output, $result_str, $cf, $field_info) {
3048 3048
     ob_start();
3049 3049
     ?>
3050 3050
     <li>
3051 3051
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
3052 3052
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
3053 3053
             <div class="gdcf-tooltip">
3054
-                <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory');?>
3054
+                <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory'); ?>
3055 3055
             </div>
3056 3056
         </label>
3057 3057
         <div class="gd-cf-input-wrap">
@@ -3059,13 +3059,13 @@  discard block
 block discarded – undo
3059 3059
             <select name="multi_display_type" id="multi_display_type">
3060 3060
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
3061 3061
                     echo 'selected="selected"';
3062
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
3062
+                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
3063 3063
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
3064 3064
                     echo 'selected="selected"';
3065
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3065
+                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
3066 3066
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
3067 3067
                     echo 'selected="selected"';
3068
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3068
+                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
3069 3069
             </select>
3070 3070
 
3071 3071
             <br/>
@@ -3076,10 +3076,10 @@  discard block
 block discarded – undo
3076 3076
     $output = ob_get_clean();
3077 3077
     return $output;
3078 3078
 }
3079
-add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
3079
+add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_multiselect', 10, 4);
3080 3080
 
3081 3081
 
3082
-function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
3082
+function geodir_cfa_extra_fields_smr($output, $result_str, $cf, $field_info) {
3083 3083
 
3084 3084
     ob_start();
3085 3085
     $field_type = isset($field_info->field_type) ? $field_info->field_type : '';
@@ -3088,11 +3088,11 @@  discard block
 block discarded – undo
3088 3088
         <label for="option_values" class="gd-cf-tooltip-wrap">
3089 3089
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
3090 3090
             <div class="gdcf-tooltip">
3091
-                <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
3091
+                <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
3092 3092
                 <br/>
3093
-                <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory');?></span>
3093
+                <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory'); ?></span>
3094 3094
                     <br/>
3095
-                    <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
3095
+                    <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
3096 3096
                     <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
3097 3097
                         <br/>
3098 3098
                         <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
@@ -3115,12 +3115,12 @@  discard block
 block discarded – undo
3115 3115
     $output = ob_get_clean();
3116 3116
     return $output;
3117 3117
 }
3118
-add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
3119
-add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
3120
-add_filter('geodir_cfa_extra_fields_radio','geodir_cfa_extra_fields_smr',10,4);
3118
+add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_smr', 10, 4);
3119
+add_filter('geodir_cfa_extra_fields_select', 'geodir_cfa_extra_fields_smr', 10, 4);
3120
+add_filter('geodir_cfa_extra_fields_radio', 'geodir_cfa_extra_fields_smr', 10, 4);
3121 3121
 
3122 3122
 
3123
-function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
3123
+function geodir_cfa_extra_fields_datepicker($output, $result_str, $cf, $field_info) {
3124 3124
     ob_start();
3125 3125
     $extra = array();
3126 3126
     if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
@@ -3131,7 +3131,7 @@  discard block
 block discarded – undo
3131 3131
         <label for="date_format" class="gd-cf-tooltip-wrap">
3132 3132
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
3133 3133
             <div class="gdcf-tooltip">
3134
-                <?php _e('Select the date format.', 'geodirectory');?>
3134
+                <?php _e('Select the date format.', 'geodirectory'); ?>
3135 3135
             </div>
3136 3136
         </label>
3137 3137
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
@@ -3151,16 +3151,16 @@  discard block
 block discarded – undo
3151 3151
              * @since 1.6.5
3152 3152
              * @param array $date_formats The PHP date format array.
3153 3153
              */
3154
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
3154
+            $date_formats = apply_filters('geodir_date_formats', $date_formats);
3155 3155
             ?>
3156 3156
             <select name="extra[date_format]" id="date_format">
3157 3157
                 <?php
3158
-                foreach($date_formats as $format){
3158
+                foreach ($date_formats as $format) {
3159 3159
                     $selected = '';
3160
-                    if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3160
+                    if (!empty($extra) && esc_attr($extra['date_format']) == $format) {
3161 3161
                         $selected = "selected='selected'";
3162 3162
                     }
3163
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3163
+                    echo "<option $selected value='$format'>$format       (".date_i18n($format, time()).")</option>";
3164 3164
                 }
3165 3165
                 ?>
3166 3166
             </select>
@@ -3172,10 +3172,10 @@  discard block
 block discarded – undo
3172 3172
     $output = ob_get_clean();
3173 3173
     return $output;
3174 3174
 }
3175
-add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3175
+add_filter('geodir_cfa_extra_fields_datepicker', 'geodir_cfa_extra_fields_datepicker', 10, 4);
3176 3176
 
3177 3177
 
3178
-function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3178
+function geodir_cfa_extra_fields_file($output, $result_str, $cf, $field_info) {
3179 3179
     ob_start();
3180 3180
     $allowed_file_types = geodir_allowed_mime_types();
3181 3181
 
@@ -3186,16 +3186,16 @@  discard block
 block discarded – undo
3186 3186
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3187 3187
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
3188 3188
             <div class="gdcf-tooltip">
3189
-                <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory');?>
3189
+                <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory'); ?>
3190 3190
             </div>
3191 3191
         </label>
3192 3192
         <div class="gd-cf-input-wrap">
3193 3193
             <select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;">
3194
-                <option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
3195
-                <?php foreach ( $allowed_file_types as $format => $types ) { ?>
3196
-                    <optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
3197
-                        <?php foreach ( $types as $ext => $type ) { ?>
3198
-                            <option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option>
3194
+                <option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
3195
+                <?php foreach ($allowed_file_types as $format => $types) { ?>
3196
+                    <optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
3197
+                        <?php foreach ($types as $ext => $type) { ?>
3198
+                            <option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.'.$ext; ?></option>
3199 3199
                         <?php } ?>
3200 3200
                     </optgroup>
3201 3201
                 <?php } ?>
@@ -3207,11 +3207,11 @@  discard block
 block discarded – undo
3207 3207
     $output = ob_get_clean();
3208 3208
     return $output;
3209 3209
 }
3210
-add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3210
+add_filter('geodir_cfa_extra_fields_file', 'geodir_cfa_extra_fields_file', 10, 4);
3211 3211
 
3212
-function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
3212
+function geodir_default_custom_fields($post_type = 'gd_place', $package_id = '') {
3213 3213
     $fields = array();
3214
-    $package = ($package_id=='') ? '' : array($package_id);
3214
+    $package = ($package_id == '') ? '' : array($package_id);
3215 3215
 
3216 3216
     $fields[] = array('listing_type' => $post_type,
3217 3217
                       'data_type' => 'VARCHAR',
Please login to merge, or discard this patch.
geodirectory-functions/helper_functions.php 1 patch
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16 16
 function geodir_add_listing_page_id(){
17
-    $gd_page_id = get_option('geodir_add_listing_page');
17
+	$gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19
-    if (function_exists('icl_object_id')) {
20
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
21
-    }
19
+	if (function_exists('icl_object_id')) {
20
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
21
+	}
22 22
 
23
-    return $gd_page_id;
23
+	return $gd_page_id;
24 24
 }
25 25
 
26 26
 /**
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33 33
 function geodir_preview_page_id(){
34
-    $gd_page_id = get_option('geodir_preview_page');
34
+	$gd_page_id = get_option('geodir_preview_page');
35 35
 
36
-    if (function_exists('icl_object_id')) {
37
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
38
-    }
36
+	if (function_exists('icl_object_id')) {
37
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
38
+	}
39 39
 
40
-    return $gd_page_id;
40
+	return $gd_page_id;
41 41
 }
42 42
 
43 43
 /**
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50 50
 function geodir_success_page_id(){
51
-    $gd_page_id = get_option('geodir_success_page');
51
+	$gd_page_id = get_option('geodir_success_page');
52 52
 
53
-    if (function_exists('icl_object_id')) {
54
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
55
-    }
53
+	if (function_exists('icl_object_id')) {
54
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
55
+	}
56 56
 
57
-    return $gd_page_id;
57
+	return $gd_page_id;
58 58
 }
59 59
 
60 60
 /**
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67 67
 function geodir_location_page_id(){
68
-    $gd_page_id = get_option('geodir_location_page');
68
+	$gd_page_id = get_option('geodir_location_page');
69 69
 
70
-    if (function_exists('icl_object_id')) {
71
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
72
-    }
70
+	if (function_exists('icl_object_id')) {
71
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
72
+	}
73 73
 
74
-    return $gd_page_id;
74
+	return $gd_page_id;
75 75
 }
76 76
 
77 77
 /**
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84 84
 function geodir_home_page_id(){
85
-    $gd_page_id = get_option('geodir_home_page');
85
+	$gd_page_id = get_option('geodir_home_page');
86 86
 
87
-    if (function_exists('icl_object_id')) {
88
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
89
-    }
87
+	if (function_exists('icl_object_id')) {
88
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
89
+	}
90 90
 
91
-    return $gd_page_id;
91
+	return $gd_page_id;
92 92
 }
93 93
 
94 94
 /**
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101 101
 function geodir_info_page_id(){
102
-    $gd_page_id = get_option('geodir_info_page');
102
+	$gd_page_id = get_option('geodir_info_page');
103 103
 
104
-    if (function_exists('icl_object_id')) {
105
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
106
-    }
104
+	if (function_exists('icl_object_id')) {
105
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
106
+	}
107 107
 
108
-    return $gd_page_id;
108
+	return $gd_page_id;
109 109
 }
110 110
 
111 111
 /**
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118 118
 function geodir_login_page_id(){
119
-    $gd_page_id = get_option('geodir_login_page');
119
+	$gd_page_id = get_option('geodir_login_page');
120 120
 
121
-    if (function_exists('icl_object_id')) {
122
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
123
-    }
121
+	if (function_exists('icl_object_id')) {
122
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
123
+	}
124 124
 
125
-    return $gd_page_id;
125
+	return $gd_page_id;
126 126
 }
127 127
 
128 128
 
@@ -134,45 +134,45 @@  discard block
 block discarded – undo
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136 136
 function geodir_login_url($args=array()){
137
-    $gd_page_id = get_option('geodir_login_page');
138
-
139
-    if (function_exists('icl_object_id')) {
140
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
141
-    }
142
-
143
-    if (function_exists('geodir_location_geo_home_link')) {
144
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
-    }
146
-    $home_url = get_home_url();
147
-    if (function_exists('geodir_location_geo_home_link')) {
148
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
149
-    }
150
-
151
-    if($gd_page_id){
152
-        $post = get_post($gd_page_id);
153
-        $slug = $post->post_name;
154
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
155
-        $login_url = trailingslashit($home_url)."$slug/";
156
-    }else{
157
-        $login_url = trailingslashit($home_url)."?geodir_signup=true";
158
-    }
159
-
160
-    if($args){
161
-        $login_url = add_query_arg($args,$login_url );
162
-    }
163
-
164
-    /**
165
-     * Filter the GeoDirectory login page url.
166
-     *
167
-     * This filter can be used to change the GeoDirectory page url.
168
-     *
169
-     * @since 1.5.3
170
-     * @package GeoDirectory
171
-     * @param string $login_url The url of the login page.
172
-     * @param array $args The array of query args used.
173
-     * @param int $gd_page_id The page id of the GD login page.
174
-     */
175
-    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
137
+	$gd_page_id = get_option('geodir_login_page');
138
+
139
+	if (function_exists('icl_object_id')) {
140
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
141
+	}
142
+
143
+	if (function_exists('geodir_location_geo_home_link')) {
144
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
+	}
146
+	$home_url = get_home_url();
147
+	if (function_exists('geodir_location_geo_home_link')) {
148
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
149
+	}
150
+
151
+	if($gd_page_id){
152
+		$post = get_post($gd_page_id);
153
+		$slug = $post->post_name;
154
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
155
+		$login_url = trailingslashit($home_url)."$slug/";
156
+	}else{
157
+		$login_url = trailingslashit($home_url)."?geodir_signup=true";
158
+	}
159
+
160
+	if($args){
161
+		$login_url = add_query_arg($args,$login_url );
162
+	}
163
+
164
+	/**
165
+	 * Filter the GeoDirectory login page url.
166
+	 *
167
+	 * This filter can be used to change the GeoDirectory page url.
168
+	 *
169
+	 * @since 1.5.3
170
+	 * @package GeoDirectory
171
+	 * @param string $login_url The url of the login page.
172
+	 * @param array $args The array of query args used.
173
+	 * @param int $gd_page_id The page id of the GD login page.
174
+	 */
175
+	return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
176 176
 }
177 177
 
178 178
 /**
@@ -183,34 +183,34 @@  discard block
 block discarded – undo
183 183
  * @return string Info page url.
184 184
  */
185 185
 function geodir_info_url($args=array()){
186
-    $gd_page_id = get_option('geodir_info_page');
187
-
188
-    if (function_exists('icl_object_id')) {
189
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
190
-    }
191
-
192
-    if (function_exists('geodir_location_geo_home_link')) {
193
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
194
-    }
195
-    $home_url = get_home_url();
196
-    if (function_exists('geodir_location_geo_home_link')) {
197
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
198
-    }
199
-
200
-    if($gd_page_id){
201
-        $post = get_post($gd_page_id);
202
-        $slug = $post->post_name;
203
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
204
-        $info_url = trailingslashit($home_url)."$slug/";
205
-    }else{
206
-        $info_url = trailingslashit($home_url);
207
-    }
208
-
209
-    if($args){
210
-        $info_url = add_query_arg($args,$info_url );
211
-    }
212
-
213
-    return $info_url;
186
+	$gd_page_id = get_option('geodir_info_page');
187
+
188
+	if (function_exists('icl_object_id')) {
189
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
190
+	}
191
+
192
+	if (function_exists('geodir_location_geo_home_link')) {
193
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
194
+	}
195
+	$home_url = get_home_url();
196
+	if (function_exists('geodir_location_geo_home_link')) {
197
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
198
+	}
199
+
200
+	if($gd_page_id){
201
+		$post = get_post($gd_page_id);
202
+		$slug = $post->post_name;
203
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
204
+		$info_url = trailingslashit($home_url)."$slug/";
205
+	}else{
206
+		$info_url = trailingslashit($home_url);
207
+	}
208
+
209
+	if($args){
210
+		$info_url = add_query_arg($args,$info_url );
211
+	}
212
+
213
+	return $info_url;
214 214
 }
215 215
 
216 216
 /**
@@ -226,11 +226,11 @@  discard block
 block discarded – undo
226 226
  * @return string Returns converted string.
227 227
  */
228 228
 function geodir_ucwords($string, $charset='UTF-8') {
229
-    if (function_exists('mb_convert_case')) {
230
-        return mb_convert_case($string, MB_CASE_TITLE, $charset);
231
-    } else {
232
-        return ucwords($string);
233
-    }
229
+	if (function_exists('mb_convert_case')) {
230
+		return mb_convert_case($string, MB_CASE_TITLE, $charset);
231
+	} else {
232
+		return ucwords($string);
233
+	}
234 234
 }
235 235
 
236 236
 /**
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
  * @return string Returns converted string.
247 247
  */
248 248
 function geodir_strtolower($string, $charset='UTF-8') {
249
-    if (function_exists('mb_convert_case')) {
250
-        return mb_convert_case($string, MB_CASE_LOWER, $charset);
251
-    } else {
252
-        return strtolower($string);
253
-    }
249
+	if (function_exists('mb_convert_case')) {
250
+		return mb_convert_case($string, MB_CASE_LOWER, $charset);
251
+	} else {
252
+		return strtolower($string);
253
+	}
254 254
 }
255 255
 
256 256
 /**
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
  * @return string Returns converted string.
267 267
  */
268 268
 function geodir_strtoupper($string, $charset='UTF-8') {
269
-    if (function_exists('mb_convert_case')) {
270
-        return mb_convert_case($string, MB_CASE_UPPER, $charset);
271
-    } else {
272
-        return strtoupper($string);
273
-    }
269
+	if (function_exists('mb_convert_case')) {
270
+		return mb_convert_case($string, MB_CASE_UPPER, $charset);
271
+	} else {
272
+		return strtoupper($string);
273
+	}
274 274
 }
275 275
 
276 276
 /**
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
  * @package GeoDirectory
450 450
  */
451 451
 function _gd_die_handler() {
452
-    if ( defined( 'GD_TESTING_MODE' ) ) {
453
-        return '_gd_die_handler';
454
-    } else {
455
-        die();
456
-    }
452
+	if ( defined( 'GD_TESTING_MODE' ) ) {
453
+		return '_gd_die_handler';
454
+	} else {
455
+		die();
456
+	}
457 457
 }
458 458
 
459 459
 /**
@@ -468,9 +468,9 @@  discard block
 block discarded – undo
468 468
  * @param int $status     Optional. Status code.
469 469
  */
470 470
 function gd_die( $message = '', $title = '', $status = 400 ) {
471
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
472
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
473
-    wp_die( $message, $title, array( 'response' => $status ));
471
+	add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
472
+	add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
473
+	wp_die( $message, $title, array( 'response' => $status ));
474 474
 }
475 475
 
476 476
 /*
@@ -639,19 +639,19 @@  discard block
 block discarded – undo
639 639
  * @return string The formatted date.
640 640
  */
641 641
 function geodir_date($date, $date_to, $date_from) {
642
-    if (empty($date)) {
643
-        return $date;
644
-    }
642
+	if (empty($date)) {
643
+		return $date;
644
+	}
645 645
     
646
-    $datetime = date_create_from_format($date_from, $date);
646
+	$datetime = date_create_from_format($date_from, $date);
647 647
     
648
-    if (empty($datetime)) {
649
-        $date = date_i18n($date_to, strtotime($date));
650
-    } else {
651
-        $date = $datetime->format($date_to);
652
-    }
648
+	if (empty($datetime)) {
649
+		$date = date_i18n($date_to, strtotime($date));
650
+	} else {
651
+		$date = $datetime->format($date_to);
652
+	}
653 653
     
654
-    $date = geodir_maybe_untranslate_date($date);
654
+	$date = geodir_maybe_untranslate_date($date);
655 655
     
656
-    return $date;
656
+	return $date;
657 657
 }
658 658
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_output_functions.php 1 patch
Indentation   +1525 added lines, -1525 removed lines patch added patch discarded remove patch
@@ -21,84 +21,84 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function geodir_cf_checkbox($html,$location,$cf,$p=''){
23 23
 
24
-    // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
27
-
28
-    if(!is_array($cf) && $cf!=''){
29
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
31
-    }
32
-
33
-    $html_var = $cf['htmlvar_name'];
34
-
35
-    // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
-        /**
38
-         * Filter the checkbox html by location.
39
-         *
40
-         * @param string $html The html to filter.
41
-         * @param array $cf The custom field array.
42
-         * @since 1.6.6
43
-         */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
-    }
46
-
47
-    // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
-        /**
50
-         * Filter the checkbox html by individual custom field.
51
-         *
52
-         * @param string $html The html to filter.
53
-         * @param string $location The location to output the html.
54
-         * @param array $cf The custom field array.
55
-         * @since 1.6.6
56
-         */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
-    }
59
-
60
-    // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
-        /**
63
-         * Filter the checkbox html by field type key.
64
-         *
65
-         * @param string $html The html to filter.
66
-         * @param string $location The location to output the html.
67
-         * @param array $cf The custom field array.
68
-         * @since 1.6.6
69
-         */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
-    }
72
-
73
-    // If not html then we run the standard output.
74
-    if(empty($html)){
75
-
76
-        if ( (int) $post->{$html_var} == 1 ):
77
-
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
80
-            else:
81
-                $html_val = __( 'No', 'geodirectory' );
82
-            endif;
83
-
84
-            $field_icon = geodir_field_icon_proccess($cf);
85
-            if (strpos($field_icon, 'http') !== false) {
86
-                $field_icon_af = '';
87
-            } elseif ($field_icon == '') {
88
-                $field_icon_af = '';
89
-            } else {
90
-                $field_icon_af = $field_icon;
91
-                $field_icon = '';
92
-            }
93
-
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
97
-        endif;
98
-
99
-    }
100
-
101
-    return $html;
24
+	// check we have the post value
25
+	if(is_int($p)){$post = geodir_get_post_info($p);}
26
+	else{ global $post;}
27
+
28
+	if(!is_array($cf) && $cf!=''){
29
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
+		if(!$cf){return NULL;}
31
+	}
32
+
33
+	$html_var = $cf['htmlvar_name'];
34
+
35
+	// Check if there is a location specific filter.
36
+	if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
+		/**
38
+		 * Filter the checkbox html by location.
39
+		 *
40
+		 * @param string $html The html to filter.
41
+		 * @param array $cf The custom field array.
42
+		 * @since 1.6.6
43
+		 */
44
+		$html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
+	}
46
+
47
+	// Check if there is a custom field specific filter.
48
+	if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
+		/**
50
+		 * Filter the checkbox html by individual custom field.
51
+		 *
52
+		 * @param string $html The html to filter.
53
+		 * @param string $location The location to output the html.
54
+		 * @param array $cf The custom field array.
55
+		 * @since 1.6.6
56
+		 */
57
+		$html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
+	}
59
+
60
+	// Check if there is a custom field key specific filter.
61
+	if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
+		/**
63
+		 * Filter the checkbox html by field type key.
64
+		 *
65
+		 * @param string $html The html to filter.
66
+		 * @param string $location The location to output the html.
67
+		 * @param array $cf The custom field array.
68
+		 * @since 1.6.6
69
+		 */
70
+		$html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
+	}
72
+
73
+	// If not html then we run the standard output.
74
+	if(empty($html)){
75
+
76
+		if ( (int) $post->{$html_var} == 1 ):
77
+
78
+			if ( $post->{$html_var} == '1' ):
79
+				$html_val = __( 'Yes', 'geodirectory' );
80
+			else:
81
+				$html_val = __( 'No', 'geodirectory' );
82
+			endif;
83
+
84
+			$field_icon = geodir_field_icon_proccess($cf);
85
+			if (strpos($field_icon, 'http') !== false) {
86
+				$field_icon_af = '';
87
+			} elseif ($field_icon == '') {
88
+				$field_icon_af = '';
89
+			} else {
90
+				$field_icon_af = $field_icon;
91
+				$field_icon = '';
92
+			}
93
+
94
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
+			$html .= '</span>' . $html_val . '</div>';
97
+		endif;
98
+
99
+	}
100
+
101
+	return $html;
102 102
 }
103 103
 add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
104 104
 
@@ -115,71 +115,71 @@  discard block
 block discarded – undo
115 115
  */
116 116
 function geodir_cf_fieldset($html,$location,$cf,$p=''){
117 117
 
118
-    // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
121
-
122
-    if(!is_array($cf) && $cf!=''){
123
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
125
-    }
126
-
127
-    $html_var = $cf['htmlvar_name'];
128
-
129
-    // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
-        /**
132
-         * Filter the fieldset html by location.
133
-         *
134
-         * @param string $html The html to filter.
135
-         * @param array $cf The custom field array.
136
-         * @since 1.6.6
137
-         */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
-    }
140
-
141
-    // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
-        /**
144
-         * Filter the fieldset html by individual custom field.
145
-         *
146
-         * @param string $html The html to filter.
147
-         * @param string $location The location to output the html.
148
-         * @param array $cf The custom field array.
149
-         * @since 1.6.6
150
-         */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
-    }
153
-
154
-    // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
-        /**
157
-         * Filter the fieldset html by field type key.
158
-         *
159
-         * @param string $html The html to filter.
160
-         * @param string $location The location to output the html.
161
-         * @param array $cf The custom field array.
162
-         * @since 1.6.6
163
-         */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
-    }
166
-
167
-    // If not html then we run the standard output.
168
-    if(empty($html)){
169
-
170
-        global $field_set_start;
171
-        $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172
-
173
-        if ($field_set_start == 1) {
174
-            $html = '';
175
-        } else {
176
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
-            //$field_set_start = 1;
178
-        }
179
-
180
-    }
181
-
182
-    return $html;
118
+	// check we have the post value
119
+	if(is_int($p)){$post = geodir_get_post_info($p);}
120
+	else{ global $post;}
121
+
122
+	if(!is_array($cf) && $cf!=''){
123
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
+		if(!$cf){return NULL;}
125
+	}
126
+
127
+	$html_var = $cf['htmlvar_name'];
128
+
129
+	// Check if there is a location specific filter.
130
+	if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
+		/**
132
+		 * Filter the fieldset html by location.
133
+		 *
134
+		 * @param string $html The html to filter.
135
+		 * @param array $cf The custom field array.
136
+		 * @since 1.6.6
137
+		 */
138
+		$html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
+	}
140
+
141
+	// Check if there is a custom field specific filter.
142
+	if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
+		/**
144
+		 * Filter the fieldset html by individual custom field.
145
+		 *
146
+		 * @param string $html The html to filter.
147
+		 * @param string $location The location to output the html.
148
+		 * @param array $cf The custom field array.
149
+		 * @since 1.6.6
150
+		 */
151
+		$html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
+	}
153
+
154
+	// Check if there is a custom field key specific filter.
155
+	if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
+		/**
157
+		 * Filter the fieldset html by field type key.
158
+		 *
159
+		 * @param string $html The html to filter.
160
+		 * @param string $location The location to output the html.
161
+		 * @param array $cf The custom field array.
162
+		 * @since 1.6.6
163
+		 */
164
+		$html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
+	}
166
+
167
+	// If not html then we run the standard output.
168
+	if(empty($html)){
169
+
170
+		global $field_set_start;
171
+		$fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172
+
173
+		if ($field_set_start == 1) {
174
+			$html = '';
175
+		} else {
176
+			$html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
+			//$field_set_start = 1;
178
+		}
179
+
180
+	}
181
+
182
+	return $html;
183 183
 }
184 184
 add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
185 185
 
@@ -196,106 +196,106 @@  discard block
 block discarded – undo
196 196
  */
197 197
 function geodir_cf_url($html,$location,$cf,$p=''){
198 198
 
199
-    // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
202
-
203
-    if(!is_array($cf) && $cf!=''){
204
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
-        if(!$cf){return NULL;}
206
-    }
207
-
208
-    $html_var = $cf['htmlvar_name'];
209
-
210
-    // Check if there is a location specific filter.
211
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
-        /**
213
-         * Filter the url html by location.
214
-         *
215
-         * @param string $html The html to filter.
216
-         * @param array $cf The custom field array.
217
-         * @since 1.6.6
218
-         */
219
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
-    }
221
-
222
-    // Check if there is a custom field specific filter.
223
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
-        /**
225
-         * Filter the url html by individual custom field.
226
-         *
227
-         * @param string $html The html to filter.
228
-         * @param string $location The location to output the html.
229
-         * @param array $cf The custom field array.
230
-         * @since 1.6.6
231
-         */
232
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
-    }
234
-
235
-    // Check if there is a custom field key specific filter.
236
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
-        /**
238
-         * Filter the url html by field type key.
239
-         *
240
-         * @param string $html The html to filter.
241
-         * @param string $location The location to output the html.
242
-         * @param array $cf The custom field array.
243
-         * @since 1.6.6
244
-         */
245
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
-    }
247
-
248
-    // If not html then we run the standard output.
249
-    if(empty($html)){
250
-
251
-        if ($post->{$cf['htmlvar_name']}):
252
-
253
-            $field_icon = geodir_field_icon_proccess($cf);
254
-            if (strpos($field_icon, 'http') !== false) {
255
-                $field_icon_af = '';
256
-            } elseif ($field_icon == '') {
257
-
258
-                if ($cf['name'] == 'geodir_facebook') {
259
-                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
260
-                } elseif ($cf['name'] == 'geodir_twitter') {
261
-                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
262
-                } else {
263
-                    $field_icon_af = '<i class="fa fa-link"></i>';
264
-                }
265
-
266
-            } else {
267
-                $field_icon_af = $field_icon;
268
-                $field_icon = '';
269
-            }
270
-
271
-            $a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
272
-
273
-
274
-            $website = !empty($a_url['url']) ? $a_url['url'] : '';
275
-            $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
-            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278
-
279
-
280
-
281
-            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
282
-            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
283
-            /**
284
-             * Filter custom field website name.
285
-             *
286
-             * @since 1.0.0
287
-             *
288
-             * @param string $title Website Title.
289
-             * @param string $website Website URL.
290
-             * @param int $post->ID Post ID.
291
-             */
292
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
-
294
-        endif;
295
-
296
-    }
297
-
298
-    return $html;
199
+	// check we have the post value
200
+	if(is_int($p)){$post = geodir_get_post_info($p);}
201
+	else{ global $post;}
202
+
203
+	if(!is_array($cf) && $cf!=''){
204
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
+		if(!$cf){return NULL;}
206
+	}
207
+
208
+	$html_var = $cf['htmlvar_name'];
209
+
210
+	// Check if there is a location specific filter.
211
+	if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
+		/**
213
+		 * Filter the url html by location.
214
+		 *
215
+		 * @param string $html The html to filter.
216
+		 * @param array $cf The custom field array.
217
+		 * @since 1.6.6
218
+		 */
219
+		$html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
+	}
221
+
222
+	// Check if there is a custom field specific filter.
223
+	if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
+		/**
225
+		 * Filter the url html by individual custom field.
226
+		 *
227
+		 * @param string $html The html to filter.
228
+		 * @param string $location The location to output the html.
229
+		 * @param array $cf The custom field array.
230
+		 * @since 1.6.6
231
+		 */
232
+		$html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
+	}
234
+
235
+	// Check if there is a custom field key specific filter.
236
+	if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
+		/**
238
+		 * Filter the url html by field type key.
239
+		 *
240
+		 * @param string $html The html to filter.
241
+		 * @param string $location The location to output the html.
242
+		 * @param array $cf The custom field array.
243
+		 * @since 1.6.6
244
+		 */
245
+		$html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
+	}
247
+
248
+	// If not html then we run the standard output.
249
+	if(empty($html)){
250
+
251
+		if ($post->{$cf['htmlvar_name']}):
252
+
253
+			$field_icon = geodir_field_icon_proccess($cf);
254
+			if (strpos($field_icon, 'http') !== false) {
255
+				$field_icon_af = '';
256
+			} elseif ($field_icon == '') {
257
+
258
+				if ($cf['name'] == 'geodir_facebook') {
259
+					$field_icon_af = '<i class="fa fa-facebook-square"></i>';
260
+				} elseif ($cf['name'] == 'geodir_twitter') {
261
+					$field_icon_af = '<i class="fa fa-twitter-square"></i>';
262
+				} else {
263
+					$field_icon_af = '<i class="fa fa-link"></i>';
264
+				}
265
+
266
+			} else {
267
+				$field_icon_af = $field_icon;
268
+				$field_icon = '';
269
+			}
270
+
271
+			$a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
272
+
273
+
274
+			$website = !empty($a_url['url']) ? $a_url['url'] : '';
275
+			$title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
+			if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
+			$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278
+
279
+
280
+
281
+			// all search engines that use the nofollow value exclude links that use it from their ranking calculation
282
+			$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
283
+			/**
284
+			 * Filter custom field website name.
285
+			 *
286
+			 * @since 1.0.0
287
+			 *
288
+			 * @param string $title Website Title.
289
+			 * @param string $website Website URL.
290
+			 * @param int $post->ID Post ID.
291
+			 */
292
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
+
294
+		endif;
295
+
296
+	}
297
+
298
+	return $html;
299 299
 }
300 300
 add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
301 301
 
@@ -312,80 +312,80 @@  discard block
 block discarded – undo
312 312
  */
313 313
 function geodir_cf_phone($html,$location,$cf,$p=''){
314 314
 
315
-    // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
318
-
319
-    if(!is_array($cf) && $cf!=''){
320
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
-        if(!$cf){return NULL;}
322
-    }
323
-
324
-    $html_var = $cf['htmlvar_name'];
325
-
326
-    // Check if there is a location specific filter.
327
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
-        /**
329
-         * Filter the phone html by location.
330
-         *
331
-         * @param string $html The html to filter.
332
-         * @param array $cf The custom field array.
333
-         * @since 1.6.6
334
-         */
335
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
-    }
337
-
338
-    // Check if there is a custom field specific filter.
339
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
-        /**
341
-         * Filter the phone html by individual custom field.
342
-         *
343
-         * @param string $html The html to filter.
344
-         * @param string $location The location to output the html.
345
-         * @param array $cf The custom field array.
346
-         * @since 1.6.6
347
-         */
348
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
-    }
350
-
351
-    // Check if there is a custom field key specific filter.
352
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
-        /**
354
-         * Filter the phone html by field type key.
355
-         *
356
-         * @param string $html The html to filter.
357
-         * @param string $location The location to output the html.
358
-         * @param array $cf The custom field array.
359
-         * @since 1.6.6
360
-         */
361
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
-    }
363
-
364
-    // If not html then we run the standard output.
365
-    if(empty($html)){
366
-
367
-        if ($post->{$cf['htmlvar_name']}):
368
-
369
-            $field_icon = geodir_field_icon_proccess($cf);
370
-            if (strpos($field_icon, 'http') !== false) {
371
-                $field_icon_af = '';
372
-            } elseif ($field_icon == '') {
373
-                $field_icon_af = '<i class="fa fa-phone"></i>';
374
-            } else {
375
-                $field_icon_af = $field_icon;
376
-                $field_icon = '';
377
-            }
378
-
379
-
380
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
383
-
384
-        endif;
385
-
386
-    }
387
-
388
-    return $html;
315
+	// check we have the post value
316
+	if(is_int($p)){$post = geodir_get_post_info($p);}
317
+	else{ global $post;}
318
+
319
+	if(!is_array($cf) && $cf!=''){
320
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
+		if(!$cf){return NULL;}
322
+	}
323
+
324
+	$html_var = $cf['htmlvar_name'];
325
+
326
+	// Check if there is a location specific filter.
327
+	if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
+		/**
329
+		 * Filter the phone html by location.
330
+		 *
331
+		 * @param string $html The html to filter.
332
+		 * @param array $cf The custom field array.
333
+		 * @since 1.6.6
334
+		 */
335
+		$html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
+	}
337
+
338
+	// Check if there is a custom field specific filter.
339
+	if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
+		/**
341
+		 * Filter the phone html by individual custom field.
342
+		 *
343
+		 * @param string $html The html to filter.
344
+		 * @param string $location The location to output the html.
345
+		 * @param array $cf The custom field array.
346
+		 * @since 1.6.6
347
+		 */
348
+		$html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
+	}
350
+
351
+	// Check if there is a custom field key specific filter.
352
+	if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
+		/**
354
+		 * Filter the phone html by field type key.
355
+		 *
356
+		 * @param string $html The html to filter.
357
+		 * @param string $location The location to output the html.
358
+		 * @param array $cf The custom field array.
359
+		 * @since 1.6.6
360
+		 */
361
+		$html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
+	}
363
+
364
+	// If not html then we run the standard output.
365
+	if(empty($html)){
366
+
367
+		if ($post->{$cf['htmlvar_name']}):
368
+
369
+			$field_icon = geodir_field_icon_proccess($cf);
370
+			if (strpos($field_icon, 'http') !== false) {
371
+				$field_icon_af = '';
372
+			} elseif ($field_icon == '') {
373
+				$field_icon_af = '<i class="fa fa-phone"></i>';
374
+			} else {
375
+				$field_icon_af = $field_icon;
376
+				$field_icon = '';
377
+			}
378
+
379
+
380
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
+					$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
+			$html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
383
+
384
+		endif;
385
+
386
+	}
387
+
388
+	return $html;
389 389
 }
390 390
 add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
391 391
 
@@ -402,85 +402,85 @@  discard block
 block discarded – undo
402 402
  */
403 403
 function geodir_cf_time($html,$location,$cf,$p=''){
404 404
 
405
-    // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
408
-
409
-    if(!is_array($cf) && $cf!=''){
410
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
-        if(!$cf){return NULL;}
412
-    }
413
-
414
-    $html_var = $cf['htmlvar_name'];
415
-
416
-    // Check if there is a location specific filter.
417
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
-        /**
419
-         * Filter the time html by location.
420
-         *
421
-         * @param string $html The html to filter.
422
-         * @param array $cf The custom field array.
423
-         * @since 1.6.6
424
-         */
425
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
-    }
427
-
428
-    // Check if there is a custom field specific filter.
429
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
-        /**
431
-         * Filter the time html by individual custom field.
432
-         *
433
-         * @param string $html The html to filter.
434
-         * @param string $location The location to output the html.
435
-         * @param array $cf The custom field array.
436
-         * @since 1.6.6
437
-         */
438
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
-    }
440
-
441
-    // Check if there is a custom field key specific filter.
442
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
-        /**
444
-         * Filter the time html by field type key.
445
-         *
446
-         * @param string $html The html to filter.
447
-         * @param string $location The location to output the html.
448
-         * @param array $cf The custom field array.
449
-         * @since 1.6.6
450
-         */
451
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
-    }
453
-
454
-    // If not html then we run the standard output.
455
-    if(empty($html)){
456
-
457
-        if ($post->{$cf['htmlvar_name']}):
458
-
459
-            $value = '';
460
-            if ($post->{$cf['htmlvar_name']} != '')
461
-                //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462
-                $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
463
-
464
-            $field_icon = geodir_field_icon_proccess($cf);
465
-            if (strpos($field_icon, 'http') !== false) {
466
-                $field_icon_af = '';
467
-            } elseif ($field_icon == '') {
468
-                $field_icon_af = '<i class="fa fa-clock-o"></i>';
469
-            } else {
470
-                $field_icon_af = $field_icon;
471
-                $field_icon = '';
472
-            }
473
-
474
-
475
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
-            $html .= '</span>' . $value . '</div>';
478
-
479
-        endif;
480
-
481
-    }
482
-
483
-    return $html;
405
+	// check we have the post value
406
+	if(is_int($p)){$post = geodir_get_post_info($p);}
407
+	else{ global $post;}
408
+
409
+	if(!is_array($cf) && $cf!=''){
410
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
+		if(!$cf){return NULL;}
412
+	}
413
+
414
+	$html_var = $cf['htmlvar_name'];
415
+
416
+	// Check if there is a location specific filter.
417
+	if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
+		/**
419
+		 * Filter the time html by location.
420
+		 *
421
+		 * @param string $html The html to filter.
422
+		 * @param array $cf The custom field array.
423
+		 * @since 1.6.6
424
+		 */
425
+		$html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
+	}
427
+
428
+	// Check if there is a custom field specific filter.
429
+	if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
+		/**
431
+		 * Filter the time html by individual custom field.
432
+		 *
433
+		 * @param string $html The html to filter.
434
+		 * @param string $location The location to output the html.
435
+		 * @param array $cf The custom field array.
436
+		 * @since 1.6.6
437
+		 */
438
+		$html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
+	}
440
+
441
+	// Check if there is a custom field key specific filter.
442
+	if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
+		/**
444
+		 * Filter the time html by field type key.
445
+		 *
446
+		 * @param string $html The html to filter.
447
+		 * @param string $location The location to output the html.
448
+		 * @param array $cf The custom field array.
449
+		 * @since 1.6.6
450
+		 */
451
+		$html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
+	}
453
+
454
+	// If not html then we run the standard output.
455
+	if(empty($html)){
456
+
457
+		if ($post->{$cf['htmlvar_name']}):
458
+
459
+			$value = '';
460
+			if ($post->{$cf['htmlvar_name']} != '')
461
+				//$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462
+				$value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
463
+
464
+			$field_icon = geodir_field_icon_proccess($cf);
465
+			if (strpos($field_icon, 'http') !== false) {
466
+				$field_icon_af = '';
467
+			} elseif ($field_icon == '') {
468
+				$field_icon_af = '<i class="fa fa-clock-o"></i>';
469
+			} else {
470
+				$field_icon_af = $field_icon;
471
+				$field_icon = '';
472
+			}
473
+
474
+
475
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
+			$html .= '</span>' . $value . '</div>';
478
+
479
+		endif;
480
+
481
+	}
482
+
483
+	return $html;
484 484
 }
485 485
 add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
486 486
 
@@ -496,111 +496,111 @@  discard block
 block discarded – undo
496 496
  * @return string The html to output for the custom field.
497 497
  */
498 498
 function geodir_cf_datepicker($html,$location,$cf,$p=''){
499
-    global $preview;
500
-    // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
503
-
504
-    if(!is_array($cf) && $cf!=''){
505
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
-        if(!$cf){return NULL;}
507
-    }
508
-
509
-    $html_var = $cf['htmlvar_name'];
510
-
511
-    // Check if there is a location specific filter.
512
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
-        /**
514
-         * Filter the datepicker html by location.
515
-         *
516
-         * @param string $html The html to filter.
517
-         * @param array $cf The custom field array.
518
-         * @since 1.6.6
519
-         */
520
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
-    }
522
-
523
-    // Check if there is a custom field specific filter.
524
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
-        /**
526
-         * Filter the datepicker html by individual custom field.
527
-         *
528
-         * @param string $html The html to filter.
529
-         * @param string $location The location to output the html.
530
-         * @param array $cf The custom field array.
531
-         * @since 1.6.6
532
-         */
533
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
-    }
535
-
536
-    // Check if there is a custom field key specific filter.
537
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
-        /**
539
-         * Filter the datepicker html by field type key.
540
-         *
541
-         * @param string $html The html to filter.
542
-         * @param string $location The location to output the html.
543
-         * @param array $cf The custom field array.
544
-         * @since 1.6.6
545
-         */
546
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
-    }
548
-
549
-    // If not html then we run the standard output.
550
-    if(empty($html)){
551
-
552
-        if ($post->{$cf['htmlvar_name']}):
553
-
554
-            $date_format = geodir_default_date_format();
555
-            if ($cf['extra_fields'] != '') {
556
-                $date_format = unserialize($cf['extra_fields']);
557
-                $date_format = $date_format['date_format'];
558
-            }
559
-            // check if we need to change the format or not
560
-            $date_format_len = strlen(str_replace(' ', '', $date_format));
561
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
562
-
563
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
565
-
566
-                $date_format = str_replace($search, $replace, $date_format);
567
-
568
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
570
-                $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571
-            }
572
-
573
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
-                $date_format_from = $preview ? $date_format : 'Y-m-d';
575
-                $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576
-                //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577
-                //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
579
-                return '';
580
-            }
581
-
582
-            $field_icon = geodir_field_icon_proccess($cf);
583
-
584
-            if (strpos($field_icon, 'http') !== false) {
585
-                $field_icon_af = '';
586
-            } elseif ($field_icon == '') {
587
-                $field_icon_af = '<i class="fa fa-calendar"></i>';
588
-            } else {
589
-                $field_icon_af = $field_icon;
590
-                $field_icon = '';
591
-            }
592
-
593
-
594
-
595
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
-            $html .= '</span>' . $value . '</div>';
598
-
599
-        endif;
600
-
601
-    }
602
-
603
-    return $html;
499
+	global $preview;
500
+	// check we have the post value
501
+	if(is_int($p)){$post = geodir_get_post_info($p);}
502
+	else{ global $post;}
503
+
504
+	if(!is_array($cf) && $cf!=''){
505
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
+		if(!$cf){return NULL;}
507
+	}
508
+
509
+	$html_var = $cf['htmlvar_name'];
510
+
511
+	// Check if there is a location specific filter.
512
+	if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
+		/**
514
+		 * Filter the datepicker html by location.
515
+		 *
516
+		 * @param string $html The html to filter.
517
+		 * @param array $cf The custom field array.
518
+		 * @since 1.6.6
519
+		 */
520
+		$html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
+	}
522
+
523
+	// Check if there is a custom field specific filter.
524
+	if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
+		/**
526
+		 * Filter the datepicker html by individual custom field.
527
+		 *
528
+		 * @param string $html The html to filter.
529
+		 * @param string $location The location to output the html.
530
+		 * @param array $cf The custom field array.
531
+		 * @since 1.6.6
532
+		 */
533
+		$html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
+	}
535
+
536
+	// Check if there is a custom field key specific filter.
537
+	if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
+		/**
539
+		 * Filter the datepicker html by field type key.
540
+		 *
541
+		 * @param string $html The html to filter.
542
+		 * @param string $location The location to output the html.
543
+		 * @param array $cf The custom field array.
544
+		 * @since 1.6.6
545
+		 */
546
+		$html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
+	}
548
+
549
+	// If not html then we run the standard output.
550
+	if(empty($html)){
551
+
552
+		if ($post->{$cf['htmlvar_name']}):
553
+
554
+			$date_format = geodir_default_date_format();
555
+			if ($cf['extra_fields'] != '') {
556
+				$date_format = unserialize($cf['extra_fields']);
557
+				$date_format = $date_format['date_format'];
558
+			}
559
+			// check if we need to change the format or not
560
+			$date_format_len = strlen(str_replace(' ', '', $date_format));
561
+			if($date_format_len>5){// if greater then 4 then it's the old style format.
562
+
563
+				$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
+				$replace = array('d','j','l','m','n','F','Y');//PHP date format
565
+
566
+				$date_format = str_replace($search, $replace, $date_format);
567
+
568
+				$post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
+			}else{
570
+				$post_htmlvar_value = $post->{$cf['htmlvar_name']};
571
+			}
572
+
573
+			if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
+				$date_format_from = $preview ? $date_format : 'Y-m-d';
575
+				$value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576
+				//$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577
+				//$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
+			}else{
579
+				return '';
580
+			}
581
+
582
+			$field_icon = geodir_field_icon_proccess($cf);
583
+
584
+			if (strpos($field_icon, 'http') !== false) {
585
+				$field_icon_af = '';
586
+			} elseif ($field_icon == '') {
587
+				$field_icon_af = '<i class="fa fa-calendar"></i>';
588
+			} else {
589
+				$field_icon_af = $field_icon;
590
+				$field_icon = '';
591
+			}
592
+
593
+
594
+
595
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
+			$html .= '</span>' . $value . '</div>';
598
+
599
+		endif;
600
+
601
+	}
602
+
603
+	return $html;
604 604
 }
605 605
 add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
606 606
 
@@ -617,84 +617,84 @@  discard block
 block discarded – undo
617 617
  */
618 618
 function geodir_cf_text($html,$location,$cf,$p=''){
619 619
 
620
-    // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
623
-
624
-    if(!is_array($cf) && $cf!=''){
625
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
-        if(!$cf){return NULL;}
627
-    }
628
-
629
-    $html_var = $cf['htmlvar_name'];
630
-
631
-    // Check if there is a location specific filter.
632
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
633
-        /**
634
-         * Filter the text html by location.
635
-         *
636
-         * @param string $html The html to filter.
637
-         * @param array $cf The custom field array.
638
-         * @since 1.6.6
639
-         */
640
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
641
-    }
642
-
643
-    // Check if there is a custom field specific filter.
644
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
645
-        /**
646
-         * Filter the text html by individual custom field.
647
-         *
648
-         * @param string $html The html to filter.
649
-         * @param string $location The location to output the html.
650
-         * @param array $cf The custom field array.
651
-         * @since 1.6.6
652
-         */
653
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
654
-    }
655
-
656
-    // Check if there is a custom field key specific filter.
657
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
658
-        /**
659
-         * Filter the text html by field type key.
660
-         *
661
-         * @param string $html The html to filter.
662
-         * @param string $location The location to output the html.
663
-         * @param array $cf The custom field array.
664
-         * @since 1.6.6
665
-         */
666
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
667
-    }
620
+	// check we have the post value
621
+	if(is_int($p)){$post = geodir_get_post_info($p);}
622
+	else{ global $post;}
623
+
624
+	if(!is_array($cf) && $cf!=''){
625
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
+		if(!$cf){return NULL;}
627
+	}
628
+
629
+	$html_var = $cf['htmlvar_name'];
630
+
631
+	// Check if there is a location specific filter.
632
+	if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
633
+		/**
634
+		 * Filter the text html by location.
635
+		 *
636
+		 * @param string $html The html to filter.
637
+		 * @param array $cf The custom field array.
638
+		 * @since 1.6.6
639
+		 */
640
+		$html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
641
+	}
642
+
643
+	// Check if there is a custom field specific filter.
644
+	if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
645
+		/**
646
+		 * Filter the text html by individual custom field.
647
+		 *
648
+		 * @param string $html The html to filter.
649
+		 * @param string $location The location to output the html.
650
+		 * @param array $cf The custom field array.
651
+		 * @since 1.6.6
652
+		 */
653
+		$html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
654
+	}
655
+
656
+	// Check if there is a custom field key specific filter.
657
+	if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
658
+		/**
659
+		 * Filter the text html by field type key.
660
+		 *
661
+		 * @param string $html The html to filter.
662
+		 * @param string $location The location to output the html.
663
+		 * @param array $cf The custom field array.
664
+		 * @since 1.6.6
665
+		 */
666
+		$html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
667
+	}
668 668
 
669 669
     
670 670
 
671
-    // If not html then we run the standard output.
672
-    if(empty($html)){
671
+	// If not html then we run the standard output.
672
+	if(empty($html)){
673 673
 
674
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
674
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
675 675
 
676
-            $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
676
+			$class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
677 677
 
678
-            $field_icon = geodir_field_icon_proccess($cf);
679
-            if (strpos($field_icon, 'http') !== false) {
680
-                $field_icon_af = '';
681
-            } elseif ($field_icon == '') {
682
-                $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
683
-            } else {
684
-                $field_icon_af = $field_icon;
685
-                $field_icon = '';
686
-            }
678
+			$field_icon = geodir_field_icon_proccess($cf);
679
+			if (strpos($field_icon, 'http') !== false) {
680
+				$field_icon_af = '';
681
+			} elseif ($field_icon == '') {
682
+				$field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
683
+			} else {
684
+				$field_icon_af = $field_icon;
685
+				$field_icon = '';
686
+			}
687 687
 
688 688
 
689
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
-            $html .= '</span>' . $post->{$cf['htmlvar_name']} . '</div>';
689
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
+			$html .= '</span>' . $post->{$cf['htmlvar_name']} . '</div>';
692 692
 
693
-        endif;
693
+		endif;
694 694
 
695
-    }
695
+	}
696 696
 
697
-    return $html;
697
+	return $html;
698 698
 }
699 699
 add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
700 700
 
@@ -711,98 +711,98 @@  discard block
 block discarded – undo
711 711
  */
712 712
 function geodir_cf_radio($html,$location,$cf,$p=''){
713 713
 
714
-    // check we have the post value
715
-    if(is_int($p)){$post = geodir_get_post_info($p);}
716
-    else{ global $post;}
717
-
718
-    if(!is_array($cf) && $cf!=''){
719
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
720
-        if(!$cf){return NULL;}
721
-    }
722
-
723
-    $html_var = $cf['htmlvar_name'];
724
-
725
-    // Check if there is a location specific filter.
726
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
727
-        /**
728
-         * Filter the radio html by location.
729
-         *
730
-         * @param string $html The html to filter.
731
-         * @param array $cf The custom field array.
732
-         * @since 1.6.6
733
-         */
734
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
735
-    }
736
-
737
-    // Check if there is a custom field specific filter.
738
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
739
-        /**
740
-         * Filter the radio html by individual custom field.
741
-         *
742
-         * @param string $html The html to filter.
743
-         * @param string $location The location to output the html.
744
-         * @param array $cf The custom field array.
745
-         * @since 1.6.6
746
-         */
747
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
748
-    }
749
-
750
-    // Check if there is a custom field key specific filter.
751
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
752
-        /**
753
-         * Filter the radio html by field type key.
754
-         *
755
-         * @param string $html The html to filter.
756
-         * @param string $location The location to output the html.
757
-         * @param array $cf The custom field array.
758
-         * @since 1.6.6
759
-         */
760
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
761
-    }
762
-
763
-    // If not html then we run the standard output.
764
-    if(empty($html)){
765
-
766
-        $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
767
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
768
-
769
-            if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
770
-                $html_val = __('No', 'geodirectory');
771
-            } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
772
-                $html_val = __('Yes', 'geodirectory');
773
-            } else {
774
-                if (!empty($cf['option_values'])) {
775
-                    $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
776
-
777
-                    if (!empty($cf_option_values)) {
778
-                        foreach ($cf_option_values as $cf_option_value) {
779
-                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
780
-                                $html_val = $cf_option_value['label'];
781
-                            }
782
-                        }
783
-                    }
784
-                }
785
-            }
786
-
787
-            $field_icon = geodir_field_icon_proccess($cf);
788
-            if (strpos($field_icon, 'http') !== false) {
789
-                $field_icon_af = '';
790
-            } elseif ($field_icon == '') {
791
-                $field_icon_af = '';
792
-            } else {
793
-                $field_icon_af = $field_icon;
794
-                $field_icon = '';
795
-            }
796
-
797
-
798
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
799
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
800
-            $html .= '</span>' . $html_val . '</div>';
801
-        endif;
802
-
803
-    }
804
-
805
-    return $html;
714
+	// check we have the post value
715
+	if(is_int($p)){$post = geodir_get_post_info($p);}
716
+	else{ global $post;}
717
+
718
+	if(!is_array($cf) && $cf!=''){
719
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
720
+		if(!$cf){return NULL;}
721
+	}
722
+
723
+	$html_var = $cf['htmlvar_name'];
724
+
725
+	// Check if there is a location specific filter.
726
+	if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
727
+		/**
728
+		 * Filter the radio html by location.
729
+		 *
730
+		 * @param string $html The html to filter.
731
+		 * @param array $cf The custom field array.
732
+		 * @since 1.6.6
733
+		 */
734
+		$html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
735
+	}
736
+
737
+	// Check if there is a custom field specific filter.
738
+	if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
739
+		/**
740
+		 * Filter the radio html by individual custom field.
741
+		 *
742
+		 * @param string $html The html to filter.
743
+		 * @param string $location The location to output the html.
744
+		 * @param array $cf The custom field array.
745
+		 * @since 1.6.6
746
+		 */
747
+		$html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
748
+	}
749
+
750
+	// Check if there is a custom field key specific filter.
751
+	if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
752
+		/**
753
+		 * Filter the radio html by field type key.
754
+		 *
755
+		 * @param string $html The html to filter.
756
+		 * @param string $location The location to output the html.
757
+		 * @param array $cf The custom field array.
758
+		 * @since 1.6.6
759
+		 */
760
+		$html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
761
+	}
762
+
763
+	// If not html then we run the standard output.
764
+	if(empty($html)){
765
+
766
+		$html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
767
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
768
+
769
+			if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
770
+				$html_val = __('No', 'geodirectory');
771
+			} else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
772
+				$html_val = __('Yes', 'geodirectory');
773
+			} else {
774
+				if (!empty($cf['option_values'])) {
775
+					$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
776
+
777
+					if (!empty($cf_option_values)) {
778
+						foreach ($cf_option_values as $cf_option_value) {
779
+							if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
780
+								$html_val = $cf_option_value['label'];
781
+							}
782
+						}
783
+					}
784
+				}
785
+			}
786
+
787
+			$field_icon = geodir_field_icon_proccess($cf);
788
+			if (strpos($field_icon, 'http') !== false) {
789
+				$field_icon_af = '';
790
+			} elseif ($field_icon == '') {
791
+				$field_icon_af = '';
792
+			} else {
793
+				$field_icon_af = $field_icon;
794
+				$field_icon = '';
795
+			}
796
+
797
+
798
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
799
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
800
+			$html .= '</span>' . $html_val . '</div>';
801
+		endif;
802
+
803
+	}
804
+
805
+	return $html;
806 806
 }
807 807
 add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
808 808
 
@@ -819,92 +819,92 @@  discard block
 block discarded – undo
819 819
  */
820 820
 function geodir_cf_select($html,$location,$cf,$p=''){
821 821
 
822
-    // check we have the post value
823
-    if(is_int($p)){$post = geodir_get_post_info($p);}
824
-    else{ global $post;}
825
-
826
-    if(!is_array($cf) && $cf!=''){
827
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
828
-        if(!$cf){return NULL;}
829
-    }
830
-
831
-    $html_var = $cf['htmlvar_name'];
832
-
833
-    // Check if there is a location specific filter.
834
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
835
-        /**
836
-         * Filter the select html by location.
837
-         *
838
-         * @param string $html The html to filter.
839
-         * @param array $cf The custom field array.
840
-         * @since 1.6.6
841
-         */
842
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
843
-    }
844
-
845
-    // Check if there is a custom field specific filter.
846
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
847
-        /**
848
-         * Filter the select html by individual custom field.
849
-         *
850
-         * @param string $html The html to filter.
851
-         * @param string $location The location to output the html.
852
-         * @param array $cf The custom field array.
853
-         * @since 1.6.6
854
-         */
855
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
856
-    }
857
-
858
-    // Check if there is a custom field key specific filter.
859
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
860
-        /**
861
-         * Filter the select html by field type key.
862
-         *
863
-         * @param string $html The html to filter.
864
-         * @param string $location The location to output the html.
865
-         * @param array $cf The custom field array.
866
-         * @since 1.6.6
867
-         */
868
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
869
-    }
870
-
871
-    // If not html then we run the standard output.
872
-    if(empty($html)){
873
-
874
-        if ($post->{$cf['htmlvar_name']}):
875
-            $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
876
-
877
-            if (!empty($cf['option_values'])) {
878
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
879
-
880
-                if (!empty($cf_option_values)) {
881
-                    foreach ($cf_option_values as $cf_option_value) {
882
-                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
883
-                            //$field_value = $cf_option_value['label']; // no longer needed here.
884
-                        }
885
-                    }
886
-                }
887
-            }
888
-
889
-            $field_icon = geodir_field_icon_proccess($cf);
890
-            if (strpos($field_icon, 'http') !== false) {
891
-                $field_icon_af = '';
892
-            } elseif ($field_icon == '') {
893
-                $field_icon_af = '';
894
-            } else {
895
-                $field_icon_af = $field_icon;
896
-                $field_icon = '';
897
-            }
898
-
899
-
900
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
901
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
902
-            $html .= '</span>' . $field_value . '</div>';
903
-        endif;
904
-
905
-    }
906
-
907
-    return $html;
822
+	// check we have the post value
823
+	if(is_int($p)){$post = geodir_get_post_info($p);}
824
+	else{ global $post;}
825
+
826
+	if(!is_array($cf) && $cf!=''){
827
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
828
+		if(!$cf){return NULL;}
829
+	}
830
+
831
+	$html_var = $cf['htmlvar_name'];
832
+
833
+	// Check if there is a location specific filter.
834
+	if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
835
+		/**
836
+		 * Filter the select html by location.
837
+		 *
838
+		 * @param string $html The html to filter.
839
+		 * @param array $cf The custom field array.
840
+		 * @since 1.6.6
841
+		 */
842
+		$html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
843
+	}
844
+
845
+	// Check if there is a custom field specific filter.
846
+	if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
847
+		/**
848
+		 * Filter the select html by individual custom field.
849
+		 *
850
+		 * @param string $html The html to filter.
851
+		 * @param string $location The location to output the html.
852
+		 * @param array $cf The custom field array.
853
+		 * @since 1.6.6
854
+		 */
855
+		$html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
856
+	}
857
+
858
+	// Check if there is a custom field key specific filter.
859
+	if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
860
+		/**
861
+		 * Filter the select html by field type key.
862
+		 *
863
+		 * @param string $html The html to filter.
864
+		 * @param string $location The location to output the html.
865
+		 * @param array $cf The custom field array.
866
+		 * @since 1.6.6
867
+		 */
868
+		$html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
869
+	}
870
+
871
+	// If not html then we run the standard output.
872
+	if(empty($html)){
873
+
874
+		if ($post->{$cf['htmlvar_name']}):
875
+			$field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
876
+
877
+			if (!empty($cf['option_values'])) {
878
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
879
+
880
+				if (!empty($cf_option_values)) {
881
+					foreach ($cf_option_values as $cf_option_value) {
882
+						if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
883
+							//$field_value = $cf_option_value['label']; // no longer needed here.
884
+						}
885
+					}
886
+				}
887
+			}
888
+
889
+			$field_icon = geodir_field_icon_proccess($cf);
890
+			if (strpos($field_icon, 'http') !== false) {
891
+				$field_icon_af = '';
892
+			} elseif ($field_icon == '') {
893
+				$field_icon_af = '';
894
+			} else {
895
+				$field_icon_af = $field_icon;
896
+				$field_icon = '';
897
+			}
898
+
899
+
900
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
901
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
902
+			$html .= '</span>' . $field_value . '</div>';
903
+		endif;
904
+
905
+	}
906
+
907
+	return $html;
908 908
 }
909 909
 add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
910 910
 
@@ -921,113 +921,113 @@  discard block
 block discarded – undo
921 921
  */
922 922
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
923 923
 
924
-    // check we have the post value
925
-    if(is_int($p)){$post = geodir_get_post_info($p);}
926
-    else{ global $post;}
927
-
928
-    if(!is_array($cf) && $cf!=''){
929
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
930
-        if(!$cf){return NULL;}
931
-    }
932
-
933
-    $html_var = $cf['htmlvar_name'];
934
-
935
-    // Check if there is a location specific filter.
936
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
937
-        /**
938
-         * Filter the multiselect html by location.
939
-         *
940
-         * @param string $html The html to filter.
941
-         * @param array $cf The custom field array.
942
-         * @since 1.6.6
943
-         */
944
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
945
-    }
946
-
947
-    // Check if there is a custom field specific filter.
948
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
949
-        /**
950
-         * Filter the multiselect html by individual custom field.
951
-         *
952
-         * @param string $html The html to filter.
953
-         * @param string $location The location to output the html.
954
-         * @param array $cf The custom field array.
955
-         * @since 1.6.6
956
-         */
957
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
958
-    }
959
-
960
-    // Check if there is a custom field key specific filter.
961
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
962
-        /**
963
-         * Filter the multiselect html by field type key.
964
-         *
965
-         * @param string $html The html to filter.
966
-         * @param string $location The location to output the html.
967
-         * @param array $cf The custom field array.
968
-         * @since 1.6.6
969
-         */
970
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
971
-    }
972
-
973
-    // If not html then we run the standard output.
974
-    if(empty($html)){
975
-
976
-
977
-        if (!empty($post->{$cf['htmlvar_name']})):
978
-
979
-            if (is_array($post->{$cf['htmlvar_name']})) {
980
-                $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
981
-            }
982
-
983
-            $field_icon = geodir_field_icon_proccess($cf);
984
-            if (strpos($field_icon, 'http') !== false) {
985
-                $field_icon_af = '';
986
-            } elseif ($field_icon == '') {
987
-                $field_icon_af = '';
988
-            } else {
989
-                $field_icon_af = $field_icon;
990
-                $field_icon = '';
991
-            }
992
-
993
-            $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
994
-
995
-            $option_values = array();
996
-            if (!empty($cf['option_values'])) {
997
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
998
-
999
-                if (!empty($cf_option_values)) {
1000
-                    foreach ($cf_option_values as $cf_option_value) {
1001
-                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1002
-                            $option_values[] = $cf_option_value['label'];
1003
-                        }
1004
-                    }
1005
-                }
1006
-            }
1007
-
1008
-
1009
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1010
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1011
-            $html .= '</span>';
1012
-
1013
-            if (count($option_values) > 1) {
1014
-                $html .= '<ul>';
1015
-
1016
-                foreach ($option_values as $val) {
1017
-                    $html .= '<li>' . $val . '</li>';
1018
-                }
1019
-
1020
-                $html .= '</ul>';
1021
-            } else {
1022
-                $html .= $post->{$cf['htmlvar_name']};
1023
-            }
1024
-
1025
-            $html .= '</div>';
1026
-        endif;
1027
-
1028
-    }
1029
-
1030
-    return $html;
924
+	// check we have the post value
925
+	if(is_int($p)){$post = geodir_get_post_info($p);}
926
+	else{ global $post;}
927
+
928
+	if(!is_array($cf) && $cf!=''){
929
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
930
+		if(!$cf){return NULL;}
931
+	}
932
+
933
+	$html_var = $cf['htmlvar_name'];
934
+
935
+	// Check if there is a location specific filter.
936
+	if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
937
+		/**
938
+		 * Filter the multiselect html by location.
939
+		 *
940
+		 * @param string $html The html to filter.
941
+		 * @param array $cf The custom field array.
942
+		 * @since 1.6.6
943
+		 */
944
+		$html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
945
+	}
946
+
947
+	// Check if there is a custom field specific filter.
948
+	if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
949
+		/**
950
+		 * Filter the multiselect html by individual custom field.
951
+		 *
952
+		 * @param string $html The html to filter.
953
+		 * @param string $location The location to output the html.
954
+		 * @param array $cf The custom field array.
955
+		 * @since 1.6.6
956
+		 */
957
+		$html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
958
+	}
959
+
960
+	// Check if there is a custom field key specific filter.
961
+	if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
962
+		/**
963
+		 * Filter the multiselect html by field type key.
964
+		 *
965
+		 * @param string $html The html to filter.
966
+		 * @param string $location The location to output the html.
967
+		 * @param array $cf The custom field array.
968
+		 * @since 1.6.6
969
+		 */
970
+		$html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
971
+	}
972
+
973
+	// If not html then we run the standard output.
974
+	if(empty($html)){
975
+
976
+
977
+		if (!empty($post->{$cf['htmlvar_name']})):
978
+
979
+			if (is_array($post->{$cf['htmlvar_name']})) {
980
+				$post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
981
+			}
982
+
983
+			$field_icon = geodir_field_icon_proccess($cf);
984
+			if (strpos($field_icon, 'http') !== false) {
985
+				$field_icon_af = '';
986
+			} elseif ($field_icon == '') {
987
+				$field_icon_af = '';
988
+			} else {
989
+				$field_icon_af = $field_icon;
990
+				$field_icon = '';
991
+			}
992
+
993
+			$field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
994
+
995
+			$option_values = array();
996
+			if (!empty($cf['option_values'])) {
997
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
998
+
999
+				if (!empty($cf_option_values)) {
1000
+					foreach ($cf_option_values as $cf_option_value) {
1001
+						if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1002
+							$option_values[] = $cf_option_value['label'];
1003
+						}
1004
+					}
1005
+				}
1006
+			}
1007
+
1008
+
1009
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1010
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1011
+			$html .= '</span>';
1012
+
1013
+			if (count($option_values) > 1) {
1014
+				$html .= '<ul>';
1015
+
1016
+				foreach ($option_values as $val) {
1017
+					$html .= '<li>' . $val . '</li>';
1018
+				}
1019
+
1020
+				$html .= '</ul>';
1021
+			} else {
1022
+				$html .= $post->{$cf['htmlvar_name']};
1023
+			}
1024
+
1025
+			$html .= '</div>';
1026
+		endif;
1027
+
1028
+	}
1029
+
1030
+	return $html;
1031 1031
 }
1032 1032
 add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1033 1033
 
@@ -1044,152 +1044,152 @@  discard block
 block discarded – undo
1044 1044
  */
1045 1045
 function geodir_cf_email($html,$location,$cf,$p=''){
1046 1046
 
1047
-    // check we have the post value
1048
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1049
-    else{ global $post;}
1050
-
1051
-    if(!is_array($cf) && $cf!=''){
1052
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1053
-        if(!$cf){return NULL;}
1054
-    }
1055
-
1056
-    $html_var = $cf['htmlvar_name'];
1057
-
1058
-    // Check if there is a location specific filter.
1059
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1060
-        /**
1061
-         * Filter the email html by location.
1062
-         *
1063
-         * @param string $html The html to filter.
1064
-         * @param array $cf The custom field array.
1065
-         * @since 1.6.6
1066
-         */
1067
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1068
-    }
1069
-
1070
-    // Check if there is a custom field specific filter.
1071
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1072
-        /**
1073
-         * Filter the email html by individual custom field.
1074
-         *
1075
-         * @param string $html The html to filter.
1076
-         * @param string $location The location to output the html.
1077
-         * @param array $cf The custom field array.
1078
-         * @since 1.6.6
1079
-         */
1080
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1081
-    }
1082
-
1083
-    // Check if there is a custom field key specific filter.
1084
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1085
-        /**
1086
-         * Filter the email html by field type key.
1087
-         *
1088
-         * @param string $html The html to filter.
1089
-         * @param string $location The location to output the html.
1090
-         * @param array $cf The custom field array.
1091
-         * @since 1.6.6
1092
-         */
1093
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1094
-    }
1095
-
1096
-    // If not html then we run the standard output.
1097
-    if(empty($html)){
1098
-
1099
-        global $preview;
1100
-        if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1101
-            return ''; // Remove Send Enquiry | Send To Friend from listings page
1102
-        }
1103
-
1104
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1105
-
1106
-        if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1107
-            $send_to_friend = true;
1108
-            $b_send_inquiry = '';
1109
-            $b_sendtofriend = '';
1110
-
1111
-            $html = '';
1112
-            if (!$preview) {
1113
-                $b_send_inquiry = 'b_send_inquiry';
1114
-                $b_sendtofriend = 'b_sendtofriend';
1115
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1116
-            }
1117
-
1118
-            $field_icon = geodir_field_icon_proccess($cf);
1119
-            if (strpos($field_icon, 'http') !== false) {
1120
-                $field_icon_af = '';
1121
-            } elseif ($field_icon == '') {
1122
-                $field_icon_af = '<i class="fa fa-envelope"></i>';
1123
-            } else {
1124
-                $field_icon_af = $field_icon;
1125
-                $field_icon = '';
1126
-            }
1127
-
1128
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1129
-            $seperator = '';
1130
-            if ($post->{$cf['htmlvar_name']}) {
1131
-                $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1132
-                $seperator = ' | ';
1133
-            }
1134
-
1135
-            if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1136
-                $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1137
-            }
1138
-
1139
-            $html .= '</span></div>';
1140
-
1141
-
1142
-            if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1143
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1144
-            } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1145
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1146
-            } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1147
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1148
-            }
1149
-
1150
-            /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1151
-
1152
-        } else {
1153
-
1154
-            if ($post->{$cf['htmlvar_name']}) {
1155
-
1156
-                $field_icon = geodir_field_icon_proccess($cf);
1157
-                if (strpos($field_icon, 'http') !== false) {
1158
-                    $field_icon_af = '';
1159
-                } elseif ($field_icon == '') {
1160
-                    $field_icon_af = '<i class="fa fa-envelope"></i>';
1161
-                } else {
1162
-                    $field_icon_af = $field_icon;
1163
-                    $field_icon = '';
1164
-                }
1165
-
1166
-
1167
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1168
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1169
-                $html .= '</span><span class="geodir-email-address-output">';
1170
-                $email = $post->{$cf['htmlvar_name']} ;
1171
-                if($e_split = explode('@',$email)){
1172
-                    /**
1173
-                     * Filter email custom field name output.
1174
-                     *
1175
-                     * @since 1.5.3
1176
-                     *
1177
-                     * @param string $email The email string being output.
1178
-                     * @param array $cf Custom field variables array.
1179
-                     */
1180
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1181
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1182
-                }else{
1183
-                    $html .=  $email;
1184
-                }
1185
-                $html .= '</span></div>';
1186
-            }
1187
-
1188
-        }
1189
-
1190
-    }
1191
-
1192
-    return $html;
1047
+	// check we have the post value
1048
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1049
+	else{ global $post;}
1050
+
1051
+	if(!is_array($cf) && $cf!=''){
1052
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1053
+		if(!$cf){return NULL;}
1054
+	}
1055
+
1056
+	$html_var = $cf['htmlvar_name'];
1057
+
1058
+	// Check if there is a location specific filter.
1059
+	if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1060
+		/**
1061
+		 * Filter the email html by location.
1062
+		 *
1063
+		 * @param string $html The html to filter.
1064
+		 * @param array $cf The custom field array.
1065
+		 * @since 1.6.6
1066
+		 */
1067
+		$html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1068
+	}
1069
+
1070
+	// Check if there is a custom field specific filter.
1071
+	if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1072
+		/**
1073
+		 * Filter the email html by individual custom field.
1074
+		 *
1075
+		 * @param string $html The html to filter.
1076
+		 * @param string $location The location to output the html.
1077
+		 * @param array $cf The custom field array.
1078
+		 * @since 1.6.6
1079
+		 */
1080
+		$html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1081
+	}
1082
+
1083
+	// Check if there is a custom field key specific filter.
1084
+	if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1085
+		/**
1086
+		 * Filter the email html by field type key.
1087
+		 *
1088
+		 * @param string $html The html to filter.
1089
+		 * @param string $location The location to output the html.
1090
+		 * @param array $cf The custom field array.
1091
+		 * @since 1.6.6
1092
+		 */
1093
+		$html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1094
+	}
1095
+
1096
+	// If not html then we run the standard output.
1097
+	if(empty($html)){
1098
+
1099
+		global $preview;
1100
+		if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1101
+			return ''; // Remove Send Enquiry | Send To Friend from listings page
1102
+		}
1103
+
1104
+		$package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1105
+
1106
+		if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1107
+			$send_to_friend = true;
1108
+			$b_send_inquiry = '';
1109
+			$b_sendtofriend = '';
1110
+
1111
+			$html = '';
1112
+			if (!$preview) {
1113
+				$b_send_inquiry = 'b_send_inquiry';
1114
+				$b_sendtofriend = 'b_sendtofriend';
1115
+				$html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1116
+			}
1117
+
1118
+			$field_icon = geodir_field_icon_proccess($cf);
1119
+			if (strpos($field_icon, 'http') !== false) {
1120
+				$field_icon_af = '';
1121
+			} elseif ($field_icon == '') {
1122
+				$field_icon_af = '<i class="fa fa-envelope"></i>';
1123
+			} else {
1124
+				$field_icon_af = $field_icon;
1125
+				$field_icon = '';
1126
+			}
1127
+
1128
+			$html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1129
+			$seperator = '';
1130
+			if ($post->{$cf['htmlvar_name']}) {
1131
+				$html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1132
+				$seperator = ' | ';
1133
+			}
1134
+
1135
+			if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1136
+				$html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1137
+			}
1138
+
1139
+			$html .= '</span></div>';
1140
+
1141
+
1142
+			if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1143
+				$html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1144
+			} elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1145
+				$html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1146
+			} elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1147
+				$html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1148
+			}
1149
+
1150
+			/*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1151
+
1152
+		} else {
1153
+
1154
+			if ($post->{$cf['htmlvar_name']}) {
1155
+
1156
+				$field_icon = geodir_field_icon_proccess($cf);
1157
+				if (strpos($field_icon, 'http') !== false) {
1158
+					$field_icon_af = '';
1159
+				} elseif ($field_icon == '') {
1160
+					$field_icon_af = '<i class="fa fa-envelope"></i>';
1161
+				} else {
1162
+					$field_icon_af = $field_icon;
1163
+					$field_icon = '';
1164
+				}
1165
+
1166
+
1167
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1168
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1169
+				$html .= '</span><span class="geodir-email-address-output">';
1170
+				$email = $post->{$cf['htmlvar_name']} ;
1171
+				if($e_split = explode('@',$email)){
1172
+					/**
1173
+					 * Filter email custom field name output.
1174
+					 *
1175
+					 * @since 1.5.3
1176
+					 *
1177
+					 * @param string $email The email string being output.
1178
+					 * @param array $cf Custom field variables array.
1179
+					 */
1180
+					$email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1181
+					$html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1182
+				}else{
1183
+					$html .=  $email;
1184
+				}
1185
+				$html .= '</span></div>';
1186
+			}
1187
+
1188
+		}
1189
+
1190
+	}
1191
+
1192
+	return $html;
1193 1193
 }
1194 1194
 add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1195 1195
 
@@ -1206,130 +1206,130 @@  discard block
 block discarded – undo
1206 1206
  */
1207 1207
 function geodir_cf_file($html,$location,$cf,$p=''){
1208 1208
 
1209
-    // check we have the post value
1210
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1211
-    else{ global $post;}
1212
-
1213
-    if(!is_array($cf) && $cf!=''){
1214
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1215
-        if(!$cf){return NULL;}
1216
-    }
1217
-
1218
-    $html_var = $cf['htmlvar_name'];
1219
-
1220
-    // Check if there is a location specific filter.
1221
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1222
-        /**
1223
-         * Filter the file html by location.
1224
-         *
1225
-         * @param string $html The html to filter.
1226
-         * @param array $cf The custom field array.
1227
-         * @since 1.6.6
1228
-         */
1229
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1230
-    }
1231
-
1232
-    // Check if there is a custom field specific filter.
1233
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1234
-        /**
1235
-         * Filter the file html by individual custom field.
1236
-         *
1237
-         * @param string $html The html to filter.
1238
-         * @param string $location The location to output the html.
1239
-         * @param array $cf The custom field array.
1240
-         * @since 1.6.6
1241
-         */
1242
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1243
-    }
1244
-
1245
-    // Check if there is a custom field key specific filter.
1246
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1247
-        /**
1248
-         * Filter the file html by field type key.
1249
-         *
1250
-         * @param string $html The html to filter.
1251
-         * @param string $location The location to output the html.
1252
-         * @param array $cf The custom field array.
1253
-         * @since 1.6.6
1254
-         */
1255
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1256
-    }
1257
-
1258
-    // If not html then we run the standard output.
1259
-    if(empty($html)){
1260
-
1261
-        if (!empty($post->{$cf['htmlvar_name']})):
1262
-
1263
-            $files = explode(",", $post->{$cf['htmlvar_name']});
1264
-            if (!empty($files)):
1265
-
1266
-                $extra_fields = !empty($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : NULL;
1267
-                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1268
-
1269
-                $file_paths = '';
1270
-                foreach ($files as $file) {
1271
-                    if (!empty($file)) {
1272
-
1273
-                        // $filetype = wp_check_filetype($file);
1274
-
1275
-                        $image_name_arr = explode('/', $file);
1276
-                        $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1277
-                        $filename = end($image_name_arr);
1278
-                        $img_name_arr = explode('.', $filename);
1279
-
1280
-                        $arr_file_type = wp_check_filetype($filename);
1281
-                        if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1282
-                            continue;
1283
-                        }
1284
-
1285
-                        $uploaded_file_type = $arr_file_type['type'];
1286
-                        $uploaded_file_ext = $arr_file_type['ext'];
1287
-
1288
-                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1289
-                            continue; // Invalid file type.
1290
-                        }
1291
-
1292
-                        //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1293
-                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1294
-
1295
-                        // If the uploaded file is image
1296
-                        if (in_array($uploaded_file_type, $image_file_types)) {
1297
-                            $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1298
-                            $file_paths .= '<a href="'.$file.'">';
1299
-                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1300
-                            $file_paths .= '</a>';
1301
-                            //$file_paths .= '<img src="'.$file.'"  />';	
1302
-                            $file_paths .= '</div>';
1303
-                        } else {
1304
-                            $ext_path = '_' . $html_var . '_';
1305
-                            $filename = explode($ext_path, $filename);
1306
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1307
-                        }
1308
-                    }
1309
-                }
1310
-
1311
-                $field_icon = geodir_field_icon_proccess($cf);
1312
-                if (strpos($field_icon, 'http') !== false) {
1313
-                    $field_icon_af = '';
1314
-                } elseif ($field_icon == '') {
1315
-                    $field_icon_af = '';
1316
-                } else {
1317
-                    $field_icon_af = $field_icon;
1318
-                    $field_icon = '';
1319
-                }
1320
-
1321
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1322
-                $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1323
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1324
-                $html .= '</span>';
1325
-                $html .= $file_paths . '</div></div>';
1326
-
1327
-            endif;
1328
-        endif;
1329
-
1330
-    }
1331
-
1332
-    return $html;
1209
+	// check we have the post value
1210
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1211
+	else{ global $post;}
1212
+
1213
+	if(!is_array($cf) && $cf!=''){
1214
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1215
+		if(!$cf){return NULL;}
1216
+	}
1217
+
1218
+	$html_var = $cf['htmlvar_name'];
1219
+
1220
+	// Check if there is a location specific filter.
1221
+	if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1222
+		/**
1223
+		 * Filter the file html by location.
1224
+		 *
1225
+		 * @param string $html The html to filter.
1226
+		 * @param array $cf The custom field array.
1227
+		 * @since 1.6.6
1228
+		 */
1229
+		$html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1230
+	}
1231
+
1232
+	// Check if there is a custom field specific filter.
1233
+	if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1234
+		/**
1235
+		 * Filter the file html by individual custom field.
1236
+		 *
1237
+		 * @param string $html The html to filter.
1238
+		 * @param string $location The location to output the html.
1239
+		 * @param array $cf The custom field array.
1240
+		 * @since 1.6.6
1241
+		 */
1242
+		$html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1243
+	}
1244
+
1245
+	// Check if there is a custom field key specific filter.
1246
+	if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1247
+		/**
1248
+		 * Filter the file html by field type key.
1249
+		 *
1250
+		 * @param string $html The html to filter.
1251
+		 * @param string $location The location to output the html.
1252
+		 * @param array $cf The custom field array.
1253
+		 * @since 1.6.6
1254
+		 */
1255
+		$html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1256
+	}
1257
+
1258
+	// If not html then we run the standard output.
1259
+	if(empty($html)){
1260
+
1261
+		if (!empty($post->{$cf['htmlvar_name']})):
1262
+
1263
+			$files = explode(",", $post->{$cf['htmlvar_name']});
1264
+			if (!empty($files)):
1265
+
1266
+				$extra_fields = !empty($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : NULL;
1267
+				$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1268
+
1269
+				$file_paths = '';
1270
+				foreach ($files as $file) {
1271
+					if (!empty($file)) {
1272
+
1273
+						// $filetype = wp_check_filetype($file);
1274
+
1275
+						$image_name_arr = explode('/', $file);
1276
+						$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1277
+						$filename = end($image_name_arr);
1278
+						$img_name_arr = explode('.', $filename);
1279
+
1280
+						$arr_file_type = wp_check_filetype($filename);
1281
+						if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1282
+							continue;
1283
+						}
1284
+
1285
+						$uploaded_file_type = $arr_file_type['type'];
1286
+						$uploaded_file_ext = $arr_file_type['ext'];
1287
+
1288
+						if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1289
+							continue; // Invalid file type.
1290
+						}
1291
+
1292
+						//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1293
+						$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1294
+
1295
+						// If the uploaded file is image
1296
+						if (in_array($uploaded_file_type, $image_file_types)) {
1297
+							$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1298
+							$file_paths .= '<a href="'.$file.'">';
1299
+							$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1300
+							$file_paths .= '</a>';
1301
+							//$file_paths .= '<img src="'.$file.'"  />';	
1302
+							$file_paths .= '</div>';
1303
+						} else {
1304
+							$ext_path = '_' . $html_var . '_';
1305
+							$filename = explode($ext_path, $filename);
1306
+							$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1307
+						}
1308
+					}
1309
+				}
1310
+
1311
+				$field_icon = geodir_field_icon_proccess($cf);
1312
+				if (strpos($field_icon, 'http') !== false) {
1313
+					$field_icon_af = '';
1314
+				} elseif ($field_icon == '') {
1315
+					$field_icon_af = '';
1316
+				} else {
1317
+					$field_icon_af = $field_icon;
1318
+					$field_icon = '';
1319
+				}
1320
+
1321
+				$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1322
+				$html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1323
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1324
+				$html .= '</span>';
1325
+				$html .= $file_paths . '</div></div>';
1326
+
1327
+			endif;
1328
+		endif;
1329
+
1330
+	}
1331
+
1332
+	return $html;
1333 1333
 }
1334 1334
 add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1335 1335
 
@@ -1347,80 +1347,80 @@  discard block
 block discarded – undo
1347 1347
  */
1348 1348
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1349 1349
 
1350
-    // check we have the post value
1351
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1352
-    else{ global $post;}
1353
-
1354
-    if(!is_array($cf) && $cf!=''){
1355
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1356
-        if(!$cf){return NULL;}
1357
-    }
1358
-
1359
-    $html_var = $cf['htmlvar_name'];
1360
-
1361
-    // Check if there is a location specific filter.
1362
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1363
-        /**
1364
-         * Filter the textarea html by location.
1365
-         *
1366
-         * @param string $html The html to filter.
1367
-         * @param array $cf The custom field array.
1368
-         * @since 1.6.6
1369
-         */
1370
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1371
-    }
1372
-
1373
-    // Check if there is a custom field specific filter.
1374
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1375
-        /**
1376
-         * Filter the textarea html by individual custom field.
1377
-         *
1378
-         * @param string $html The html to filter.
1379
-         * @param string $location The location to output the html.
1380
-         * @param array $cf The custom field array.
1381
-         * @since 1.6.6
1382
-         */
1383
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1384
-    }
1385
-
1386
-    // Check if there is a custom field key specific filter.
1387
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1388
-        /**
1389
-         * Filter the textarea html by field type key.
1390
-         *
1391
-         * @param string $html The html to filter.
1392
-         * @param string $location The location to output the html.
1393
-         * @param array $cf The custom field array.
1394
-         * @since 1.6.6
1395
-         */
1396
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1397
-    }
1398
-
1399
-    // If not html then we run the standard output.
1400
-    if(empty($html)){
1401
-
1402
-        if (!empty($post->{$cf['htmlvar_name']})) {
1403
-
1404
-            $field_icon = geodir_field_icon_proccess($cf);
1405
-            if (strpos($field_icon, 'http') !== false) {
1406
-                $field_icon_af = '';
1407
-            } elseif ($field_icon == '') {
1408
-                $field_icon_af = '';
1409
-            } else {
1410
-                $field_icon_af = $field_icon;
1411
-                $field_icon = '';
1412
-            }
1413
-
1414
-
1415
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1416
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1417
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1418
-
1419
-        }
1420
-
1421
-    }
1422
-
1423
-    return $html;
1350
+	// check we have the post value
1351
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1352
+	else{ global $post;}
1353
+
1354
+	if(!is_array($cf) && $cf!=''){
1355
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1356
+		if(!$cf){return NULL;}
1357
+	}
1358
+
1359
+	$html_var = $cf['htmlvar_name'];
1360
+
1361
+	// Check if there is a location specific filter.
1362
+	if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1363
+		/**
1364
+		 * Filter the textarea html by location.
1365
+		 *
1366
+		 * @param string $html The html to filter.
1367
+		 * @param array $cf The custom field array.
1368
+		 * @since 1.6.6
1369
+		 */
1370
+		$html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1371
+	}
1372
+
1373
+	// Check if there is a custom field specific filter.
1374
+	if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1375
+		/**
1376
+		 * Filter the textarea html by individual custom field.
1377
+		 *
1378
+		 * @param string $html The html to filter.
1379
+		 * @param string $location The location to output the html.
1380
+		 * @param array $cf The custom field array.
1381
+		 * @since 1.6.6
1382
+		 */
1383
+		$html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1384
+	}
1385
+
1386
+	// Check if there is a custom field key specific filter.
1387
+	if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1388
+		/**
1389
+		 * Filter the textarea html by field type key.
1390
+		 *
1391
+		 * @param string $html The html to filter.
1392
+		 * @param string $location The location to output the html.
1393
+		 * @param array $cf The custom field array.
1394
+		 * @since 1.6.6
1395
+		 */
1396
+		$html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1397
+	}
1398
+
1399
+	// If not html then we run the standard output.
1400
+	if(empty($html)){
1401
+
1402
+		if (!empty($post->{$cf['htmlvar_name']})) {
1403
+
1404
+			$field_icon = geodir_field_icon_proccess($cf);
1405
+			if (strpos($field_icon, 'http') !== false) {
1406
+				$field_icon_af = '';
1407
+			} elseif ($field_icon == '') {
1408
+				$field_icon_af = '';
1409
+			} else {
1410
+				$field_icon_af = $field_icon;
1411
+				$field_icon = '';
1412
+			}
1413
+
1414
+
1415
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1416
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1417
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1418
+
1419
+		}
1420
+
1421
+	}
1422
+
1423
+	return $html;
1424 1424
 }
1425 1425
 add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1426 1426
 
@@ -1438,79 +1438,79 @@  discard block
 block discarded – undo
1438 1438
  */
1439 1439
 function geodir_cf_html($html,$location,$cf,$p=''){
1440 1440
 
1441
-    // check we have the post value
1442
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1443
-    else{ global $post;}
1444
-
1445
-    if(!is_array($cf) && $cf!=''){
1446
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1447
-        if(!$cf){return NULL;}
1448
-    }
1449
-
1450
-    $html_var = $cf['htmlvar_name'];
1451
-
1452
-    // Check if there is a location specific filter.
1453
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1454
-        /**
1455
-         * Filter the html html by location.
1456
-         *
1457
-         * @param string $html The html to filter.
1458
-         * @param array $cf The custom field array.
1459
-         * @since 1.6.6
1460
-         */
1461
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1462
-    }
1463
-
1464
-    // Check if there is a custom field specific filter.
1465
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1466
-        /**
1467
-         * Filter the html html by individual custom field.
1468
-         *
1469
-         * @param string $html The html to filter.
1470
-         * @param string $location The location to output the html.
1471
-         * @param array $cf The custom field array.
1472
-         * @since 1.6.6
1473
-         */
1474
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1475
-    }
1476
-
1477
-    // Check if there is a custom field key specific filter.
1478
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1479
-        /**
1480
-         * Filter the html html by field type key.
1481
-         *
1482
-         * @param string $html The html to filter.
1483
-         * @param string $location The location to output the html.
1484
-         * @param array $cf The custom field array.
1485
-         * @since 1.6.6
1486
-         */
1487
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1488
-    }
1489
-
1490
-    // If not html then we run the standard output.
1491
-    if(empty($html)){
1492
-
1493
-        if (!empty($post->{$cf['htmlvar_name']})) {
1494
-
1495
-            $field_icon = geodir_field_icon_proccess($cf);
1496
-            if (strpos($field_icon, 'http') !== false) {
1497
-                $field_icon_af = '';
1498
-            } elseif ($field_icon == '') {
1499
-                $field_icon_af = '';
1500
-            } else {
1501
-                $field_icon_af = $field_icon;
1502
-                $field_icon = '';
1503
-            }
1504
-
1505
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1506
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1507
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1508
-
1509
-        }
1510
-
1511
-    }
1512
-
1513
-    return $html;
1441
+	// check we have the post value
1442
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1443
+	else{ global $post;}
1444
+
1445
+	if(!is_array($cf) && $cf!=''){
1446
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1447
+		if(!$cf){return NULL;}
1448
+	}
1449
+
1450
+	$html_var = $cf['htmlvar_name'];
1451
+
1452
+	// Check if there is a location specific filter.
1453
+	if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1454
+		/**
1455
+		 * Filter the html html by location.
1456
+		 *
1457
+		 * @param string $html The html to filter.
1458
+		 * @param array $cf The custom field array.
1459
+		 * @since 1.6.6
1460
+		 */
1461
+		$html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1462
+	}
1463
+
1464
+	// Check if there is a custom field specific filter.
1465
+	if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1466
+		/**
1467
+		 * Filter the html html by individual custom field.
1468
+		 *
1469
+		 * @param string $html The html to filter.
1470
+		 * @param string $location The location to output the html.
1471
+		 * @param array $cf The custom field array.
1472
+		 * @since 1.6.6
1473
+		 */
1474
+		$html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1475
+	}
1476
+
1477
+	// Check if there is a custom field key specific filter.
1478
+	if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1479
+		/**
1480
+		 * Filter the html html by field type key.
1481
+		 *
1482
+		 * @param string $html The html to filter.
1483
+		 * @param string $location The location to output the html.
1484
+		 * @param array $cf The custom field array.
1485
+		 * @since 1.6.6
1486
+		 */
1487
+		$html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1488
+	}
1489
+
1490
+	// If not html then we run the standard output.
1491
+	if(empty($html)){
1492
+
1493
+		if (!empty($post->{$cf['htmlvar_name']})) {
1494
+
1495
+			$field_icon = geodir_field_icon_proccess($cf);
1496
+			if (strpos($field_icon, 'http') !== false) {
1497
+				$field_icon_af = '';
1498
+			} elseif ($field_icon == '') {
1499
+				$field_icon_af = '';
1500
+			} else {
1501
+				$field_icon_af = $field_icon;
1502
+				$field_icon = '';
1503
+			}
1504
+
1505
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1506
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1507
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1508
+
1509
+		}
1510
+
1511
+	}
1512
+
1513
+	return $html;
1514 1514
 }
1515 1515
 add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1516 1516
 
@@ -1528,113 +1528,113 @@  discard block
 block discarded – undo
1528 1528
  */
1529 1529
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1530 1530
 
1531
-    // check we have the post value
1532
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1533
-    else{ global $post;}
1534
-
1535
-    if(!is_array($cf) && $cf!=''){
1536
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1537
-        if(!$cf){return NULL;}
1538
-    }
1539
-
1540
-    $html_var = $cf['htmlvar_name'];
1541
-
1542
-    // Check if there is a location specific filter.
1543
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1544
-        /**
1545
-         * Filter the taxonomy html by location.
1546
-         *
1547
-         * @param string $html The html to filter.
1548
-         * @param array $cf The custom field array.
1549
-         * @since 1.6.6
1550
-         */
1551
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1552
-    }
1553
-
1554
-    // Check if there is a custom field specific filter.
1555
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1556
-        /**
1557
-         * Filter the taxonomy html by individual custom field.
1558
-         *
1559
-         * @param string $html The html to filter.
1560
-         * @param string $location The location to output the html.
1561
-         * @param array $cf The custom field array.
1562
-         * @since 1.6.6
1563
-         */
1564
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1565
-    }
1566
-
1567
-    // Check if there is a custom field key specific filter.
1568
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1569
-        /**
1570
-         * Filter the taxonomy html by field type key.
1571
-         *
1572
-         * @param string $html The html to filter.
1573
-         * @param string $location The location to output the html.
1574
-         * @param array $cf The custom field array.
1575
-         * @since 1.6.6
1576
-         */
1577
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1578
-    }
1579
-
1580
-    // If not html then we run the standard output.
1581
-    if(empty($html)){
1582
-
1583
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1584
-            $post_taxonomy = $post->post_type . 'category';
1585
-            $field_value = $post->{$html_var};
1586
-            $links = array();
1587
-            $terms = array();
1588
-            $termsOrdered = array();
1589
-            if (!is_array($field_value)) {
1590
-                $field_value = explode(",", trim($field_value, ","));
1591
-            }
1592
-
1593
-            $field_value = array_unique($field_value);
1594
-
1595
-            if (!empty($field_value)) {
1596
-                foreach ($field_value as $term) {
1597
-                    $term = trim($term);
1598
-
1599
-                    if ($term != '') {
1600
-                        $term = get_term_by('id', $term, $html_var);
1601
-                        if (is_object($term)) {
1602
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1603
-                            $terms[] = $term;
1604
-                        }
1605
-                    }
1606
-                }
1607
-                if (!empty($links)) {
1608
-                    // order alphabetically
1609
-                    asort($links);
1610
-                    foreach (array_keys($links) as $key) {
1611
-                        $termsOrdered[$key] = $terms[$key];
1612
-                    }
1613
-                    $terms = $termsOrdered;
1614
-                }
1615
-            }
1616
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1617
-
1618
-            if ($html_value != '') {
1619
-                $field_icon = geodir_field_icon_proccess($cf);
1620
-                if (strpos($field_icon, 'http') !== false) {
1621
-                    $field_icon_af = '';
1622
-                } else if ($field_icon == '') {
1623
-                    $field_icon_af = '';
1624
-                } else {
1625
-                    $field_icon_af = $field_icon;
1626
-                    $field_icon = '';
1627
-                }
1628
-
1629
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1630
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1631
-                $html .= '</span> ' . $html_value . '</div>';
1632
-            }
1633
-        }
1634
-
1635
-    }
1636
-
1637
-    return $html;
1531
+	// check we have the post value
1532
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1533
+	else{ global $post;}
1534
+
1535
+	if(!is_array($cf) && $cf!=''){
1536
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1537
+		if(!$cf){return NULL;}
1538
+	}
1539
+
1540
+	$html_var = $cf['htmlvar_name'];
1541
+
1542
+	// Check if there is a location specific filter.
1543
+	if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1544
+		/**
1545
+		 * Filter the taxonomy html by location.
1546
+		 *
1547
+		 * @param string $html The html to filter.
1548
+		 * @param array $cf The custom field array.
1549
+		 * @since 1.6.6
1550
+		 */
1551
+		$html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1552
+	}
1553
+
1554
+	// Check if there is a custom field specific filter.
1555
+	if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1556
+		/**
1557
+		 * Filter the taxonomy html by individual custom field.
1558
+		 *
1559
+		 * @param string $html The html to filter.
1560
+		 * @param string $location The location to output the html.
1561
+		 * @param array $cf The custom field array.
1562
+		 * @since 1.6.6
1563
+		 */
1564
+		$html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1565
+	}
1566
+
1567
+	// Check if there is a custom field key specific filter.
1568
+	if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1569
+		/**
1570
+		 * Filter the taxonomy html by field type key.
1571
+		 *
1572
+		 * @param string $html The html to filter.
1573
+		 * @param string $location The location to output the html.
1574
+		 * @param array $cf The custom field array.
1575
+		 * @since 1.6.6
1576
+		 */
1577
+		$html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1578
+	}
1579
+
1580
+	// If not html then we run the standard output.
1581
+	if(empty($html)){
1582
+
1583
+		if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1584
+			$post_taxonomy = $post->post_type . 'category';
1585
+			$field_value = $post->{$html_var};
1586
+			$links = array();
1587
+			$terms = array();
1588
+			$termsOrdered = array();
1589
+			if (!is_array($field_value)) {
1590
+				$field_value = explode(",", trim($field_value, ","));
1591
+			}
1592
+
1593
+			$field_value = array_unique($field_value);
1594
+
1595
+			if (!empty($field_value)) {
1596
+				foreach ($field_value as $term) {
1597
+					$term = trim($term);
1598
+
1599
+					if ($term != '') {
1600
+						$term = get_term_by('id', $term, $html_var);
1601
+						if (is_object($term)) {
1602
+							$links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1603
+							$terms[] = $term;
1604
+						}
1605
+					}
1606
+				}
1607
+				if (!empty($links)) {
1608
+					// order alphabetically
1609
+					asort($links);
1610
+					foreach (array_keys($links) as $key) {
1611
+						$termsOrdered[$key] = $terms[$key];
1612
+					}
1613
+					$terms = $termsOrdered;
1614
+				}
1615
+			}
1616
+			$html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1617
+
1618
+			if ($html_value != '') {
1619
+				$field_icon = geodir_field_icon_proccess($cf);
1620
+				if (strpos($field_icon, 'http') !== false) {
1621
+					$field_icon_af = '';
1622
+				} else if ($field_icon == '') {
1623
+					$field_icon_af = '';
1624
+				} else {
1625
+					$field_icon_af = $field_icon;
1626
+					$field_icon = '';
1627
+				}
1628
+
1629
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1630
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1631
+				$html .= '</span> ' . $html_value . '</div>';
1632
+			}
1633
+		}
1634
+
1635
+	}
1636
+
1637
+	return $html;
1638 1638
 }
1639 1639
 add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1640 1640
 
@@ -1651,162 +1651,162 @@  discard block
 block discarded – undo
1651 1651
  */
1652 1652
 function geodir_cf_address($html,$location,$cf,$p=''){
1653 1653
 
1654
-    // check we have the post value
1655
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1656
-    else{ global $post;}
1657
-
1658
-    if(!is_array($cf) && $cf!=''){
1659
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1660
-        if(!$cf){return NULL;}
1661
-    }
1662
-
1663
-    $html_var = $cf['htmlvar_name'];
1664
-
1665
-    // Check if there is a location specific filter.
1666
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1667
-        /**
1668
-         * Filter the address html by location.
1669
-         *
1670
-         * @param string $html The html to filter.
1671
-         * @param array $cf The custom field array.
1672
-         * @since 1.6.6
1673
-         */
1674
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1675
-    }
1676
-
1677
-    // Check if there is a custom field specific filter.
1678
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1679
-        /**
1680
-         * Filter the address html by individual custom field.
1681
-         *
1682
-         * @param string $html The html to filter.
1683
-         * @param string $location The location to output the html.
1684
-         * @param array $cf The custom field array.
1685
-         * @since 1.6.6
1686
-         */
1687
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1688
-    }
1689
-
1690
-    // Check if there is a custom field key specific filter.
1691
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1692
-        /**
1693
-         * Filter the address html by field type key.
1694
-         *
1695
-         * @param string $html The html to filter.
1696
-         * @param string $location The location to output the html.
1697
-         * @param array $cf The custom field array.
1698
-         * @since 1.6.6
1699
-         */
1700
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1701
-    }
1702
-
1703
-    // If not html then we run the standard output.
1704
-    if(empty($html)){
1705
-
1706
-        global $preview;
1707
-        $html_var = $cf['htmlvar_name'] . '_address';
1708
-
1709
-        if ($cf['extra_fields']) {
1710
-
1711
-            $extra_fields = unserialize($cf['extra_fields']);
1712
-
1713
-            $addition_fields = '';
1714
-
1715
-            if (!empty($extra_fields)) {
1716
-
1717
-                $show_city_in_address = false;
1718
-                if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1719
-                    $show_city_in_address = true;
1720
-                }
1721
-                /**
1722
-                 * Filter "show city in address" value.
1723
-                 *
1724
-                 * @since 1.0.0
1725
-                 */
1726
-                $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1727
-
1728
-
1729
-                $show_region_in_address = false;
1730
-                if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1731
-                    $show_region_in_address = true;
1732
-                }
1733
-                /**
1734
-                 * Filter "show region in address" value.
1735
-                 *
1736
-                 * @since 1.6.6
1737
-                 */
1738
-                $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1739
-
1740
-                $show_country_in_address = false;
1741
-                if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1742
-                    $show_country_in_address = true;
1743
-                }
1744
-                /**
1745
-                 * Filter "show country in address" value.
1746
-                 *
1747
-                 * @since 1.6.6
1748
-                 */
1749
-                $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1750
-
1751
-                $show_zip_in_address = false;
1752
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1753
-                    $show_zip_in_address = true;
1754
-                }
1755
-                /**
1756
-                 * Filter "show zip in address" value.
1757
-                 *
1758
-                 * @since 1.6.6
1759
-                 */
1760
-                $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1761
-
1762
-
1763
-            }
1764
-
1765
-        }
1766
-
1767
-
1768
-        if ($post->{$html_var}) {
1769
-
1770
-            $field_icon = geodir_field_icon_proccess( $cf );
1771
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1772
-                $field_icon_af = '';
1773
-            } elseif ( $field_icon == '' ) {
1774
-                $field_icon_af = '<i class="fa fa-home"></i>';
1775
-            } else {
1776
-                $field_icon_af = $field_icon;
1777
-                $field_icon    = '';
1778
-            }
1654
+	// check we have the post value
1655
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1656
+	else{ global $post;}
1657
+
1658
+	if(!is_array($cf) && $cf!=''){
1659
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1660
+		if(!$cf){return NULL;}
1661
+	}
1662
+
1663
+	$html_var = $cf['htmlvar_name'];
1664
+
1665
+	// Check if there is a location specific filter.
1666
+	if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1667
+		/**
1668
+		 * Filter the address html by location.
1669
+		 *
1670
+		 * @param string $html The html to filter.
1671
+		 * @param array $cf The custom field array.
1672
+		 * @since 1.6.6
1673
+		 */
1674
+		$html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1675
+	}
1676
+
1677
+	// Check if there is a custom field specific filter.
1678
+	if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1679
+		/**
1680
+		 * Filter the address html by individual custom field.
1681
+		 *
1682
+		 * @param string $html The html to filter.
1683
+		 * @param string $location The location to output the html.
1684
+		 * @param array $cf The custom field array.
1685
+		 * @since 1.6.6
1686
+		 */
1687
+		$html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1688
+	}
1689
+
1690
+	// Check if there is a custom field key specific filter.
1691
+	if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1692
+		/**
1693
+		 * Filter the address html by field type key.
1694
+		 *
1695
+		 * @param string $html The html to filter.
1696
+		 * @param string $location The location to output the html.
1697
+		 * @param array $cf The custom field array.
1698
+		 * @since 1.6.6
1699
+		 */
1700
+		$html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1701
+	}
1702
+
1703
+	// If not html then we run the standard output.
1704
+	if(empty($html)){
1705
+
1706
+		global $preview;
1707
+		$html_var = $cf['htmlvar_name'] . '_address';
1708
+
1709
+		if ($cf['extra_fields']) {
1710
+
1711
+			$extra_fields = unserialize($cf['extra_fields']);
1712
+
1713
+			$addition_fields = '';
1714
+
1715
+			if (!empty($extra_fields)) {
1716
+
1717
+				$show_city_in_address = false;
1718
+				if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1719
+					$show_city_in_address = true;
1720
+				}
1721
+				/**
1722
+				 * Filter "show city in address" value.
1723
+				 *
1724
+				 * @since 1.0.0
1725
+				 */
1726
+				$show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1727
+
1728
+
1729
+				$show_region_in_address = false;
1730
+				if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1731
+					$show_region_in_address = true;
1732
+				}
1733
+				/**
1734
+				 * Filter "show region in address" value.
1735
+				 *
1736
+				 * @since 1.6.6
1737
+				 */
1738
+				$show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1739
+
1740
+				$show_country_in_address = false;
1741
+				if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1742
+					$show_country_in_address = true;
1743
+				}
1744
+				/**
1745
+				 * Filter "show country in address" value.
1746
+				 *
1747
+				 * @since 1.6.6
1748
+				 */
1749
+				$show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1750
+
1751
+				$show_zip_in_address = false;
1752
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1753
+					$show_zip_in_address = true;
1754
+				}
1755
+				/**
1756
+				 * Filter "show zip in address" value.
1757
+				 *
1758
+				 * @since 1.6.6
1759
+				 */
1760
+				$show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1761
+
1762
+
1763
+			}
1764
+
1765
+		}
1766
+
1767
+
1768
+		if ($post->{$html_var}) {
1769
+
1770
+			$field_icon = geodir_field_icon_proccess( $cf );
1771
+			if ( strpos( $field_icon, 'http' ) !== false ) {
1772
+				$field_icon_af = '';
1773
+			} elseif ( $field_icon == '' ) {
1774
+				$field_icon_af = '<i class="fa fa-home"></i>';
1775
+			} else {
1776
+				$field_icon_af = $field_icon;
1777
+				$field_icon    = '';
1778
+			}
1779 1779
             
1780 1780
 
1781 1781
 
1782
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1783
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1784
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1785
-            $html .= '</span>';
1782
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1783
+			$html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1784
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1785
+			$html .= '</span>';
1786 1786
 
1787 1787
 
1788
-            if ( $post->post_address ) {
1789
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1790
-            }
1791
-            if ($show_city_in_address && $post->post_city ) {
1792
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1793
-            }
1794
-            if ($show_region_in_address && $post->post_region ) {
1795
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1796
-            }
1797
-            if ($show_zip_in_address && $post->post_zip ) {
1798
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1799
-            }
1800
-            if ($show_country_in_address && $post->post_country ) {
1801
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1802
-            }
1803
-            $html .= '</div>';
1788
+			if ( $post->post_address ) {
1789
+				$html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1790
+			}
1791
+			if ($show_city_in_address && $post->post_city ) {
1792
+				$html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1793
+			}
1794
+			if ($show_region_in_address && $post->post_region ) {
1795
+				$html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1796
+			}
1797
+			if ($show_zip_in_address && $post->post_zip ) {
1798
+				$html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1799
+			}
1800
+			if ($show_country_in_address && $post->post_country ) {
1801
+				$html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1802
+			}
1803
+			$html .= '</div>';
1804 1804
 
1805
-        }
1805
+		}
1806 1806
 
1807
-    }
1807
+	}
1808 1808
 
1809 1809
 
1810
-    return $html;
1810
+	return $html;
1811 1811
 }
1812 1812
 add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1813 1813
\ No newline at end of file
Please login to merge, or discard this patch.